diff options
1158 files changed, 21829 insertions, 23803 deletions
diff --git a/src/lib/libc/include/namespace.h b/src/lib/libc/include/namespace.h index 8503de47be..cc83735b90 100644 --- a/src/lib/libc/include/namespace.h +++ b/src/lib/libc/include/namespace.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: namespace.h,v 1.16 2023/10/29 14:26:13 millert Exp $ */ | 1 | /* $OpenBSD: namespace.h,v 1.17 2025/10/23 19:06:10 miod Exp $ */ |
| 2 | 2 | ||
| 3 | #ifndef _LIBC_NAMESPACE_H_ | 3 | #ifndef _LIBC_NAMESPACE_H_ |
| 4 | #define _LIBC_NAMESPACE_H_ | 4 | #define _LIBC_NAMESPACE_H_ |
| @@ -57,13 +57,13 @@ | |||
| 57 | #define DEF_WRAP(x) __weak_alias(x, WRAP(x)) | 57 | #define DEF_WRAP(x) __weak_alias(x, WRAP(x)) |
| 58 | #define DEF_SYS(x) __strong_alias(_thread_sys_##x, HIDDEN(x)) | 58 | #define DEF_SYS(x) __strong_alias(_thread_sys_##x, HIDDEN(x)) |
| 59 | 59 | ||
| 60 | #if !defined(__clang__) && __GNUC__ != 3 | 60 | #if !defined(__clang__) |
| 61 | /* our gcc 4.2 handles redirecting builtins via PROTO_NORMAL()'s asm() label */ | 61 | /* our gcc 4.2 handles redirecting builtins via PROTO_NORMAL()'s asm() label */ |
| 62 | #define DEF_BUILTIN(x) DEF_STRONG(x) | 62 | #define DEF_BUILTIN(x) DEF_STRONG(x) |
| 63 | #define BUILTIN | 63 | #define BUILTIN |
| 64 | #else | 64 | #else |
| 65 | /* | 65 | /* |
| 66 | * clang and gcc can't redirect builtins via asm() labels, so mark | 66 | * clang can't redirect builtins via asm() labels, so mark |
| 67 | * them protected instead. | 67 | * them protected instead. |
| 68 | */ | 68 | */ |
| 69 | #define DEF_BUILTIN(x) __asm("") | 69 | #define DEF_BUILTIN(x) __asm("") |
| @@ -86,7 +86,7 @@ BUILTIN void *memmove(void *, const void *, __size_t); | |||
| 86 | BUILTIN void *memcpy(void *__restrict, const void *__restrict, __size_t); | 86 | BUILTIN void *memcpy(void *__restrict, const void *__restrict, __size_t); |
| 87 | BUILTIN void *memset(void *, int, __size_t); | 87 | BUILTIN void *memset(void *, int, __size_t); |
| 88 | BUILTIN void __stack_smash_handler(const char [], int __unused); | 88 | BUILTIN void __stack_smash_handler(const char [], int __unused); |
| 89 | #if !defined(__clang__) && __GNUC__ != 3 | 89 | #if !defined(__clang__) |
| 90 | PROTO_NORMAL(memmove); | 90 | PROTO_NORMAL(memmove); |
| 91 | PROTO_NORMAL(memcpy); | 91 | PROTO_NORMAL(memcpy); |
| 92 | PROTO_NORMAL(memset); | 92 | PROTO_NORMAL(memset); |
diff --git a/src/lib/libc/include/thread_private.h b/src/lib/libc/include/thread_private.h index 1ec1071161..3e1dbcdf6e 100644 --- a/src/lib/libc/include/thread_private.h +++ b/src/lib/libc/include/thread_private.h | |||
| @@ -1,10 +1,13 @@ | |||
| 1 | /* $OpenBSD: thread_private.h,v 1.37 2024/08/18 02:25:51 guenther Exp $ */ | 1 | /* $OpenBSD: thread_private.h,v 1.40 2025/08/04 01:44:33 dlg Exp $ */ |
| 2 | 2 | ||
| 3 | /* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman <marc@snafu.org> */ | 3 | /* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman <marc@snafu.org> */ |
| 4 | 4 | ||
| 5 | #ifndef _THREAD_PRIVATE_H_ | 5 | #ifndef _THREAD_PRIVATE_H_ |
| 6 | #define _THREAD_PRIVATE_H_ | 6 | #define _THREAD_PRIVATE_H_ |
| 7 | 7 | ||
| 8 | #include <sys/types.h> | ||
| 9 | #include <sys/gmon.h> | ||
| 10 | |||
| 8 | extern int __isthreaded; | 11 | extern int __isthreaded; |
| 9 | 12 | ||
| 10 | #define _MALLOC_MUTEXES 32 | 13 | #define _MALLOC_MUTEXES 32 |
| @@ -292,6 +295,12 @@ TAILQ_HEAD(pthread_queue, pthread); | |||
| 292 | 295 | ||
| 293 | #ifdef FUTEX | 296 | #ifdef FUTEX |
| 294 | 297 | ||
| 298 | /* | ||
| 299 | * CAS based implementations | ||
| 300 | */ | ||
| 301 | |||
| 302 | #define __CMTX_CAS | ||
| 303 | |||
| 295 | struct pthread_mutex { | 304 | struct pthread_mutex { |
| 296 | volatile unsigned int lock; | 305 | volatile unsigned int lock; |
| 297 | int type; | 306 | int type; |
| @@ -312,6 +321,10 @@ struct pthread_rwlock { | |||
| 312 | 321 | ||
| 313 | #else | 322 | #else |
| 314 | 323 | ||
| 324 | /* | ||
| 325 | * spinlock based implementations | ||
| 326 | */ | ||
| 327 | |||
| 315 | struct pthread_mutex { | 328 | struct pthread_mutex { |
| 316 | _atomic_lock_t lock; | 329 | _atomic_lock_t lock; |
| 317 | struct pthread_queue lockers; | 330 | struct pthread_queue lockers; |
| @@ -336,6 +349,46 @@ struct pthread_rwlock { | |||
| 336 | }; | 349 | }; |
| 337 | #endif /* FUTEX */ | 350 | #endif /* FUTEX */ |
| 338 | 351 | ||
| 352 | /* libc mutex */ | ||
| 353 | |||
| 354 | #define __CMTX_UNLOCKED 0 | ||
| 355 | #define __CMTX_LOCKED 1 | ||
| 356 | #define __CMTX_CONTENDED 2 | ||
| 357 | |||
| 358 | #ifdef __CMTX_CAS | ||
| 359 | struct __cmtx { | ||
| 360 | volatile unsigned int lock; | ||
| 361 | }; | ||
| 362 | |||
| 363 | #define __CMTX_INITIALIZER() { \ | ||
| 364 | .lock = __CMTX_UNLOCKED, \ | ||
| 365 | } | ||
| 366 | #else /* __CMTX_CAS */ | ||
| 367 | struct __cmtx { | ||
| 368 | _atomic_lock_t spin; | ||
| 369 | volatile unsigned int lock; | ||
| 370 | }; | ||
| 371 | |||
| 372 | #define __CMTX_INITIALIZER() { \ | ||
| 373 | .spin = _SPINLOCK_UNLOCKED, \ | ||
| 374 | .lock = __CMTX_UNLOCKED, \ | ||
| 375 | } | ||
| 376 | #endif /* __CMTX_CAS */ | ||
| 377 | |||
| 378 | /* libc recursive mutex */ | ||
| 379 | |||
| 380 | struct __rcmtx { | ||
| 381 | volatile pthread_t owner; | ||
| 382 | struct __cmtx mtx; | ||
| 383 | unsigned int depth; | ||
| 384 | }; | ||
| 385 | |||
| 386 | #define __RCMTX_INITIALIZER() { \ | ||
| 387 | .owner = NULL, \ | ||
| 388 | .mtx = __CMTX_INITIALIZER(), \ | ||
| 389 | .depth = 0, \ | ||
| 390 | } | ||
| 391 | |||
| 339 | struct pthread_mutex_attr { | 392 | struct pthread_mutex_attr { |
| 340 | int ma_type; | 393 | int ma_type; |
| 341 | int ma_protocol; | 394 | int ma_protocol; |
| @@ -390,6 +443,7 @@ struct pthread { | |||
| 390 | 443 | ||
| 391 | /* cancel received in a delayed cancel block? */ | 444 | /* cancel received in a delayed cancel block? */ |
| 392 | int delayed_cancel; | 445 | int delayed_cancel; |
| 446 | struct gmonparam *gmonparam; | ||
| 393 | }; | 447 | }; |
| 394 | /* flags in pthread->flags */ | 448 | /* flags in pthread->flags */ |
| 395 | #define THREAD_DONE 0x001 | 449 | #define THREAD_DONE 0x001 |
| @@ -410,6 +464,16 @@ void _spinlock(volatile _atomic_lock_t *); | |||
| 410 | int _spinlocktry(volatile _atomic_lock_t *); | 464 | int _spinlocktry(volatile _atomic_lock_t *); |
| 411 | void _spinunlock(volatile _atomic_lock_t *); | 465 | void _spinunlock(volatile _atomic_lock_t *); |
| 412 | 466 | ||
| 467 | void __cmtx_init(struct __cmtx *); | ||
| 468 | int __cmtx_enter_try(struct __cmtx *); | ||
| 469 | void __cmtx_enter(struct __cmtx *); | ||
| 470 | void __cmtx_leave(struct __cmtx *); | ||
| 471 | |||
| 472 | void __rcmtx_init(struct __rcmtx *); | ||
| 473 | int __rcmtx_enter_try(struct __rcmtx *); | ||
| 474 | void __rcmtx_enter(struct __rcmtx *); | ||
| 475 | void __rcmtx_leave(struct __rcmtx *); | ||
| 476 | |||
| 413 | void _rthread_debug(int, const char *, ...) | 477 | void _rthread_debug(int, const char *, ...) |
| 414 | __attribute__((__format__ (printf, 2, 3))); | 478 | __attribute__((__format__ (printf, 2, 3))); |
| 415 | pid_t _thread_dofork(pid_t (*_sys_fork)(void)); | 479 | pid_t _thread_dofork(pid_t (*_sys_fork)(void)); |
diff --git a/src/lib/libc/net/ether_aton.3 b/src/lib/libc/net/ether_aton.3 index 98562dc44c..83fe98880c 100644 --- a/src/lib/libc/net/ether_aton.3 +++ b/src/lib/libc/net/ether_aton.3 | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | .\" $OpenBSD: ether_aton.3,v 1.3 2022/09/11 06:38:10 jmc Exp $ | 1 | .\" $OpenBSD: ether_aton.3,v 1.4 2025/06/29 00:33:46 dlg Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Written by roland@frob.com. Public domain. | 3 | .\" Written by roland@frob.com. Public domain. |
| 4 | .\" | 4 | .\" |
| 5 | .Dd $Mdocdate: September 11 2022 $ | 5 | .Dd $Mdocdate: June 29 2025 $ |
| 6 | .Dt ETHER_ATON 3 | 6 | .Dt ETHER_ATON 3 |
| 7 | .Os | 7 | .Os |
| 8 | .Sh NAME | 8 | .Sh NAME |
| @@ -19,7 +19,7 @@ | |||
| 19 | .In netinet/in.h | 19 | .In netinet/in.h |
| 20 | .In netinet/if_ether.h | 20 | .In netinet/if_ether.h |
| 21 | .Ft char * | 21 | .Ft char * |
| 22 | .Fn ether_ntoa "struct ether_addr *e" | 22 | .Fn ether_ntoa "const struct ether_addr *e" |
| 23 | .Ft struct ether_addr * | 23 | .Ft struct ether_addr * |
| 24 | .Fn ether_aton "const char *s" | 24 | .Fn ether_aton "const char *s" |
| 25 | .Ft int | 25 | .Ft int |
diff --git a/src/lib/libc/net/ethers.c b/src/lib/libc/net/ethers.c index d62be1ca71..6edad5c5e5 100644 --- a/src/lib/libc/net/ethers.c +++ b/src/lib/libc/net/ethers.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ethers.c,v 1.27 2019/01/25 00:19:25 millert Exp $ */ | 1 | /* $OpenBSD: ethers.c,v 1.28 2025/06/29 00:33:46 dlg Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (c) 1998 Todd C. Miller <millert@openbsd.org> | 4 | * Copyright (c) 1998 Todd C. Miller <millert@openbsd.org> |
| @@ -42,7 +42,7 @@ | |||
| 42 | static char * _ether_aton(const char *, struct ether_addr *); | 42 | static char * _ether_aton(const char *, struct ether_addr *); |
| 43 | 43 | ||
| 44 | char * | 44 | char * |
| 45 | ether_ntoa(struct ether_addr *e) | 45 | ether_ntoa(const struct ether_addr *e) |
| 46 | { | 46 | { |
| 47 | static char a[] = "xx:xx:xx:xx:xx:xx"; | 47 | static char a[] = "xx:xx:xx:xx:xx:xx"; |
| 48 | 48 | ||
diff --git a/src/lib/libc/net/freeaddrinfo.c b/src/lib/libc/net/freeaddrinfo.c index 154f70cd75..c06318fb75 100644 --- a/src/lib/libc/net/freeaddrinfo.c +++ b/src/lib/libc/net/freeaddrinfo.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: freeaddrinfo.c,v 1.9 2016/09/21 04:38:56 guenther Exp $ */ | 1 | /* $OpenBSD: freeaddrinfo.c,v 1.10 2025/12/08 13:30:08 jca Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (c) 1996, 1997, 1998, 1999, Craig Metz, All rights reserved. | 4 | * Copyright (c) 1996, 1997, 1998, 1999, Craig Metz, All rights reserved. |
| @@ -40,11 +40,15 @@ freeaddrinfo(struct addrinfo *ai) | |||
| 40 | { | 40 | { |
| 41 | struct addrinfo *p; | 41 | struct addrinfo *p; |
| 42 | 42 | ||
| 43 | do { | 43 | /* |
| 44 | * Calling freeaddrinfo() with a NULL pointer is unspecified, | ||
| 45 | * but try to cope with it anyway for compatibility. | ||
| 46 | */ | ||
| 47 | while (ai != NULL) { | ||
| 44 | p = ai; | 48 | p = ai; |
| 45 | ai = ai->ai_next; | 49 | ai = ai->ai_next; |
| 46 | free(p->ai_canonname); | 50 | free(p->ai_canonname); |
| 47 | free(p); | 51 | free(p); |
| 48 | } while (ai); | 52 | } |
| 49 | } | 53 | } |
| 50 | DEF_WEAK(freeaddrinfo); | 54 | DEF_WEAK(freeaddrinfo); |
diff --git a/src/lib/libc/net/gai_strerror.3 b/src/lib/libc/net/gai_strerror.3 index d271f492c5..93d11aad09 100644 --- a/src/lib/libc/net/gai_strerror.3 +++ b/src/lib/libc/net/gai_strerror.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: gai_strerror.3,v 1.10 2017/05/03 01:58:33 deraadt Exp $ | 1 | .\" $OpenBSD: gai_strerror.3,v 1.11 2025/06/13 18:34:00 schwarze Exp $ |
| 2 | .\" $KAME: gai_strerror.3,v 1.1 2005/01/05 03:04:47 itojun Exp $ | 2 | .\" $KAME: gai_strerror.3,v 1.1 2005/01/05 03:04:47 itojun Exp $ |
| 3 | .\" | 3 | .\" |
| 4 | .\" Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") | 4 | .\" Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") |
| @@ -16,7 +16,7 @@ | |||
| 16 | .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | 16 | .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 17 | .\" PERFORMANCE OF THIS SOFTWARE. | 17 | .\" PERFORMANCE OF THIS SOFTWARE. |
| 18 | .\" | 18 | .\" |
| 19 | .Dd $Mdocdate: May 3 2017 $ | 19 | .Dd $Mdocdate: June 13 2025 $ |
| 20 | .Dt GAI_STRERROR 3 | 20 | .Dt GAI_STRERROR 3 |
| 21 | .Os | 21 | .Os |
| 22 | .Sh NAME | 22 | .Sh NAME |
| @@ -26,7 +26,7 @@ | |||
| 26 | .In sys/types.h | 26 | .In sys/types.h |
| 27 | .In sys/socket.h | 27 | .In sys/socket.h |
| 28 | .In netdb.h | 28 | .In netdb.h |
| 29 | .Ft "const char *" | 29 | .Ft const char * |
| 30 | .Fn gai_strerror "int ecode" | 30 | .Fn gai_strerror "int ecode" |
| 31 | .Sh DESCRIPTION | 31 | .Sh DESCRIPTION |
| 32 | The | 32 | The |
diff --git a/src/lib/libc/net/getaddrinfo.3 b/src/lib/libc/net/getaddrinfo.3 index 780c7a409f..2df5fbe896 100644 --- a/src/lib/libc/net/getaddrinfo.3 +++ b/src/lib/libc/net/getaddrinfo.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: getaddrinfo.3,v 1.61 2022/09/11 06:38:10 jmc Exp $ | 1 | .\" $OpenBSD: getaddrinfo.3,v 1.62 2025/12/08 13:30:08 jca Exp $ |
| 2 | .\" $KAME: getaddrinfo.3,v 1.36 2005/01/05 03:23:05 itojun Exp $ | 2 | .\" $KAME: getaddrinfo.3,v 1.36 2005/01/05 03:23:05 itojun Exp $ |
| 3 | .\" | 3 | .\" |
| 4 | .\" Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") | 4 | .\" Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") |
| @@ -16,7 +16,7 @@ | |||
| 16 | .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | 16 | .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 17 | .\" PERFORMANCE OF THIS SOFTWARE. | 17 | .\" PERFORMANCE OF THIS SOFTWARE. |
| 18 | .\" | 18 | .\" |
| 19 | .Dd $Mdocdate: September 11 2022 $ | 19 | .Dd $Mdocdate: December 8 2025 $ |
| 20 | .Dt GETADDRINFO 3 | 20 | .Dt GETADDRINFO 3 |
| 21 | .Os | 21 | .Os |
| 22 | .Sh NAME | 22 | .Sh NAME |
| @@ -475,3 +475,7 @@ flag bit first appeared in Windows 7. | |||
| 475 | .%R RFC 4007 | 475 | .%R RFC 4007 |
| 476 | .%T IPv6 Scoped Address Architecture | 476 | .%T IPv6 Scoped Address Architecture |
| 477 | .Re | 477 | .Re |
| 478 | .Sh CAVEATS | ||
| 479 | The behavior of | ||
| 480 | .Fn freeaddrinfo "NULL" | ||
| 481 | is not specified and therefore not portable. | ||
diff --git a/src/lib/libc/net/getifaddrs.c b/src/lib/libc/net/getifaddrs.c index 069ee9afab..448e76097f 100644 --- a/src/lib/libc/net/getifaddrs.c +++ b/src/lib/libc/net/getifaddrs.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: getifaddrs.c,v 1.14 2021/11/29 03:20:37 deraadt Exp $ */ | 1 | /* $OpenBSD: getifaddrs.c,v 1.15 2025/11/13 10:34:32 deraadt Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (c) 1995, 1999 | 4 | * Copyright (c) 1995, 1999 |
| @@ -25,10 +25,10 @@ | |||
| 25 | * BSDI getifaddrs.c,v 2.12 2000/02/23 14:51:59 dab Exp | 25 | * BSDI getifaddrs.c,v 2.12 2000/02/23 14:51:59 dab Exp |
| 26 | */ | 26 | */ |
| 27 | 27 | ||
| 28 | #include <sys/param.h> /* ALIGN ALIGNBYTES */ | ||
| 29 | #include <sys/types.h> | 28 | #include <sys/types.h> |
| 30 | #include <sys/ioctl.h> | 29 | #include <sys/ioctl.h> |
| 31 | #include <sys/socket.h> | 30 | #include <sys/socket.h> |
| 31 | #include <sys/syslog.h> | ||
| 32 | #include <net/if.h> | 32 | #include <net/if.h> |
| 33 | #include <net/route.h> | 33 | #include <net/route.h> |
| 34 | #include <sys/sysctl.h> | 34 | #include <sys/sysctl.h> |
| @@ -38,35 +38,32 @@ | |||
| 38 | #include <ifaddrs.h> | 38 | #include <ifaddrs.h> |
| 39 | #include <stddef.h> | 39 | #include <stddef.h> |
| 40 | #include <stdlib.h> | 40 | #include <stdlib.h> |
| 41 | #include <stdint.h> | ||
| 41 | #include <string.h> | 42 | #include <string.h> |
| 42 | #include <unistd.h> | 43 | #include <unistd.h> |
| 44 | #include <stdio.h> | ||
| 43 | 45 | ||
| 44 | #define SALIGN (sizeof(long) - 1) | 46 | #define roundup(x, y) ((((uintptr_t)(x)+((y)-1))/(y))*(y)) |
| 45 | #define SA_RLEN(sa) ((sa)->sa_len ? (((sa)->sa_len + SALIGN) & ~SALIGN) : (SALIGN + 1)) | 47 | #define proundup(x, y) (void *)roundup(x,y) |
| 48 | |||
| 49 | #define SA_RLEN(sa) ((sa)->sa_len ? \ | ||
| 50 | roundup((sa)->sa_len, sizeof(long)) : \ | ||
| 51 | roundup(1, sizeof(long))) | ||
| 46 | 52 | ||
| 47 | int | 53 | int |
| 48 | getifaddrs(struct ifaddrs **pif) | 54 | getifaddrs(struct ifaddrs **pif) |
| 49 | { | 55 | { |
| 50 | int icnt = 1; | 56 | int icnt = 1, dcnt = 0, ncnt = 0, mib[6], i; |
| 51 | int dcnt = 0; | ||
| 52 | int ncnt = 0; | ||
| 53 | int mib[6]; | ||
| 54 | size_t needed; | 57 | size_t needed; |
| 55 | char *buf = NULL, *bufp; | 58 | char *buf = NULL, *bufp, *data, *names, *next, *p, *p0; |
| 56 | char *next; | 59 | struct ifaddrs *cif = 0, *ifa, *ift; |
| 57 | struct ifaddrs *cif = 0; | ||
| 58 | char *p, *p0; | ||
| 59 | struct rt_msghdr *rtm; | 60 | struct rt_msghdr *rtm; |
| 60 | struct if_msghdr *ifm; | 61 | struct if_msghdr *ifm; |
| 61 | struct ifa_msghdr *ifam; | 62 | struct ifa_msghdr *ifam; |
| 62 | struct sockaddr_dl *dl; | 63 | struct sockaddr_dl *dl; |
| 63 | struct sockaddr *sa; | 64 | struct sockaddr *sa; |
| 64 | u_short index = 0; | 65 | u_short index = 0; |
| 65 | size_t len, alen, dlen; | 66 | size_t len, alen, dlen, dsize; |
| 66 | struct ifaddrs *ifa, *ift; | ||
| 67 | int i; | ||
| 68 | char *data; | ||
| 69 | char *names; | ||
| 70 | 67 | ||
| 71 | mib[0] = CTL_NET; | 68 | mib[0] = CTL_NET; |
| 72 | mib[1] = PF_ROUTE; | 69 | mib[1] = PF_ROUTE; |
| @@ -95,6 +92,7 @@ getifaddrs(struct ifaddrs **pif) | |||
| 95 | break; | 92 | break; |
| 96 | } | 93 | } |
| 97 | 94 | ||
| 95 | /* Calculate data buffer size */ | ||
| 98 | for (next = buf; next < buf + needed; next += rtm->rtm_msglen) { | 96 | for (next = buf; next < buf + needed; next += rtm->rtm_msglen) { |
| 99 | rtm = (struct rt_msghdr *)next; | 97 | rtm = (struct rt_msghdr *)next; |
| 100 | if (rtm->rtm_version != RTM_VERSION) | 98 | if (rtm->rtm_version != RTM_VERSION) |
| @@ -107,10 +105,15 @@ getifaddrs(struct ifaddrs **pif) | |||
| 107 | ++icnt; | 105 | ++icnt; |
| 108 | dl = (struct sockaddr_dl *)(next + | 106 | dl = (struct sockaddr_dl *)(next + |
| 109 | rtm->rtm_hdrlen); | 107 | rtm->rtm_hdrlen); |
| 110 | dcnt += SA_RLEN((struct sockaddr *)dl) + | ||
| 111 | ALIGNBYTES; | ||
| 112 | dcnt += sizeof(ifm->ifm_data); | ||
| 113 | ncnt += dl->sdl_nlen + 1; | 108 | ncnt += dl->sdl_nlen + 1; |
| 109 | |||
| 110 | /* sockaddr's need long alignment */ | ||
| 111 | dcnt = roundup(dcnt, sizeof(long)); | ||
| 112 | dcnt += SA_RLEN((struct sockaddr *)dl); | ||
| 113 | |||
| 114 | /* ifm_data[] needs long long alignment */ | ||
| 115 | dcnt = roundup(dcnt, sizeof(long long)); | ||
| 116 | dcnt += sizeof(ifm->ifm_data); | ||
| 114 | } else | 117 | } else |
| 115 | index = 0; | 118 | index = 0; |
| 116 | break; | 119 | break; |
| @@ -145,6 +148,8 @@ getifaddrs(struct ifaddrs **pif) | |||
| 145 | continue; | 148 | continue; |
| 146 | sa = (struct sockaddr *)p; | 149 | sa = (struct sockaddr *)p; |
| 147 | len = SA_RLEN(sa); | 150 | len = SA_RLEN(sa); |
| 151 | /* sockaddr's need long alignment */ | ||
| 152 | dcnt = roundup(dcnt, sizeof(long)); | ||
| 148 | if (i == RTAX_NETMASK && sa->sa_len == 0) | 153 | if (i == RTAX_NETMASK && sa->sa_len == 0) |
| 149 | dcnt += alen; | 154 | dcnt += alen; |
| 150 | else | 155 | else |
| @@ -155,23 +160,29 @@ getifaddrs(struct ifaddrs **pif) | |||
| 155 | } | 160 | } |
| 156 | } | 161 | } |
| 157 | 162 | ||
| 158 | if (icnt + dcnt + ncnt == 1) { | 163 | if (icnt + ncnt + dcnt == 1) { |
| 159 | *pif = NULL; | 164 | *pif = NULL; |
| 160 | free(buf); | 165 | free(buf); |
| 161 | return (0); | 166 | return (0); |
| 162 | } | 167 | } |
| 163 | data = malloc(sizeof(struct ifaddrs) * icnt + dcnt + ncnt); | 168 | |
| 169 | dsize = sizeof(struct ifaddrs) * icnt; | ||
| 170 | dsize += ncnt; | ||
| 171 | dsize = roundup(dsize, sizeof(long long)); | ||
| 172 | dsize += dcnt; | ||
| 173 | |||
| 174 | data = calloc(dsize, 1); | ||
| 164 | if (data == NULL) { | 175 | if (data == NULL) { |
| 165 | free(buf); | 176 | free(buf); |
| 166 | return(-1); | 177 | return(-1); |
| 167 | } | 178 | } |
| 168 | 179 | ||
| 169 | ifa = (struct ifaddrs *)data; | 180 | /* ifaddrs[], names, then if_data[] */ |
| 181 | ift = ifa = (struct ifaddrs *)data; | ||
| 170 | data += sizeof(struct ifaddrs) * icnt; | 182 | data += sizeof(struct ifaddrs) * icnt; |
| 171 | names = data + dcnt; | 183 | names = data; |
| 172 | 184 | data += ncnt; | |
| 173 | memset(ifa, 0, sizeof(struct ifaddrs) * icnt); | 185 | data = proundup(data, sizeof(long long)); |
| 174 | ift = ifa; | ||
| 175 | 186 | ||
| 176 | index = 0; | 187 | index = 0; |
| 177 | for (next = buf; next < buf + needed; next += rtm->rtm_msglen) { | 188 | for (next = buf; next < buf + needed; next += rtm->rtm_msglen) { |
| @@ -193,19 +204,21 @@ getifaddrs(struct ifaddrs **pif) | |||
| 193 | names[dl->sdl_nlen] = 0; | 204 | names[dl->sdl_nlen] = 0; |
| 194 | names += dl->sdl_nlen + 1; | 205 | names += dl->sdl_nlen + 1; |
| 195 | 206 | ||
| 207 | data = proundup(data, sizeof(long)); | ||
| 196 | ift->ifa_addr = (struct sockaddr *)data; | 208 | ift->ifa_addr = (struct sockaddr *)data; |
| 197 | memcpy(data, dl, | 209 | memcpy(data, dl, |
| 198 | ((struct sockaddr *)dl)->sa_len); | 210 | ((struct sockaddr *)dl)->sa_len); |
| 199 | data += SA_RLEN((struct sockaddr *)dl); | 211 | data += SA_RLEN((struct sockaddr *)dl); |
| 200 | 212 | ||
| 201 | /* ifm_data needs to be aligned */ | 213 | /* if_data needs long long alignment */ |
| 202 | ift->ifa_data = data = (void *)ALIGN(data); | 214 | data = proundup(data, sizeof(long long)); |
| 215 | ift->ifa_data = data; | ||
| 203 | dlen = rtm->rtm_hdrlen - | 216 | dlen = rtm->rtm_hdrlen - |
| 204 | offsetof(struct if_msghdr, ifm_data); | 217 | offsetof(struct if_msghdr, ifm_data); |
| 205 | if (dlen > sizeof(ifm->ifm_data)) | 218 | if (dlen > sizeof(ifm->ifm_data)) |
| 206 | dlen = sizeof(ifm->ifm_data); | 219 | dlen = sizeof(ifm->ifm_data); |
| 207 | memcpy(data, &ifm->ifm_data, dlen); | 220 | memcpy(data, &ifm->ifm_data, dlen); |
| 208 | data += sizeof(ifm->ifm_data); | 221 | data += dlen; |
| 209 | 222 | ||
| 210 | ift = (ift->ifa_next = ift + 1); | 223 | ift = (ift->ifa_next = ift + 1); |
| 211 | } else | 224 | } else |
| @@ -245,12 +258,14 @@ getifaddrs(struct ifaddrs **pif) | |||
| 245 | len = SA_RLEN(sa); | 258 | len = SA_RLEN(sa); |
| 246 | switch (i) { | 259 | switch (i) { |
| 247 | case RTAX_IFA: | 260 | case RTAX_IFA: |
| 261 | data = proundup(data, sizeof(long)); | ||
| 248 | ift->ifa_addr = (struct sockaddr *)data; | 262 | ift->ifa_addr = (struct sockaddr *)data; |
| 249 | memcpy(data, p, len); | 263 | memcpy(data, p, len); |
| 250 | data += len; | 264 | data += len; |
| 251 | break; | 265 | break; |
| 252 | 266 | ||
| 253 | case RTAX_NETMASK: | 267 | case RTAX_NETMASK: |
| 268 | data = proundup(data, sizeof(long)); | ||
| 254 | ift->ifa_netmask = | 269 | ift->ifa_netmask = |
| 255 | (struct sockaddr *)data; | 270 | (struct sockaddr *)data; |
| 256 | if (sa->sa_len == 0) { | 271 | if (sa->sa_len == 0) { |
| @@ -263,6 +278,7 @@ getifaddrs(struct ifaddrs **pif) | |||
| 263 | break; | 278 | break; |
| 264 | 279 | ||
| 265 | case RTAX_BRD: | 280 | case RTAX_BRD: |
| 281 | data = proundup(data, sizeof(long)); | ||
| 266 | ift->ifa_broadaddr = | 282 | ift->ifa_broadaddr = |
| 267 | (struct sockaddr *)data; | 283 | (struct sockaddr *)data; |
| 268 | memcpy(data, p, len); | 284 | memcpy(data, p, len); |
| @@ -278,6 +294,17 @@ getifaddrs(struct ifaddrs **pif) | |||
| 278 | } | 294 | } |
| 279 | } | 295 | } |
| 280 | 296 | ||
| 297 | /* XXX temporary paranoia until we are sure it is bug free */ | ||
| 298 | if (dsize != (char *)data - (char *)ifa) { | ||
| 299 | char buf[1024]; | ||
| 300 | |||
| 301 | /* <10> is LOG_CRIT */ | ||
| 302 | snprintf(buf, sizeof buf, | ||
| 303 | "<10>%s: getifaddrs: allocated %lu used %lu\n", | ||
| 304 | __progname, dsize, (char *)data - (char *)ifa); | ||
| 305 | sendsyslog(buf, strlen(buf), LOG_CONS); | ||
| 306 | } | ||
| 307 | |||
| 281 | free(buf); | 308 | free(buf); |
| 282 | if (--ift >= ifa) { | 309 | if (--ift >= ifa) { |
| 283 | ift->ifa_next = NULL; | 310 | ift->ifa_next = NULL; |
diff --git a/src/lib/libc/net/if_indextoname.3 b/src/lib/libc/net/if_indextoname.3 index 25d2a2722f..9d00d66bd5 100644 --- a/src/lib/libc/net/if_indextoname.3 +++ b/src/lib/libc/net/if_indextoname.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: if_indextoname.3,v 1.16 2015/11/21 07:48:10 jmc Exp $ | 1 | .\" $OpenBSD: if_indextoname.3,v 1.17 2025/06/13 18:34:00 schwarze Exp $ |
| 2 | .\" Copyright (c) 1983, 1991, 1993 | 2 | .\" Copyright (c) 1983, 1991, 1993 |
| 3 | .\" The Regents of the University of California. All rights reserved. | 3 | .\" The Regents of the University of California. All rights reserved. |
| 4 | .\" | 4 | .\" |
| @@ -28,7 +28,7 @@ | |||
| 28 | .\" | 28 | .\" |
| 29 | .\" From: @(#)rcmd.3 8.1 (Berkeley) 6/4/93 | 29 | .\" From: @(#)rcmd.3 8.1 (Berkeley) 6/4/93 |
| 30 | .\" | 30 | .\" |
| 31 | .Dd $Mdocdate: November 21 2015 $ | 31 | .Dd $Mdocdate: June 13 2025 $ |
| 32 | .Dt IF_NAMETOINDEX 3 | 32 | .Dt IF_NAMETOINDEX 3 |
| 33 | .Os | 33 | .Os |
| 34 | .Sh NAME | 34 | .Sh NAME |
| @@ -41,13 +41,13 @@ | |||
| 41 | .In sys/types.h | 41 | .In sys/types.h |
| 42 | .In sys/socket.h | 42 | .In sys/socket.h |
| 43 | .In net/if.h | 43 | .In net/if.h |
| 44 | .Ft "unsigned int" | 44 | .Ft unsigned int |
| 45 | .Fn if_nametoindex "const char *ifname" | 45 | .Fn if_nametoindex "const char *ifname" |
| 46 | .Ft "char *" | 46 | .Ft char * |
| 47 | .Fn if_indextoname "unsigned int ifindex" "char *ifname" | 47 | .Fn if_indextoname "unsigned int ifindex" "char *ifname" |
| 48 | .Ft "struct if_nameindex *" | 48 | .Ft struct if_nameindex * |
| 49 | .Fn if_nameindex "void" | 49 | .Fn if_nameindex "void" |
| 50 | .Ft "void" | 50 | .Ft void |
| 51 | .Fn if_freenameindex "struct if_nameindex *ptr" | 51 | .Fn if_freenameindex "struct if_nameindex *ptr" |
| 52 | .Sh DESCRIPTION | 52 | .Sh DESCRIPTION |
| 53 | These functions map interface indexes to interface names (such as | 53 | These functions map interface indexes to interface names (such as |
diff --git a/src/lib/libc/net/inet6_opt_init.3 b/src/lib/libc/net/inet6_opt_init.3 index 41ba842166..87244507a9 100644 --- a/src/lib/libc/net/inet6_opt_init.3 +++ b/src/lib/libc/net/inet6_opt_init.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: inet6_opt_init.3,v 1.8 2022/03/31 17:27:16 naddy Exp $ | 1 | .\" $OpenBSD: inet6_opt_init.3,v 1.9 2025/06/13 18:34:00 schwarze Exp $ |
| 2 | .\" $KAME: inet6_opt_init.3,v 1.7 2004/12/27 05:08:23 itojun Exp $ | 2 | .\" $KAME: inet6_opt_init.3,v 1.7 2004/12/27 05:08:23 itojun Exp $ |
| 3 | .\" | 3 | .\" |
| 4 | .\" Copyright (C) 2004 WIDE Project. | 4 | .\" Copyright (C) 2004 WIDE Project. |
| @@ -28,7 +28,7 @@ | |||
| 28 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 28 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | .\" SUCH DAMAGE. | 29 | .\" SUCH DAMAGE. |
| 30 | .\" | 30 | .\" |
| 31 | .Dd $Mdocdate: March 31 2022 $ | 31 | .Dd $Mdocdate: June 13 2025 $ |
| 32 | .Dt INET6_OPT_INIT 3 | 32 | .Dt INET6_OPT_INIT 3 |
| 33 | .Os | 33 | .Os |
| 34 | .\" | 34 | .\" |
| @@ -44,19 +44,19 @@ | |||
| 44 | .\" | 44 | .\" |
| 45 | .Sh SYNOPSIS | 45 | .Sh SYNOPSIS |
| 46 | .In netinet/in.h | 46 | .In netinet/in.h |
| 47 | .Ft "int" | 47 | .Ft int |
| 48 | .Fn inet6_opt_init "void *extbuf" "socklen_t extlen" | 48 | .Fn inet6_opt_init "void *extbuf" "socklen_t extlen" |
| 49 | .Ft "int" | 49 | .Ft int |
| 50 | .Fn inet6_opt_append "void *extbuf" "socklen_t extlen" "int offset" "u_int8_t type" "socklen_t len" "u_int8_t align" "void **databufp" | 50 | .Fn inet6_opt_append "void *extbuf" "socklen_t extlen" "int offset" "u_int8_t type" "socklen_t len" "u_int8_t align" "void **databufp" |
| 51 | .Ft "int" | 51 | .Ft int |
| 52 | .Fn inet6_opt_finish "void *extbuf" "socklen_t extlen" "int offset" | 52 | .Fn inet6_opt_finish "void *extbuf" "socklen_t extlen" "int offset" |
| 53 | .Ft "int" | 53 | .Ft int |
| 54 | .Fn inet6_opt_set_val "void *databuf" "int offset" "void *val" "socklen_t vallen" | 54 | .Fn inet6_opt_set_val "void *databuf" "int offset" "void *val" "socklen_t vallen" |
| 55 | .Ft "int" | 55 | .Ft int |
| 56 | .Fn inet6_opt_next "void *extbuf" "socklen_t extlen" "int offset" "u_int8_t *typep" "socklen_t *lenp" "void **databufp" | 56 | .Fn inet6_opt_next "void *extbuf" "socklen_t extlen" "int offset" "u_int8_t *typep" "socklen_t *lenp" "void **databufp" |
| 57 | .Ft "int" | 57 | .Ft int |
| 58 | .Fn inet6_opt_find "void *extbuf" "socklen_t extlen" "int offset" "u_int8_t type" "socklen_t *lenp" "void **databufp" | 58 | .Fn inet6_opt_find "void *extbuf" "socklen_t extlen" "int offset" "u_int8_t type" "socklen_t *lenp" "void **databufp" |
| 59 | .Ft "int" | 59 | .Ft int |
| 60 | .Fn inet6_opt_get_val "void *databuf" "socklen_t offset" "void *val" "socklen_t vallen" | 60 | .Fn inet6_opt_get_val "void *databuf" "socklen_t offset" "void *val" "socklen_t vallen" |
| 61 | .\" | 61 | .\" |
| 62 | .Sh DESCRIPTION | 62 | .Sh DESCRIPTION |
diff --git a/src/lib/libc/net/inet6_rth_space.3 b/src/lib/libc/net/inet6_rth_space.3 index c40b45057e..7304266fe1 100644 --- a/src/lib/libc/net/inet6_rth_space.3 +++ b/src/lib/libc/net/inet6_rth_space.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: inet6_rth_space.3,v 1.8 2022/03/31 17:27:16 naddy Exp $ | 1 | .\" $OpenBSD: inet6_rth_space.3,v 1.9 2025/06/13 18:34:00 schwarze Exp $ |
| 2 | .\" $KAME: inet6_rth_space.3,v 1.7 2005/01/05 03:00:44 itojun Exp $ | 2 | .\" $KAME: inet6_rth_space.3,v 1.7 2005/01/05 03:00:44 itojun Exp $ |
| 3 | .\" | 3 | .\" |
| 4 | .\" Copyright (C) 2004 WIDE Project. | 4 | .\" Copyright (C) 2004 WIDE Project. |
| @@ -28,7 +28,7 @@ | |||
| 28 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 28 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | .\" SUCH DAMAGE. | 29 | .\" SUCH DAMAGE. |
| 30 | .\" | 30 | .\" |
| 31 | .Dd $Mdocdate: March 31 2022 $ | 31 | .Dd $Mdocdate: June 13 2025 $ |
| 32 | .Dt INET6_RTH_SPACE 3 | 32 | .Dt INET6_RTH_SPACE 3 |
| 33 | .Os | 33 | .Os |
| 34 | .\" | 34 | .\" |
| @@ -45,7 +45,7 @@ | |||
| 45 | .In netinet/in.h | 45 | .In netinet/in.h |
| 46 | .Ft socklen_t | 46 | .Ft socklen_t |
| 47 | .Fn inet6_rth_space "int" "int" | 47 | .Fn inet6_rth_space "int" "int" |
| 48 | .Ft "void *" | 48 | .Ft void * |
| 49 | .Fn inet6_rth_init "void *" "socklen_t" "int" "int" | 49 | .Fn inet6_rth_init "void *" "socklen_t" "int" "int" |
| 50 | .Ft int | 50 | .Ft int |
| 51 | .Fn inet6_rth_add "void *" "const struct in6_addr *" | 51 | .Fn inet6_rth_add "void *" "const struct in6_addr *" |
| @@ -53,7 +53,7 @@ | |||
| 53 | .Fn inet6_rth_reverse "const void *" "void *" | 53 | .Fn inet6_rth_reverse "const void *" "void *" |
| 54 | .Ft int | 54 | .Ft int |
| 55 | .Fn inet6_rth_segments "const void *" | 55 | .Fn inet6_rth_segments "const void *" |
| 56 | .Ft "struct in6_addr *" | 56 | .Ft struct in6_addr * |
| 57 | .Fn inet6_rth_getaddr "const void *" "int" | 57 | .Fn inet6_rth_getaddr "const void *" "int" |
| 58 | .\" | 58 | .\" |
| 59 | .Sh DESCRIPTION | 59 | .Sh DESCRIPTION |
diff --git a/src/lib/libc/stdlib/exit.3 b/src/lib/libc/stdlib/exit.3 index 22acade86c..ccb416ee82 100644 --- a/src/lib/libc/stdlib/exit.3 +++ b/src/lib/libc/stdlib/exit.3 | |||
| @@ -29,9 +29,9 @@ | |||
| 29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 30 | .\" SUCH DAMAGE. | 30 | .\" SUCH DAMAGE. |
| 31 | .\" | 31 | .\" |
| 32 | .\" $OpenBSD: exit.3,v 1.18 2024/08/30 03:44:48 guenther Exp $ | 32 | .\" $OpenBSD: exit.3,v 1.19 2025/06/03 14:15:53 yasuoka Exp $ |
| 33 | .\" | 33 | .\" |
| 34 | .Dd $Mdocdate: August 30 2024 $ | 34 | .Dd $Mdocdate: June 3 2025 $ |
| 35 | .Dt EXIT 3 | 35 | .Dt EXIT 3 |
| 36 | .Os | 36 | .Os |
| 37 | .Sh NAME | 37 | .Sh NAME |
| @@ -54,9 +54,7 @@ Call the functions registered with the | |||
| 54 | .Xr atexit 3 | 54 | .Xr atexit 3 |
| 55 | function, in the reverse order of their registration. | 55 | function, in the reverse order of their registration. |
| 56 | .It | 56 | .It |
| 57 | Flush all open output streams. | 57 | Flush and close all open streams. |
| 58 | .It | ||
| 59 | Close all open streams. | ||
| 60 | .It | 58 | .It |
| 61 | Unlink all files created with the | 59 | Unlink all files created with the |
| 62 | .Xr tmpfile 3 | 60 | .Xr tmpfile 3 |
| @@ -79,6 +77,7 @@ function never returns. | |||
| 79 | .Sh SEE ALSO | 77 | .Sh SEE ALSO |
| 80 | .Xr _exit 2 , | 78 | .Xr _exit 2 , |
| 81 | .Xr atexit 3 , | 79 | .Xr atexit 3 , |
| 80 | .Xr fflush 3 , | ||
| 82 | .Xr intro 3 , | 81 | .Xr intro 3 , |
| 83 | .Xr sysexits 3 , | 82 | .Xr sysexits 3 , |
| 84 | .Xr tmpfile 3 | 83 | .Xr tmpfile 3 |
| @@ -86,7 +85,7 @@ function never returns. | |||
| 86 | The | 85 | The |
| 87 | .Fn exit | 86 | .Fn exit |
| 88 | function conforms to | 87 | function conforms to |
| 89 | .St -isoC-99 . | 88 | .St -p1003.1-2024 . |
| 90 | .Sh HISTORY | 89 | .Sh HISTORY |
| 91 | An | 90 | An |
| 92 | .Fn exit | 91 | .Fn exit |
diff --git a/src/lib/libc/stdlib/malloc.3 b/src/lib/libc/stdlib/malloc.3 index bea5575bf8..ee13b01bd4 100644 --- a/src/lib/libc/stdlib/malloc.3 +++ b/src/lib/libc/stdlib/malloc.3 | |||
| @@ -30,9 +30,9 @@ | |||
| 30 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 30 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 31 | .\" SUCH DAMAGE. | 31 | .\" SUCH DAMAGE. |
| 32 | .\" | 32 | .\" |
| 33 | .\" $OpenBSD: malloc.3,v 1.142 2024/08/03 20:09:24 guenther Exp $ | 33 | .\" $OpenBSD: malloc.3,v 1.147 2025/06/04 00:38:01 yasuoka Exp $ |
| 34 | .\" | 34 | .\" |
| 35 | .Dd $Mdocdate: August 3 2024 $ | 35 | .Dd $Mdocdate: June 4 2025 $ |
| 36 | .Dt MALLOC 3 | 36 | .Dt MALLOC 3 |
| 37 | .Os | 37 | .Os |
| 38 | .Sh NAME | 38 | .Sh NAME |
| @@ -69,7 +69,8 @@ | |||
| 69 | .Fn malloc_conceal "size_t size" | 69 | .Fn malloc_conceal "size_t size" |
| 70 | .Ft void * | 70 | .Ft void * |
| 71 | .Fn calloc_conceal "size_t nmemb" "size_t size" | 71 | .Fn calloc_conceal "size_t nmemb" "size_t size" |
| 72 | .Vt char *malloc_options ; | 72 | .Vt const char * const |
| 73 | .Va malloc_options ; | ||
| 73 | .Sh DESCRIPTION | 74 | .Sh DESCRIPTION |
| 74 | The standard functions | 75 | The standard functions |
| 75 | .Fn malloc , | 76 | .Fn malloc , |
| @@ -268,7 +269,15 @@ next checks the environment for a variable called | |||
| 268 | and finally looks at the global variable | 269 | and finally looks at the global variable |
| 269 | .Va malloc_options | 270 | .Va malloc_options |
| 270 | in the program. | 271 | in the program. |
| 271 | Each is scanned for the flags documented below. | 272 | Since |
| 273 | .Fn malloc | ||
| 274 | might already get called before the beginning of | ||
| 275 | .Fn main , | ||
| 276 | either initialize | ||
| 277 | .Va malloc_options | ||
| 278 | to a string literal at file scope or do not declare it at all. | ||
| 279 | .Pp | ||
| 280 | Each of the three strings is scanned for the flags documented below. | ||
| 272 | Unless otherwise noted uppercase means on, lowercase means off. | 281 | Unless otherwise noted uppercase means on, lowercase means off. |
| 273 | During initialization, flags occurring later modify the behaviour | 282 | During initialization, flags occurring later modify the behaviour |
| 274 | that was requested by flags processed earlier. | 283 | that was requested by flags processed earlier. |
| @@ -363,18 +372,9 @@ Use with | |||
| 363 | to get a verbose dump of malloc's internal state. | 372 | to get a verbose dump of malloc's internal state. |
| 364 | .It Cm X | 373 | .It Cm X |
| 365 | .Dq xmalloc . | 374 | .Dq xmalloc . |
| 366 | Rather than return failure, | 375 | Rather than return failure to handle out-of-memory conditions gracefully, |
| 367 | .Xr abort 3 | 376 | .Xr abort 3 |
| 368 | the program with a diagnostic message on stderr. | 377 | the program with a diagnostic message on stderr. |
| 369 | It is the intention that this option be set at compile time by | ||
| 370 | including in the source: | ||
| 371 | .Bd -literal -offset indent | ||
| 372 | extern char *malloc_options; | ||
| 373 | malloc_options = "X"; | ||
| 374 | .Ed | ||
| 375 | .Pp | ||
| 376 | Note that this will cause code that is supposed to handle | ||
| 377 | out-of-memory conditions gracefully to abort instead. | ||
| 378 | .It Cm < | 378 | .It Cm < |
| 379 | .Dq Halve the cache size . | 379 | .Dq Halve the cache size . |
| 380 | Decrease the size of the free page cache by a factor of two. | 380 | Decrease the size of the free page cache by a factor of two. |
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index cad8e5d6a1..f067dd1f37 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: malloc.c,v 1.297 2024/09/20 02:00:46 jsg Exp $ */ | 1 | /* $OpenBSD: malloc.c,v 1.300 2025/10/23 18:49:46 miod Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2008, 2010, 2011, 2016, 2023 Otto Moerbeek <otto@drijf.net> | 3 | * Copyright (c) 2008, 2010, 2011, 2016, 2023 Otto Moerbeek <otto@drijf.net> |
| 4 | * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org> | 4 | * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org> |
| @@ -31,7 +31,6 @@ | |||
| 31 | #include <sys/queue.h> | 31 | #include <sys/queue.h> |
| 32 | #include <sys/mman.h> | 32 | #include <sys/mman.h> |
| 33 | #include <sys/sysctl.h> | 33 | #include <sys/sysctl.h> |
| 34 | #include <uvm/uvmexp.h> | ||
| 35 | #include <errno.h> | 34 | #include <errno.h> |
| 36 | #include <stdarg.h> | 35 | #include <stdarg.h> |
| 37 | #include <stdint.h> | 36 | #include <stdint.h> |
| @@ -264,7 +263,8 @@ static union { | |||
| 264 | __attribute__((section(".openbsd.mutable"))); | 263 | __attribute__((section(".openbsd.mutable"))); |
| 265 | #define mopts malloc_readonly.mopts | 264 | #define mopts malloc_readonly.mopts |
| 266 | 265 | ||
| 267 | char *malloc_options; /* compile-time options */ | 266 | /* compile-time options */ |
| 267 | const char *const malloc_options __attribute__((weak)); | ||
| 268 | 268 | ||
| 269 | static __dead void wrterror(struct dir_info *d, char *msg, ...) | 269 | static __dead void wrterror(struct dir_info *d, char *msg, ...) |
| 270 | __attribute__((__format__ (printf, 2, 3))); | 270 | __attribute__((__format__ (printf, 2, 3))); |
| @@ -501,7 +501,8 @@ omalloc_parseopt(char opt) | |||
| 501 | static void | 501 | static void |
| 502 | omalloc_init(void) | 502 | omalloc_init(void) |
| 503 | { | 503 | { |
| 504 | char *p, *q, b[16]; | 504 | const char *p; |
| 505 | char *q, b[16]; | ||
| 505 | int i, j; | 506 | int i, j; |
| 506 | const int mib[2] = { CTL_VM, VM_MALLOC_CONF }; | 507 | const int mib[2] = { CTL_VM, VM_MALLOC_CONF }; |
| 507 | size_t sb; | 508 | size_t sb; |
| @@ -1090,24 +1091,6 @@ err: | |||
| 1090 | return NULL; | 1091 | return NULL; |
| 1091 | } | 1092 | } |
| 1092 | 1093 | ||
| 1093 | #if defined(__GNUC__) && __GNUC__ < 4 | ||
| 1094 | static inline unsigned int | ||
| 1095 | lb(u_int x) | ||
| 1096 | { | ||
| 1097 | #if defined(__m88k__) | ||
| 1098 | __asm__ __volatile__ ("ff1 %0, %0" : "=r" (x) : "0" (x)); | ||
| 1099 | return x; | ||
| 1100 | #else | ||
| 1101 | /* portable version */ | ||
| 1102 | unsigned int count = 0; | ||
| 1103 | while ((x & (1U << (sizeof(int) * CHAR_BIT - 1))) == 0) { | ||
| 1104 | count++; | ||
| 1105 | x <<= 1; | ||
| 1106 | } | ||
| 1107 | return (sizeof(int) * CHAR_BIT - 1) - count; | ||
| 1108 | #endif | ||
| 1109 | } | ||
| 1110 | #else | ||
| 1111 | /* using built-in function version */ | 1094 | /* using built-in function version */ |
| 1112 | static inline unsigned int | 1095 | static inline unsigned int |
| 1113 | lb(u_int x) | 1096 | lb(u_int x) |
| @@ -1115,7 +1098,6 @@ lb(u_int x) | |||
| 1115 | /* I need an extension just for integer-length (: */ | 1098 | /* I need an extension just for integer-length (: */ |
| 1116 | return (sizeof(int) * CHAR_BIT - 1) - __builtin_clz(x); | 1099 | return (sizeof(int) * CHAR_BIT - 1) - __builtin_clz(x); |
| 1117 | } | 1100 | } |
| 1118 | #endif | ||
| 1119 | 1101 | ||
| 1120 | /* https://pvk.ca/Blog/2015/06/27/linear-log-bucketing-fast-versatile-simple/ | 1102 | /* https://pvk.ca/Blog/2015/06/27/linear-log-bucketing-fast-versatile-simple/ |
| 1121 | via Tony Finch */ | 1103 | via Tony Finch */ |
diff --git a/src/lib/libc/stdlib/mkstemp.c b/src/lib/libc/stdlib/mkstemp.c index 75a9d27d1a..760575005f 100644 --- a/src/lib/libc/stdlib/mkstemp.c +++ b/src/lib/libc/stdlib/mkstemp.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: mkstemp.c,v 1.1 2024/01/19 19:45:02 millert Exp $ */ | 1 | /* $OpenBSD: mkstemp.c,v 1.2 2025/08/04 04:59:31 guenther Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Todd C. Miller | 3 | * Copyright (c) 2024 Todd C. Miller |
| 4 | * | 4 | * |
| @@ -20,7 +20,8 @@ | |||
| 20 | #include <fcntl.h> | 20 | #include <fcntl.h> |
| 21 | #include <stdlib.h> | 21 | #include <stdlib.h> |
| 22 | 22 | ||
| 23 | #define MKOSTEMP_FLAGS (O_APPEND | O_CLOEXEC | O_DSYNC | O_RSYNC | O_SYNC) | 23 | #define MKOSTEMP_FLAGS \ |
| 24 | (O_APPEND | O_CLOEXEC | O_CLOFORK | O_DSYNC | O_RSYNC | O_SYNC) | ||
| 24 | 25 | ||
| 25 | static int | 26 | static int |
| 26 | mkstemp_cb(const char *path, int flags) | 27 | mkstemp_cb(const char *path, int flags) |
diff --git a/src/lib/libc/stdlib/mktemp.3 b/src/lib/libc/stdlib/mktemp.3 index 83b7c9eb30..a967358164 100644 --- a/src/lib/libc/stdlib/mktemp.3 +++ b/src/lib/libc/stdlib/mktemp.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: mktemp.3,v 1.2 2024/03/01 21:30:40 millert Exp $ | 1 | .\" $OpenBSD: mktemp.3,v 1.4 2025/08/04 14:11:37 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 1989, 1991, 1993 | 3 | .\" Copyright (c) 1989, 1991, 1993 |
| 4 | .\" The Regents of the University of California. All rights reserved. | 4 | .\" The Regents of the University of California. All rights reserved. |
| @@ -27,17 +27,17 @@ | |||
| 27 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 27 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 28 | .\" SUCH DAMAGE. | 28 | .\" SUCH DAMAGE. |
| 29 | .\" | 29 | .\" |
| 30 | .Dd $Mdocdate: March 1 2024 $ | 30 | .Dd $Mdocdate: August 4 2025 $ |
| 31 | .Dt MKTEMP 3 | 31 | .Dt MKTEMP 3 |
| 32 | .Os | 32 | .Os |
| 33 | .Sh NAME | 33 | .Sh NAME |
| 34 | .Nm mktemp , | 34 | .Nm mktemp , |
| 35 | .Nm mkstemp , | 35 | .Nm mkstemp , |
| 36 | .Nm mkostemp , | ||
| 37 | .Nm mkstemps , | 36 | .Nm mkstemps , |
| 38 | .Nm mkostemps , | ||
| 39 | .Nm mkdtemp , | 37 | .Nm mkdtemp , |
| 40 | .Nm mkdtemps | 38 | .Nm mkdtemps , |
| 39 | .Nm mkostemp , | ||
| 40 | .Nm mkostemps | ||
| 41 | .Nd make temporary file name (unique) | 41 | .Nd make temporary file name (unique) |
| 42 | .Sh SYNOPSIS | 42 | .Sh SYNOPSIS |
| 43 | .In stdlib.h | 43 | .In stdlib.h |
| @@ -119,6 +119,8 @@ system call: | |||
| 119 | Append on each write. | 119 | Append on each write. |
| 120 | .It Dv O_CLOEXEC | 120 | .It Dv O_CLOEXEC |
| 121 | Set the close-on-exec flag on the new file descriptor. | 121 | Set the close-on-exec flag on the new file descriptor. |
| 122 | .It Dv O_CLOFORK | ||
| 123 | Set the close-on-fork flag on the new file descriptor. | ||
| 122 | .It Dv O_SYNC | 124 | .It Dv O_SYNC |
| 123 | Perform synchronous I/O operations. | 125 | Perform synchronous I/O operations. |
| 124 | .El | 126 | .El |
| @@ -163,8 +165,8 @@ functions return a pointer to the template on success and | |||
| 163 | on failure. | 165 | on failure. |
| 164 | The | 166 | The |
| 165 | .Fn mkstemp , | 167 | .Fn mkstemp , |
| 166 | .Fn mkostemp , | ||
| 167 | .Fn mkstemps , | 168 | .Fn mkstemps , |
| 169 | .Fn mkostemp , | ||
| 168 | and | 170 | and |
| 169 | .Fn mkostemps | 171 | .Fn mkostemps |
| 170 | functions return \-1 if no suitable file could be created. | 172 | functions return \-1 if no suitable file could be created. |
| @@ -253,9 +255,9 @@ of | |||
| 253 | The | 255 | The |
| 254 | .Fn mktemp , | 256 | .Fn mktemp , |
| 255 | .Fn mkstemp , | 257 | .Fn mkstemp , |
| 256 | .Fn mkostemp , | 258 | .Fn mkdtemp , |
| 257 | and | 259 | and |
| 258 | .Fn mkdtemp | 260 | .Fn mkostemp |
| 259 | functions may set | 261 | functions may set |
| 260 | .Va errno | 262 | .Va errno |
| 261 | to one of the following values: | 263 | to one of the following values: |
| @@ -318,8 +320,8 @@ function. | |||
| 318 | .Pp | 320 | .Pp |
| 319 | The | 321 | The |
| 320 | .Fn mkstemp , | 322 | .Fn mkstemp , |
| 321 | .Fn mkostemp , | ||
| 322 | .Fn mkstemps , | 323 | .Fn mkstemps , |
| 324 | .Fn mkostemp , | ||
| 323 | and | 325 | and |
| 324 | .Fn mkostemps | 326 | .Fn mkostemps |
| 325 | functions may also set | 327 | functions may also set |
| @@ -345,18 +347,16 @@ function. | |||
| 345 | .Xr tmpnam 3 | 347 | .Xr tmpnam 3 |
| 346 | .Sh STANDARDS | 348 | .Sh STANDARDS |
| 347 | The | 349 | The |
| 348 | .Fn mkdtemp | 350 | .Fn mkstemp , |
| 351 | .Fn mkdtemp , | ||
| 349 | and | 352 | and |
| 350 | .Fn mkstemp | 353 | .Fn mkostemp |
| 351 | functions conform to the | 354 | functions conform to the |
| 352 | .St -p1003.1-2008 | 355 | .St -p1003.1-2024 |
| 353 | specification. | 356 | specification. |
| 354 | The ability to specify more than six | 357 | The ability to specify more than six |
| 355 | .Em X Ns s | 358 | .Em X Ns s |
| 356 | is an extension to that standard. | 359 | is an extension to that standard. |
| 357 | The | ||
| 358 | .Fn mkostemp | ||
| 359 | function is expected to conform to a future revision of that standard. | ||
| 360 | .Pp | 360 | .Pp |
| 361 | The | 361 | The |
| 362 | .Fn mktemp | 362 | .Fn mktemp |
| @@ -368,9 +368,9 @@ it is no longer a part of the standard. | |||
| 368 | .Pp | 368 | .Pp |
| 369 | The | 369 | The |
| 370 | .Fn mkstemps , | 370 | .Fn mkstemps , |
| 371 | .Fn mkostemps , | 371 | .Fn mkdtemps , |
| 372 | and | 372 | and |
| 373 | .Fn mkdtemps | 373 | .Fn mkostemps |
| 374 | functions are non-standard and should not be used if portability is required. | 374 | functions are non-standard and should not be used if portability is required. |
| 375 | .Sh HISTORY | 375 | .Sh HISTORY |
| 376 | A | 376 | A |
| @@ -378,14 +378,14 @@ A | |||
| 378 | function appeared in | 378 | function appeared in |
| 379 | .At v7 . | 379 | .At v7 . |
| 380 | The | 380 | The |
| 381 | .Fn mkdtemp | ||
| 382 | function appeared in | ||
| 383 | .Ox 2.2 . | ||
| 384 | The | ||
| 385 | .Fn mkstemp | 381 | .Fn mkstemp |
| 386 | function appeared in | 382 | function appeared in |
| 387 | .Bx 4.3 . | 383 | .Bx 4.3 . |
| 388 | The | 384 | The |
| 385 | .Fn mkdtemp | ||
| 386 | function appeared in | ||
| 387 | .Ox 2.2 . | ||
| 388 | The | ||
| 389 | .Fn mkstemps | 389 | .Fn mkstemps |
| 390 | function appeared in | 390 | function appeared in |
| 391 | .Ox 2.3 . | 391 | .Ox 2.3 . |
diff --git a/src/lib/libc/stdlib/ptsname.3 b/src/lib/libc/stdlib/ptsname.3 index 98705528f5..eea36a5a02 100644 --- a/src/lib/libc/stdlib/ptsname.3 +++ b/src/lib/libc/stdlib/ptsname.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ptsname.3,v 1.2 2012/12/04 18:42:16 millert Exp $ | 1 | .\" $OpenBSD: ptsname.3,v 1.3 2025/06/13 18:34:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2002 The FreeBSD Project, Inc. | 3 | .\" Copyright (c) 2002 The FreeBSD Project, Inc. |
| 4 | .\" All rights reserved. | 4 | .\" All rights reserved. |
| @@ -32,7 +32,7 @@ | |||
| 32 | .\" | 32 | .\" |
| 33 | .\" $FreeBSD: head/lib/libc/stdlib/ptsname.3 240412 2012-09-12 17:54:09Z emaste $ | 33 | .\" $FreeBSD: head/lib/libc/stdlib/ptsname.3 240412 2012-09-12 17:54:09Z emaste $ |
| 34 | .\" | 34 | .\" |
| 35 | .Dd $Mdocdate: December 4 2012 $ | 35 | .Dd $Mdocdate: June 13 2025 $ |
| 36 | .Dt PTSNAME 3 | 36 | .Dt PTSNAME 3 |
| 37 | .Os | 37 | .Os |
| 38 | .Sh NAME | 38 | .Sh NAME |
| @@ -44,7 +44,7 @@ | |||
| 44 | .In stdlib.h | 44 | .In stdlib.h |
| 45 | .Ft int | 45 | .Ft int |
| 46 | .Fn grantpt "int fildes" | 46 | .Fn grantpt "int fildes" |
| 47 | .Ft "char *" | 47 | .Ft char * |
| 48 | .Fn ptsname "int fildes" | 48 | .Fn ptsname "int fildes" |
| 49 | .Ft int | 49 | .Ft int |
| 50 | .Fn unlockpt "int fildes" | 50 | .Fn unlockpt "int fildes" |
diff --git a/src/lib/libc/stdlib/rand48.3 b/src/lib/libc/stdlib/rand48.3 index fa7a7179bc..02e1999db9 100644 --- a/src/lib/libc/stdlib/rand48.3 +++ b/src/lib/libc/stdlib/rand48.3 | |||
| @@ -9,9 +9,9 @@ | |||
| 9 | .\" of any kind. I shall in no event be liable for anything that happens | 9 | .\" of any kind. I shall in no event be liable for anything that happens |
| 10 | .\" to anyone/anything when using this software. | 10 | .\" to anyone/anything when using this software. |
| 11 | .\" | 11 | .\" |
| 12 | .\" $OpenBSD: rand48.3,v 1.21 2019/12/20 19:16:40 tb Exp $ | 12 | .\" $OpenBSD: rand48.3,v 1.22 2025/06/13 18:34:00 schwarze Exp $ |
| 13 | .\" | 13 | .\" |
| 14 | .Dd $Mdocdate: December 20 2019 $ | 14 | .Dd $Mdocdate: June 13 2025 $ |
| 15 | .Dt DRAND48 3 | 15 | .Dt DRAND48 3 |
| 16 | .Os | 16 | .Os |
| 17 | .Sh NAME | 17 | .Sh NAME |
| @@ -46,9 +46,9 @@ | |||
| 46 | .Fn srand48 "long seed" | 46 | .Fn srand48 "long seed" |
| 47 | .Ft void | 47 | .Ft void |
| 48 | .Fn srand48_deterministic "long seed" | 48 | .Fn srand48_deterministic "long seed" |
| 49 | .Ft "unsigned short *" | 49 | .Ft unsigned short * |
| 50 | .Fn seed48 "unsigned short xseed[3]" | 50 | .Fn seed48 "unsigned short xseed[3]" |
| 51 | .Ft "unsigned short *" | 51 | .Ft unsigned short * |
| 52 | .Fn seed48_deterministic "unsigned short xseed[3]" | 52 | .Fn seed48_deterministic "unsigned short xseed[3]" |
| 53 | .Ft void | 53 | .Ft void |
| 54 | .Fn lcong48 "unsigned short p[7]" | 54 | .Fn lcong48 "unsigned short p[7]" |
diff --git a/src/lib/libc/stdlib/realpath.3 b/src/lib/libc/stdlib/realpath.3 index 1dec10fef4..1f932e3bb5 100644 --- a/src/lib/libc/stdlib/realpath.3 +++ b/src/lib/libc/stdlib/realpath.3 | |||
| @@ -28,9 +28,9 @@ | |||
| 28 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 28 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | .\" SUCH DAMAGE. | 29 | .\" SUCH DAMAGE. |
| 30 | .\" | 30 | .\" |
| 31 | .\" $OpenBSD: realpath.3,v 1.26 2021/10/13 15:04:53 kn Exp $ | 31 | .\" $OpenBSD: realpath.3,v 1.27 2025/06/13 18:34:00 schwarze Exp $ |
| 32 | .\" | 32 | .\" |
| 33 | .Dd $Mdocdate: October 13 2021 $ | 33 | .Dd $Mdocdate: June 13 2025 $ |
| 34 | .Dt REALPATH 3 | 34 | .Dt REALPATH 3 |
| 35 | .Os | 35 | .Os |
| 36 | .Sh NAME | 36 | .Sh NAME |
| @@ -39,7 +39,7 @@ | |||
| 39 | .Sh SYNOPSIS | 39 | .Sh SYNOPSIS |
| 40 | .In limits.h | 40 | .In limits.h |
| 41 | .In stdlib.h | 41 | .In stdlib.h |
| 42 | .Ft "char *" | 42 | .Ft char * |
| 43 | .Fn realpath "const char *pathname" "char *resolved" | 43 | .Fn realpath "const char *pathname" "char *resolved" |
| 44 | .Sh DESCRIPTION | 44 | .Sh DESCRIPTION |
| 45 | The | 45 | The |
diff --git a/src/lib/libc/string/Makefile.inc b/src/lib/libc/string/Makefile.inc index 204ca1b266..f8b6330453 100644 --- a/src/lib/libc/string/Makefile.inc +++ b/src/lib/libc/string/Makefile.inc | |||
| @@ -1,13 +1,13 @@ | |||
| 1 | # $OpenBSD: Makefile.inc,v 1.40 2024/07/14 09:51:18 jca Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.41 2025/10/24 11:30:06 claudio Exp $ |
| 2 | 2 | ||
| 3 | # string sources | 3 | # string sources |
| 4 | .PATH: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/string ${LIBCSRCDIR}/string | 4 | .PATH: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/string ${LIBCSRCDIR}/string |
| 5 | 5 | ||
| 6 | SRCS+= explicit_bzero.c memccpy.c memmem.c memrchr.c stpcpy.c stpncpy.c \ | 6 | SRCS+= explicit_bzero.c ffsl.c ffsll.c memccpy.c memmem.c memrchr.c \ |
| 7 | strcasecmp.c strcasecmp_l.c strcasestr.c strcoll.c strcoll_l.c \ | 7 | stpcpy.c stpncpy.c strcasecmp.c strcasecmp_l.c strcasestr.c \ |
| 8 | strdup.c strerror.c strerror_l.c strerror_r.c strmode.c \ | 8 | strcoll.c strcoll_l.c strdup.c strerror.c strerror_l.c strerror_r.c \ |
| 9 | strndup.c strnlen.c strsignal.c strtok.c strxfrm.c strxfrm_l.c \ | 9 | strmode.c strndup.c strnlen.c strsignal.c strtok.c strxfrm.c \ |
| 10 | timingsafe_bcmp.c timingsafe_memcmp.c \ | 10 | strxfrm_l.c timingsafe_bcmp.c timingsafe_memcmp.c \ |
| 11 | wcscat.c wcschr.c wcscmp.c wcscpy.c wcscspn.c wcslcat.c wcslcpy.c \ | 11 | wcscat.c wcschr.c wcscmp.c wcscpy.c wcscspn.c wcslcat.c wcslcpy.c \ |
| 12 | wcslen.c wcsncat.c wcsncmp.c wcsncpy.c wcsnlen.c wcspbrk.c wcsrchr.c \ | 12 | wcslen.c wcsncat.c wcsncmp.c wcsncpy.c wcsnlen.c wcspbrk.c wcsrchr.c \ |
| 13 | wcsspn.c wcsstr.c wcstok.c wcswcs.c wcswidth.c wmemchr.c wmemcmp.c \ | 13 | wcsspn.c wcsstr.c wcstok.c wcswcs.c wcswidth.c wmemchr.c wmemcmp.c \ |
diff --git a/src/lib/libc/string/ffs.3 b/src/lib/libc/string/ffs.3 index e78ab99e8f..0b78fbfd33 100644 --- a/src/lib/libc/string/ffs.3 +++ b/src/lib/libc/string/ffs.3 | |||
| @@ -27,24 +27,33 @@ | |||
| 27 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 27 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 28 | .\" SUCH DAMAGE. | 28 | .\" SUCH DAMAGE. |
| 29 | .\" | 29 | .\" |
| 30 | .\" $OpenBSD: ffs.3,v 1.11 2019/08/30 18:35:03 deraadt Exp $ | 30 | .\" $OpenBSD: ffs.3,v 1.13 2025/11/06 17:19:11 schwarze Exp $ |
| 31 | .\" | 31 | .\" |
| 32 | .Dd $Mdocdate: August 30 2019 $ | 32 | .Dd $Mdocdate: November 6 2025 $ |
| 33 | .Dt FFS 3 | 33 | .Dt FFS 3 |
| 34 | .Os | 34 | .Os |
| 35 | .Sh NAME | 35 | .Sh NAME |
| 36 | .Nm ffs | 36 | .Nm ffs , |
| 37 | .Nm ffsl , | ||
| 38 | .Nm ffsll | ||
| 37 | .Nd find first bit set in a bit string | 39 | .Nd find first bit set in a bit string |
| 38 | .Sh SYNOPSIS | 40 | .Sh SYNOPSIS |
| 39 | .In strings.h | 41 | .In strings.h |
| 40 | .Ft int | 42 | .Ft int |
| 41 | .Fn ffs "int value" | 43 | .Fn ffs "int value" |
| 44 | .Ft int | ||
| 45 | .Fn ffsl "long value" | ||
| 46 | .Ft int | ||
| 47 | .Fn ffsll "long long value" | ||
| 42 | .Sh DESCRIPTION | 48 | .Sh DESCRIPTION |
| 43 | The | 49 | The |
| 44 | .Fn ffs | 50 | .Fn ffs , |
| 45 | function finds the first bit set in | 51 | .Fn ffsl , |
| 52 | and | ||
| 53 | .Fn ffsll | ||
| 54 | functions find the first bit set in | ||
| 46 | .Fa value | 55 | .Fa value |
| 47 | and returns the index of that bit. | 56 | and return the index of that bit. |
| 48 | Bits are numbered starting from 1, starting at the rightmost bit. | 57 | Bits are numbered starting from 1, starting at the rightmost bit. |
| 49 | A return value of 0 means that the argument was zero. | 58 | A return value of 0 means that the argument was zero. |
| 50 | .Sh SEE ALSO | 59 | .Sh SEE ALSO |
| @@ -54,8 +63,20 @@ The | |||
| 54 | .Fn ffs | 63 | .Fn ffs |
| 55 | function conforms to | 64 | function conforms to |
| 56 | .St -p1003.1-2008 . | 65 | .St -p1003.1-2008 . |
| 66 | The | ||
| 67 | .Fn ffsl | ||
| 68 | and | ||
| 69 | .Fn ffsll | ||
| 70 | functions conform to | ||
| 71 | .St -p1003.1-2024 . | ||
| 57 | .Sh HISTORY | 72 | .Sh HISTORY |
| 58 | The | 73 | The |
| 59 | .Fn ffs | 74 | .Fn ffs |
| 60 | function first appeared in | 75 | function first appeared in |
| 61 | .Bx 4.2 . | 76 | .Bx 4.2 . |
| 77 | The | ||
| 78 | .Fn ffsl | ||
| 79 | and | ||
| 80 | .Fn ffsll | ||
| 81 | functions first appeared in | ||
| 82 | .Ox 7.9 . | ||
diff --git a/src/lib/libc/string/ffsl.c b/src/lib/libc/string/ffsl.c new file mode 100644 index 0000000000..182318c3d6 --- /dev/null +++ b/src/lib/libc/string/ffsl.c | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | /* $OpenBSD: ffsl.c,v 1.1 2025/10/24 11:30:06 claudio Exp $ */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Public domain. | ||
| 5 | * Written by Claudio Jeker. | ||
| 6 | */ | ||
| 7 | |||
| 8 | #include <strings.h> | ||
| 9 | |||
| 10 | /* | ||
| 11 | * ffs -- find the first (least significant) bit set | ||
| 12 | */ | ||
| 13 | int | ||
| 14 | ffsl(long mask) | ||
| 15 | { | ||
| 16 | return (mask ? __builtin_ctzl(mask) + 1 : 0); | ||
| 17 | } | ||
diff --git a/src/lib/libc/string/ffsll.c b/src/lib/libc/string/ffsll.c new file mode 100644 index 0000000000..9370c5ae41 --- /dev/null +++ b/src/lib/libc/string/ffsll.c | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | /* $OpenBSD: ffsll.c,v 1.1 2025/10/24 11:30:06 claudio Exp $ */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Public domain. | ||
| 5 | * Written by Claudio Jeker. | ||
| 6 | */ | ||
| 7 | |||
| 8 | #include <strings.h> | ||
| 9 | |||
| 10 | /* | ||
| 11 | * ffs -- find the first (least significant) bit set | ||
| 12 | */ | ||
| 13 | int | ||
| 14 | ffsll(long long mask) | ||
| 15 | { | ||
| 16 | return (mask ? __builtin_ctzll(mask) + 1 : 0); | ||
| 17 | } | ||
diff --git a/src/lib/libc/string/memmem.3 b/src/lib/libc/string/memmem.3 index de62d738de..eeb621f8f6 100644 --- a/src/lib/libc/string/memmem.3 +++ b/src/lib/libc/string/memmem.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: memmem.3,v 1.4 2024/08/03 20:13:23 guenther Exp $ | 1 | .\" $OpenBSD: memmem.3,v 1.5 2025/06/13 18:34:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2005 Pascal Gloor <pascal.gloor@spale.com> | 3 | .\" Copyright (c) 2005 Pascal Gloor <pascal.gloor@spale.com> |
| 4 | .\" | 4 | .\" |
| @@ -26,7 +26,7 @@ | |||
| 26 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 26 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 | .\" SUCH DAMAGE. | 27 | .\" SUCH DAMAGE. |
| 28 | .\" | 28 | .\" |
| 29 | .Dd $Mdocdate: August 3 2024 $ | 29 | .Dd $Mdocdate: June 13 2025 $ |
| 30 | .Dt MEMMEM 3 | 30 | .Dt MEMMEM 3 |
| 31 | .Os | 31 | .Os |
| 32 | .Sh NAME | 32 | .Sh NAME |
| @@ -34,7 +34,7 @@ | |||
| 34 | .Nd locate a byte substring in a byte string | 34 | .Nd locate a byte substring in a byte string |
| 35 | .Sh SYNOPSIS | 35 | .Sh SYNOPSIS |
| 36 | .In string.h | 36 | .In string.h |
| 37 | .Ft "void *" | 37 | .Ft void * |
| 38 | .Fo memmem | 38 | .Fo memmem |
| 39 | .Fa "const void *big" "size_t big_len" | 39 | .Fa "const void *big" "size_t big_len" |
| 40 | .Fa "const void *little" "size_t little_len" | 40 | .Fa "const void *little" "size_t little_len" |
diff --git a/src/lib/libcrypto/Makefile b/src/lib/libcrypto/Makefile index db3bc767d9..92866400c2 100644 --- a/src/lib/libcrypto/Makefile +++ b/src/lib/libcrypto/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.231 2024/12/19 23:56:32 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.244 2025/09/05 23:30:12 beck Exp $ |
| 2 | 2 | ||
| 3 | LIB= crypto | 3 | LIB= crypto |
| 4 | LIBREBUILD=y | 4 | LIBREBUILD=y |
| @@ -25,6 +25,7 @@ CFLAGS+= -DLIBRESSL_NAMESPACE -DLIBRESSL_CRYPTO_NAMESPACE | |||
| 25 | CFLAGS+= -DHAVE_FUNOPEN | 25 | CFLAGS+= -DHAVE_FUNOPEN |
| 26 | 26 | ||
| 27 | CFLAGS+= -I${LCRYPTO_SRC} | 27 | CFLAGS+= -I${LCRYPTO_SRC} |
| 28 | CFLAGS+= -I${LCRYPTO_SRC}/aes | ||
| 28 | CFLAGS+= -I${LCRYPTO_SRC}/arch/${MACHINE_CPU} | 29 | CFLAGS+= -I${LCRYPTO_SRC}/arch/${MACHINE_CPU} |
| 29 | CFLAGS+= -I${LCRYPTO_SRC}/asn1 | 30 | CFLAGS+= -I${LCRYPTO_SRC}/asn1 |
| 30 | CFLAGS+= -I${LCRYPTO_SRC}/bio | 31 | CFLAGS+= -I${LCRYPTO_SRC}/bio |
| @@ -67,7 +68,6 @@ SRCS+= crypto_memory.c | |||
| 67 | # aes/ | 68 | # aes/ |
| 68 | SRCS+= aes.c | 69 | SRCS+= aes.c |
| 69 | SRCS+= aes_core.c | 70 | SRCS+= aes_core.c |
| 70 | SRCS+= aes_ige.c | ||
| 71 | 71 | ||
| 72 | # asn1/ | 72 | # asn1/ |
| 73 | SRCS+= a_bitstr.c | 73 | SRCS+= a_bitstr.c |
| @@ -119,10 +119,8 @@ SRCS+= x_attrib.c | |||
| 119 | SRCS+= x_bignum.c | 119 | SRCS+= x_bignum.c |
| 120 | SRCS+= x_crl.c | 120 | SRCS+= x_crl.c |
| 121 | SRCS+= x_exten.c | 121 | SRCS+= x_exten.c |
| 122 | SRCS+= x_info.c | ||
| 123 | SRCS+= x_long.c | 122 | SRCS+= x_long.c |
| 124 | SRCS+= x_name.c | 123 | SRCS+= x_name.c |
| 125 | SRCS+= x_pkey.c | ||
| 126 | SRCS+= x_pubkey.c | 124 | SRCS+= x_pubkey.c |
| 127 | SRCS+= x_req.c | 125 | SRCS+= x_req.c |
| 128 | SRCS+= x_sig.c | 126 | SRCS+= x_sig.c |
| @@ -152,13 +150,13 @@ SRCS+= bss_conn.c | |||
| 152 | SRCS+= bss_dgram.c | 150 | SRCS+= bss_dgram.c |
| 153 | SRCS+= bss_fd.c | 151 | SRCS+= bss_fd.c |
| 154 | SRCS+= bss_file.c | 152 | SRCS+= bss_file.c |
| 155 | SRCS+= bss_log.c | ||
| 156 | SRCS+= bss_mem.c | 153 | SRCS+= bss_mem.c |
| 157 | SRCS+= bss_null.c | 154 | SRCS+= bss_null.c |
| 158 | SRCS+= bss_sock.c | 155 | SRCS+= bss_sock.c |
| 159 | 156 | ||
| 160 | # bn/ | 157 | # bn/ |
| 161 | SRCS+= bn_add.c | 158 | SRCS+= bn_add.c |
| 159 | SRCS+= bn_add_sub.c | ||
| 162 | SRCS+= bn_bpsw.c | 160 | SRCS+= bn_bpsw.c |
| 163 | SRCS+= bn_const.c | 161 | SRCS+= bn_const.c |
| 164 | SRCS+= bn_convert.c | 162 | SRCS+= bn_convert.c |
| @@ -172,6 +170,7 @@ SRCS+= bn_kron.c | |||
| 172 | SRCS+= bn_lib.c | 170 | SRCS+= bn_lib.c |
| 173 | SRCS+= bn_mod.c | 171 | SRCS+= bn_mod.c |
| 174 | SRCS+= bn_mod_sqrt.c | 172 | SRCS+= bn_mod_sqrt.c |
| 173 | SRCS+= bn_mod_words.c | ||
| 175 | SRCS+= bn_mont.c | 174 | SRCS+= bn_mont.c |
| 176 | SRCS+= bn_mul.c | 175 | SRCS+= bn_mul.c |
| 177 | SRCS+= bn_prime.c | 176 | SRCS+= bn_prime.c |
| @@ -281,11 +280,13 @@ SRCS+= ec_asn1.c | |||
| 281 | SRCS+= ec_convert.c | 280 | SRCS+= ec_convert.c |
| 282 | SRCS+= ec_curve.c | 281 | SRCS+= ec_curve.c |
| 283 | SRCS+= ec_err.c | 282 | SRCS+= ec_err.c |
| 283 | SRCS+= ec_field.c | ||
| 284 | SRCS+= ec_key.c | 284 | SRCS+= ec_key.c |
| 285 | SRCS+= ec_lib.c | 285 | SRCS+= ec_lib.c |
| 286 | SRCS+= ec_mult.c | 286 | SRCS+= ec_mult.c |
| 287 | SRCS+= ec_pmeth.c | 287 | SRCS+= ec_pmeth.c |
| 288 | SRCS+= eck_prn.c | 288 | SRCS+= eck_prn.c |
| 289 | SRCS+= ecp_hp_methods.c | ||
| 289 | SRCS+= ecp_methods.c | 290 | SRCS+= ecp_methods.c |
| 290 | SRCS+= ecx_methods.c | 291 | SRCS+= ecx_methods.c |
| 291 | 292 | ||
| @@ -373,8 +374,9 @@ SRCS+= md4.c | |||
| 373 | SRCS+= md5.c | 374 | SRCS+= md5.c |
| 374 | 375 | ||
| 375 | # mlkem/ | 376 | # mlkem/ |
| 376 | SRCS+= mlkem768.c | 377 | SRCS+= mlkem.c |
| 377 | SRCS+= mlkem1024.c | 378 | SRCS+= mlkem_internal.c |
| 379 | SRCS+= mlkem_key.c | ||
| 378 | 380 | ||
| 379 | # modes/ | 381 | # modes/ |
| 380 | SRCS+= cbc128.c | 382 | SRCS+= cbc128.c |
| @@ -450,11 +452,7 @@ SRCS+= rand_lib.c | |||
| 450 | SRCS+= randfile.c | 452 | SRCS+= randfile.c |
| 451 | 453 | ||
| 452 | # rc2/ | 454 | # rc2/ |
| 453 | SRCS+= rc2_cbc.c | 455 | SRCS+= rc2.c |
| 454 | SRCS+= rc2_ecb.c | ||
| 455 | SRCS+= rc2_skey.c | ||
| 456 | SRCS+= rc2cfb64.c | ||
| 457 | SRCS+= rc2ofb64.c | ||
| 458 | 456 | ||
| 459 | # rc4/ | 457 | # rc4/ |
| 460 | SRCS+= rc4.c | 458 | SRCS+= rc4.c |
| @@ -671,9 +669,11 @@ HDRS=\ | |||
| 671 | ${LCRYPTO_SRC}/lhash/lhash.h \ | 669 | ${LCRYPTO_SRC}/lhash/lhash.h \ |
| 672 | ${LCRYPTO_SRC}/md4/md4.h \ | 670 | ${LCRYPTO_SRC}/md4/md4.h \ |
| 673 | ${LCRYPTO_SRC}/md5/md5.h \ | 671 | ${LCRYPTO_SRC}/md5/md5.h \ |
| 672 | ${LCRYPTO_SRC}/mlkem/mlkem.h \ | ||
| 674 | ${LCRYPTO_SRC}/modes/modes.h \ | 673 | ${LCRYPTO_SRC}/modes/modes.h \ |
| 675 | ${LCRYPTO_SRC}/objects/objects.h \ | 674 | ${LCRYPTO_SRC}/objects/objects.h \ |
| 676 | ${LCRYPTO_SRC}/ocsp/ocsp.h \ | 675 | ${LCRYPTO_SRC}/ocsp/ocsp.h \ |
| 676 | ${LCRYPTO_SRC}/opensslconf.h \ | ||
| 677 | ${LCRYPTO_SRC}/opensslfeatures.h \ | 677 | ${LCRYPTO_SRC}/opensslfeatures.h \ |
| 678 | ${LCRYPTO_SRC}/opensslv.h \ | 678 | ${LCRYPTO_SRC}/opensslv.h \ |
| 679 | ${LCRYPTO_SRC}/ossl_typ.h \ | 679 | ${LCRYPTO_SRC}/ossl_typ.h \ |
| @@ -699,7 +699,6 @@ HDRS=\ | |||
| 699 | ${LCRYPTO_SRC}/x509/x509v3.h | 699 | ${LCRYPTO_SRC}/x509/x509v3.h |
| 700 | 700 | ||
| 701 | HDRS_GEN=\ | 701 | HDRS_GEN=\ |
| 702 | ${.CURDIR}/arch/${MACHINE_CPU}/opensslconf.h \ | ||
| 703 | ${.OBJDIR}/obj_mac.h | 702 | ${.OBJDIR}/obj_mac.h |
| 704 | 703 | ||
| 705 | prereq: obj_mac.h | 704 | prereq: obj_mac.h |
diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list index e259430bbf..d85922e12e 100644 --- a/src/lib/libcrypto/Symbols.list +++ b/src/lib/libcrypto/Symbols.list | |||
| @@ -34,6 +34,7 @@ ASN1_BIT_STRING_set_bit | |||
| 34 | ASN1_BMPSTRING_free | 34 | ASN1_BMPSTRING_free |
| 35 | ASN1_BMPSTRING_it | 35 | ASN1_BMPSTRING_it |
| 36 | ASN1_BMPSTRING_new | 36 | ASN1_BMPSTRING_new |
| 37 | ASN1_BOOLEAN_it | ||
| 37 | ASN1_ENUMERATED_free | 38 | ASN1_ENUMERATED_free |
| 38 | ASN1_ENUMERATED_get | 39 | ASN1_ENUMERATED_get |
| 39 | ASN1_ENUMERATED_get_int64 | 40 | ASN1_ENUMERATED_get_int64 |
| @@ -42,6 +43,7 @@ ASN1_ENUMERATED_new | |||
| 42 | ASN1_ENUMERATED_set | 43 | ASN1_ENUMERATED_set |
| 43 | ASN1_ENUMERATED_set_int64 | 44 | ASN1_ENUMERATED_set_int64 |
| 44 | ASN1_ENUMERATED_to_BN | 45 | ASN1_ENUMERATED_to_BN |
| 46 | ASN1_FBOOLEAN_it | ||
| 45 | ASN1_GENERALIZEDTIME_adj | 47 | ASN1_GENERALIZEDTIME_adj |
| 46 | ASN1_GENERALIZEDTIME_check | 48 | ASN1_GENERALIZEDTIME_check |
| 47 | ASN1_GENERALIZEDTIME_free | 49 | ASN1_GENERALIZEDTIME_free |
| @@ -116,6 +118,7 @@ ASN1_STRING_type_new | |||
| 116 | ASN1_T61STRING_free | 118 | ASN1_T61STRING_free |
| 117 | ASN1_T61STRING_it | 119 | ASN1_T61STRING_it |
| 118 | ASN1_T61STRING_new | 120 | ASN1_T61STRING_new |
| 121 | ASN1_TBOOLEAN_it | ||
| 119 | ASN1_TIME_adj | 122 | ASN1_TIME_adj |
| 120 | ASN1_TIME_check | 123 | ASN1_TIME_check |
| 121 | ASN1_TIME_cmp_time_t | 124 | ASN1_TIME_cmp_time_t |
| @@ -308,7 +311,6 @@ BIO_s_connect | |||
| 308 | BIO_s_datagram | 311 | BIO_s_datagram |
| 309 | BIO_s_fd | 312 | BIO_s_fd |
| 310 | BIO_s_file | 313 | BIO_s_file |
| 311 | BIO_s_log | ||
| 312 | BIO_s_mem | 314 | BIO_s_mem |
| 313 | BIO_s_null | 315 | BIO_s_null |
| 314 | BIO_s_socket | 316 | BIO_s_socket |
| @@ -1447,6 +1449,23 @@ MD5_Final | |||
| 1447 | MD5_Init | 1449 | MD5_Init |
| 1448 | MD5_Transform | 1450 | MD5_Transform |
| 1449 | MD5_Update | 1451 | MD5_Update |
| 1452 | MLKEM_decap | ||
| 1453 | MLKEM_encap | ||
| 1454 | MLKEM_generate_key | ||
| 1455 | MLKEM_marshal_private_key | ||
| 1456 | MLKEM_marshal_public_key | ||
| 1457 | MLKEM_parse_private_key | ||
| 1458 | MLKEM_parse_public_key | ||
| 1459 | MLKEM_private_key_ciphertext_length | ||
| 1460 | MLKEM_private_key_encoded_length | ||
| 1461 | MLKEM_private_key_free | ||
| 1462 | MLKEM_private_key_from_seed | ||
| 1463 | MLKEM_private_key_new | ||
| 1464 | MLKEM_public_from_private | ||
| 1465 | MLKEM_public_key_ciphertext_length | ||
| 1466 | MLKEM_public_key_encoded_length | ||
| 1467 | MLKEM_public_key_free | ||
| 1468 | MLKEM_public_key_new | ||
| 1450 | NAME_CONSTRAINTS_check | 1469 | NAME_CONSTRAINTS_check |
| 1451 | NAME_CONSTRAINTS_free | 1470 | NAME_CONSTRAINTS_free |
| 1452 | NAME_CONSTRAINTS_it | 1471 | NAME_CONSTRAINTS_it |
| @@ -1664,9 +1683,7 @@ PEM_ASN1_write_bio | |||
| 1664 | PEM_SignFinal | 1683 | PEM_SignFinal |
| 1665 | PEM_SignInit | 1684 | PEM_SignInit |
| 1666 | PEM_SignUpdate | 1685 | PEM_SignUpdate |
| 1667 | PEM_X509_INFO_read | ||
| 1668 | PEM_X509_INFO_read_bio | 1686 | PEM_X509_INFO_read_bio |
| 1669 | PEM_X509_INFO_write_bio | ||
| 1670 | PEM_bytes_read_bio | 1687 | PEM_bytes_read_bio |
| 1671 | PEM_def_callback | 1688 | PEM_def_callback |
| 1672 | PEM_dek_info | 1689 | PEM_dek_info |
| @@ -2474,8 +2491,6 @@ X509_OBJECT_idx_by_subject | |||
| 2474 | X509_OBJECT_new | 2491 | X509_OBJECT_new |
| 2475 | X509_OBJECT_retrieve_by_subject | 2492 | X509_OBJECT_retrieve_by_subject |
| 2476 | X509_OBJECT_retrieve_match | 2493 | X509_OBJECT_retrieve_match |
| 2477 | X509_PKEY_free | ||
| 2478 | X509_PKEY_new | ||
| 2479 | X509_PUBKEY_free | 2494 | X509_PUBKEY_free |
| 2480 | X509_PUBKEY_get | 2495 | X509_PUBKEY_get |
| 2481 | X509_PUBKEY_get0 | 2496 | X509_PUBKEY_get0 |
| @@ -2639,6 +2654,7 @@ X509_VERIFY_PARAM_get0_peername | |||
| 2639 | X509_VERIFY_PARAM_get_count | 2654 | X509_VERIFY_PARAM_get_count |
| 2640 | X509_VERIFY_PARAM_get_depth | 2655 | X509_VERIFY_PARAM_get_depth |
| 2641 | X509_VERIFY_PARAM_get_flags | 2656 | X509_VERIFY_PARAM_get_flags |
| 2657 | X509_VERIFY_PARAM_get_hostflags | ||
| 2642 | X509_VERIFY_PARAM_get_time | 2658 | X509_VERIFY_PARAM_get_time |
| 2643 | X509_VERIFY_PARAM_inherit | 2659 | X509_VERIFY_PARAM_inherit |
| 2644 | X509_VERIFY_PARAM_lookup | 2660 | X509_VERIFY_PARAM_lookup |
diff --git a/src/lib/libcrypto/aes/aes.c b/src/lib/libcrypto/aes/aes.c index d36a006360..9cffe6b7cd 100644 --- a/src/lib/libcrypto/aes/aes.c +++ b/src/lib/libcrypto/aes/aes.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: aes.c,v 1.4 2024/08/11 13:02:39 jsing Exp $ */ | 1 | /* $OpenBSD: aes.c,v 1.17 2025/09/15 07:36:12 tb Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -46,21 +46,101 @@ | |||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. |
| 48 | * ==================================================================== | 48 | * ==================================================================== |
| 49 | * | ||
| 50 | */ | 49 | */ |
| 51 | 50 | ||
| 52 | #include <string.h> | 51 | #include <string.h> |
| 53 | 52 | ||
| 54 | #include <openssl/aes.h> | 53 | #include <openssl/aes.h> |
| 55 | #include <openssl/bio.h> | 54 | #include <openssl/bio.h> |
| 55 | #include <openssl/crypto.h> | ||
| 56 | #include <openssl/modes.h> | 56 | #include <openssl/modes.h> |
| 57 | 57 | ||
| 58 | #include "crypto_arch.h" | 58 | #include "crypto_arch.h" |
| 59 | #include "crypto_internal.h" | ||
| 60 | #include "modes_local.h" | ||
| 59 | 61 | ||
| 60 | static const unsigned char aes_wrap_default_iv[] = { | 62 | static const unsigned char aes_wrap_default_iv[] = { |
| 61 | 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, | 63 | 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, |
| 62 | }; | 64 | }; |
| 63 | 65 | ||
| 66 | int aes_set_encrypt_key_internal(const unsigned char *userKey, const int bits, | ||
| 67 | AES_KEY *key); | ||
| 68 | int aes_set_decrypt_key_internal(const unsigned char *userKey, const int bits, | ||
| 69 | AES_KEY *key); | ||
| 70 | void aes_encrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 71 | const AES_KEY *key); | ||
| 72 | void aes_decrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 73 | const AES_KEY *key); | ||
| 74 | |||
| 75 | static int | ||
| 76 | aes_rounds_for_key_length(int bits) | ||
| 77 | { | ||
| 78 | if (bits == 128) | ||
| 79 | return 10; | ||
| 80 | if (bits == 192) | ||
| 81 | return 12; | ||
| 82 | if (bits == 256) | ||
| 83 | return 14; | ||
| 84 | |||
| 85 | return 0; | ||
| 86 | } | ||
| 87 | |||
| 88 | int | ||
| 89 | AES_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key) | ||
| 90 | { | ||
| 91 | if (userKey == NULL || key == NULL) | ||
| 92 | return -1; | ||
| 93 | |||
| 94 | explicit_bzero(key->rd_key, sizeof(key->rd_key)); | ||
| 95 | |||
| 96 | if ((key->rounds = aes_rounds_for_key_length(bits)) <= 0) | ||
| 97 | return -2; | ||
| 98 | |||
| 99 | return aes_set_encrypt_key_internal(userKey, bits, key); | ||
| 100 | } | ||
| 101 | LCRYPTO_ALIAS(AES_set_encrypt_key); | ||
| 102 | |||
| 103 | int | ||
| 104 | AES_set_decrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key) | ||
| 105 | { | ||
| 106 | if (userKey == NULL || key == NULL) | ||
| 107 | return -1; | ||
| 108 | |||
| 109 | explicit_bzero(key->rd_key, sizeof(key->rd_key)); | ||
| 110 | |||
| 111 | if ((key->rounds = aes_rounds_for_key_length(bits)) <= 0) | ||
| 112 | return -2; | ||
| 113 | |||
| 114 | return aes_set_decrypt_key_internal(userKey, bits, key); | ||
| 115 | } | ||
| 116 | LCRYPTO_ALIAS(AES_set_decrypt_key); | ||
| 117 | |||
| 118 | void | ||
| 119 | AES_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key) | ||
| 120 | { | ||
| 121 | aes_encrypt_internal(in, out, key); | ||
| 122 | } | ||
| 123 | LCRYPTO_ALIAS(AES_encrypt); | ||
| 124 | |||
| 125 | void | ||
| 126 | AES_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key) | ||
| 127 | { | ||
| 128 | aes_decrypt_internal(in, out, key); | ||
| 129 | } | ||
| 130 | LCRYPTO_ALIAS(AES_decrypt); | ||
| 131 | |||
| 132 | void | ||
| 133 | aes_encrypt_block128(const unsigned char *in, unsigned char *out, const void *key) | ||
| 134 | { | ||
| 135 | aes_encrypt_internal(in, out, key); | ||
| 136 | } | ||
| 137 | |||
| 138 | void | ||
| 139 | aes_decrypt_block128(const unsigned char *in, unsigned char *out, const void *key) | ||
| 140 | { | ||
| 141 | aes_decrypt_internal(in, out, key); | ||
| 142 | } | ||
| 143 | |||
| 64 | #ifdef HAVE_AES_CBC_ENCRYPT_INTERNAL | 144 | #ifdef HAVE_AES_CBC_ENCRYPT_INTERNAL |
| 65 | void aes_cbc_encrypt_internal(const unsigned char *in, unsigned char *out, | 145 | void aes_cbc_encrypt_internal(const unsigned char *in, unsigned char *out, |
| 66 | size_t len, const AES_KEY *key, unsigned char *ivec, const int enc); | 146 | size_t len, const AES_KEY *key, unsigned char *ivec, const int enc); |
| @@ -72,10 +152,10 @@ aes_cbc_encrypt_internal(const unsigned char *in, unsigned char *out, | |||
| 72 | { | 152 | { |
| 73 | if (enc) | 153 | if (enc) |
| 74 | CRYPTO_cbc128_encrypt(in, out, len, key, ivec, | 154 | CRYPTO_cbc128_encrypt(in, out, len, key, ivec, |
| 75 | (block128_f)AES_encrypt); | 155 | aes_encrypt_block128); |
| 76 | else | 156 | else |
| 77 | CRYPTO_cbc128_decrypt(in, out, len, key, ivec, | 157 | CRYPTO_cbc128_decrypt(in, out, len, key, ivec, |
| 78 | (block128_f)AES_decrypt); | 158 | aes_decrypt_block128); |
| 79 | } | 159 | } |
| 80 | #endif | 160 | #endif |
| 81 | 161 | ||
| @@ -98,7 +178,7 @@ AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, | |||
| 98 | const AES_KEY *key, unsigned char *ivec, int *num, const int enc) | 178 | const AES_KEY *key, unsigned char *ivec, int *num, const int enc) |
| 99 | { | 179 | { |
| 100 | CRYPTO_cfb128_encrypt(in, out, length, key, ivec, num, enc, | 180 | CRYPTO_cfb128_encrypt(in, out, length, key, ivec, num, enc, |
| 101 | (block128_f)AES_encrypt); | 181 | aes_encrypt_block128); |
| 102 | } | 182 | } |
| 103 | LCRYPTO_ALIAS(AES_cfb128_encrypt); | 183 | LCRYPTO_ALIAS(AES_cfb128_encrypt); |
| 104 | 184 | ||
| @@ -108,7 +188,7 @@ AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, size_t length, | |||
| 108 | const AES_KEY *key, unsigned char *ivec, int *num, const int enc) | 188 | const AES_KEY *key, unsigned char *ivec, int *num, const int enc) |
| 109 | { | 189 | { |
| 110 | CRYPTO_cfb128_1_encrypt(in, out, length, key, ivec, num, enc, | 190 | CRYPTO_cfb128_1_encrypt(in, out, length, key, ivec, num, enc, |
| 111 | (block128_f)AES_encrypt); | 191 | aes_encrypt_block128); |
| 112 | } | 192 | } |
| 113 | LCRYPTO_ALIAS(AES_cfb1_encrypt); | 193 | LCRYPTO_ALIAS(AES_cfb1_encrypt); |
| 114 | 194 | ||
| @@ -117,17 +197,134 @@ AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, size_t length, | |||
| 117 | const AES_KEY *key, unsigned char *ivec, int *num, const int enc) | 197 | const AES_KEY *key, unsigned char *ivec, int *num, const int enc) |
| 118 | { | 198 | { |
| 119 | CRYPTO_cfb128_8_encrypt(in, out, length, key, ivec, num, enc, | 199 | CRYPTO_cfb128_8_encrypt(in, out, length, key, ivec, num, enc, |
| 120 | (block128_f)AES_encrypt); | 200 | aes_encrypt_block128); |
| 121 | } | 201 | } |
| 122 | LCRYPTO_ALIAS(AES_cfb8_encrypt); | 202 | LCRYPTO_ALIAS(AES_cfb8_encrypt); |
| 123 | 203 | ||
| 124 | void | 204 | void |
| 205 | aes_ccm64_encrypt_generic(const unsigned char *in, unsigned char *out, | ||
| 206 | size_t blocks, const void *key, const unsigned char ivec[16], | ||
| 207 | unsigned char cmac[16], int encrypt) | ||
| 208 | { | ||
| 209 | uint8_t iv[AES_BLOCK_SIZE], buf[AES_BLOCK_SIZE]; | ||
| 210 | uint8_t in_mask; | ||
| 211 | uint64_t ctr; | ||
| 212 | int i; | ||
| 213 | |||
| 214 | in_mask = 0 - (encrypt != 0); | ||
| 215 | |||
| 216 | memcpy(iv, ivec, sizeof(iv)); | ||
| 217 | |||
| 218 | ctr = crypto_load_be64toh(&iv[8]); | ||
| 219 | |||
| 220 | while (blocks > 0) { | ||
| 221 | crypto_store_htobe64(&iv[8], ctr); | ||
| 222 | aes_encrypt_internal(iv, buf, key); | ||
| 223 | ctr++; | ||
| 224 | |||
| 225 | for (i = 0; i < 16; i++) { | ||
| 226 | out[i] = in[i] ^ buf[i]; | ||
| 227 | cmac[i] ^= (in[i] & in_mask) | (out[i] & ~in_mask); | ||
| 228 | } | ||
| 229 | |||
| 230 | aes_encrypt_internal(cmac, cmac, key); | ||
| 231 | |||
| 232 | in += 16; | ||
| 233 | out += 16; | ||
| 234 | blocks--; | ||
| 235 | } | ||
| 236 | |||
| 237 | explicit_bzero(buf, sizeof(buf)); | ||
| 238 | explicit_bzero(iv, sizeof(iv)); | ||
| 239 | } | ||
| 240 | |||
| 241 | #ifdef HAVE_AES_CCM64_ENCRYPT_INTERNAL | ||
| 242 | void aes_ccm64_encrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 243 | size_t blocks, const void *key, const unsigned char ivec[16], | ||
| 244 | unsigned char cmac[16], int encrypt); | ||
| 245 | |||
| 246 | #else | ||
| 247 | static inline void | ||
| 248 | aes_ccm64_encrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 249 | size_t blocks, const void *key, const unsigned char ivec[16], | ||
| 250 | unsigned char cmac[16], int encrypt) | ||
| 251 | { | ||
| 252 | aes_ccm64_encrypt_generic(in, out, blocks, key, ivec, cmac, encrypt); | ||
| 253 | } | ||
| 254 | #endif | ||
| 255 | |||
| 256 | void | ||
| 257 | aes_ccm64_encrypt_ccm128f(const unsigned char *in, unsigned char *out, | ||
| 258 | size_t blocks, const void *key, const unsigned char ivec[16], | ||
| 259 | unsigned char cmac[16]) | ||
| 260 | { | ||
| 261 | aes_ccm64_encrypt_internal(in, out, blocks, key, ivec, cmac, 1); | ||
| 262 | } | ||
| 263 | |||
| 264 | void | ||
| 265 | aes_ccm64_decrypt_ccm128f(const unsigned char *in, unsigned char *out, | ||
| 266 | size_t blocks, const void *key, const unsigned char ivec[16], | ||
| 267 | unsigned char cmac[16]) | ||
| 268 | { | ||
| 269 | aes_ccm64_encrypt_internal(in, out, blocks, key, ivec, cmac, 0); | ||
| 270 | } | ||
| 271 | |||
| 272 | void | ||
| 273 | aes_ctr32_encrypt_generic(const unsigned char *in, unsigned char *out, | ||
| 274 | size_t blocks, const AES_KEY *key, const unsigned char ivec[AES_BLOCK_SIZE]) | ||
| 275 | { | ||
| 276 | uint8_t iv[AES_BLOCK_SIZE], buf[AES_BLOCK_SIZE]; | ||
| 277 | uint32_t ctr; | ||
| 278 | int i; | ||
| 279 | |||
| 280 | memcpy(iv, ivec, sizeof(iv)); | ||
| 281 | |||
| 282 | ctr = crypto_load_be32toh(&iv[12]); | ||
| 283 | |||
| 284 | while (blocks > 0) { | ||
| 285 | crypto_store_htobe32(&iv[12], ctr); | ||
| 286 | aes_encrypt_internal(iv, buf, key); | ||
| 287 | ctr++; | ||
| 288 | |||
| 289 | for (i = 0; i < AES_BLOCK_SIZE; i++) | ||
| 290 | out[i] = in[i] ^ buf[i]; | ||
| 291 | |||
| 292 | in += 16; | ||
| 293 | out += 16; | ||
| 294 | blocks--; | ||
| 295 | } | ||
| 296 | |||
| 297 | explicit_bzero(buf, sizeof(buf)); | ||
| 298 | explicit_bzero(iv, sizeof(iv)); | ||
| 299 | } | ||
| 300 | |||
| 301 | #ifdef HAVE_AES_CTR32_ENCRYPT_INTERNAL | ||
| 302 | void aes_ctr32_encrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 303 | size_t blocks, const AES_KEY *key, const unsigned char ivec[AES_BLOCK_SIZE]); | ||
| 304 | |||
| 305 | #else | ||
| 306 | static inline void | ||
| 307 | aes_ctr32_encrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 308 | size_t blocks, const AES_KEY *key, const unsigned char ivec[AES_BLOCK_SIZE]) | ||
| 309 | { | ||
| 310 | aes_ctr32_encrypt_generic(in, out, blocks, key, ivec); | ||
| 311 | } | ||
| 312 | #endif | ||
| 313 | |||
| 314 | void | ||
| 315 | aes_ctr32_encrypt_ctr128f(const unsigned char *in, unsigned char *out, size_t blocks, | ||
| 316 | const void *key, const unsigned char ivec[AES_BLOCK_SIZE]) | ||
| 317 | { | ||
| 318 | aes_ctr32_encrypt_internal(in, out, blocks, key, ivec); | ||
| 319 | } | ||
| 320 | |||
| 321 | void | ||
| 125 | AES_ctr128_encrypt(const unsigned char *in, unsigned char *out, | 322 | AES_ctr128_encrypt(const unsigned char *in, unsigned char *out, |
| 126 | size_t length, const AES_KEY *key, unsigned char ivec[AES_BLOCK_SIZE], | 323 | size_t length, const AES_KEY *key, unsigned char ivec[AES_BLOCK_SIZE], |
| 127 | unsigned char ecount_buf[AES_BLOCK_SIZE], unsigned int *num) | 324 | unsigned char ecount_buf[AES_BLOCK_SIZE], unsigned int *num) |
| 128 | { | 325 | { |
| 129 | CRYPTO_ctr128_encrypt(in, out, length, key, ivec, ecount_buf, num, | 326 | CRYPTO_ctr128_encrypt_ctr32(in, out, length, key, ivec, ecount_buf, |
| 130 | (block128_f)AES_encrypt); | 327 | num, aes_ctr32_encrypt_ctr128f); |
| 131 | } | 328 | } |
| 132 | LCRYPTO_ALIAS(AES_ctr128_encrypt); | 329 | LCRYPTO_ALIAS(AES_ctr128_encrypt); |
| 133 | 330 | ||
| @@ -142,15 +339,121 @@ AES_ecb_encrypt(const unsigned char *in, unsigned char *out, | |||
| 142 | } | 339 | } |
| 143 | LCRYPTO_ALIAS(AES_ecb_encrypt); | 340 | LCRYPTO_ALIAS(AES_ecb_encrypt); |
| 144 | 341 | ||
| 342 | #ifndef HAVE_AES_ECB_ENCRYPT_INTERNAL | ||
| 343 | void | ||
| 344 | aes_ecb_encrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 345 | size_t len, const AES_KEY *key, int encrypt) | ||
| 346 | { | ||
| 347 | while (len >= AES_BLOCK_SIZE) { | ||
| 348 | AES_ecb_encrypt(in, out, key, encrypt); | ||
| 349 | in += AES_BLOCK_SIZE; | ||
| 350 | out += AES_BLOCK_SIZE; | ||
| 351 | len -= AES_BLOCK_SIZE; | ||
| 352 | } | ||
| 353 | } | ||
| 354 | #endif | ||
| 355 | |||
| 356 | #define N_WORDS (AES_BLOCK_SIZE / sizeof(unsigned long)) | ||
| 357 | typedef struct { | ||
| 358 | unsigned long data[N_WORDS]; | ||
| 359 | } aes_block_t; | ||
| 360 | |||
| 361 | void | ||
| 362 | AES_ige_encrypt(const unsigned char *in, unsigned char *out, size_t length, | ||
| 363 | const AES_KEY *key, unsigned char *ivec, const int enc) | ||
| 364 | { | ||
| 365 | aes_block_t tmp, tmp2; | ||
| 366 | aes_block_t iv; | ||
| 367 | aes_block_t iv2; | ||
| 368 | size_t n; | ||
| 369 | size_t len; | ||
| 370 | |||
| 371 | /* N.B. The IV for this mode is _twice_ the block size */ | ||
| 372 | |||
| 373 | OPENSSL_assert((length % AES_BLOCK_SIZE) == 0); | ||
| 374 | |||
| 375 | len = length / AES_BLOCK_SIZE; | ||
| 376 | |||
| 377 | memcpy(iv.data, ivec, AES_BLOCK_SIZE); | ||
| 378 | memcpy(iv2.data, ivec + AES_BLOCK_SIZE, AES_BLOCK_SIZE); | ||
| 379 | |||
| 380 | if (AES_ENCRYPT == enc) { | ||
| 381 | while (len) { | ||
| 382 | memcpy(tmp.data, in, AES_BLOCK_SIZE); | ||
| 383 | for (n = 0; n < N_WORDS; ++n) | ||
| 384 | tmp2.data[n] = tmp.data[n] ^ iv.data[n]; | ||
| 385 | AES_encrypt((unsigned char *)tmp2.data, | ||
| 386 | (unsigned char *)tmp2.data, key); | ||
| 387 | for (n = 0; n < N_WORDS; ++n) | ||
| 388 | tmp2.data[n] ^= iv2.data[n]; | ||
| 389 | memcpy(out, tmp2.data, AES_BLOCK_SIZE); | ||
| 390 | iv = tmp2; | ||
| 391 | iv2 = tmp; | ||
| 392 | --len; | ||
| 393 | in += AES_BLOCK_SIZE; | ||
| 394 | out += AES_BLOCK_SIZE; | ||
| 395 | } | ||
| 396 | } else { | ||
| 397 | while (len) { | ||
| 398 | memcpy(tmp.data, in, AES_BLOCK_SIZE); | ||
| 399 | tmp2 = tmp; | ||
| 400 | for (n = 0; n < N_WORDS; ++n) | ||
| 401 | tmp.data[n] ^= iv2.data[n]; | ||
| 402 | AES_decrypt((unsigned char *)tmp.data, | ||
| 403 | (unsigned char *)tmp.data, key); | ||
| 404 | for (n = 0; n < N_WORDS; ++n) | ||
| 405 | tmp.data[n] ^= iv.data[n]; | ||
| 406 | memcpy(out, tmp.data, AES_BLOCK_SIZE); | ||
| 407 | iv = tmp2; | ||
| 408 | iv2 = tmp; | ||
| 409 | --len; | ||
| 410 | in += AES_BLOCK_SIZE; | ||
| 411 | out += AES_BLOCK_SIZE; | ||
| 412 | } | ||
| 413 | } | ||
| 414 | memcpy(ivec, iv.data, AES_BLOCK_SIZE); | ||
| 415 | memcpy(ivec + AES_BLOCK_SIZE, iv2.data, AES_BLOCK_SIZE); | ||
| 416 | } | ||
| 417 | LCRYPTO_ALIAS(AES_ige_encrypt); | ||
| 418 | |||
| 145 | void | 419 | void |
| 146 | AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, | 420 | AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, |
| 147 | const AES_KEY *key, unsigned char *ivec, int *num) | 421 | const AES_KEY *key, unsigned char *ivec, int *num) |
| 148 | { | 422 | { |
| 149 | CRYPTO_ofb128_encrypt(in, out, length, key, ivec, num, | 423 | CRYPTO_ofb128_encrypt(in, out, length, key, ivec, num, |
| 150 | (block128_f)AES_encrypt); | 424 | aes_encrypt_block128); |
| 151 | } | 425 | } |
| 152 | LCRYPTO_ALIAS(AES_ofb128_encrypt); | 426 | LCRYPTO_ALIAS(AES_ofb128_encrypt); |
| 153 | 427 | ||
| 428 | void | ||
| 429 | aes_xts_encrypt_generic(const unsigned char *in, unsigned char *out, size_t len, | ||
| 430 | const AES_KEY *key1, const AES_KEY *key2, const unsigned char iv[16], | ||
| 431 | int encrypt) | ||
| 432 | { | ||
| 433 | XTS128_CONTEXT xctx; | ||
| 434 | |||
| 435 | if (encrypt) | ||
| 436 | xctx.block1 = aes_encrypt_block128; | ||
| 437 | else | ||
| 438 | xctx.block1 = aes_decrypt_block128; | ||
| 439 | |||
| 440 | xctx.block2 = aes_encrypt_block128; | ||
| 441 | xctx.key1 = key1; | ||
| 442 | xctx.key2 = key2; | ||
| 443 | |||
| 444 | CRYPTO_xts128_encrypt(&xctx, iv, in, out, len, encrypt); | ||
| 445 | } | ||
| 446 | |||
| 447 | #ifndef HAVE_AES_XTS_ENCRYPT_INTERNAL | ||
| 448 | void | ||
| 449 | aes_xts_encrypt_internal(const unsigned char *in, unsigned char *out, size_t len, | ||
| 450 | const AES_KEY *key1, const AES_KEY *key2, const unsigned char iv[16], | ||
| 451 | int encrypt) | ||
| 452 | { | ||
| 453 | aes_xts_encrypt_generic(in, out, len, key1, key2, iv, encrypt); | ||
| 454 | } | ||
| 455 | #endif | ||
| 456 | |||
| 154 | int | 457 | int |
| 155 | AES_wrap_key(AES_KEY *key, const unsigned char *iv, unsigned char *out, | 458 | AES_wrap_key(AES_KEY *key, const unsigned char *iv, unsigned char *out, |
| 156 | const unsigned char *in, unsigned int inlen) | 459 | const unsigned char *in, unsigned int inlen) |
| @@ -217,7 +520,7 @@ AES_unwrap_key(AES_KEY *key, const unsigned char *iv, unsigned char *out, | |||
| 217 | } | 520 | } |
| 218 | if (!iv) | 521 | if (!iv) |
| 219 | iv = aes_wrap_default_iv; | 522 | iv = aes_wrap_default_iv; |
| 220 | if (memcmp(A, iv, 8)) { | 523 | if (timingsafe_memcmp(A, iv, 8) != 0) { |
| 221 | explicit_bzero(out, inlen); | 524 | explicit_bzero(out, inlen); |
| 222 | return 0; | 525 | return 0; |
| 223 | } | 526 | } |
diff --git a/src/lib/libcrypto/aes/aes_amd64.c b/src/lib/libcrypto/aes/aes_amd64.c new file mode 100644 index 0000000000..183a5cce14 --- /dev/null +++ b/src/lib/libcrypto/aes/aes_amd64.c | |||
| @@ -0,0 +1,201 @@ | |||
| 1 | /* $OpenBSD: aes_amd64.c,v 1.5 2025/07/22 09:13:49 jsing Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2025 Joel Sing <jsing@openbsd.org> | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <openssl/aes.h> | ||
| 19 | |||
| 20 | #include "crypto_arch.h" | ||
| 21 | #include "modes_local.h" | ||
| 22 | |||
| 23 | int aes_set_encrypt_key_generic(const unsigned char *userKey, const int bits, | ||
| 24 | AES_KEY *key); | ||
| 25 | int aes_set_decrypt_key_generic(const unsigned char *userKey, const int bits, | ||
| 26 | AES_KEY *key); | ||
| 27 | |||
| 28 | void aes_encrypt_generic(const unsigned char *in, unsigned char *out, | ||
| 29 | const AES_KEY *key); | ||
| 30 | void aes_decrypt_generic(const unsigned char *in, unsigned char *out, | ||
| 31 | const AES_KEY *key); | ||
| 32 | |||
| 33 | void aes_cbc_encrypt_generic(const unsigned char *in, unsigned char *out, | ||
| 34 | size_t len, const AES_KEY *key, unsigned char *ivec, const int enc); | ||
| 35 | |||
| 36 | void aes_ccm64_encrypt_generic(const unsigned char *in, unsigned char *out, | ||
| 37 | size_t blocks, const void *key, const unsigned char ivec[16], | ||
| 38 | unsigned char cmac[16], int encrypt); | ||
| 39 | |||
| 40 | void aes_ctr32_encrypt_generic(const unsigned char *in, unsigned char *out, | ||
| 41 | size_t blocks, const AES_KEY *key, const unsigned char ivec[AES_BLOCK_SIZE]); | ||
| 42 | |||
| 43 | void aes_xts_encrypt_generic(const unsigned char *in, unsigned char *out, | ||
| 44 | size_t len, const AES_KEY *key1, const AES_KEY *key2, | ||
| 45 | const unsigned char iv[16], int encrypt); | ||
| 46 | |||
| 47 | int aesni_set_encrypt_key(const unsigned char *userKey, int bits, | ||
| 48 | AES_KEY *key); | ||
| 49 | int aesni_set_decrypt_key(const unsigned char *userKey, int bits, | ||
| 50 | AES_KEY *key); | ||
| 51 | |||
| 52 | void aesni_encrypt(const unsigned char *in, unsigned char *out, | ||
| 53 | const AES_KEY *key); | ||
| 54 | void aesni_decrypt(const unsigned char *in, unsigned char *out, | ||
| 55 | const AES_KEY *key); | ||
| 56 | |||
| 57 | void aesni_cbc_encrypt(const unsigned char *in, unsigned char *out, | ||
| 58 | size_t len, const AES_KEY *key, unsigned char *ivec, const int enc); | ||
| 59 | |||
| 60 | void aesni_ccm64_encrypt_blocks(const unsigned char *in, unsigned char *out, | ||
| 61 | size_t blocks, const void *key, const unsigned char ivec[16], | ||
| 62 | unsigned char cmac[16]); | ||
| 63 | |||
| 64 | void aesni_ccm64_decrypt_blocks(const unsigned char *in, unsigned char *out, | ||
| 65 | size_t blocks, const void *key, const unsigned char ivec[16], | ||
| 66 | unsigned char cmac[16]); | ||
| 67 | |||
| 68 | void aesni_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out, | ||
| 69 | size_t blocks, const void *key, const unsigned char *ivec); | ||
| 70 | |||
| 71 | void aesni_ecb_encrypt(const unsigned char *in, unsigned char *out, | ||
| 72 | size_t length, const AES_KEY *key, int enc); | ||
| 73 | |||
| 74 | void aesni_xts_encrypt(const unsigned char *in, unsigned char *out, | ||
| 75 | size_t length, const AES_KEY *key1, const AES_KEY *key2, | ||
| 76 | const unsigned char iv[16]); | ||
| 77 | |||
| 78 | void aesni_xts_decrypt(const unsigned char *in, unsigned char *out, | ||
| 79 | size_t length, const AES_KEY *key1, const AES_KEY *key2, | ||
| 80 | const unsigned char iv[16]); | ||
| 81 | |||
| 82 | int | ||
| 83 | aes_set_encrypt_key_internal(const unsigned char *userKey, const int bits, | ||
| 84 | AES_KEY *key) | ||
| 85 | { | ||
| 86 | if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_AES) != 0) | ||
| 87 | return aesni_set_encrypt_key(userKey, bits, key); | ||
| 88 | |||
| 89 | return aes_set_encrypt_key_generic(userKey, bits, key); | ||
| 90 | } | ||
| 91 | |||
| 92 | int | ||
| 93 | aes_set_decrypt_key_internal(const unsigned char *userKey, const int bits, | ||
| 94 | AES_KEY *key) | ||
| 95 | { | ||
| 96 | if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_AES) != 0) | ||
| 97 | return aesni_set_decrypt_key(userKey, bits, key); | ||
| 98 | |||
| 99 | return aes_set_decrypt_key_generic(userKey, bits, key); | ||
| 100 | } | ||
| 101 | |||
| 102 | void | ||
| 103 | aes_encrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 104 | const AES_KEY *key) | ||
| 105 | { | ||
| 106 | if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_AES) != 0) { | ||
| 107 | aesni_encrypt(in, out, key); | ||
| 108 | return; | ||
| 109 | } | ||
| 110 | |||
| 111 | aes_encrypt_generic(in, out, key); | ||
| 112 | } | ||
| 113 | |||
| 114 | void | ||
| 115 | aes_decrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 116 | const AES_KEY *key) | ||
| 117 | { | ||
| 118 | if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_AES) != 0) { | ||
| 119 | aesni_decrypt(in, out, key); | ||
| 120 | return; | ||
| 121 | } | ||
| 122 | |||
| 123 | aes_decrypt_generic(in, out, key); | ||
| 124 | } | ||
| 125 | |||
| 126 | void | ||
| 127 | aes_cbc_encrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 128 | size_t len, const AES_KEY *key, unsigned char *ivec, const int enc) | ||
| 129 | { | ||
| 130 | if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_AES) != 0) { | ||
| 131 | aesni_cbc_encrypt(in, out, len, key, ivec, enc); | ||
| 132 | return; | ||
| 133 | } | ||
| 134 | |||
| 135 | aes_cbc_encrypt_generic(in, out, len, key, ivec, enc); | ||
| 136 | } | ||
| 137 | |||
| 138 | void | ||
| 139 | aes_ccm64_encrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 140 | size_t blocks, const void *key, const unsigned char ivec[16], | ||
| 141 | unsigned char cmac[16], int encrypt) | ||
| 142 | { | ||
| 143 | if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_AES) != 0) { | ||
| 144 | if (encrypt) | ||
| 145 | aesni_ccm64_encrypt_blocks(in, out, blocks, key, ivec, cmac); | ||
| 146 | else | ||
| 147 | aesni_ccm64_decrypt_blocks(in, out, blocks, key, ivec, cmac); | ||
| 148 | return; | ||
| 149 | } | ||
| 150 | |||
| 151 | aes_ccm64_encrypt_generic(in, out, blocks, key, ivec, cmac, encrypt); | ||
| 152 | } | ||
| 153 | |||
| 154 | void | ||
| 155 | aes_ctr32_encrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 156 | size_t blocks, const AES_KEY *key, const unsigned char ivec[AES_BLOCK_SIZE]) | ||
| 157 | { | ||
| 158 | if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_AES) != 0) { | ||
| 159 | aesni_ctr32_encrypt_blocks(in, out, blocks, key, ivec); | ||
| 160 | return; | ||
| 161 | } | ||
| 162 | |||
| 163 | aes_ctr32_encrypt_generic(in, out, blocks, key, ivec); | ||
| 164 | } | ||
| 165 | |||
| 166 | void | ||
| 167 | aes_ecb_encrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 168 | size_t len, const AES_KEY *key, int encrypt) | ||
| 169 | { | ||
| 170 | if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_AES) != 0) { | ||
| 171 | aesni_ecb_encrypt(in, out, len, key, encrypt); | ||
| 172 | return; | ||
| 173 | } | ||
| 174 | |||
| 175 | while (len >= AES_BLOCK_SIZE) { | ||
| 176 | if (encrypt) | ||
| 177 | aes_encrypt_generic(in, out, key); | ||
| 178 | else | ||
| 179 | aes_decrypt_generic(in, out, key); | ||
| 180 | |||
| 181 | in += AES_BLOCK_SIZE; | ||
| 182 | out += AES_BLOCK_SIZE; | ||
| 183 | len -= AES_BLOCK_SIZE; | ||
| 184 | } | ||
| 185 | } | ||
| 186 | |||
| 187 | void | ||
| 188 | aes_xts_encrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 189 | size_t len, const AES_KEY *key1, const AES_KEY *key2, | ||
| 190 | const unsigned char iv[16], int encrypt) | ||
| 191 | { | ||
| 192 | if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_AES) != 0) { | ||
| 193 | if (encrypt) | ||
| 194 | aesni_xts_encrypt(in, out, len, key1, key2, iv); | ||
| 195 | else | ||
| 196 | aesni_xts_decrypt(in, out, len, key1, key2, iv); | ||
| 197 | return; | ||
| 198 | } | ||
| 199 | |||
| 200 | aes_xts_encrypt_generic(in, out, len, key1, key2, iv, encrypt); | ||
| 201 | } | ||
diff --git a/src/lib/libcrypto/aes/aes_core.c b/src/lib/libcrypto/aes/aes_core.c index 4383d74903..c4ca58a979 100644 --- a/src/lib/libcrypto/aes/aes_core.c +++ b/src/lib/libcrypto/aes/aes_core.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: aes_core.c,v 1.25 2024/11/13 21:00:57 tb Exp $ */ | 1 | /* $OpenBSD: aes_core.c,v 1.30 2025/09/08 13:37:39 jsing Exp $ */ |
| 2 | /** | 2 | /** |
| 3 | * rijndael-alg-fst.c | 3 | * rijndael-alg-fst.c |
| 4 | * | 4 | * |
| @@ -30,7 +30,7 @@ | |||
| 30 | * compatible API. | 30 | * compatible API. |
| 31 | */ | 31 | */ |
| 32 | 32 | ||
| 33 | #include <stdlib.h> | 33 | #include <stdint.h> |
| 34 | 34 | ||
| 35 | #include <openssl/aes.h> | 35 | #include <openssl/aes.h> |
| 36 | 36 | ||
| @@ -51,11 +51,11 @@ Td3[x] = Si[x].[09, 0d, 0b, 0e]; | |||
| 51 | Td4[x] = Si[x].[01]; | 51 | Td4[x] = Si[x].[01]; |
| 52 | */ | 52 | */ |
| 53 | 53 | ||
| 54 | #if !defined(HAVE_AES_SET_ENCRYPT_KEY_INTERNAL) || \ | 54 | #if !defined(HAVE_AES_SET_ENCRYPT_KEY_GENERIC) || \ |
| 55 | !defined(HAVE_AES_SET_DECRYPT_KEY_INTERNAL) || \ | 55 | !defined(HAVE_AES_SET_DECRYPT_KEY_GENERIC) || \ |
| 56 | !defined(HAVE_AES_ENCRYPT_INTERNAL) || \ | 56 | !defined(HAVE_AES_ENCRYPT_GENERIC) || \ |
| 57 | !defined(HAVE_AES_DECRYPT_INTERNAL) | 57 | !defined(HAVE_AES_DECRYPT_GENERIC) |
| 58 | static const u32 Te0[256] = { | 58 | static const uint32_t Te0[256] = { |
| 59 | 0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU, | 59 | 0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU, |
| 60 | 0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U, | 60 | 0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U, |
| 61 | 0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU, | 61 | 0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU, |
| @@ -121,7 +121,7 @@ static const u32 Te0[256] = { | |||
| 121 | 0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U, | 121 | 0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U, |
| 122 | 0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU, | 122 | 0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU, |
| 123 | }; | 123 | }; |
| 124 | static const u32 Te1[256] = { | 124 | static const uint32_t Te1[256] = { |
| 125 | 0xa5c66363U, 0x84f87c7cU, 0x99ee7777U, 0x8df67b7bU, | 125 | 0xa5c66363U, 0x84f87c7cU, 0x99ee7777U, 0x8df67b7bU, |
| 126 | 0x0dfff2f2U, 0xbdd66b6bU, 0xb1de6f6fU, 0x5491c5c5U, | 126 | 0x0dfff2f2U, 0xbdd66b6bU, 0xb1de6f6fU, 0x5491c5c5U, |
| 127 | 0x50603030U, 0x03020101U, 0xa9ce6767U, 0x7d562b2bU, | 127 | 0x50603030U, 0x03020101U, 0xa9ce6767U, 0x7d562b2bU, |
| @@ -187,7 +187,7 @@ static const u32 Te1[256] = { | |||
| 187 | 0xc3824141U, 0xb0299999U, 0x775a2d2dU, 0x111e0f0fU, | 187 | 0xc3824141U, 0xb0299999U, 0x775a2d2dU, 0x111e0f0fU, |
| 188 | 0xcb7bb0b0U, 0xfca85454U, 0xd66dbbbbU, 0x3a2c1616U, | 188 | 0xcb7bb0b0U, 0xfca85454U, 0xd66dbbbbU, 0x3a2c1616U, |
| 189 | }; | 189 | }; |
| 190 | static const u32 Te2[256] = { | 190 | static const uint32_t Te2[256] = { |
| 191 | 0x63a5c663U, 0x7c84f87cU, 0x7799ee77U, 0x7b8df67bU, | 191 | 0x63a5c663U, 0x7c84f87cU, 0x7799ee77U, 0x7b8df67bU, |
| 192 | 0xf20dfff2U, 0x6bbdd66bU, 0x6fb1de6fU, 0xc55491c5U, | 192 | 0xf20dfff2U, 0x6bbdd66bU, 0x6fb1de6fU, 0xc55491c5U, |
| 193 | 0x30506030U, 0x01030201U, 0x67a9ce67U, 0x2b7d562bU, | 193 | 0x30506030U, 0x01030201U, 0x67a9ce67U, 0x2b7d562bU, |
| @@ -253,7 +253,7 @@ static const u32 Te2[256] = { | |||
| 253 | 0x41c38241U, 0x99b02999U, 0x2d775a2dU, 0x0f111e0fU, | 253 | 0x41c38241U, 0x99b02999U, 0x2d775a2dU, 0x0f111e0fU, |
| 254 | 0xb0cb7bb0U, 0x54fca854U, 0xbbd66dbbU, 0x163a2c16U, | 254 | 0xb0cb7bb0U, 0x54fca854U, 0xbbd66dbbU, 0x163a2c16U, |
| 255 | }; | 255 | }; |
| 256 | static const u32 Te3[256] = { | 256 | static const uint32_t Te3[256] = { |
| 257 | 0x6363a5c6U, 0x7c7c84f8U, 0x777799eeU, 0x7b7b8df6U, | 257 | 0x6363a5c6U, 0x7c7c84f8U, 0x777799eeU, 0x7b7b8df6U, |
| 258 | 0xf2f20dffU, 0x6b6bbdd6U, 0x6f6fb1deU, 0xc5c55491U, | 258 | 0xf2f20dffU, 0x6b6bbdd6U, 0x6f6fb1deU, 0xc5c55491U, |
| 259 | 0x30305060U, 0x01010302U, 0x6767a9ceU, 0x2b2b7d56U, | 259 | 0x30305060U, 0x01010302U, 0x6767a9ceU, 0x2b2b7d56U, |
| @@ -320,7 +320,7 @@ static const u32 Te3[256] = { | |||
| 320 | 0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU, | 320 | 0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU, |
| 321 | }; | 321 | }; |
| 322 | 322 | ||
| 323 | static const u32 Td0[256] = { | 323 | static const uint32_t Td0[256] = { |
| 324 | 0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U, | 324 | 0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U, |
| 325 | 0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U, | 325 | 0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U, |
| 326 | 0x2030fa55U, 0xad766df6U, 0x88cc7691U, 0xf5024c25U, | 326 | 0x2030fa55U, 0xad766df6U, 0x88cc7691U, 0xf5024c25U, |
| @@ -386,7 +386,7 @@ static const u32 Td0[256] = { | |||
| 386 | 0x39a80171U, 0x080cb3deU, 0xd8b4e49cU, 0x6456c190U, | 386 | 0x39a80171U, 0x080cb3deU, 0xd8b4e49cU, 0x6456c190U, |
| 387 | 0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U, | 387 | 0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U, |
| 388 | }; | 388 | }; |
| 389 | static const u32 Td1[256] = { | 389 | static const uint32_t Td1[256] = { |
| 390 | 0x5051f4a7U, 0x537e4165U, 0xc31a17a4U, 0x963a275eU, | 390 | 0x5051f4a7U, 0x537e4165U, 0xc31a17a4U, 0x963a275eU, |
| 391 | 0xcb3bab6bU, 0xf11f9d45U, 0xabacfa58U, 0x934be303U, | 391 | 0xcb3bab6bU, 0xf11f9d45U, 0xabacfa58U, 0x934be303U, |
| 392 | 0x552030faU, 0xf6ad766dU, 0x9188cc76U, 0x25f5024cU, | 392 | 0x552030faU, 0xf6ad766dU, 0x9188cc76U, 0x25f5024cU, |
| @@ -452,7 +452,7 @@ static const u32 Td1[256] = { | |||
| 452 | 0x7139a801U, 0xde080cb3U, 0x9cd8b4e4U, 0x906456c1U, | 452 | 0x7139a801U, 0xde080cb3U, 0x9cd8b4e4U, 0x906456c1U, |
| 453 | 0x617bcb84U, 0x70d532b6U, 0x74486c5cU, 0x42d0b857U, | 453 | 0x617bcb84U, 0x70d532b6U, 0x74486c5cU, 0x42d0b857U, |
| 454 | }; | 454 | }; |
| 455 | static const u32 Td2[256] = { | 455 | static const uint32_t Td2[256] = { |
| 456 | 0xa75051f4U, 0x65537e41U, 0xa4c31a17U, 0x5e963a27U, | 456 | 0xa75051f4U, 0x65537e41U, 0xa4c31a17U, 0x5e963a27U, |
| 457 | 0x6bcb3babU, 0x45f11f9dU, 0x58abacfaU, 0x03934be3U, | 457 | 0x6bcb3babU, 0x45f11f9dU, 0x58abacfaU, 0x03934be3U, |
| 458 | 0xfa552030U, 0x6df6ad76U, 0x769188ccU, 0x4c25f502U, | 458 | 0xfa552030U, 0x6df6ad76U, 0x769188ccU, 0x4c25f502U, |
| @@ -518,7 +518,7 @@ static const u32 Td2[256] = { | |||
| 518 | 0x017139a8U, 0xb3de080cU, 0xe49cd8b4U, 0xc1906456U, | 518 | 0x017139a8U, 0xb3de080cU, 0xe49cd8b4U, 0xc1906456U, |
| 519 | 0x84617bcbU, 0xb670d532U, 0x5c74486cU, 0x5742d0b8U, | 519 | 0x84617bcbU, 0xb670d532U, 0x5c74486cU, 0x5742d0b8U, |
| 520 | }; | 520 | }; |
| 521 | static const u32 Td3[256] = { | 521 | static const uint32_t Td3[256] = { |
| 522 | 0xf4a75051U, 0x4165537eU, 0x17a4c31aU, 0x275e963aU, | 522 | 0xf4a75051U, 0x4165537eU, 0x17a4c31aU, 0x275e963aU, |
| 523 | 0xab6bcb3bU, 0x9d45f11fU, 0xfa58abacU, 0xe303934bU, | 523 | 0xab6bcb3bU, 0x9d45f11fU, 0xfa58abacU, 0xe303934bU, |
| 524 | 0x30fa5520U, 0x766df6adU, 0xcc769188U, 0x024c25f5U, | 524 | 0x30fa5520U, 0x766df6adU, 0xcc769188U, 0x024c25f5U, |
| @@ -586,9 +586,9 @@ static const u32 Td3[256] = { | |||
| 586 | }; | 586 | }; |
| 587 | #endif | 587 | #endif |
| 588 | 588 | ||
| 589 | #if !defined(HAVE_AES_ENCRYPT_INTERNAL) || \ | 589 | #if !defined(HAVE_AES_ENCRYPT_GENERIC) || \ |
| 590 | !defined(HAVE_AES_DECRYPT_INTERNAL) | 590 | !defined(HAVE_AES_DECRYPT_GENERIC) |
| 591 | static const u8 Td4[256] = { | 591 | static const uint8_t Td4[256] = { |
| 592 | 0x52U, 0x09U, 0x6aU, 0xd5U, 0x30U, 0x36U, 0xa5U, 0x38U, | 592 | 0x52U, 0x09U, 0x6aU, 0xd5U, 0x30U, 0x36U, 0xa5U, 0x38U, |
| 593 | 0xbfU, 0x40U, 0xa3U, 0x9eU, 0x81U, 0xf3U, 0xd7U, 0xfbU, | 593 | 0xbfU, 0x40U, 0xa3U, 0x9eU, 0x81U, 0xf3U, 0xd7U, 0xfbU, |
| 594 | 0x7cU, 0xe3U, 0x39U, 0x82U, 0x9bU, 0x2fU, 0xffU, 0x87U, | 594 | 0x7cU, 0xe3U, 0x39U, 0x82U, 0x9bU, 0x2fU, 0xffU, 0x87U, |
| @@ -624,46 +624,29 @@ static const u8 Td4[256] = { | |||
| 624 | }; | 624 | }; |
| 625 | #endif | 625 | #endif |
| 626 | 626 | ||
| 627 | #if !defined(HAVE_AES_SET_ENCRYPT_KEY_INTERNAL) || \ | 627 | #if !defined(HAVE_AES_SET_ENCRYPT_KEY_GENERIC) || \ |
| 628 | !defined(HAVE_AES_SET_DECRYPT_KEY_INTERNAL) | 628 | !defined(HAVE_AES_SET_DECRYPT_KEY_GENERIC) |
| 629 | static const u32 rcon[] = { | 629 | static const uint32_t rcon[] = { |
| 630 | 0x01000000, 0x02000000, 0x04000000, 0x08000000, | 630 | 0x01000000, 0x02000000, 0x04000000, 0x08000000, |
| 631 | 0x10000000, 0x20000000, 0x40000000, 0x80000000, | 631 | 0x10000000, 0x20000000, 0x40000000, 0x80000000, |
| 632 | 0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */ | 632 | 0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */ |
| 633 | }; | 633 | }; |
| 634 | #endif | 634 | #endif |
| 635 | 635 | ||
| 636 | #ifdef HAVE_AES_SET_ENCRYPT_KEY_INTERNAL | 636 | #ifndef HAVE_AES_SET_ENCRYPT_KEY_GENERIC |
| 637 | int aes_set_encrypt_key_internal(const unsigned char *userKey, const int bits, | ||
| 638 | AES_KEY *key); | ||
| 639 | |||
| 640 | #else | ||
| 641 | |||
| 642 | /* | 637 | /* |
| 643 | * Expand the cipher key into the encryption key schedule. | 638 | * Expand the cipher key into the encryption key schedule. |
| 644 | */ | 639 | */ |
| 645 | static inline int | 640 | int |
| 646 | aes_set_encrypt_key_internal(const unsigned char *userKey, const int bits, | 641 | aes_set_encrypt_key_generic(const unsigned char *userKey, const int bits, |
| 647 | AES_KEY *key) | 642 | AES_KEY *key) |
| 648 | { | 643 | { |
| 649 | u32 *rk; | 644 | uint32_t *rk; |
| 650 | int i = 0; | 645 | int i = 0; |
| 651 | u32 temp; | 646 | uint32_t temp; |
| 652 | |||
| 653 | if (!userKey || !key) | ||
| 654 | return -1; | ||
| 655 | if (bits != 128 && bits != 192 && bits != 256) | ||
| 656 | return -2; | ||
| 657 | 647 | ||
| 658 | rk = key->rd_key; | 648 | rk = key->rd_key; |
| 659 | 649 | ||
| 660 | if (bits == 128) | ||
| 661 | key->rounds = 10; | ||
| 662 | else if (bits == 192) | ||
| 663 | key->rounds = 12; | ||
| 664 | else | ||
| 665 | key->rounds = 14; | ||
| 666 | |||
| 667 | rk[0] = crypto_load_be32toh(&userKey[0 * 4]); | 650 | rk[0] = crypto_load_be32toh(&userKey[0 * 4]); |
| 668 | rk[1] = crypto_load_be32toh(&userKey[1 * 4]); | 651 | rk[1] = crypto_load_be32toh(&userKey[1 * 4]); |
| 669 | rk[2] = crypto_load_be32toh(&userKey[2 * 4]); | 652 | rk[2] = crypto_load_be32toh(&userKey[2 * 4]); |
| @@ -742,33 +725,30 @@ aes_set_encrypt_key_internal(const unsigned char *userKey, const int bits, | |||
| 742 | } | 725 | } |
| 743 | #endif | 726 | #endif |
| 744 | 727 | ||
| 728 | #ifndef HAVE_AES_SET_ENCRYPT_KEY_INTERNAL | ||
| 745 | int | 729 | int |
| 746 | AES_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key) | 730 | aes_set_encrypt_key_internal(const unsigned char *userKey, const int bits, |
| 731 | AES_KEY *key) | ||
| 747 | { | 732 | { |
| 748 | return aes_set_encrypt_key_internal(userKey, bits, key); | 733 | return aes_set_encrypt_key_generic(userKey, bits, key); |
| 749 | } | 734 | } |
| 750 | LCRYPTO_ALIAS(AES_set_encrypt_key); | 735 | #endif |
| 751 | |||
| 752 | #ifdef HAVE_AES_SET_DECRYPT_KEY_INTERNAL | ||
| 753 | int aes_set_decrypt_key_internal(const unsigned char *userKey, const int bits, | ||
| 754 | AES_KEY *key); | ||
| 755 | 736 | ||
| 756 | #else | 737 | #ifndef HAVE_AES_SET_DECRYPT_KEY_GENERIC |
| 757 | /* | 738 | /* |
| 758 | * Expand the cipher key into the decryption key schedule. | 739 | * Expand the cipher key into the decryption key schedule. |
| 759 | */ | 740 | */ |
| 760 | static inline int | 741 | int |
| 761 | aes_set_decrypt_key_internal(const unsigned char *userKey, const int bits, | 742 | aes_set_decrypt_key_generic(const unsigned char *userKey, const int bits, |
| 762 | AES_KEY *key) | 743 | AES_KEY *key) |
| 763 | { | 744 | { |
| 764 | u32 *rk; | 745 | uint32_t *rk; |
| 765 | int i, j, status; | 746 | uint32_t temp; |
| 766 | u32 temp; | 747 | int i, j, ret; |
| 767 | 748 | ||
| 768 | /* first, start with an encryption schedule */ | 749 | /* first, start with an encryption schedule */ |
| 769 | status = AES_set_encrypt_key(userKey, bits, key); | 750 | if ((ret = aes_set_encrypt_key_generic(userKey, bits, key)) < 0) |
| 770 | if (status < 0) | 751 | return ret; |
| 771 | return status; | ||
| 772 | 752 | ||
| 773 | rk = key->rd_key; | 753 | rk = key->rd_key; |
| 774 | 754 | ||
| @@ -815,27 +795,25 @@ aes_set_decrypt_key_internal(const unsigned char *userKey, const int bits, | |||
| 815 | } | 795 | } |
| 816 | #endif | 796 | #endif |
| 817 | 797 | ||
| 798 | #ifndef HAVE_AES_SET_DECRYPT_KEY_INTERNAL | ||
| 818 | int | 799 | int |
| 819 | AES_set_decrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key) | 800 | aes_set_decrypt_key_internal(const unsigned char *userKey, const int bits, |
| 801 | AES_KEY *key) | ||
| 820 | { | 802 | { |
| 821 | return aes_set_decrypt_key_internal(userKey, bits, key); | 803 | return aes_set_decrypt_key_generic(userKey, bits, key); |
| 822 | } | 804 | } |
| 823 | LCRYPTO_ALIAS(AES_set_decrypt_key); | 805 | #endif |
| 824 | |||
| 825 | #ifdef HAVE_AES_ENCRYPT_INTERNAL | ||
| 826 | void aes_encrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 827 | const AES_KEY *key); | ||
| 828 | 806 | ||
| 829 | #else | 807 | #ifndef HAVE_AES_ENCRYPT_GENERIC |
| 830 | /* | 808 | /* |
| 831 | * Encrypt a single block - in and out can overlap. | 809 | * Encrypt a single block - in and out can overlap. |
| 832 | */ | 810 | */ |
| 833 | static inline void | 811 | void |
| 834 | aes_encrypt_internal(const unsigned char *in, unsigned char *out, | 812 | aes_encrypt_generic(const unsigned char *in, unsigned char *out, |
| 835 | const AES_KEY *key) | 813 | const AES_KEY *key) |
| 836 | { | 814 | { |
| 837 | const u32 *rk; | 815 | const uint32_t *rk; |
| 838 | u32 s0, s1, s2, s3, t0, t1, t2, t3; | 816 | uint32_t s0, s1, s2, s3, t0, t1, t2, t3; |
| 839 | #ifndef FULL_UNROLL | 817 | #ifndef FULL_UNROLL |
| 840 | int r; | 818 | int r; |
| 841 | #endif /* ?FULL_UNROLL */ | 819 | #endif /* ?FULL_UNROLL */ |
| @@ -1018,27 +996,25 @@ aes_encrypt_internal(const unsigned char *in, unsigned char *out, | |||
| 1018 | } | 996 | } |
| 1019 | #endif | 997 | #endif |
| 1020 | 998 | ||
| 999 | #ifndef HAVE_AES_ENCRYPT_INTERNAL | ||
| 1021 | void | 1000 | void |
| 1022 | AES_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key) | 1001 | aes_encrypt_internal(const unsigned char *in, unsigned char *out, |
| 1002 | const AES_KEY *key) | ||
| 1023 | { | 1003 | { |
| 1024 | aes_encrypt_internal(in, out, key); | 1004 | aes_encrypt_generic(in, out, key); |
| 1025 | } | 1005 | } |
| 1026 | LCRYPTO_ALIAS(AES_encrypt); | 1006 | #endif |
| 1027 | |||
| 1028 | #ifdef HAVE_AES_DECRYPT_INTERNAL | ||
| 1029 | void aes_decrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 1030 | const AES_KEY *key); | ||
| 1031 | 1007 | ||
| 1032 | #else | 1008 | #ifndef HAVE_AES_DECRYPT_GENERIC |
| 1033 | /* | 1009 | /* |
| 1034 | * Decrypt a single block - in and out can overlap. | 1010 | * Decrypt a single block - in and out can overlap. |
| 1035 | */ | 1011 | */ |
| 1036 | static inline void | 1012 | void |
| 1037 | aes_decrypt_internal(const unsigned char *in, unsigned char *out, | 1013 | aes_decrypt_generic(const unsigned char *in, unsigned char *out, |
| 1038 | const AES_KEY *key) | 1014 | const AES_KEY *key) |
| 1039 | { | 1015 | { |
| 1040 | const u32 *rk; | 1016 | const uint32_t *rk; |
| 1041 | u32 s0, s1, s2, s3, t0, t1, t2, t3; | 1017 | uint32_t s0, s1, s2, s3, t0, t1, t2, t3; |
| 1042 | #ifndef FULL_UNROLL | 1018 | #ifndef FULL_UNROLL |
| 1043 | int r; | 1019 | int r; |
| 1044 | #endif /* ?FULL_UNROLL */ | 1020 | #endif /* ?FULL_UNROLL */ |
| @@ -1221,9 +1197,11 @@ aes_decrypt_internal(const unsigned char *in, unsigned char *out, | |||
| 1221 | } | 1197 | } |
| 1222 | #endif | 1198 | #endif |
| 1223 | 1199 | ||
| 1200 | #ifndef HAVE_AES_DECRYPT_INTERNAL | ||
| 1224 | void | 1201 | void |
| 1225 | AES_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key) | 1202 | aes_decrypt_internal(const unsigned char *in, unsigned char *out, |
| 1203 | const AES_KEY *key) | ||
| 1226 | { | 1204 | { |
| 1227 | aes_decrypt_internal(in, out, key); | 1205 | aes_decrypt_generic(in, out, key); |
| 1228 | } | 1206 | } |
| 1229 | LCRYPTO_ALIAS(AES_decrypt); | 1207 | #endif |
diff --git a/src/lib/libcrypto/aes/aes_i386.c b/src/lib/libcrypto/aes/aes_i386.c new file mode 100644 index 0000000000..85a14454da --- /dev/null +++ b/src/lib/libcrypto/aes/aes_i386.c | |||
| @@ -0,0 +1,201 @@ | |||
| 1 | /* $OpenBSD: aes_i386.c,v 1.5 2025/07/22 09:13:49 jsing Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2025 Joel Sing <jsing@openbsd.org> | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <openssl/aes.h> | ||
| 19 | |||
| 20 | #include "crypto_arch.h" | ||
| 21 | #include "modes_local.h" | ||
| 22 | |||
| 23 | int aes_set_encrypt_key_generic(const unsigned char *userKey, const int bits, | ||
| 24 | AES_KEY *key); | ||
| 25 | int aes_set_decrypt_key_generic(const unsigned char *userKey, const int bits, | ||
| 26 | AES_KEY *key); | ||
| 27 | |||
| 28 | void aes_encrypt_generic(const unsigned char *in, unsigned char *out, | ||
| 29 | const AES_KEY *key); | ||
| 30 | void aes_decrypt_generic(const unsigned char *in, unsigned char *out, | ||
| 31 | const AES_KEY *key); | ||
| 32 | |||
| 33 | void aes_cbc_encrypt_generic(const unsigned char *in, unsigned char *out, | ||
| 34 | size_t len, const AES_KEY *key, unsigned char *ivec, const int enc); | ||
| 35 | |||
| 36 | void aes_ccm64_encrypt_generic(const unsigned char *in, unsigned char *out, | ||
| 37 | size_t blocks, const void *key, const unsigned char ivec[16], | ||
| 38 | unsigned char cmac[16], int encrypt); | ||
| 39 | |||
| 40 | void aes_ctr32_encrypt_generic(const unsigned char *in, unsigned char *out, | ||
| 41 | size_t blocks, const AES_KEY *key, const unsigned char ivec[AES_BLOCK_SIZE]); | ||
| 42 | |||
| 43 | void aes_xts_encrypt_generic(const unsigned char *in, unsigned char *out, | ||
| 44 | size_t len, const AES_KEY *key1, const AES_KEY *key2, | ||
| 45 | const unsigned char iv[16], int encrypt); | ||
| 46 | |||
| 47 | int aesni_set_encrypt_key(const unsigned char *userKey, int bits, | ||
| 48 | AES_KEY *key); | ||
| 49 | int aesni_set_decrypt_key(const unsigned char *userKey, int bits, | ||
| 50 | AES_KEY *key); | ||
| 51 | |||
| 52 | void aesni_encrypt(const unsigned char *in, unsigned char *out, | ||
| 53 | const AES_KEY *key); | ||
| 54 | void aesni_decrypt(const unsigned char *in, unsigned char *out, | ||
| 55 | const AES_KEY *key); | ||
| 56 | |||
| 57 | void aesni_cbc_encrypt(const unsigned char *in, unsigned char *out, | ||
| 58 | size_t len, const AES_KEY *key, unsigned char *ivec, const int enc); | ||
| 59 | |||
| 60 | void aesni_ccm64_encrypt_blocks(const unsigned char *in, unsigned char *out, | ||
| 61 | size_t blocks, const void *key, const unsigned char ivec[16], | ||
| 62 | unsigned char cmac[16]); | ||
| 63 | |||
| 64 | void aesni_ccm64_decrypt_blocks(const unsigned char *in, unsigned char *out, | ||
| 65 | size_t blocks, const void *key, const unsigned char ivec[16], | ||
| 66 | unsigned char cmac[16]); | ||
| 67 | |||
| 68 | void aesni_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out, | ||
| 69 | size_t blocks, const void *key, const unsigned char *ivec); | ||
| 70 | |||
| 71 | void aesni_ecb_encrypt(const unsigned char *in, unsigned char *out, | ||
| 72 | size_t length, const AES_KEY *key, int enc); | ||
| 73 | |||
| 74 | void aesni_xts_encrypt(const unsigned char *in, unsigned char *out, | ||
| 75 | size_t length, const AES_KEY *key1, const AES_KEY *key2, | ||
| 76 | const unsigned char iv[16]); | ||
| 77 | |||
| 78 | void aesni_xts_decrypt(const unsigned char *in, unsigned char *out, | ||
| 79 | size_t length, const AES_KEY *key1, const AES_KEY *key2, | ||
| 80 | const unsigned char iv[16]); | ||
| 81 | |||
| 82 | int | ||
| 83 | aes_set_encrypt_key_internal(const unsigned char *userKey, const int bits, | ||
| 84 | AES_KEY *key) | ||
| 85 | { | ||
| 86 | if ((crypto_cpu_caps_i386 & CRYPTO_CPU_CAPS_I386_AES) != 0) | ||
| 87 | return aesni_set_encrypt_key(userKey, bits, key); | ||
| 88 | |||
| 89 | return aes_set_encrypt_key_generic(userKey, bits, key); | ||
| 90 | } | ||
| 91 | |||
| 92 | int | ||
| 93 | aes_set_decrypt_key_internal(const unsigned char *userKey, const int bits, | ||
| 94 | AES_KEY *key) | ||
| 95 | { | ||
| 96 | if ((crypto_cpu_caps_i386 & CRYPTO_CPU_CAPS_I386_AES) != 0) | ||
| 97 | return aesni_set_decrypt_key(userKey, bits, key); | ||
| 98 | |||
| 99 | return aes_set_decrypt_key_generic(userKey, bits, key); | ||
| 100 | } | ||
| 101 | |||
| 102 | void | ||
| 103 | aes_encrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 104 | const AES_KEY *key) | ||
| 105 | { | ||
| 106 | if ((crypto_cpu_caps_i386 & CRYPTO_CPU_CAPS_I386_AES) != 0) { | ||
| 107 | aesni_encrypt(in, out, key); | ||
| 108 | return; | ||
| 109 | } | ||
| 110 | |||
| 111 | aes_encrypt_generic(in, out, key); | ||
| 112 | } | ||
| 113 | |||
| 114 | void | ||
| 115 | aes_decrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 116 | const AES_KEY *key) | ||
| 117 | { | ||
| 118 | if ((crypto_cpu_caps_i386 & CRYPTO_CPU_CAPS_I386_AES) != 0) { | ||
| 119 | aesni_decrypt(in, out, key); | ||
| 120 | return; | ||
| 121 | } | ||
| 122 | |||
| 123 | aes_decrypt_generic(in, out, key); | ||
| 124 | } | ||
| 125 | |||
| 126 | void | ||
| 127 | aes_cbc_encrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 128 | size_t len, const AES_KEY *key, unsigned char *ivec, const int enc) | ||
| 129 | { | ||
| 130 | if ((crypto_cpu_caps_i386 & CRYPTO_CPU_CAPS_I386_AES) != 0) { | ||
| 131 | aesni_cbc_encrypt(in, out, len, key, ivec, enc); | ||
| 132 | return; | ||
| 133 | } | ||
| 134 | |||
| 135 | aes_cbc_encrypt_generic(in, out, len, key, ivec, enc); | ||
| 136 | } | ||
| 137 | |||
| 138 | void | ||
| 139 | aes_ccm64_encrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 140 | size_t blocks, const void *key, const unsigned char ivec[16], | ||
| 141 | unsigned char cmac[16], int encrypt) | ||
| 142 | { | ||
| 143 | if ((crypto_cpu_caps_i386 & CRYPTO_CPU_CAPS_I386_AES) != 0) { | ||
| 144 | if (encrypt) | ||
| 145 | aesni_ccm64_encrypt_blocks(in, out, blocks, key, ivec, cmac); | ||
| 146 | else | ||
| 147 | aesni_ccm64_decrypt_blocks(in, out, blocks, key, ivec, cmac); | ||
| 148 | return; | ||
| 149 | } | ||
| 150 | |||
| 151 | aes_ccm64_encrypt_generic(in, out, blocks, key, ivec, cmac, encrypt); | ||
| 152 | } | ||
| 153 | |||
| 154 | void | ||
| 155 | aes_ctr32_encrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 156 | size_t blocks, const AES_KEY *key, const unsigned char ivec[AES_BLOCK_SIZE]) | ||
| 157 | { | ||
| 158 | if ((crypto_cpu_caps_i386 & CRYPTO_CPU_CAPS_I386_AES) != 0) { | ||
| 159 | aesni_ctr32_encrypt_blocks(in, out, blocks, key, ivec); | ||
| 160 | return; | ||
| 161 | } | ||
| 162 | |||
| 163 | aes_ctr32_encrypt_generic(in, out, blocks, key, ivec); | ||
| 164 | } | ||
| 165 | |||
| 166 | void | ||
| 167 | aes_ecb_encrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 168 | size_t len, const AES_KEY *key, int encrypt) | ||
| 169 | { | ||
| 170 | if ((crypto_cpu_caps_i386 & CRYPTO_CPU_CAPS_I386_AES) != 0) { | ||
| 171 | aesni_ecb_encrypt(in, out, len, key, encrypt); | ||
| 172 | return; | ||
| 173 | } | ||
| 174 | |||
| 175 | while (len >= AES_BLOCK_SIZE) { | ||
| 176 | if (encrypt) | ||
| 177 | aes_encrypt_generic(in, out, key); | ||
| 178 | else | ||
| 179 | aes_decrypt_generic(in, out, key); | ||
| 180 | |||
| 181 | in += AES_BLOCK_SIZE; | ||
| 182 | out += AES_BLOCK_SIZE; | ||
| 183 | len -= AES_BLOCK_SIZE; | ||
| 184 | } | ||
| 185 | } | ||
| 186 | |||
| 187 | void | ||
| 188 | aes_xts_encrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 189 | size_t len, const AES_KEY *key1, const AES_KEY *key2, | ||
| 190 | const unsigned char iv[16], int encrypt) | ||
| 191 | { | ||
| 192 | if ((crypto_cpu_caps_i386 & CRYPTO_CPU_CAPS_I386_AES) != 0) { | ||
| 193 | if (encrypt) | ||
| 194 | aesni_xts_encrypt(in, out, len, key1, key2, iv); | ||
| 195 | else | ||
| 196 | aesni_xts_decrypt(in, out, len, key1, key2, iv); | ||
| 197 | return; | ||
| 198 | } | ||
| 199 | |||
| 200 | aes_xts_encrypt_generic(in, out, len, key1, key2, iv, encrypt); | ||
| 201 | } | ||
diff --git a/src/lib/libcrypto/aes/aes_ige.c b/src/lib/libcrypto/aes/aes_ige.c deleted file mode 100644 index 1a6fcfcfbf..0000000000 --- a/src/lib/libcrypto/aes/aes_ige.c +++ /dev/null | |||
| @@ -1,195 +0,0 @@ | |||
| 1 | /* $OpenBSD: aes_ige.c,v 1.10 2024/03/30 05:14:12 joshua Exp $ */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 2006 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * openssl-core@openssl.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | * ==================================================================== | ||
| 49 | * | ||
| 50 | */ | ||
| 51 | |||
| 52 | #include <openssl/aes.h> | ||
| 53 | #include <openssl/crypto.h> | ||
| 54 | |||
| 55 | #include "aes_local.h" | ||
| 56 | |||
| 57 | #define N_WORDS (AES_BLOCK_SIZE / sizeof(unsigned long)) | ||
| 58 | typedef struct { | ||
| 59 | unsigned long data[N_WORDS]; | ||
| 60 | } aes_block_t; | ||
| 61 | |||
| 62 | /* XXX: probably some better way to do this */ | ||
| 63 | #if defined(__i386__) || defined(__x86_64__) | ||
| 64 | #define UNALIGNED_MEMOPS_ARE_FAST 1 | ||
| 65 | #else | ||
| 66 | #define UNALIGNED_MEMOPS_ARE_FAST 0 | ||
| 67 | #endif | ||
| 68 | |||
| 69 | #if UNALIGNED_MEMOPS_ARE_FAST | ||
| 70 | #define load_block(d, s) (d) = *(const aes_block_t *)(s) | ||
| 71 | #define store_block(d, s) *(aes_block_t *)(d) = (s) | ||
| 72 | #else | ||
| 73 | #define load_block(d, s) memcpy((d).data, (s), AES_BLOCK_SIZE) | ||
| 74 | #define store_block(d, s) memcpy((d), (s).data, AES_BLOCK_SIZE) | ||
| 75 | #endif | ||
| 76 | |||
| 77 | /* N.B. The IV for this mode is _twice_ the block size */ | ||
| 78 | |||
| 79 | void | ||
| 80 | AES_ige_encrypt(const unsigned char *in, unsigned char *out, size_t length, | ||
| 81 | const AES_KEY *key, unsigned char *ivec, const int enc) | ||
| 82 | { | ||
| 83 | size_t n; | ||
| 84 | size_t len; | ||
| 85 | |||
| 86 | OPENSSL_assert((length % AES_BLOCK_SIZE) == 0); | ||
| 87 | |||
| 88 | len = length / AES_BLOCK_SIZE; | ||
| 89 | |||
| 90 | if (AES_ENCRYPT == enc) { | ||
| 91 | if (in != out && (UNALIGNED_MEMOPS_ARE_FAST || | ||
| 92 | ((size_t)in|(size_t)out|(size_t)ivec) % | ||
| 93 | sizeof(long) == 0)) { | ||
| 94 | aes_block_t *ivp = (aes_block_t *)ivec; | ||
| 95 | aes_block_t *iv2p = (aes_block_t *)(ivec + AES_BLOCK_SIZE); | ||
| 96 | |||
| 97 | while (len) { | ||
| 98 | aes_block_t *inp = (aes_block_t *)in; | ||
| 99 | aes_block_t *outp = (aes_block_t *)out; | ||
| 100 | |||
| 101 | for (n = 0; n < N_WORDS; ++n) | ||
| 102 | outp->data[n] = inp->data[n] ^ ivp->data[n]; | ||
| 103 | AES_encrypt((unsigned char *)outp->data, (unsigned char *)outp->data, key); | ||
| 104 | for (n = 0; n < N_WORDS; ++n) | ||
| 105 | outp->data[n] ^= iv2p->data[n]; | ||
| 106 | ivp = outp; | ||
| 107 | iv2p = inp; | ||
| 108 | --len; | ||
| 109 | in += AES_BLOCK_SIZE; | ||
| 110 | out += AES_BLOCK_SIZE; | ||
| 111 | } | ||
| 112 | memmove(ivec, ivp->data, AES_BLOCK_SIZE); | ||
| 113 | memmove(ivec + AES_BLOCK_SIZE, iv2p->data, AES_BLOCK_SIZE); | ||
| 114 | } else { | ||
| 115 | aes_block_t tmp, tmp2; | ||
| 116 | aes_block_t iv; | ||
| 117 | aes_block_t iv2; | ||
| 118 | |||
| 119 | load_block(iv, ivec); | ||
| 120 | load_block(iv2, ivec + AES_BLOCK_SIZE); | ||
| 121 | |||
| 122 | while (len) { | ||
| 123 | load_block(tmp, in); | ||
| 124 | for (n = 0; n < N_WORDS; ++n) | ||
| 125 | tmp2.data[n] = tmp.data[n] ^ iv.data[n]; | ||
| 126 | AES_encrypt((unsigned char *)tmp2.data, | ||
| 127 | (unsigned char *)tmp2.data, key); | ||
| 128 | for (n = 0; n < N_WORDS; ++n) | ||
| 129 | tmp2.data[n] ^= iv2.data[n]; | ||
| 130 | store_block(out, tmp2); | ||
| 131 | iv = tmp2; | ||
| 132 | iv2 = tmp; | ||
| 133 | --len; | ||
| 134 | in += AES_BLOCK_SIZE; | ||
| 135 | out += AES_BLOCK_SIZE; | ||
| 136 | } | ||
| 137 | memcpy(ivec, iv.data, AES_BLOCK_SIZE); | ||
| 138 | memcpy(ivec + AES_BLOCK_SIZE, iv2.data, AES_BLOCK_SIZE); | ||
| 139 | } | ||
| 140 | } else { | ||
| 141 | if (in != out && (UNALIGNED_MEMOPS_ARE_FAST || | ||
| 142 | ((size_t)in|(size_t)out|(size_t)ivec) % | ||
| 143 | sizeof(long) == 0)) { | ||
| 144 | aes_block_t *ivp = (aes_block_t *)ivec; | ||
| 145 | aes_block_t *iv2p = (aes_block_t *)(ivec + AES_BLOCK_SIZE); | ||
| 146 | |||
| 147 | while (len) { | ||
| 148 | aes_block_t tmp; | ||
| 149 | aes_block_t *inp = (aes_block_t *)in; | ||
| 150 | aes_block_t *outp = (aes_block_t *)out; | ||
| 151 | |||
| 152 | for (n = 0; n < N_WORDS; ++n) | ||
| 153 | tmp.data[n] = inp->data[n] ^ iv2p->data[n]; | ||
| 154 | AES_decrypt((unsigned char *)tmp.data, | ||
| 155 | (unsigned char *)outp->data, key); | ||
| 156 | for (n = 0; n < N_WORDS; ++n) | ||
| 157 | outp->data[n] ^= ivp->data[n]; | ||
| 158 | ivp = inp; | ||
| 159 | iv2p = outp; | ||
| 160 | --len; | ||
| 161 | in += AES_BLOCK_SIZE; | ||
| 162 | out += AES_BLOCK_SIZE; | ||
| 163 | } | ||
| 164 | memmove(ivec, ivp->data, AES_BLOCK_SIZE); | ||
| 165 | memmove(ivec + AES_BLOCK_SIZE, iv2p->data, AES_BLOCK_SIZE); | ||
| 166 | } else { | ||
| 167 | aes_block_t tmp, tmp2; | ||
| 168 | aes_block_t iv; | ||
| 169 | aes_block_t iv2; | ||
| 170 | |||
| 171 | load_block(iv, ivec); | ||
| 172 | load_block(iv2, ivec + AES_BLOCK_SIZE); | ||
| 173 | |||
| 174 | while (len) { | ||
| 175 | load_block(tmp, in); | ||
| 176 | tmp2 = tmp; | ||
| 177 | for (n = 0; n < N_WORDS; ++n) | ||
| 178 | tmp.data[n] ^= iv2.data[n]; | ||
| 179 | AES_decrypt((unsigned char *)tmp.data, | ||
| 180 | (unsigned char *)tmp.data, key); | ||
| 181 | for (n = 0; n < N_WORDS; ++n) | ||
| 182 | tmp.data[n] ^= iv.data[n]; | ||
| 183 | store_block(out, tmp); | ||
| 184 | iv = tmp2; | ||
| 185 | iv2 = tmp; | ||
| 186 | --len; | ||
| 187 | in += AES_BLOCK_SIZE; | ||
| 188 | out += AES_BLOCK_SIZE; | ||
| 189 | } | ||
| 190 | memcpy(ivec, iv.data, AES_BLOCK_SIZE); | ||
| 191 | memcpy(ivec + AES_BLOCK_SIZE, iv2.data, AES_BLOCK_SIZE); | ||
| 192 | } | ||
| 193 | } | ||
| 194 | } | ||
| 195 | LCRYPTO_ALIAS(AES_ige_encrypt); | ||
diff --git a/src/lib/libcrypto/aes/aes_local.h b/src/lib/libcrypto/aes/aes_local.h index e0714df409..a265eaac1d 100644 --- a/src/lib/libcrypto/aes/aes_local.h +++ b/src/lib/libcrypto/aes/aes_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: aes_local.h,v 1.4 2025/01/25 17:59:44 tb Exp $ */ | 1 | /* $OpenBSD: aes_local.h,v 1.11 2025/07/22 09:29:31 jsing Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -60,17 +60,30 @@ | |||
| 60 | 60 | ||
| 61 | __BEGIN_HIDDEN_DECLS | 61 | __BEGIN_HIDDEN_DECLS |
| 62 | 62 | ||
| 63 | typedef unsigned int u32; | ||
| 64 | typedef unsigned short u16; | ||
| 65 | typedef unsigned char u8; | ||
| 66 | |||
| 67 | #define MAXKC (256/32) | ||
| 68 | #define MAXKB (256/8) | ||
| 69 | #define MAXNR 14 | ||
| 70 | |||
| 71 | /* This controls loop-unrolling in aes_core.c */ | 63 | /* This controls loop-unrolling in aes_core.c */ |
| 72 | #undef FULL_UNROLL | 64 | #undef FULL_UNROLL |
| 73 | 65 | ||
| 66 | void aes_encrypt_block128(const unsigned char *in, unsigned char *out, | ||
| 67 | const void *key); | ||
| 68 | |||
| 69 | void aes_ctr32_encrypt_ctr128f(const unsigned char *in, unsigned char *out, | ||
| 70 | size_t blocks, const void *key, const unsigned char ivec[AES_BLOCK_SIZE]); | ||
| 71 | |||
| 72 | void aes_ccm64_encrypt_ccm128f(const unsigned char *in, unsigned char *out, | ||
| 73 | size_t blocks, const void *key, const unsigned char ivec[16], | ||
| 74 | unsigned char cmac[16]); | ||
| 75 | |||
| 76 | void aes_ccm64_decrypt_ccm128f(const unsigned char *in, unsigned char *out, | ||
| 77 | size_t blocks, const void *key, const unsigned char ivec[16], | ||
| 78 | unsigned char cmac[16]); | ||
| 79 | |||
| 80 | void aes_ecb_encrypt_internal(const unsigned char *in, unsigned char *out, | ||
| 81 | size_t len, const AES_KEY *key, int encrypt); | ||
| 82 | |||
| 83 | void aes_xts_encrypt_internal(const char unsigned *in, char unsigned *out, | ||
| 84 | size_t len, const AES_KEY *key1, const AES_KEY *key2, | ||
| 85 | const unsigned char iv[16], int encrypt); | ||
| 86 | |||
| 74 | __END_HIDDEN_DECLS | 87 | __END_HIDDEN_DECLS |
| 75 | 88 | ||
| 76 | #endif /* !HEADER_AES_LOCAL_H */ | 89 | #endif /* !HEADER_AES_LOCAL_H */ |
diff --git a/src/lib/libcrypto/aes/asm/aes-586.pl b/src/lib/libcrypto/aes/asm/aes-586.pl index 364099d4d3..402a1a3c46 100644 --- a/src/lib/libcrypto/aes/asm/aes-586.pl +++ b/src/lib/libcrypto/aes/asm/aes-586.pl | |||
| @@ -1158,8 +1158,8 @@ sub enclast() | |||
| 1158 | &data_word(0x00000000, 0x00000000, 0x00000000, 0x00000000); | 1158 | &data_word(0x00000000, 0x00000000, 0x00000000, 0x00000000); |
| 1159 | &previous(); | 1159 | &previous(); |
| 1160 | 1160 | ||
| 1161 | # void aes_encrypt_internal(const void *inp, void *out, const AES_KEY *key); | 1161 | # void aes_encrypt_generic(const void *inp, void *out, const AES_KEY *key); |
| 1162 | &function_begin("aes_encrypt_internal"); | 1162 | &function_begin("aes_encrypt_generic"); |
| 1163 | &mov ($acc,&wparam(0)); # load inp | 1163 | &mov ($acc,&wparam(0)); # load inp |
| 1164 | &mov ($key,&wparam(2)); # load key | 1164 | &mov ($key,&wparam(2)); # load key |
| 1165 | 1165 | ||
| @@ -1213,7 +1213,7 @@ sub enclast() | |||
| 1213 | &mov (&DWP(4,$acc),$s1); | 1213 | &mov (&DWP(4,$acc),$s1); |
| 1214 | &mov (&DWP(8,$acc),$s2); | 1214 | &mov (&DWP(8,$acc),$s2); |
| 1215 | &mov (&DWP(12,$acc),$s3); | 1215 | &mov (&DWP(12,$acc),$s3); |
| 1216 | &function_end("aes_encrypt_internal"); | 1216 | &function_end("aes_encrypt_generic"); |
| 1217 | 1217 | ||
| 1218 | #--------------------------------------------------------------------# | 1218 | #--------------------------------------------------------------------# |
| 1219 | 1219 | ||
| @@ -1947,8 +1947,8 @@ sub declast() | |||
| 1947 | &data_byte(0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d); | 1947 | &data_byte(0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d); |
| 1948 | &previous(); | 1948 | &previous(); |
| 1949 | 1949 | ||
| 1950 | # void aes_decrypt_internal(const void *inp, void *out, const AES_KEY *key); | 1950 | # void aes_decrypt_generic(const void *inp, void *out, const AES_KEY *key); |
| 1951 | &function_begin("aes_decrypt_internal"); | 1951 | &function_begin("aes_decrypt_generic"); |
| 1952 | &mov ($acc,&wparam(0)); # load inp | 1952 | &mov ($acc,&wparam(0)); # load inp |
| 1953 | &mov ($key,&wparam(2)); # load key | 1953 | &mov ($key,&wparam(2)); # load key |
| 1954 | 1954 | ||
| @@ -2002,9 +2002,9 @@ sub declast() | |||
| 2002 | &mov (&DWP(4,$acc),$s1); | 2002 | &mov (&DWP(4,$acc),$s1); |
| 2003 | &mov (&DWP(8,$acc),$s2); | 2003 | &mov (&DWP(8,$acc),$s2); |
| 2004 | &mov (&DWP(12,$acc),$s3); | 2004 | &mov (&DWP(12,$acc),$s3); |
| 2005 | &function_end("aes_decrypt_internal"); | 2005 | &function_end("aes_decrypt_generic"); |
| 2006 | 2006 | ||
| 2007 | # void aes_cbc_encrypt_internal(const void char *inp, unsigned char *out, | 2007 | # void aes_cbc_encrypt_generic(const void char *inp, unsigned char *out, |
| 2008 | # size_t length, const AES_KEY *key, unsigned char *ivp,const int enc); | 2008 | # size_t length, const AES_KEY *key, unsigned char *ivp,const int enc); |
| 2009 | { | 2009 | { |
| 2010 | # stack frame layout | 2010 | # stack frame layout |
| @@ -2028,7 +2028,7 @@ my $ivec=&DWP(60,"esp"); # ivec[16] | |||
| 2028 | my $aes_key=&DWP(76,"esp"); # copy of aes_key | 2028 | my $aes_key=&DWP(76,"esp"); # copy of aes_key |
| 2029 | my $mark=&DWP(76+240,"esp"); # copy of aes_key->rounds | 2029 | my $mark=&DWP(76+240,"esp"); # copy of aes_key->rounds |
| 2030 | 2030 | ||
| 2031 | &function_begin("aes_cbc_encrypt_internal"); | 2031 | &function_begin("aes_cbc_encrypt_generic"); |
| 2032 | &mov ($s2 eq "ecx"? $s2 : "",&wparam(2)); # load len | 2032 | &mov ($s2 eq "ecx"? $s2 : "",&wparam(2)); # load len |
| 2033 | &cmp ($s2,0); | 2033 | &cmp ($s2,0); |
| 2034 | &je (&label("drop_out")); | 2034 | &je (&label("drop_out")); |
| @@ -2616,7 +2616,7 @@ my $mark=&DWP(76+240,"esp"); # copy of aes_key->rounds | |||
| 2616 | 2616 | ||
| 2617 | &mov ("esp",$_esp); | 2617 | &mov ("esp",$_esp); |
| 2618 | &popf (); | 2618 | &popf (); |
| 2619 | &function_end("aes_cbc_encrypt_internal"); | 2619 | &function_end("aes_cbc_encrypt_generic"); |
| 2620 | } | 2620 | } |
| 2621 | 2621 | ||
| 2622 | #------------------------------------------------------------------# | 2622 | #------------------------------------------------------------------# |
| @@ -2849,12 +2849,12 @@ sub enckey() | |||
| 2849 | &set_label("exit"); | 2849 | &set_label("exit"); |
| 2850 | &function_end("_x86_AES_set_encrypt_key"); | 2850 | &function_end("_x86_AES_set_encrypt_key"); |
| 2851 | 2851 | ||
| 2852 | # int aes_set_encrypt_key_internal(const unsigned char *userKey, const int bits, | 2852 | # int aes_set_encrypt_key_generic(const unsigned char *userKey, const int bits, |
| 2853 | # AES_KEY *key) | 2853 | # AES_KEY *key) |
| 2854 | &function_begin_B("aes_set_encrypt_key_internal"); | 2854 | &function_begin_B("aes_set_encrypt_key_generic"); |
| 2855 | &call ("_x86_AES_set_encrypt_key"); | 2855 | &call ("_x86_AES_set_encrypt_key"); |
| 2856 | &ret (); | 2856 | &ret (); |
| 2857 | &function_end_B("aes_set_encrypt_key_internal"); | 2857 | &function_end_B("aes_set_encrypt_key_generic"); |
| 2858 | 2858 | ||
| 2859 | sub deckey() | 2859 | sub deckey() |
| 2860 | { my ($i,$key,$tp1,$tp2,$tp4,$tp8) = @_; | 2860 | { my ($i,$key,$tp1,$tp2,$tp4,$tp8) = @_; |
| @@ -2911,9 +2911,9 @@ sub deckey() | |||
| 2911 | &mov (&DWP(4*$i,$key),$tp1); | 2911 | &mov (&DWP(4*$i,$key),$tp1); |
| 2912 | } | 2912 | } |
| 2913 | 2913 | ||
| 2914 | # int aes_set_decrypt_key_internal(const unsigned char *userKey, const int bits, | 2914 | # int aes_set_decrypt_key_generic(const unsigned char *userKey, const int bits, |
| 2915 | # AES_KEY *key) | 2915 | # AES_KEY *key) |
| 2916 | &function_begin_B("aes_set_decrypt_key_internal"); | 2916 | &function_begin_B("aes_set_decrypt_key_generic"); |
| 2917 | &call ("_x86_AES_set_encrypt_key"); | 2917 | &call ("_x86_AES_set_encrypt_key"); |
| 2918 | &cmp ("eax",0); | 2918 | &cmp ("eax",0); |
| 2919 | &je (&label("proceed")); | 2919 | &je (&label("proceed")); |
| @@ -2969,6 +2969,6 @@ sub deckey() | |||
| 2969 | &jb (&label("permute")); | 2969 | &jb (&label("permute")); |
| 2970 | 2970 | ||
| 2971 | &xor ("eax","eax"); # return success | 2971 | &xor ("eax","eax"); # return success |
| 2972 | &function_end("aes_set_decrypt_key_internal"); | 2972 | &function_end("aes_set_decrypt_key_generic"); |
| 2973 | 2973 | ||
| 2974 | &asm_finish(); | 2974 | &asm_finish(); |
diff --git a/src/lib/libcrypto/aes/asm/aes-x86_64.pl b/src/lib/libcrypto/aes/asm/aes-x86_64.pl index 324c4a2be2..2c73627546 100755 --- a/src/lib/libcrypto/aes/asm/aes-x86_64.pl +++ b/src/lib/libcrypto/aes/asm/aes-x86_64.pl | |||
| @@ -586,15 +586,15 @@ $code.=<<___; | |||
| 586 | .size _x86_64_AES_encrypt_compact,.-_x86_64_AES_encrypt_compact | 586 | .size _x86_64_AES_encrypt_compact,.-_x86_64_AES_encrypt_compact |
| 587 | ___ | 587 | ___ |
| 588 | 588 | ||
| 589 | # void aes_encrypt_internal(const void *inp, void *out, const AES_KEY *key); | 589 | # void aes_encrypt_generic(const void *inp, void *out, const AES_KEY *key); |
| 590 | $code.=<<___; | 590 | $code.=<<___; |
| 591 | .globl aes_encrypt_internal | 591 | .globl aes_encrypt_generic |
| 592 | .type aes_encrypt_internal,\@function,3 | 592 | .type aes_encrypt_generic,\@function,3 |
| 593 | .align 16 | 593 | .align 16 |
| 594 | .globl asm_AES_encrypt | 594 | .globl asm_AES_encrypt |
| 595 | .hidden asm_AES_encrypt | 595 | .hidden asm_AES_encrypt |
| 596 | asm_AES_encrypt: | 596 | asm_AES_encrypt: |
| 597 | aes_encrypt_internal: | 597 | aes_encrypt_generic: |
| 598 | _CET_ENDBR | 598 | _CET_ENDBR |
| 599 | push %rbx | 599 | push %rbx |
| 600 | push %rbp | 600 | push %rbp |
| @@ -655,7 +655,7 @@ aes_encrypt_internal: | |||
| 655 | lea 48(%rsi),%rsp | 655 | lea 48(%rsi),%rsp |
| 656 | .Lenc_epilogue: | 656 | .Lenc_epilogue: |
| 657 | ret | 657 | ret |
| 658 | .size aes_encrypt_internal,.-aes_encrypt_internal | 658 | .size aes_encrypt_generic,.-aes_encrypt_generic |
| 659 | ___ | 659 | ___ |
| 660 | 660 | ||
| 661 | #------------------------------------------------------------------# | 661 | #------------------------------------------------------------------# |
| @@ -1188,15 +1188,15 @@ $code.=<<___; | |||
| 1188 | .size _x86_64_AES_decrypt_compact,.-_x86_64_AES_decrypt_compact | 1188 | .size _x86_64_AES_decrypt_compact,.-_x86_64_AES_decrypt_compact |
| 1189 | ___ | 1189 | ___ |
| 1190 | 1190 | ||
| 1191 | # void aes_decrypt_internal(const void *inp, void *out, const AES_KEY *key); | 1191 | # void aes_decrypt_generic(const void *inp, void *out, const AES_KEY *key); |
| 1192 | $code.=<<___; | 1192 | $code.=<<___; |
| 1193 | .globl aes_decrypt_internal | 1193 | .globl aes_decrypt_generic |
| 1194 | .type aes_decrypt_internal,\@function,3 | 1194 | .type aes_decrypt_generic,\@function,3 |
| 1195 | .align 16 | 1195 | .align 16 |
| 1196 | .globl asm_AES_decrypt | 1196 | .globl asm_AES_decrypt |
| 1197 | .hidden asm_AES_decrypt | 1197 | .hidden asm_AES_decrypt |
| 1198 | asm_AES_decrypt: | 1198 | asm_AES_decrypt: |
| 1199 | aes_decrypt_internal: | 1199 | aes_decrypt_generic: |
| 1200 | _CET_ENDBR | 1200 | _CET_ENDBR |
| 1201 | push %rbx | 1201 | push %rbx |
| 1202 | push %rbp | 1202 | push %rbp |
| @@ -1259,7 +1259,7 @@ aes_decrypt_internal: | |||
| 1259 | lea 48(%rsi),%rsp | 1259 | lea 48(%rsi),%rsp |
| 1260 | .Ldec_epilogue: | 1260 | .Ldec_epilogue: |
| 1261 | ret | 1261 | ret |
| 1262 | .size aes_decrypt_internal,.-aes_decrypt_internal | 1262 | .size aes_decrypt_generic,.-aes_decrypt_generic |
| 1263 | ___ | 1263 | ___ |
| 1264 | #------------------------------------------------------------------# | 1264 | #------------------------------------------------------------------# |
| 1265 | 1265 | ||
| @@ -1290,13 +1290,13 @@ $code.=<<___; | |||
| 1290 | ___ | 1290 | ___ |
| 1291 | } | 1291 | } |
| 1292 | 1292 | ||
| 1293 | # int aes_set_encrypt_key_internal(const unsigned char *userKey, const int bits, | 1293 | # int aes_set_encrypt_key_generic(const unsigned char *userKey, const int bits, |
| 1294 | # AES_KEY *key) | 1294 | # AES_KEY *key) |
| 1295 | $code.=<<___; | 1295 | $code.=<<___; |
| 1296 | .globl aes_set_encrypt_key_internal | 1296 | .globl aes_set_encrypt_key_generic |
| 1297 | .type aes_set_encrypt_key_internal,\@function,3 | 1297 | .type aes_set_encrypt_key_generic,\@function,3 |
| 1298 | .align 16 | 1298 | .align 16 |
| 1299 | aes_set_encrypt_key_internal: | 1299 | aes_set_encrypt_key_generic: |
| 1300 | _CET_ENDBR | 1300 | _CET_ENDBR |
| 1301 | push %rbx | 1301 | push %rbx |
| 1302 | push %rbp | 1302 | push %rbp |
| @@ -1318,7 +1318,7 @@ aes_set_encrypt_key_internal: | |||
| 1318 | add \$56,%rsp | 1318 | add \$56,%rsp |
| 1319 | .Lenc_key_epilogue: | 1319 | .Lenc_key_epilogue: |
| 1320 | ret | 1320 | ret |
| 1321 | .size aes_set_encrypt_key_internal,.-aes_set_encrypt_key_internal | 1321 | .size aes_set_encrypt_key_generic,.-aes_set_encrypt_key_generic |
| 1322 | 1322 | ||
| 1323 | .type _x86_64_AES_set_encrypt_key,\@abi-omnipotent | 1323 | .type _x86_64_AES_set_encrypt_key,\@abi-omnipotent |
| 1324 | .align 16 | 1324 | .align 16 |
| @@ -1562,13 +1562,13 @@ $code.=<<___; | |||
| 1562 | ___ | 1562 | ___ |
| 1563 | } | 1563 | } |
| 1564 | 1564 | ||
| 1565 | # int aes_set_decrypt_key_internal(const unsigned char *userKey, const int bits, | 1565 | # int aes_set_decrypt_key_generic(const unsigned char *userKey, const int bits, |
| 1566 | # AES_KEY *key) | 1566 | # AES_KEY *key) |
| 1567 | $code.=<<___; | 1567 | $code.=<<___; |
| 1568 | .globl aes_set_decrypt_key_internal | 1568 | .globl aes_set_decrypt_key_generic |
| 1569 | .type aes_set_decrypt_key_internal,\@function,3 | 1569 | .type aes_set_decrypt_key_generic,\@function,3 |
| 1570 | .align 16 | 1570 | .align 16 |
| 1571 | aes_set_decrypt_key_internal: | 1571 | aes_set_decrypt_key_generic: |
| 1572 | _CET_ENDBR | 1572 | _CET_ENDBR |
| 1573 | push %rbx | 1573 | push %rbx |
| 1574 | push %rbp | 1574 | push %rbp |
| @@ -1638,10 +1638,10 @@ $code.=<<___; | |||
| 1638 | add \$56,%rsp | 1638 | add \$56,%rsp |
| 1639 | .Ldec_key_epilogue: | 1639 | .Ldec_key_epilogue: |
| 1640 | ret | 1640 | ret |
| 1641 | .size aes_set_decrypt_key_internal,.-aes_set_decrypt_key_internal | 1641 | .size aes_set_decrypt_key_generic,.-aes_set_decrypt_key_generic |
| 1642 | ___ | 1642 | ___ |
| 1643 | 1643 | ||
| 1644 | # void aes_cbc_encrypt_internal(const void char *inp, unsigned char *out, | 1644 | # void aes_cbc_encrypt_generic(const void char *inp, unsigned char *out, |
| 1645 | # size_t length, const AES_KEY *key, unsigned char *ivp,const int enc); | 1645 | # size_t length, const AES_KEY *key, unsigned char *ivp,const int enc); |
| 1646 | { | 1646 | { |
| 1647 | # stack frame layout | 1647 | # stack frame layout |
| @@ -1659,15 +1659,15 @@ my $aes_key="80(%rsp)"; # copy of aes_key | |||
| 1659 | my $mark="80+240(%rsp)"; # copy of aes_key->rounds | 1659 | my $mark="80+240(%rsp)"; # copy of aes_key->rounds |
| 1660 | 1660 | ||
| 1661 | $code.=<<___; | 1661 | $code.=<<___; |
| 1662 | .globl aes_cbc_encrypt_internal | 1662 | .globl aes_cbc_encrypt_generic |
| 1663 | .type aes_cbc_encrypt_internal,\@function,6 | 1663 | .type aes_cbc_encrypt_generic,\@function,6 |
| 1664 | .align 16 | 1664 | .align 16 |
| 1665 | .extern OPENSSL_ia32cap_P | 1665 | .extern OPENSSL_ia32cap_P |
| 1666 | .hidden OPENSSL_ia32cap_P | 1666 | .hidden OPENSSL_ia32cap_P |
| 1667 | .globl asm_AES_cbc_encrypt | 1667 | .globl asm_AES_cbc_encrypt |
| 1668 | .hidden asm_AES_cbc_encrypt | 1668 | .hidden asm_AES_cbc_encrypt |
| 1669 | asm_AES_cbc_encrypt: | 1669 | asm_AES_cbc_encrypt: |
| 1670 | aes_cbc_encrypt_internal: | 1670 | aes_cbc_encrypt_generic: |
| 1671 | _CET_ENDBR | 1671 | _CET_ENDBR |
| 1672 | cmp \$0,%rdx # check length | 1672 | cmp \$0,%rdx # check length |
| 1673 | je .Lcbc_epilogue | 1673 | je .Lcbc_epilogue |
| @@ -2117,7 +2117,7 @@ aes_cbc_encrypt_internal: | |||
| 2117 | popfq | 2117 | popfq |
| 2118 | .Lcbc_epilogue: | 2118 | .Lcbc_epilogue: |
| 2119 | ret | 2119 | ret |
| 2120 | .size aes_cbc_encrypt_internal,.-aes_cbc_encrypt_internal | 2120 | .size aes_cbc_encrypt_generic,.-aes_cbc_encrypt_generic |
| 2121 | ___ | 2121 | ___ |
| 2122 | } | 2122 | } |
| 2123 | 2123 | ||
| @@ -2782,45 +2782,45 @@ cbc_se_handler: | |||
| 2782 | 2782 | ||
| 2783 | .section .pdata | 2783 | .section .pdata |
| 2784 | .align 4 | 2784 | .align 4 |
| 2785 | .rva .LSEH_begin_aes_encrypt_internal | 2785 | .rva .LSEH_begin_aes_encrypt_generic |
| 2786 | .rva .LSEH_end_aes_encrypt_internal | 2786 | .rva .LSEH_end_aes_encrypt_generic |
| 2787 | .rva .LSEH_info_aes_encrypt_internal | 2787 | .rva .LSEH_info_aes_encrypt_generic |
| 2788 | 2788 | ||
| 2789 | .rva .LSEH_begin_aes_decrypt_internal | 2789 | .rva .LSEH_begin_aes_decrypt_generic |
| 2790 | .rva .LSEH_end_aes_decrypt_internal | 2790 | .rva .LSEH_end_aes_decrypt_generic |
| 2791 | .rva .LSEH_info_aes_decrypt_internal | 2791 | .rva .LSEH_info_aes_decrypt_generic |
| 2792 | 2792 | ||
| 2793 | .rva .LSEH_begin_aes_set_encrypt_key_internal | 2793 | .rva .LSEH_begin_aes_set_encrypt_key_generic |
| 2794 | .rva .LSEH_end_aes_set_encrypt_key_internal | 2794 | .rva .LSEH_end_aes_set_encrypt_key_generic |
| 2795 | .rva .LSEH_info_aes_set_encrypt_key_internal | 2795 | .rva .LSEH_info_aes_set_encrypt_key_generic |
| 2796 | 2796 | ||
| 2797 | .rva .LSEH_begin_aes_set_decrypt_key_internal | 2797 | .rva .LSEH_begin_aes_set_decrypt_key_generic |
| 2798 | .rva .LSEH_end_aes_set_decrypt_key_internal | 2798 | .rva .LSEH_end_aes_set_decrypt_key_generic |
| 2799 | .rva .LSEH_info_aes_set_decrypt_key_internal | 2799 | .rva .LSEH_info_aes_set_decrypt_key_generic |
| 2800 | 2800 | ||
| 2801 | .rva .LSEH_begin_aes_cbc_encrypt_internal | 2801 | .rva .LSEH_begin_aes_cbc_encrypt_generic |
| 2802 | .rva .LSEH_end_aes_cbc_encrypt_internal | 2802 | .rva .LSEH_end_aes_cbc_encrypt_generic |
| 2803 | .rva .LSEH_info_aes_cbc_encrypt_internal | 2803 | .rva .LSEH_info_aes_cbc_encrypt_generic |
| 2804 | 2804 | ||
| 2805 | .section .xdata | 2805 | .section .xdata |
| 2806 | .align 8 | 2806 | .align 8 |
| 2807 | .LSEH_info_aes_encrypt_internal: | 2807 | .LSEH_info_aes_encrypt_generic: |
| 2808 | .byte 9,0,0,0 | 2808 | .byte 9,0,0,0 |
| 2809 | .rva block_se_handler | 2809 | .rva block_se_handler |
| 2810 | .rva .Lenc_prologue,.Lenc_epilogue # HandlerData[] | 2810 | .rva .Lenc_prologue,.Lenc_epilogue # HandlerData[] |
| 2811 | .LSEH_info_aes_decrypt_internal: | 2811 | .LSEH_info_aes_decrypt_generic: |
| 2812 | .byte 9,0,0,0 | 2812 | .byte 9,0,0,0 |
| 2813 | .rva block_se_handler | 2813 | .rva block_se_handler |
| 2814 | .rva .Ldec_prologue,.Ldec_epilogue # HandlerData[] | 2814 | .rva .Ldec_prologue,.Ldec_epilogue # HandlerData[] |
| 2815 | .LSEH_info_aes_set_encrypt_key_internal: | 2815 | .LSEH_info_aes_set_encrypt_key_generic: |
| 2816 | .byte 9,0,0,0 | 2816 | .byte 9,0,0,0 |
| 2817 | .rva key_se_handler | 2817 | .rva key_se_handler |
| 2818 | .rva .Lenc_key_prologue,.Lenc_key_epilogue # HandlerData[] | 2818 | .rva .Lenc_key_prologue,.Lenc_key_epilogue # HandlerData[] |
| 2819 | .LSEH_info_aes_set_decrypt_key_internal: | 2819 | .LSEH_info_aes_set_decrypt_key_generic: |
| 2820 | .byte 9,0,0,0 | 2820 | .byte 9,0,0,0 |
| 2821 | .rva key_se_handler | 2821 | .rva key_se_handler |
| 2822 | .rva .Ldec_key_prologue,.Ldec_key_epilogue # HandlerData[] | 2822 | .rva .Ldec_key_prologue,.Ldec_key_epilogue # HandlerData[] |
| 2823 | .LSEH_info_aes_cbc_encrypt_internal: | 2823 | .LSEH_info_aes_cbc_encrypt_generic: |
| 2824 | .byte 9,0,0,0 | 2824 | .byte 9,0,0,0 |
| 2825 | .rva cbc_se_handler | 2825 | .rva cbc_se_handler |
| 2826 | ___ | 2826 | ___ |
diff --git a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl deleted file mode 100644 index c44a338114..0000000000 --- a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl +++ /dev/null | |||
| @@ -1,3123 +0,0 @@ | |||
| 1 | #!/usr/bin/env perl | ||
| 2 | |||
| 3 | ################################################################### | ||
| 4 | ### AES-128 [originally in CTR mode] ### | ||
| 5 | ### bitsliced implementation for Intel Core 2 processors ### | ||
| 6 | ### requires support of SSE extensions up to SSSE3 ### | ||
| 7 | ### Author: Emilia Käsper and Peter Schwabe ### | ||
| 8 | ### Date: 2009-03-19 ### | ||
| 9 | ### Public domain ### | ||
| 10 | ### ### | ||
| 11 | ### See http://homes.esat.kuleuven.be/~ekasper/#software for ### | ||
| 12 | ### further information. ### | ||
| 13 | ################################################################### | ||
| 14 | # | ||
| 15 | # September 2011. | ||
| 16 | # | ||
| 17 | # Started as transliteration to "perlasm" the original code has | ||
| 18 | # undergone following changes: | ||
| 19 | # | ||
| 20 | # - code was made position-independent; | ||
| 21 | # - rounds were folded into a loop resulting in >5x size reduction | ||
| 22 | # from 12.5KB to 2.2KB; | ||
| 23 | # - above was possible thanks to mixcolumns() modification that | ||
| 24 | # allowed to feed its output back to aesenc[last], this was | ||
| 25 | # achieved at cost of two additional inter-registers moves; | ||
| 26 | # - some instruction reordering and interleaving; | ||
| 27 | # - this module doesn't implement key setup subroutine, instead it | ||
| 28 | # relies on conversion of "conventional" key schedule as returned | ||
| 29 | # by AES_set_encrypt_key (see discussion below); | ||
| 30 | # - first and last round keys are treated differently, which allowed | ||
| 31 | # to skip one shiftrows(), reduce bit-sliced key schedule and | ||
| 32 | # speed-up conversion by 22%; | ||
| 33 | # - support for 192- and 256-bit keys was added; | ||
| 34 | # | ||
| 35 | # Resulting performance in CPU cycles spent to encrypt one byte out | ||
| 36 | # of 4096-byte buffer with 128-bit key is: | ||
| 37 | # | ||
| 38 | # Emilia's this(*) difference | ||
| 39 | # | ||
| 40 | # Core 2 9.30 8.69 +7% | ||
| 41 | # Nehalem(**) 7.63 6.98 +9% | ||
| 42 | # Atom 17.1 17.4 -2%(***) | ||
| 43 | # | ||
| 44 | # (*) Comparison is not completely fair, because "this" is ECB, | ||
| 45 | # i.e. no extra processing such as counter values calculation | ||
| 46 | # and xor-ing input as in Emilia's CTR implementation is | ||
| 47 | # performed. However, the CTR calculations stand for not more | ||
| 48 | # than 1% of total time, so comparison is *rather* fair. | ||
| 49 | # | ||
| 50 | # (**) Results were collected on Westmere, which is considered to | ||
| 51 | # be equivalent to Nehalem for this code. | ||
| 52 | # | ||
| 53 | # (***) Slowdown on Atom is rather strange per se, because original | ||
| 54 | # implementation has a number of 9+-bytes instructions, which | ||
| 55 | # are bad for Atom front-end, and which I eliminated completely. | ||
| 56 | # In attempt to address deterioration sbox() was tested in FP | ||
| 57 | # SIMD "domain" (movaps instead of movdqa, xorps instead of | ||
| 58 | # pxor, etc.). While it resulted in nominal 4% improvement on | ||
| 59 | # Atom, it hurted Westmere by more than 2x factor. | ||
| 60 | # | ||
| 61 | # As for key schedule conversion subroutine. Interface to OpenSSL | ||
| 62 | # relies on per-invocation on-the-fly conversion. This naturally | ||
| 63 | # has impact on performance, especially for short inputs. Conversion | ||
| 64 | # time in CPU cycles and its ratio to CPU cycles spent in 8x block | ||
| 65 | # function is: | ||
| 66 | # | ||
| 67 | # conversion conversion/8x block | ||
| 68 | # Core 2 240 0.22 | ||
| 69 | # Nehalem 180 0.20 | ||
| 70 | # Atom 430 0.19 | ||
| 71 | # | ||
| 72 | # The ratio values mean that 128-byte blocks will be processed | ||
| 73 | # 16-18% slower, 256-byte blocks - 9-10%, 384-byte blocks - 6-7%, | ||
| 74 | # etc. Then keep in mind that input sizes not divisible by 128 are | ||
| 75 | # *effectively* slower, especially shortest ones, e.g. consecutive | ||
| 76 | # 144-byte blocks are processed 44% slower than one would expect, | ||
| 77 | # 272 - 29%, 400 - 22%, etc. Yet, despite all these "shortcomings" | ||
| 78 | # it's still faster than ["hyper-threading-safe" code path in] | ||
| 79 | # aes-x86_64.pl on all lengths above 64 bytes... | ||
| 80 | # | ||
| 81 | # October 2011. | ||
| 82 | # | ||
| 83 | # Add decryption procedure. Performance in CPU cycles spent to decrypt | ||
| 84 | # one byte out of 4096-byte buffer with 128-bit key is: | ||
| 85 | # | ||
| 86 | # Core 2 9.83 | ||
| 87 | # Nehalem 7.74 | ||
| 88 | # Atom 19.0 | ||
| 89 | # | ||
| 90 | # November 2011. | ||
| 91 | # | ||
| 92 | # Add bsaes_xts_[en|de]crypt. Less-than-80-bytes-block performance is | ||
| 93 | # suboptimal, but XTS is meant to be used with larger blocks... | ||
| 94 | # | ||
| 95 | # <appro@openssl.org> | ||
| 96 | |||
| 97 | $flavour = shift; | ||
| 98 | $output = shift; | ||
| 99 | if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } | ||
| 100 | |||
| 101 | $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); | ||
| 102 | |||
| 103 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; | ||
| 104 | ( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or | ||
| 105 | ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or | ||
| 106 | die "can't locate x86_64-xlate.pl"; | ||
| 107 | |||
| 108 | open OUT,"| \"$^X\" $xlate $flavour $output"; | ||
| 109 | *STDOUT=*OUT; | ||
| 110 | |||
| 111 | my ($inp,$out,$len,$key,$ivp)=("%rdi","%rsi","%rdx","%rcx"); | ||
| 112 | my @XMM=map("%xmm$_",(15,0..14)); # best on Atom, +10% over (0..15) | ||
| 113 | my $ecb=0; # suppress unreferenced ECB subroutines, spare some space... | ||
| 114 | |||
| 115 | { | ||
| 116 | my ($key,$rounds,$const)=("%rax","%r10d","%r11"); | ||
| 117 | |||
| 118 | sub Sbox { | ||
| 119 | # input in lsb > [b0, b1, b2, b3, b4, b5, b6, b7] < msb | ||
| 120 | # output in lsb > [b0, b1, b4, b6, b3, b7, b2, b5] < msb | ||
| 121 | my @b=@_[0..7]; | ||
| 122 | my @t=@_[8..11]; | ||
| 123 | my @s=@_[12..15]; | ||
| 124 | &InBasisChange (@b); | ||
| 125 | &Inv_GF256 (@b[6,5,0,3,7,1,4,2],@t,@s); | ||
| 126 | &OutBasisChange (@b[7,1,4,2,6,5,0,3]); | ||
| 127 | } | ||
| 128 | |||
| 129 | sub InBasisChange { | ||
| 130 | # input in lsb > [b0, b1, b2, b3, b4, b5, b6, b7] < msb | ||
| 131 | # output in lsb > [b6, b5, b0, b3, b7, b1, b4, b2] < msb | ||
| 132 | my @b=@_[0..7]; | ||
| 133 | $code.=<<___; | ||
| 134 | pxor @b[6], @b[5] | ||
| 135 | pxor @b[1], @b[2] | ||
| 136 | pxor @b[0], @b[3] | ||
| 137 | pxor @b[2], @b[6] | ||
| 138 | pxor @b[0], @b[5] | ||
| 139 | |||
| 140 | pxor @b[3], @b[6] | ||
| 141 | pxor @b[7], @b[3] | ||
| 142 | pxor @b[5], @b[7] | ||
| 143 | pxor @b[4], @b[3] | ||
| 144 | pxor @b[5], @b[4] | ||
| 145 | pxor @b[1], @b[3] | ||
| 146 | |||
| 147 | pxor @b[7], @b[2] | ||
| 148 | pxor @b[5], @b[1] | ||
| 149 | ___ | ||
| 150 | } | ||
| 151 | |||
| 152 | sub OutBasisChange { | ||
| 153 | # input in lsb > [b0, b1, b2, b3, b4, b5, b6, b7] < msb | ||
| 154 | # output in lsb > [b6, b1, b2, b4, b7, b0, b3, b5] < msb | ||
| 155 | my @b=@_[0..7]; | ||
| 156 | $code.=<<___; | ||
| 157 | pxor @b[6], @b[0] | ||
| 158 | pxor @b[4], @b[1] | ||
| 159 | pxor @b[0], @b[2] | ||
| 160 | pxor @b[6], @b[4] | ||
| 161 | pxor @b[1], @b[6] | ||
| 162 | |||
| 163 | pxor @b[5], @b[1] | ||
| 164 | pxor @b[3], @b[5] | ||
| 165 | pxor @b[7], @b[3] | ||
| 166 | pxor @b[5], @b[7] | ||
| 167 | pxor @b[5], @b[2] | ||
| 168 | |||
| 169 | pxor @b[7], @b[4] | ||
| 170 | ___ | ||
| 171 | } | ||
| 172 | |||
| 173 | sub InvSbox { | ||
| 174 | # input in lsb > [b0, b1, b2, b3, b4, b5, b6, b7] < msb | ||
| 175 | # output in lsb > [b0, b1, b6, b4, b2, b7, b3, b5] < msb | ||
| 176 | my @b=@_[0..7]; | ||
| 177 | my @t=@_[8..11]; | ||
| 178 | my @s=@_[12..15]; | ||
| 179 | &InvInBasisChange (@b); | ||
| 180 | &Inv_GF256 (@b[5,1,2,6,3,7,0,4],@t,@s); | ||
| 181 | &InvOutBasisChange (@b[3,7,0,4,5,1,2,6]); | ||
| 182 | } | ||
| 183 | |||
| 184 | sub InvInBasisChange { # OutBasisChange in reverse | ||
| 185 | my @b=@_[5,1,2,6,3,7,0,4]; | ||
| 186 | $code.=<<___ | ||
| 187 | pxor @b[7], @b[4] | ||
| 188 | |||
| 189 | pxor @b[5], @b[7] | ||
| 190 | pxor @b[5], @b[2] | ||
| 191 | pxor @b[7], @b[3] | ||
| 192 | pxor @b[3], @b[5] | ||
| 193 | pxor @b[5], @b[1] | ||
| 194 | |||
| 195 | pxor @b[1], @b[6] | ||
| 196 | pxor @b[0], @b[2] | ||
| 197 | pxor @b[6], @b[4] | ||
| 198 | pxor @b[6], @b[0] | ||
| 199 | pxor @b[4], @b[1] | ||
| 200 | ___ | ||
| 201 | } | ||
| 202 | |||
| 203 | sub InvOutBasisChange { # InBasisChange in reverse | ||
| 204 | my @b=@_[2,5,7,3,6,1,0,4]; | ||
| 205 | $code.=<<___; | ||
| 206 | pxor @b[5], @b[1] | ||
| 207 | pxor @b[7], @b[2] | ||
| 208 | |||
| 209 | pxor @b[1], @b[3] | ||
| 210 | pxor @b[5], @b[4] | ||
| 211 | pxor @b[5], @b[7] | ||
| 212 | pxor @b[4], @b[3] | ||
| 213 | pxor @b[0], @b[5] | ||
| 214 | pxor @b[7], @b[3] | ||
| 215 | pxor @b[2], @b[6] | ||
| 216 | pxor @b[1], @b[2] | ||
| 217 | pxor @b[3], @b[6] | ||
| 218 | |||
| 219 | pxor @b[0], @b[3] | ||
| 220 | pxor @b[6], @b[5] | ||
| 221 | ___ | ||
| 222 | } | ||
| 223 | |||
| 224 | sub Mul_GF4 { | ||
| 225 | #;************************************************************* | ||
| 226 | #;* Mul_GF4: Input x0-x1,y0-y1 Output x0-x1 Temp t0 (8) * | ||
| 227 | #;************************************************************* | ||
| 228 | my ($x0,$x1,$y0,$y1,$t0)=@_; | ||
| 229 | $code.=<<___; | ||
| 230 | movdqa $y0, $t0 | ||
| 231 | pxor $y1, $t0 | ||
| 232 | pand $x0, $t0 | ||
| 233 | pxor $x1, $x0 | ||
| 234 | pand $y0, $x1 | ||
| 235 | pand $y1, $x0 | ||
| 236 | pxor $x1, $x0 | ||
| 237 | pxor $t0, $x1 | ||
| 238 | ___ | ||
| 239 | } | ||
| 240 | |||
| 241 | sub Mul_GF4_N { # not used, see next subroutine | ||
| 242 | # multiply and scale by N | ||
| 243 | my ($x0,$x1,$y0,$y1,$t0)=@_; | ||
| 244 | $code.=<<___; | ||
| 245 | movdqa $y0, $t0 | ||
| 246 | pxor $y1, $t0 | ||
| 247 | pand $x0, $t0 | ||
| 248 | pxor $x1, $x0 | ||
| 249 | pand $y0, $x1 | ||
| 250 | pand $y1, $x0 | ||
| 251 | pxor $x0, $x1 | ||
| 252 | pxor $t0, $x0 | ||
| 253 | ___ | ||
| 254 | } | ||
| 255 | |||
| 256 | sub Mul_GF4_N_GF4 { | ||
| 257 | # interleaved Mul_GF4_N and Mul_GF4 | ||
| 258 | my ($x0,$x1,$y0,$y1,$t0, | ||
| 259 | $x2,$x3,$y2,$y3,$t1)=@_; | ||
| 260 | $code.=<<___; | ||
| 261 | movdqa $y0, $t0 | ||
| 262 | movdqa $y2, $t1 | ||
| 263 | pxor $y1, $t0 | ||
| 264 | pxor $y3, $t1 | ||
| 265 | pand $x0, $t0 | ||
| 266 | pand $x2, $t1 | ||
| 267 | pxor $x1, $x0 | ||
| 268 | pxor $x3, $x2 | ||
| 269 | pand $y0, $x1 | ||
| 270 | pand $y2, $x3 | ||
| 271 | pand $y1, $x0 | ||
| 272 | pand $y3, $x2 | ||
| 273 | pxor $x0, $x1 | ||
| 274 | pxor $x3, $x2 | ||
| 275 | pxor $t0, $x0 | ||
| 276 | pxor $t1, $x3 | ||
| 277 | ___ | ||
| 278 | } | ||
| 279 | sub Mul_GF16_2 { | ||
| 280 | my @x=@_[0..7]; | ||
| 281 | my @y=@_[8..11]; | ||
| 282 | my @t=@_[12..15]; | ||
| 283 | $code.=<<___; | ||
| 284 | movdqa @x[0], @t[0] | ||
| 285 | movdqa @x[1], @t[1] | ||
| 286 | ___ | ||
| 287 | &Mul_GF4 (@x[0], @x[1], @y[0], @y[1], @t[2]); | ||
| 288 | $code.=<<___; | ||
| 289 | pxor @x[2], @t[0] | ||
| 290 | pxor @x[3], @t[1] | ||
| 291 | pxor @y[2], @y[0] | ||
| 292 | pxor @y[3], @y[1] | ||
| 293 | ___ | ||
| 294 | Mul_GF4_N_GF4 (@t[0], @t[1], @y[0], @y[1], @t[3], | ||
| 295 | @x[2], @x[3], @y[2], @y[3], @t[2]); | ||
| 296 | $code.=<<___; | ||
| 297 | pxor @t[0], @x[0] | ||
| 298 | pxor @t[0], @x[2] | ||
| 299 | pxor @t[1], @x[1] | ||
| 300 | pxor @t[1], @x[3] | ||
| 301 | |||
| 302 | movdqa @x[4], @t[0] | ||
| 303 | movdqa @x[5], @t[1] | ||
| 304 | pxor @x[6], @t[0] | ||
| 305 | pxor @x[7], @t[1] | ||
| 306 | ___ | ||
| 307 | &Mul_GF4_N_GF4 (@t[0], @t[1], @y[0], @y[1], @t[3], | ||
| 308 | @x[6], @x[7], @y[2], @y[3], @t[2]); | ||
| 309 | $code.=<<___; | ||
| 310 | pxor @y[2], @y[0] | ||
| 311 | pxor @y[3], @y[1] | ||
| 312 | ___ | ||
| 313 | &Mul_GF4 (@x[4], @x[5], @y[0], @y[1], @t[3]); | ||
| 314 | $code.=<<___; | ||
| 315 | pxor @t[0], @x[4] | ||
| 316 | pxor @t[0], @x[6] | ||
| 317 | pxor @t[1], @x[5] | ||
| 318 | pxor @t[1], @x[7] | ||
| 319 | ___ | ||
| 320 | } | ||
| 321 | sub Inv_GF256 { | ||
| 322 | #;******************************************************************** | ||
| 323 | #;* Inv_GF256: Input x0-x7 Output x0-x7 Temp t0-t3,s0-s3 (144) * | ||
| 324 | #;******************************************************************** | ||
| 325 | my @x=@_[0..7]; | ||
| 326 | my @t=@_[8..11]; | ||
| 327 | my @s=@_[12..15]; | ||
| 328 | # direct optimizations from hardware | ||
| 329 | $code.=<<___; | ||
| 330 | movdqa @x[4], @t[3] | ||
| 331 | movdqa @x[5], @t[2] | ||
| 332 | movdqa @x[1], @t[1] | ||
| 333 | movdqa @x[7], @s[1] | ||
| 334 | movdqa @x[0], @s[0] | ||
| 335 | |||
| 336 | pxor @x[6], @t[3] | ||
| 337 | pxor @x[7], @t[2] | ||
| 338 | pxor @x[3], @t[1] | ||
| 339 | movdqa @t[3], @s[2] | ||
| 340 | pxor @x[6], @s[1] | ||
| 341 | movdqa @t[2], @t[0] | ||
| 342 | pxor @x[2], @s[0] | ||
| 343 | movdqa @t[3], @s[3] | ||
| 344 | |||
| 345 | por @t[1], @t[2] | ||
| 346 | por @s[0], @t[3] | ||
| 347 | pxor @t[0], @s[3] | ||
| 348 | pand @s[0], @s[2] | ||
| 349 | pxor @t[1], @s[0] | ||
| 350 | pand @t[1], @t[0] | ||
| 351 | pand @s[0], @s[3] | ||
| 352 | movdqa @x[3], @s[0] | ||
| 353 | pxor @x[2], @s[0] | ||
| 354 | pand @s[0], @s[1] | ||
| 355 | pxor @s[1], @t[3] | ||
| 356 | pxor @s[1], @t[2] | ||
| 357 | movdqa @x[4], @s[1] | ||
| 358 | movdqa @x[1], @s[0] | ||
| 359 | pxor @x[5], @s[1] | ||
| 360 | pxor @x[0], @s[0] | ||
| 361 | movdqa @s[1], @t[1] | ||
| 362 | pand @s[0], @s[1] | ||
| 363 | por @s[0], @t[1] | ||
| 364 | pxor @s[1], @t[0] | ||
| 365 | pxor @s[3], @t[3] | ||
| 366 | pxor @s[2], @t[2] | ||
| 367 | pxor @s[3], @t[1] | ||
| 368 | movdqa @x[7], @s[0] | ||
| 369 | pxor @s[2], @t[0] | ||
| 370 | movdqa @x[6], @s[1] | ||
| 371 | pxor @s[2], @t[1] | ||
| 372 | movdqa @x[5], @s[2] | ||
| 373 | pand @x[3], @s[0] | ||
| 374 | movdqa @x[4], @s[3] | ||
| 375 | pand @x[2], @s[1] | ||
| 376 | pand @x[1], @s[2] | ||
| 377 | por @x[0], @s[3] | ||
| 378 | pxor @s[0], @t[3] | ||
| 379 | pxor @s[1], @t[2] | ||
| 380 | pxor @s[2], @t[1] | ||
| 381 | pxor @s[3], @t[0] | ||
| 382 | |||
| 383 | #Inv_GF16 \t0, \t1, \t2, \t3, \s0, \s1, \s2, \s3 | ||
| 384 | |||
| 385 | # new smaller inversion | ||
| 386 | |||
| 387 | movdqa @t[3], @s[0] | ||
| 388 | pand @t[1], @t[3] | ||
| 389 | pxor @t[2], @s[0] | ||
| 390 | |||
| 391 | movdqa @t[0], @s[2] | ||
| 392 | movdqa @s[0], @s[3] | ||
| 393 | pxor @t[3], @s[2] | ||
| 394 | pand @s[2], @s[3] | ||
| 395 | |||
| 396 | movdqa @t[1], @s[1] | ||
| 397 | pxor @t[2], @s[3] | ||
| 398 | pxor @t[0], @s[1] | ||
| 399 | |||
| 400 | pxor @t[2], @t[3] | ||
| 401 | |||
| 402 | pand @t[3], @s[1] | ||
| 403 | |||
| 404 | movdqa @s[2], @t[2] | ||
| 405 | pxor @t[0], @s[1] | ||
| 406 | |||
| 407 | pxor @s[1], @t[2] | ||
| 408 | pxor @s[1], @t[1] | ||
| 409 | |||
| 410 | pand @t[0], @t[2] | ||
| 411 | |||
| 412 | pxor @t[2], @s[2] | ||
| 413 | pxor @t[2], @t[1] | ||
| 414 | |||
| 415 | pand @s[3], @s[2] | ||
| 416 | |||
| 417 | pxor @s[0], @s[2] | ||
| 418 | ___ | ||
| 419 | # output in s3, s2, s1, t1 | ||
| 420 | |||
| 421 | # Mul_GF16_2 \x0, \x1, \x2, \x3, \x4, \x5, \x6, \x7, \t2, \t3, \t0, \t1, \s0, \s1, \s2, \s3 | ||
| 422 | |||
| 423 | # Mul_GF16_2 \x0, \x1, \x2, \x3, \x4, \x5, \x6, \x7, \s3, \s2, \s1, \t1, \s0, \t0, \t2, \t3 | ||
| 424 | &Mul_GF16_2(@x,@s[3,2,1],@t[1],@s[0],@t[0,2,3]); | ||
| 425 | |||
| 426 | ### output msb > [x3,x2,x1,x0,x7,x6,x5,x4] < lsb | ||
| 427 | } | ||
| 428 | |||
| 429 | # AES linear components | ||
| 430 | |||
| 431 | sub ShiftRows { | ||
| 432 | my @x=@_[0..7]; | ||
| 433 | my $mask=pop; | ||
| 434 | $code.=<<___; | ||
| 435 | pxor 0x00($key),@x[0] | ||
| 436 | pxor 0x10($key),@x[1] | ||
| 437 | pshufb $mask,@x[0] | ||
| 438 | pxor 0x20($key),@x[2] | ||
| 439 | pshufb $mask,@x[1] | ||
| 440 | pxor 0x30($key),@x[3] | ||
| 441 | pshufb $mask,@x[2] | ||
| 442 | pxor 0x40($key),@x[4] | ||
| 443 | pshufb $mask,@x[3] | ||
| 444 | pxor 0x50($key),@x[5] | ||
| 445 | pshufb $mask,@x[4] | ||
| 446 | pxor 0x60($key),@x[6] | ||
| 447 | pshufb $mask,@x[5] | ||
| 448 | pxor 0x70($key),@x[7] | ||
| 449 | pshufb $mask,@x[6] | ||
| 450 | lea 0x80($key),$key | ||
| 451 | pshufb $mask,@x[7] | ||
| 452 | ___ | ||
| 453 | } | ||
| 454 | |||
| 455 | sub MixColumns { | ||
| 456 | # modified to emit output in order suitable for feeding back to aesenc[last] | ||
| 457 | my @x=@_[0..7]; | ||
| 458 | my @t=@_[8..15]; | ||
| 459 | my $inv=@_[16]; # optional | ||
| 460 | $code.=<<___; | ||
| 461 | pshufd \$0x93, @x[0], @t[0] # x0 <<< 32 | ||
| 462 | pshufd \$0x93, @x[1], @t[1] | ||
| 463 | pxor @t[0], @x[0] # x0 ^ (x0 <<< 32) | ||
| 464 | pshufd \$0x93, @x[2], @t[2] | ||
| 465 | pxor @t[1], @x[1] | ||
| 466 | pshufd \$0x93, @x[3], @t[3] | ||
| 467 | pxor @t[2], @x[2] | ||
| 468 | pshufd \$0x93, @x[4], @t[4] | ||
| 469 | pxor @t[3], @x[3] | ||
| 470 | pshufd \$0x93, @x[5], @t[5] | ||
| 471 | pxor @t[4], @x[4] | ||
| 472 | pshufd \$0x93, @x[6], @t[6] | ||
| 473 | pxor @t[5], @x[5] | ||
| 474 | pshufd \$0x93, @x[7], @t[7] | ||
| 475 | pxor @t[6], @x[6] | ||
| 476 | pxor @t[7], @x[7] | ||
| 477 | |||
| 478 | pxor @x[0], @t[1] | ||
| 479 | pxor @x[7], @t[0] | ||
| 480 | pxor @x[7], @t[1] | ||
| 481 | pshufd \$0x4E, @x[0], @x[0] # (x0 ^ (x0 <<< 32)) <<< 64) | ||
| 482 | pxor @x[1], @t[2] | ||
| 483 | pshufd \$0x4E, @x[1], @x[1] | ||
| 484 | pxor @x[4], @t[5] | ||
| 485 | pxor @t[0], @x[0] | ||
| 486 | pxor @x[5], @t[6] | ||
| 487 | pxor @t[1], @x[1] | ||
| 488 | pxor @x[3], @t[4] | ||
| 489 | pshufd \$0x4E, @x[4], @t[0] | ||
| 490 | pxor @x[6], @t[7] | ||
| 491 | pshufd \$0x4E, @x[5], @t[1] | ||
| 492 | pxor @x[2], @t[3] | ||
| 493 | pshufd \$0x4E, @x[3], @x[4] | ||
| 494 | pxor @x[7], @t[3] | ||
| 495 | pshufd \$0x4E, @x[7], @x[5] | ||
| 496 | pxor @x[7], @t[4] | ||
| 497 | pshufd \$0x4E, @x[6], @x[3] | ||
| 498 | pxor @t[4], @t[0] | ||
| 499 | pshufd \$0x4E, @x[2], @x[6] | ||
| 500 | pxor @t[5], @t[1] | ||
| 501 | ___ | ||
| 502 | $code.=<<___ if (!$inv); | ||
| 503 | pxor @t[3], @x[4] | ||
| 504 | pxor @t[7], @x[5] | ||
| 505 | pxor @t[6], @x[3] | ||
| 506 | movdqa @t[0], @x[2] | ||
| 507 | pxor @t[2], @x[6] | ||
| 508 | movdqa @t[1], @x[7] | ||
| 509 | ___ | ||
| 510 | $code.=<<___ if ($inv); | ||
| 511 | pxor @x[4], @t[3] | ||
| 512 | pxor @t[7], @x[5] | ||
| 513 | pxor @x[3], @t[6] | ||
| 514 | movdqa @t[0], @x[3] | ||
| 515 | pxor @t[2], @x[6] | ||
| 516 | movdqa @t[6], @x[2] | ||
| 517 | movdqa @t[1], @x[7] | ||
| 518 | movdqa @x[6], @x[4] | ||
| 519 | movdqa @t[3], @x[6] | ||
| 520 | ___ | ||
| 521 | } | ||
| 522 | |||
| 523 | sub InvMixColumns_orig { | ||
| 524 | my @x=@_[0..7]; | ||
| 525 | my @t=@_[8..15]; | ||
| 526 | |||
| 527 | $code.=<<___; | ||
| 528 | # multiplication by 0x0e | ||
| 529 | pshufd \$0x93, @x[7], @t[7] | ||
| 530 | movdqa @x[2], @t[2] | ||
| 531 | pxor @x[5], @x[7] # 7 5 | ||
| 532 | pxor @x[5], @x[2] # 2 5 | ||
| 533 | pshufd \$0x93, @x[0], @t[0] | ||
| 534 | movdqa @x[5], @t[5] | ||
| 535 | pxor @x[0], @x[5] # 5 0 [1] | ||
| 536 | pxor @x[1], @x[0] # 0 1 | ||
| 537 | pshufd \$0x93, @x[1], @t[1] | ||
| 538 | pxor @x[2], @x[1] # 1 25 | ||
| 539 | pxor @x[6], @x[0] # 01 6 [2] | ||
| 540 | pxor @x[3], @x[1] # 125 3 [4] | ||
| 541 | pshufd \$0x93, @x[3], @t[3] | ||
| 542 | pxor @x[0], @x[2] # 25 016 [3] | ||
| 543 | pxor @x[7], @x[3] # 3 75 | ||
| 544 | pxor @x[6], @x[7] # 75 6 [0] | ||
| 545 | pshufd \$0x93, @x[6], @t[6] | ||
| 546 | movdqa @x[4], @t[4] | ||
| 547 | pxor @x[4], @x[6] # 6 4 | ||
| 548 | pxor @x[3], @x[4] # 4 375 [6] | ||
| 549 | pxor @x[7], @x[3] # 375 756=36 | ||
| 550 | pxor @t[5], @x[6] # 64 5 [7] | ||
| 551 | pxor @t[2], @x[3] # 36 2 | ||
| 552 | pxor @t[4], @x[3] # 362 4 [5] | ||
| 553 | pshufd \$0x93, @t[5], @t[5] | ||
| 554 | ___ | ||
| 555 | my @y = @x[7,5,0,2,1,3,4,6]; | ||
| 556 | $code.=<<___; | ||
| 557 | # multiplication by 0x0b | ||
| 558 | pxor @y[0], @y[1] | ||
| 559 | pxor @t[0], @y[0] | ||
| 560 | pxor @t[1], @y[1] | ||
| 561 | pshufd \$0x93, @t[2], @t[2] | ||
| 562 | pxor @t[5], @y[0] | ||
| 563 | pxor @t[6], @y[1] | ||
| 564 | pxor @t[7], @y[0] | ||
| 565 | pshufd \$0x93, @t[4], @t[4] | ||
| 566 | pxor @t[6], @t[7] # clobber t[7] | ||
| 567 | pxor @y[0], @y[1] | ||
| 568 | |||
| 569 | pxor @t[0], @y[3] | ||
| 570 | pshufd \$0x93, @t[0], @t[0] | ||
| 571 | pxor @t[1], @y[2] | ||
| 572 | pxor @t[1], @y[4] | ||
| 573 | pxor @t[2], @y[2] | ||
| 574 | pshufd \$0x93, @t[1], @t[1] | ||
| 575 | pxor @t[2], @y[3] | ||
| 576 | pxor @t[2], @y[5] | ||
| 577 | pxor @t[7], @y[2] | ||
| 578 | pshufd \$0x93, @t[2], @t[2] | ||
| 579 | pxor @t[3], @y[3] | ||
| 580 | pxor @t[3], @y[6] | ||
| 581 | pxor @t[3], @y[4] | ||
| 582 | pshufd \$0x93, @t[3], @t[3] | ||
| 583 | pxor @t[4], @y[7] | ||
| 584 | pxor @t[4], @y[5] | ||
| 585 | pxor @t[7], @y[7] | ||
| 586 | pxor @t[5], @y[3] | ||
| 587 | pxor @t[4], @y[4] | ||
| 588 | pxor @t[5], @t[7] # clobber t[7] even more | ||
| 589 | |||
| 590 | pxor @t[7], @y[5] | ||
| 591 | pshufd \$0x93, @t[4], @t[4] | ||
| 592 | pxor @t[7], @y[6] | ||
| 593 | pxor @t[7], @y[4] | ||
| 594 | |||
| 595 | pxor @t[5], @t[7] | ||
| 596 | pshufd \$0x93, @t[5], @t[5] | ||
| 597 | pxor @t[6], @t[7] # restore t[7] | ||
| 598 | |||
| 599 | # multiplication by 0x0d | ||
| 600 | pxor @y[7], @y[4] | ||
| 601 | pxor @t[4], @y[7] | ||
| 602 | pshufd \$0x93, @t[6], @t[6] | ||
| 603 | pxor @t[0], @y[2] | ||
| 604 | pxor @t[5], @y[7] | ||
| 605 | pxor @t[2], @y[2] | ||
| 606 | pshufd \$0x93, @t[7], @t[7] | ||
| 607 | |||
| 608 | pxor @y[1], @y[3] | ||
| 609 | pxor @t[1], @y[1] | ||
| 610 | pxor @t[0], @y[0] | ||
| 611 | pxor @t[0], @y[3] | ||
| 612 | pxor @t[5], @y[1] | ||
| 613 | pxor @t[5], @y[0] | ||
| 614 | pxor @t[7], @y[1] | ||
| 615 | pshufd \$0x93, @t[0], @t[0] | ||
| 616 | pxor @t[6], @y[0] | ||
| 617 | pxor @y[1], @y[3] | ||
| 618 | pxor @t[1], @y[4] | ||
| 619 | pshufd \$0x93, @t[1], @t[1] | ||
| 620 | |||
| 621 | pxor @t[7], @y[7] | ||
| 622 | pxor @t[2], @y[4] | ||
| 623 | pxor @t[2], @y[5] | ||
| 624 | pshufd \$0x93, @t[2], @t[2] | ||
| 625 | pxor @t[6], @y[2] | ||
| 626 | pxor @t[3], @t[6] # clobber t[6] | ||
| 627 | pxor @y[7], @y[4] | ||
| 628 | pxor @t[6], @y[3] | ||
| 629 | |||
| 630 | pxor @t[6], @y[6] | ||
| 631 | pxor @t[5], @y[5] | ||
| 632 | pxor @t[4], @y[6] | ||
| 633 | pshufd \$0x93, @t[4], @t[4] | ||
| 634 | pxor @t[6], @y[5] | ||
| 635 | pxor @t[7], @y[6] | ||
| 636 | pxor @t[3], @t[6] # restore t[6] | ||
| 637 | |||
| 638 | pshufd \$0x93, @t[5], @t[5] | ||
| 639 | pshufd \$0x93, @t[6], @t[6] | ||
| 640 | pshufd \$0x93, @t[7], @t[7] | ||
| 641 | pshufd \$0x93, @t[3], @t[3] | ||
| 642 | |||
| 643 | # multiplication by 0x09 | ||
| 644 | pxor @y[1], @y[4] | ||
| 645 | pxor @y[1], @t[1] # t[1]=y[1] | ||
| 646 | pxor @t[5], @t[0] # clobber t[0] | ||
| 647 | pxor @t[5], @t[1] | ||
| 648 | pxor @t[0], @y[3] | ||
| 649 | pxor @y[0], @t[0] # t[0]=y[0] | ||
| 650 | pxor @t[6], @t[1] | ||
| 651 | pxor @t[7], @t[6] # clobber t[6] | ||
| 652 | pxor @t[1], @y[4] | ||
| 653 | pxor @t[4], @y[7] | ||
| 654 | pxor @y[4], @t[4] # t[4]=y[4] | ||
| 655 | pxor @t[3], @y[6] | ||
| 656 | pxor @y[3], @t[3] # t[3]=y[3] | ||
| 657 | pxor @t[2], @y[5] | ||
| 658 | pxor @y[2], @t[2] # t[2]=y[2] | ||
| 659 | pxor @t[7], @t[3] | ||
| 660 | pxor @y[5], @t[5] # t[5]=y[5] | ||
| 661 | pxor @t[6], @t[2] | ||
| 662 | pxor @t[6], @t[5] | ||
| 663 | pxor @y[6], @t[6] # t[6]=y[6] | ||
| 664 | pxor @y[7], @t[7] # t[7]=y[7] | ||
| 665 | |||
| 666 | movdqa @t[0],@XMM[0] | ||
| 667 | movdqa @t[1],@XMM[1] | ||
| 668 | movdqa @t[2],@XMM[2] | ||
| 669 | movdqa @t[3],@XMM[3] | ||
| 670 | movdqa @t[4],@XMM[4] | ||
| 671 | movdqa @t[5],@XMM[5] | ||
| 672 | movdqa @t[6],@XMM[6] | ||
| 673 | movdqa @t[7],@XMM[7] | ||
| 674 | ___ | ||
| 675 | } | ||
| 676 | |||
| 677 | sub InvMixColumns { | ||
| 678 | my @x=@_[0..7]; | ||
| 679 | my @t=@_[8..15]; | ||
| 680 | |||
| 681 | # Thanks to Jussi Kivilinna for providing pointer to | ||
| 682 | # | ||
| 683 | # | 0e 0b 0d 09 | | 02 03 01 01 | | 05 00 04 00 | | ||
| 684 | # | 09 0e 0b 0d | = | 01 02 03 01 | x | 00 05 00 04 | | ||
| 685 | # | 0d 09 0e 0b | | 01 01 02 03 | | 04 00 05 00 | | ||
| 686 | # | 0b 0d 09 0e | | 03 01 01 02 | | 00 04 00 05 | | ||
| 687 | |||
| 688 | $code.=<<___; | ||
| 689 | # multiplication by 0x05-0x00-0x04-0x00 | ||
| 690 | pshufd \$0x4E, @x[0], @t[0] | ||
| 691 | pshufd \$0x4E, @x[6], @t[6] | ||
| 692 | pxor @x[0], @t[0] | ||
| 693 | pshufd \$0x4E, @x[7], @t[7] | ||
| 694 | pxor @x[6], @t[6] | ||
| 695 | pshufd \$0x4E, @x[1], @t[1] | ||
| 696 | pxor @x[7], @t[7] | ||
| 697 | pshufd \$0x4E, @x[2], @t[2] | ||
| 698 | pxor @x[1], @t[1] | ||
| 699 | pshufd \$0x4E, @x[3], @t[3] | ||
| 700 | pxor @x[2], @t[2] | ||
| 701 | pxor @t[6], @x[0] | ||
| 702 | pxor @t[6], @x[1] | ||
| 703 | pshufd \$0x4E, @x[4], @t[4] | ||
| 704 | pxor @x[3], @t[3] | ||
| 705 | pxor @t[0], @x[2] | ||
| 706 | pxor @t[1], @x[3] | ||
| 707 | pshufd \$0x4E, @x[5], @t[5] | ||
| 708 | pxor @x[4], @t[4] | ||
| 709 | pxor @t[7], @x[1] | ||
| 710 | pxor @t[2], @x[4] | ||
| 711 | pxor @x[5], @t[5] | ||
| 712 | |||
| 713 | pxor @t[7], @x[2] | ||
| 714 | pxor @t[6], @x[3] | ||
| 715 | pxor @t[6], @x[4] | ||
| 716 | pxor @t[3], @x[5] | ||
| 717 | pxor @t[4], @x[6] | ||
| 718 | pxor @t[7], @x[4] | ||
| 719 | pxor @t[7], @x[5] | ||
| 720 | pxor @t[5], @x[7] | ||
| 721 | ___ | ||
| 722 | &MixColumns (@x,@t,1); # flipped 2<->3 and 4<->6 | ||
| 723 | } | ||
| 724 | |||
| 725 | sub aesenc { # not used | ||
| 726 | my @b=@_[0..7]; | ||
| 727 | my @t=@_[8..15]; | ||
| 728 | $code.=<<___; | ||
| 729 | movdqa 0x30($const),@t[0] # .LSR | ||
| 730 | ___ | ||
| 731 | &ShiftRows (@b,@t[0]); | ||
| 732 | &Sbox (@b,@t); | ||
| 733 | &MixColumns (@b[0,1,4,6,3,7,2,5],@t); | ||
| 734 | } | ||
| 735 | |||
| 736 | sub aesenclast { # not used | ||
| 737 | my @b=@_[0..7]; | ||
| 738 | my @t=@_[8..15]; | ||
| 739 | $code.=<<___; | ||
| 740 | movdqa 0x40($const),@t[0] # .LSRM0 | ||
| 741 | ___ | ||
| 742 | &ShiftRows (@b,@t[0]); | ||
| 743 | &Sbox (@b,@t); | ||
| 744 | $code.=<<___ | ||
| 745 | pxor 0x00($key),@b[0] | ||
| 746 | pxor 0x10($key),@b[1] | ||
| 747 | pxor 0x20($key),@b[4] | ||
| 748 | pxor 0x30($key),@b[6] | ||
| 749 | pxor 0x40($key),@b[3] | ||
| 750 | pxor 0x50($key),@b[7] | ||
| 751 | pxor 0x60($key),@b[2] | ||
| 752 | pxor 0x70($key),@b[5] | ||
| 753 | ___ | ||
| 754 | } | ||
| 755 | |||
| 756 | sub swapmove { | ||
| 757 | my ($a,$b,$n,$mask,$t)=@_; | ||
| 758 | $code.=<<___; | ||
| 759 | movdqa $b,$t | ||
| 760 | psrlq \$$n,$b | ||
| 761 | pxor $a,$b | ||
| 762 | pand $mask,$b | ||
| 763 | pxor $b,$a | ||
| 764 | psllq \$$n,$b | ||
| 765 | pxor $t,$b | ||
| 766 | ___ | ||
| 767 | } | ||
| 768 | sub swapmove2x { | ||
| 769 | my ($a0,$b0,$a1,$b1,$n,$mask,$t0,$t1)=@_; | ||
| 770 | $code.=<<___; | ||
| 771 | movdqa $b0,$t0 | ||
| 772 | psrlq \$$n,$b0 | ||
| 773 | movdqa $b1,$t1 | ||
| 774 | psrlq \$$n,$b1 | ||
| 775 | pxor $a0,$b0 | ||
| 776 | pxor $a1,$b1 | ||
| 777 | pand $mask,$b0 | ||
| 778 | pand $mask,$b1 | ||
| 779 | pxor $b0,$a0 | ||
| 780 | psllq \$$n,$b0 | ||
| 781 | pxor $b1,$a1 | ||
| 782 | psllq \$$n,$b1 | ||
| 783 | pxor $t0,$b0 | ||
| 784 | pxor $t1,$b1 | ||
| 785 | ___ | ||
| 786 | } | ||
| 787 | |||
| 788 | sub bitslice { | ||
| 789 | my @x=reverse(@_[0..7]); | ||
| 790 | my ($t0,$t1,$t2,$t3)=@_[8..11]; | ||
| 791 | $code.=<<___; | ||
| 792 | movdqa 0x00($const),$t0 # .LBS0 | ||
| 793 | movdqa 0x10($const),$t1 # .LBS1 | ||
| 794 | ___ | ||
| 795 | &swapmove2x(@x[0,1,2,3],1,$t0,$t2,$t3); | ||
| 796 | &swapmove2x(@x[4,5,6,7],1,$t0,$t2,$t3); | ||
| 797 | $code.=<<___; | ||
| 798 | movdqa 0x20($const),$t0 # .LBS2 | ||
| 799 | ___ | ||
| 800 | &swapmove2x(@x[0,2,1,3],2,$t1,$t2,$t3); | ||
| 801 | &swapmove2x(@x[4,6,5,7],2,$t1,$t2,$t3); | ||
| 802 | |||
| 803 | &swapmove2x(@x[0,4,1,5],4,$t0,$t2,$t3); | ||
| 804 | &swapmove2x(@x[2,6,3,7],4,$t0,$t2,$t3); | ||
| 805 | } | ||
| 806 | |||
| 807 | $code.=<<___; | ||
| 808 | .text | ||
| 809 | |||
| 810 | .extern asm_AES_encrypt | ||
| 811 | .extern asm_AES_decrypt | ||
| 812 | |||
| 813 | .type _bsaes_encrypt8,\@abi-omnipotent | ||
| 814 | .align 64 | ||
| 815 | _bsaes_encrypt8: | ||
| 816 | _CET_ENDBR | ||
| 817 | lea .LBS0(%rip), $const # constants table | ||
| 818 | |||
| 819 | movdqa ($key), @XMM[9] # round 0 key | ||
| 820 | lea 0x10($key), $key | ||
| 821 | movdqa 0x50($const), @XMM[8] # .LM0SR | ||
| 822 | pxor @XMM[9], @XMM[0] # xor with round0 key | ||
| 823 | pxor @XMM[9], @XMM[1] | ||
| 824 | pshufb @XMM[8], @XMM[0] | ||
| 825 | pxor @XMM[9], @XMM[2] | ||
| 826 | pshufb @XMM[8], @XMM[1] | ||
| 827 | pxor @XMM[9], @XMM[3] | ||
| 828 | pshufb @XMM[8], @XMM[2] | ||
| 829 | pxor @XMM[9], @XMM[4] | ||
| 830 | pshufb @XMM[8], @XMM[3] | ||
| 831 | pxor @XMM[9], @XMM[5] | ||
| 832 | pshufb @XMM[8], @XMM[4] | ||
| 833 | pxor @XMM[9], @XMM[6] | ||
| 834 | pshufb @XMM[8], @XMM[5] | ||
| 835 | pxor @XMM[9], @XMM[7] | ||
| 836 | pshufb @XMM[8], @XMM[6] | ||
| 837 | pshufb @XMM[8], @XMM[7] | ||
| 838 | _bsaes_encrypt8_bitslice: | ||
| 839 | ___ | ||
| 840 | &bitslice (@XMM[0..7, 8..11]); | ||
| 841 | $code.=<<___; | ||
| 842 | dec $rounds | ||
| 843 | jmp .Lenc_sbox | ||
| 844 | .align 16 | ||
| 845 | .Lenc_loop: | ||
| 846 | ___ | ||
| 847 | &ShiftRows (@XMM[0..7, 8]); | ||
| 848 | $code.=".Lenc_sbox:\n"; | ||
| 849 | &Sbox (@XMM[0..7, 8..15]); | ||
| 850 | $code.=<<___; | ||
| 851 | dec $rounds | ||
| 852 | jl .Lenc_done | ||
| 853 | ___ | ||
| 854 | &MixColumns (@XMM[0,1,4,6,3,7,2,5, 8..15]); | ||
| 855 | $code.=<<___; | ||
| 856 | movdqa 0x30($const), @XMM[8] # .LSR | ||
| 857 | jnz .Lenc_loop | ||
| 858 | movdqa 0x40($const), @XMM[8] # .LSRM0 | ||
| 859 | jmp .Lenc_loop | ||
| 860 | .align 16 | ||
| 861 | .Lenc_done: | ||
| 862 | ___ | ||
| 863 | # output in lsb > [t0, t1, t4, t6, t3, t7, t2, t5] < msb | ||
| 864 | &bitslice (@XMM[0,1,4,6,3,7,2,5, 8..11]); | ||
| 865 | $code.=<<___; | ||
| 866 | movdqa ($key), @XMM[8] # last round key | ||
| 867 | pxor @XMM[8], @XMM[4] | ||
| 868 | pxor @XMM[8], @XMM[6] | ||
| 869 | pxor @XMM[8], @XMM[3] | ||
| 870 | pxor @XMM[8], @XMM[7] | ||
| 871 | pxor @XMM[8], @XMM[2] | ||
| 872 | pxor @XMM[8], @XMM[5] | ||
| 873 | pxor @XMM[8], @XMM[0] | ||
| 874 | pxor @XMM[8], @XMM[1] | ||
| 875 | ret | ||
| 876 | .size _bsaes_encrypt8,.-_bsaes_encrypt8 | ||
| 877 | |||
| 878 | .type _bsaes_decrypt8,\@abi-omnipotent | ||
| 879 | .align 64 | ||
| 880 | _bsaes_decrypt8: | ||
| 881 | _CET_ENDBR | ||
| 882 | lea .LBS0(%rip), $const # constants table | ||
| 883 | |||
| 884 | movdqa ($key), @XMM[9] # round 0 key | ||
| 885 | lea 0x10($key), $key | ||
| 886 | movdqa -0x30($const), @XMM[8] # .LM0ISR | ||
| 887 | pxor @XMM[9], @XMM[0] # xor with round0 key | ||
| 888 | pxor @XMM[9], @XMM[1] | ||
| 889 | pshufb @XMM[8], @XMM[0] | ||
| 890 | pxor @XMM[9], @XMM[2] | ||
| 891 | pshufb @XMM[8], @XMM[1] | ||
| 892 | pxor @XMM[9], @XMM[3] | ||
| 893 | pshufb @XMM[8], @XMM[2] | ||
| 894 | pxor @XMM[9], @XMM[4] | ||
| 895 | pshufb @XMM[8], @XMM[3] | ||
| 896 | pxor @XMM[9], @XMM[5] | ||
| 897 | pshufb @XMM[8], @XMM[4] | ||
| 898 | pxor @XMM[9], @XMM[6] | ||
| 899 | pshufb @XMM[8], @XMM[5] | ||
| 900 | pxor @XMM[9], @XMM[7] | ||
| 901 | pshufb @XMM[8], @XMM[6] | ||
| 902 | pshufb @XMM[8], @XMM[7] | ||
| 903 | ___ | ||
| 904 | &bitslice (@XMM[0..7, 8..11]); | ||
| 905 | $code.=<<___; | ||
| 906 | dec $rounds | ||
| 907 | jmp .Ldec_sbox | ||
| 908 | .align 16 | ||
| 909 | .Ldec_loop: | ||
| 910 | ___ | ||
| 911 | &ShiftRows (@XMM[0..7, 8]); | ||
| 912 | $code.=".Ldec_sbox:\n"; | ||
| 913 | &InvSbox (@XMM[0..7, 8..15]); | ||
| 914 | $code.=<<___; | ||
| 915 | dec $rounds | ||
| 916 | jl .Ldec_done | ||
| 917 | ___ | ||
| 918 | &InvMixColumns (@XMM[0,1,6,4,2,7,3,5, 8..15]); | ||
| 919 | $code.=<<___; | ||
| 920 | movdqa -0x10($const), @XMM[8] # .LISR | ||
| 921 | jnz .Ldec_loop | ||
| 922 | movdqa -0x20($const), @XMM[8] # .LISRM0 | ||
| 923 | jmp .Ldec_loop | ||
| 924 | .align 16 | ||
| 925 | .Ldec_done: | ||
| 926 | ___ | ||
| 927 | &bitslice (@XMM[0,1,6,4,2,7,3,5, 8..11]); | ||
| 928 | $code.=<<___; | ||
| 929 | movdqa ($key), @XMM[8] # last round key | ||
| 930 | pxor @XMM[8], @XMM[6] | ||
| 931 | pxor @XMM[8], @XMM[4] | ||
| 932 | pxor @XMM[8], @XMM[2] | ||
| 933 | pxor @XMM[8], @XMM[7] | ||
| 934 | pxor @XMM[8], @XMM[3] | ||
| 935 | pxor @XMM[8], @XMM[5] | ||
| 936 | pxor @XMM[8], @XMM[0] | ||
| 937 | pxor @XMM[8], @XMM[1] | ||
| 938 | ret | ||
| 939 | .size _bsaes_decrypt8,.-_bsaes_decrypt8 | ||
| 940 | ___ | ||
| 941 | } | ||
| 942 | { | ||
| 943 | my ($out,$inp,$rounds,$const)=("%rax","%rcx","%r10d","%r11"); | ||
| 944 | |||
| 945 | sub bitslice_key { | ||
| 946 | my @x=reverse(@_[0..7]); | ||
| 947 | my ($bs0,$bs1,$bs2,$t2,$t3)=@_[8..12]; | ||
| 948 | |||
| 949 | &swapmove (@x[0,1],1,$bs0,$t2,$t3); | ||
| 950 | $code.=<<___; | ||
| 951 | #&swapmove(@x[2,3],1,$t0,$t2,$t3); | ||
| 952 | movdqa @x[0], @x[2] | ||
| 953 | movdqa @x[1], @x[3] | ||
| 954 | ___ | ||
| 955 | #&swapmove2x(@x[4,5,6,7],1,$t0,$t2,$t3); | ||
| 956 | |||
| 957 | &swapmove2x (@x[0,2,1,3],2,$bs1,$t2,$t3); | ||
| 958 | $code.=<<___; | ||
| 959 | #&swapmove2x(@x[4,6,5,7],2,$t1,$t2,$t3); | ||
| 960 | movdqa @x[0], @x[4] | ||
| 961 | movdqa @x[2], @x[6] | ||
| 962 | movdqa @x[1], @x[5] | ||
| 963 | movdqa @x[3], @x[7] | ||
| 964 | ___ | ||
| 965 | &swapmove2x (@x[0,4,1,5],4,$bs2,$t2,$t3); | ||
| 966 | &swapmove2x (@x[2,6,3,7],4,$bs2,$t2,$t3); | ||
| 967 | } | ||
| 968 | |||
| 969 | $code.=<<___; | ||
| 970 | .type _bsaes_key_convert,\@abi-omnipotent | ||
| 971 | .align 16 | ||
| 972 | _bsaes_key_convert: | ||
| 973 | _CET_ENDBR | ||
| 974 | lea .Lmasks(%rip), $const | ||
| 975 | movdqu ($inp), %xmm7 # load round 0 key | ||
| 976 | lea 0x10($inp), $inp | ||
| 977 | movdqa 0x00($const), %xmm0 # 0x01... | ||
| 978 | movdqa 0x10($const), %xmm1 # 0x02... | ||
| 979 | movdqa 0x20($const), %xmm2 # 0x04... | ||
| 980 | movdqa 0x30($const), %xmm3 # 0x08... | ||
| 981 | movdqa 0x40($const), %xmm4 # .LM0 | ||
| 982 | pcmpeqd %xmm5, %xmm5 # .LNOT | ||
| 983 | |||
| 984 | movdqu ($inp), %xmm6 # load round 1 key | ||
| 985 | movdqa %xmm7, ($out) # save round 0 key | ||
| 986 | lea 0x10($out), $out | ||
| 987 | dec $rounds | ||
| 988 | jmp .Lkey_loop | ||
| 989 | .align 16 | ||
| 990 | .Lkey_loop: | ||
| 991 | pshufb %xmm4, %xmm6 # .LM0 | ||
| 992 | |||
| 993 | movdqa %xmm0, %xmm8 | ||
| 994 | movdqa %xmm1, %xmm9 | ||
| 995 | |||
| 996 | pand %xmm6, %xmm8 | ||
| 997 | pand %xmm6, %xmm9 | ||
| 998 | movdqa %xmm2, %xmm10 | ||
| 999 | pcmpeqb %xmm0, %xmm8 | ||
| 1000 | psllq \$4, %xmm0 # 0x10... | ||
| 1001 | movdqa %xmm3, %xmm11 | ||
| 1002 | pcmpeqb %xmm1, %xmm9 | ||
| 1003 | psllq \$4, %xmm1 # 0x20... | ||
| 1004 | |||
| 1005 | pand %xmm6, %xmm10 | ||
| 1006 | pand %xmm6, %xmm11 | ||
| 1007 | movdqa %xmm0, %xmm12 | ||
| 1008 | pcmpeqb %xmm2, %xmm10 | ||
| 1009 | psllq \$4, %xmm2 # 0x40... | ||
| 1010 | movdqa %xmm1, %xmm13 | ||
| 1011 | pcmpeqb %xmm3, %xmm11 | ||
| 1012 | psllq \$4, %xmm3 # 0x80... | ||
| 1013 | |||
| 1014 | movdqa %xmm2, %xmm14 | ||
| 1015 | movdqa %xmm3, %xmm15 | ||
| 1016 | pxor %xmm5, %xmm8 # "pnot" | ||
| 1017 | pxor %xmm5, %xmm9 | ||
| 1018 | |||
| 1019 | pand %xmm6, %xmm12 | ||
| 1020 | pand %xmm6, %xmm13 | ||
| 1021 | movdqa %xmm8, 0x00($out) # write bit-sliced round key | ||
| 1022 | pcmpeqb %xmm0, %xmm12 | ||
| 1023 | psrlq \$4, %xmm0 # 0x01... | ||
| 1024 | movdqa %xmm9, 0x10($out) | ||
| 1025 | pcmpeqb %xmm1, %xmm13 | ||
| 1026 | psrlq \$4, %xmm1 # 0x02... | ||
| 1027 | lea 0x10($inp), $inp | ||
| 1028 | |||
| 1029 | pand %xmm6, %xmm14 | ||
| 1030 | pand %xmm6, %xmm15 | ||
| 1031 | movdqa %xmm10, 0x20($out) | ||
| 1032 | pcmpeqb %xmm2, %xmm14 | ||
| 1033 | psrlq \$4, %xmm2 # 0x04... | ||
| 1034 | movdqa %xmm11, 0x30($out) | ||
| 1035 | pcmpeqb %xmm3, %xmm15 | ||
| 1036 | psrlq \$4, %xmm3 # 0x08... | ||
| 1037 | movdqu ($inp), %xmm6 # load next round key | ||
| 1038 | |||
| 1039 | pxor %xmm5, %xmm13 # "pnot" | ||
| 1040 | pxor %xmm5, %xmm14 | ||
| 1041 | movdqa %xmm12, 0x40($out) | ||
| 1042 | movdqa %xmm13, 0x50($out) | ||
| 1043 | movdqa %xmm14, 0x60($out) | ||
| 1044 | movdqa %xmm15, 0x70($out) | ||
| 1045 | lea 0x80($out),$out | ||
| 1046 | dec $rounds | ||
| 1047 | jnz .Lkey_loop | ||
| 1048 | |||
| 1049 | movdqa 0x50($const), %xmm7 # .L63 | ||
| 1050 | #movdqa %xmm6, ($out) # don't save last round key | ||
| 1051 | ret | ||
| 1052 | .size _bsaes_key_convert,.-_bsaes_key_convert | ||
| 1053 | ___ | ||
| 1054 | } | ||
| 1055 | |||
| 1056 | if (0 && !$win64) { # following four functions are unsupported interface | ||
| 1057 | # used for benchmarking... | ||
| 1058 | $code.=<<___; | ||
| 1059 | .globl bsaes_enc_key_convert | ||
| 1060 | .type bsaes_enc_key_convert,\@function,2 | ||
| 1061 | .align 16 | ||
| 1062 | bsaes_enc_key_convert: | ||
| 1063 | _CET_ENDBR | ||
| 1064 | mov 240($inp),%r10d # pass rounds | ||
| 1065 | mov $inp,%rcx # pass key | ||
| 1066 | mov $out,%rax # pass key schedule | ||
| 1067 | call _bsaes_key_convert | ||
| 1068 | pxor %xmm6,%xmm7 # fix up last round key | ||
| 1069 | movdqa %xmm7,(%rax) # save last round key | ||
| 1070 | ret | ||
| 1071 | .size bsaes_enc_key_convert,.-bsaes_enc_key_convert | ||
| 1072 | |||
| 1073 | .globl bsaes_encrypt_128 | ||
| 1074 | .type bsaes_encrypt_128,\@function,4 | ||
| 1075 | .align 16 | ||
| 1076 | bsaes_encrypt_128: | ||
| 1077 | .Lenc128_loop: | ||
| 1078 | _CET_ENDBR | ||
| 1079 | movdqu 0x00($inp), @XMM[0] # load input | ||
| 1080 | movdqu 0x10($inp), @XMM[1] | ||
| 1081 | movdqu 0x20($inp), @XMM[2] | ||
| 1082 | movdqu 0x30($inp), @XMM[3] | ||
| 1083 | movdqu 0x40($inp), @XMM[4] | ||
| 1084 | movdqu 0x50($inp), @XMM[5] | ||
| 1085 | movdqu 0x60($inp), @XMM[6] | ||
| 1086 | movdqu 0x70($inp), @XMM[7] | ||
| 1087 | mov $key, %rax # pass the $key | ||
| 1088 | lea 0x80($inp), $inp | ||
| 1089 | mov \$10,%r10d | ||
| 1090 | |||
| 1091 | call _bsaes_encrypt8 | ||
| 1092 | |||
| 1093 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1094 | movdqu @XMM[1], 0x10($out) | ||
| 1095 | movdqu @XMM[4], 0x20($out) | ||
| 1096 | movdqu @XMM[6], 0x30($out) | ||
| 1097 | movdqu @XMM[3], 0x40($out) | ||
| 1098 | movdqu @XMM[7], 0x50($out) | ||
| 1099 | movdqu @XMM[2], 0x60($out) | ||
| 1100 | movdqu @XMM[5], 0x70($out) | ||
| 1101 | lea 0x80($out), $out | ||
| 1102 | sub \$0x80,$len | ||
| 1103 | ja .Lenc128_loop | ||
| 1104 | ret | ||
| 1105 | .size bsaes_encrypt_128,.-bsaes_encrypt_128 | ||
| 1106 | |||
| 1107 | .globl bsaes_dec_key_convert | ||
| 1108 | .type bsaes_dec_key_convert,\@function,2 | ||
| 1109 | .align 16 | ||
| 1110 | bsaes_dec_key_convert: | ||
| 1111 | _CET_ENDBR | ||
| 1112 | mov 240($inp),%r10d # pass rounds | ||
| 1113 | mov $inp,%rcx # pass key | ||
| 1114 | mov $out,%rax # pass key schedule | ||
| 1115 | call _bsaes_key_convert | ||
| 1116 | pxor ($out),%xmm7 # fix up round 0 key | ||
| 1117 | movdqa %xmm6,(%rax) # save last round key | ||
| 1118 | movdqa %xmm7,($out) | ||
| 1119 | ret | ||
| 1120 | .size bsaes_dec_key_convert,.-bsaes_dec_key_convert | ||
| 1121 | |||
| 1122 | .globl bsaes_decrypt_128 | ||
| 1123 | .type bsaes_decrypt_128,\@function,4 | ||
| 1124 | .align 16 | ||
| 1125 | bsaes_decrypt_128: | ||
| 1126 | _CET_ENDBR | ||
| 1127 | .Ldec128_loop: | ||
| 1128 | movdqu 0x00($inp), @XMM[0] # load input | ||
| 1129 | movdqu 0x10($inp), @XMM[1] | ||
| 1130 | movdqu 0x20($inp), @XMM[2] | ||
| 1131 | movdqu 0x30($inp), @XMM[3] | ||
| 1132 | movdqu 0x40($inp), @XMM[4] | ||
| 1133 | movdqu 0x50($inp), @XMM[5] | ||
| 1134 | movdqu 0x60($inp), @XMM[6] | ||
| 1135 | movdqu 0x70($inp), @XMM[7] | ||
| 1136 | mov $key, %rax # pass the $key | ||
| 1137 | lea 0x80($inp), $inp | ||
| 1138 | mov \$10,%r10d | ||
| 1139 | |||
| 1140 | call _bsaes_decrypt8 | ||
| 1141 | |||
| 1142 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1143 | movdqu @XMM[1], 0x10($out) | ||
| 1144 | movdqu @XMM[6], 0x20($out) | ||
| 1145 | movdqu @XMM[4], 0x30($out) | ||
| 1146 | movdqu @XMM[2], 0x40($out) | ||
| 1147 | movdqu @XMM[7], 0x50($out) | ||
| 1148 | movdqu @XMM[3], 0x60($out) | ||
| 1149 | movdqu @XMM[5], 0x70($out) | ||
| 1150 | lea 0x80($out), $out | ||
| 1151 | sub \$0x80,$len | ||
| 1152 | ja .Ldec128_loop | ||
| 1153 | ret | ||
| 1154 | .size bsaes_decrypt_128,.-bsaes_decrypt_128 | ||
| 1155 | ___ | ||
| 1156 | } | ||
| 1157 | { | ||
| 1158 | ###################################################################### | ||
| 1159 | # | ||
| 1160 | # OpenSSL interface | ||
| 1161 | # | ||
| 1162 | my ($arg1,$arg2,$arg3,$arg4,$arg5,$arg6)=$win64 ? ("%rcx","%rdx","%r8","%r9","%r10","%r11d") | ||
| 1163 | : ("%rdi","%rsi","%rdx","%rcx","%r8","%r9d"); | ||
| 1164 | my ($inp,$out,$len,$key)=("%r12","%r13","%r14","%r15"); | ||
| 1165 | |||
| 1166 | if ($ecb) { | ||
| 1167 | $code.=<<___; | ||
| 1168 | .globl bsaes_ecb_encrypt_blocks | ||
| 1169 | .type bsaes_ecb_encrypt_blocks,\@abi-omnipotent | ||
| 1170 | .align 16 | ||
| 1171 | bsaes_ecb_encrypt_blocks: | ||
| 1172 | _CET_ENDBR | ||
| 1173 | mov %rsp, %rax | ||
| 1174 | .Lecb_enc_prologue: | ||
| 1175 | push %rbp | ||
| 1176 | push %rbx | ||
| 1177 | push %r12 | ||
| 1178 | push %r13 | ||
| 1179 | push %r14 | ||
| 1180 | push %r15 | ||
| 1181 | lea -0x48(%rsp),%rsp | ||
| 1182 | ___ | ||
| 1183 | $code.=<<___ if ($win64); | ||
| 1184 | lea -0xa0(%rsp), %rsp | ||
| 1185 | movaps %xmm6, 0x40(%rsp) | ||
| 1186 | movaps %xmm7, 0x50(%rsp) | ||
| 1187 | movaps %xmm8, 0x60(%rsp) | ||
| 1188 | movaps %xmm9, 0x70(%rsp) | ||
| 1189 | movaps %xmm10, 0x80(%rsp) | ||
| 1190 | movaps %xmm11, 0x90(%rsp) | ||
| 1191 | movaps %xmm12, 0xa0(%rsp) | ||
| 1192 | movaps %xmm13, 0xb0(%rsp) | ||
| 1193 | movaps %xmm14, 0xc0(%rsp) | ||
| 1194 | movaps %xmm15, 0xd0(%rsp) | ||
| 1195 | .Lecb_enc_body: | ||
| 1196 | ___ | ||
| 1197 | $code.=<<___; | ||
| 1198 | mov %rsp,%rbp # backup %rsp | ||
| 1199 | mov 240($arg4),%eax # rounds | ||
| 1200 | mov $arg1,$inp # backup arguments | ||
| 1201 | mov $arg2,$out | ||
| 1202 | mov $arg3,$len | ||
| 1203 | mov $arg4,$key | ||
| 1204 | cmp \$8,$arg3 | ||
| 1205 | jb .Lecb_enc_short | ||
| 1206 | |||
| 1207 | mov %eax,%ebx # backup rounds | ||
| 1208 | shl \$7,%rax # 128 bytes per inner round key | ||
| 1209 | sub \$`128-32`,%rax # size of bit-sliced key schedule | ||
| 1210 | sub %rax,%rsp | ||
| 1211 | mov %rsp,%rax # pass key schedule | ||
| 1212 | mov $key,%rcx # pass key | ||
| 1213 | mov %ebx,%r10d # pass rounds | ||
| 1214 | call _bsaes_key_convert | ||
| 1215 | pxor %xmm6,%xmm7 # fix up last round key | ||
| 1216 | movdqa %xmm7,(%rax) # save last round key | ||
| 1217 | |||
| 1218 | sub \$8,$len | ||
| 1219 | .Lecb_enc_loop: | ||
| 1220 | movdqu 0x00($inp), @XMM[0] # load input | ||
| 1221 | movdqu 0x10($inp), @XMM[1] | ||
| 1222 | movdqu 0x20($inp), @XMM[2] | ||
| 1223 | movdqu 0x30($inp), @XMM[3] | ||
| 1224 | movdqu 0x40($inp), @XMM[4] | ||
| 1225 | movdqu 0x50($inp), @XMM[5] | ||
| 1226 | mov %rsp, %rax # pass key schedule | ||
| 1227 | movdqu 0x60($inp), @XMM[6] | ||
| 1228 | mov %ebx,%r10d # pass rounds | ||
| 1229 | movdqu 0x70($inp), @XMM[7] | ||
| 1230 | lea 0x80($inp), $inp | ||
| 1231 | |||
| 1232 | call _bsaes_encrypt8 | ||
| 1233 | |||
| 1234 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1235 | movdqu @XMM[1], 0x10($out) | ||
| 1236 | movdqu @XMM[4], 0x20($out) | ||
| 1237 | movdqu @XMM[6], 0x30($out) | ||
| 1238 | movdqu @XMM[3], 0x40($out) | ||
| 1239 | movdqu @XMM[7], 0x50($out) | ||
| 1240 | movdqu @XMM[2], 0x60($out) | ||
| 1241 | movdqu @XMM[5], 0x70($out) | ||
| 1242 | lea 0x80($out), $out | ||
| 1243 | sub \$8,$len | ||
| 1244 | jnc .Lecb_enc_loop | ||
| 1245 | |||
| 1246 | add \$8,$len | ||
| 1247 | jz .Lecb_enc_done | ||
| 1248 | |||
| 1249 | movdqu 0x00($inp), @XMM[0] # load input | ||
| 1250 | mov %rsp, %rax # pass key schedule | ||
| 1251 | mov %ebx,%r10d # pass rounds | ||
| 1252 | cmp \$2,$len | ||
| 1253 | jb .Lecb_enc_one | ||
| 1254 | movdqu 0x10($inp), @XMM[1] | ||
| 1255 | je .Lecb_enc_two | ||
| 1256 | movdqu 0x20($inp), @XMM[2] | ||
| 1257 | cmp \$4,$len | ||
| 1258 | jb .Lecb_enc_three | ||
| 1259 | movdqu 0x30($inp), @XMM[3] | ||
| 1260 | je .Lecb_enc_four | ||
| 1261 | movdqu 0x40($inp), @XMM[4] | ||
| 1262 | cmp \$6,$len | ||
| 1263 | jb .Lecb_enc_five | ||
| 1264 | movdqu 0x50($inp), @XMM[5] | ||
| 1265 | je .Lecb_enc_six | ||
| 1266 | movdqu 0x60($inp), @XMM[6] | ||
| 1267 | call _bsaes_encrypt8 | ||
| 1268 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1269 | movdqu @XMM[1], 0x10($out) | ||
| 1270 | movdqu @XMM[4], 0x20($out) | ||
| 1271 | movdqu @XMM[6], 0x30($out) | ||
| 1272 | movdqu @XMM[3], 0x40($out) | ||
| 1273 | movdqu @XMM[7], 0x50($out) | ||
| 1274 | movdqu @XMM[2], 0x60($out) | ||
| 1275 | jmp .Lecb_enc_done | ||
| 1276 | .align 16 | ||
| 1277 | .Lecb_enc_six: | ||
| 1278 | call _bsaes_encrypt8 | ||
| 1279 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1280 | movdqu @XMM[1], 0x10($out) | ||
| 1281 | movdqu @XMM[4], 0x20($out) | ||
| 1282 | movdqu @XMM[6], 0x30($out) | ||
| 1283 | movdqu @XMM[3], 0x40($out) | ||
| 1284 | movdqu @XMM[7], 0x50($out) | ||
| 1285 | jmp .Lecb_enc_done | ||
| 1286 | .align 16 | ||
| 1287 | .Lecb_enc_five: | ||
| 1288 | call _bsaes_encrypt8 | ||
| 1289 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1290 | movdqu @XMM[1], 0x10($out) | ||
| 1291 | movdqu @XMM[4], 0x20($out) | ||
| 1292 | movdqu @XMM[6], 0x30($out) | ||
| 1293 | movdqu @XMM[3], 0x40($out) | ||
| 1294 | jmp .Lecb_enc_done | ||
| 1295 | .align 16 | ||
| 1296 | .Lecb_enc_four: | ||
| 1297 | call _bsaes_encrypt8 | ||
| 1298 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1299 | movdqu @XMM[1], 0x10($out) | ||
| 1300 | movdqu @XMM[4], 0x20($out) | ||
| 1301 | movdqu @XMM[6], 0x30($out) | ||
| 1302 | jmp .Lecb_enc_done | ||
| 1303 | .align 16 | ||
| 1304 | .Lecb_enc_three: | ||
| 1305 | call _bsaes_encrypt8 | ||
| 1306 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1307 | movdqu @XMM[1], 0x10($out) | ||
| 1308 | movdqu @XMM[4], 0x20($out) | ||
| 1309 | jmp .Lecb_enc_done | ||
| 1310 | .align 16 | ||
| 1311 | .Lecb_enc_two: | ||
| 1312 | call _bsaes_encrypt8 | ||
| 1313 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1314 | movdqu @XMM[1], 0x10($out) | ||
| 1315 | jmp .Lecb_enc_done | ||
| 1316 | .align 16 | ||
| 1317 | .Lecb_enc_one: | ||
| 1318 | call _bsaes_encrypt8 | ||
| 1319 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1320 | jmp .Lecb_enc_done | ||
| 1321 | .align 16 | ||
| 1322 | .Lecb_enc_short: | ||
| 1323 | lea ($inp), $arg1 | ||
| 1324 | lea ($out), $arg2 | ||
| 1325 | lea ($key), $arg3 | ||
| 1326 | call asm_AES_encrypt | ||
| 1327 | lea 16($inp), $inp | ||
| 1328 | lea 16($out), $out | ||
| 1329 | dec $len | ||
| 1330 | jnz .Lecb_enc_short | ||
| 1331 | |||
| 1332 | .Lecb_enc_done: | ||
| 1333 | lea (%rsp),%rax | ||
| 1334 | pxor %xmm0, %xmm0 | ||
| 1335 | .Lecb_enc_bzero: # wipe key schedule [if any] | ||
| 1336 | movdqa %xmm0, 0x00(%rax) | ||
| 1337 | movdqa %xmm0, 0x10(%rax) | ||
| 1338 | lea 0x20(%rax), %rax | ||
| 1339 | cmp %rax, %rbp | ||
| 1340 | jb .Lecb_enc_bzero | ||
| 1341 | |||
| 1342 | lea (%rbp),%rsp # restore %rsp | ||
| 1343 | ___ | ||
| 1344 | $code.=<<___ if ($win64); | ||
| 1345 | movaps 0x40(%rbp), %xmm6 | ||
| 1346 | movaps 0x50(%rbp), %xmm7 | ||
| 1347 | movaps 0x60(%rbp), %xmm8 | ||
| 1348 | movaps 0x70(%rbp), %xmm9 | ||
| 1349 | movaps 0x80(%rbp), %xmm10 | ||
| 1350 | movaps 0x90(%rbp), %xmm11 | ||
| 1351 | movaps 0xa0(%rbp), %xmm12 | ||
| 1352 | movaps 0xb0(%rbp), %xmm13 | ||
| 1353 | movaps 0xc0(%rbp), %xmm14 | ||
| 1354 | movaps 0xd0(%rbp), %xmm15 | ||
| 1355 | lea 0xa0(%rbp), %rsp | ||
| 1356 | ___ | ||
| 1357 | $code.=<<___; | ||
| 1358 | mov 0x48(%rsp), %r15 | ||
| 1359 | mov 0x50(%rsp), %r14 | ||
| 1360 | mov 0x58(%rsp), %r13 | ||
| 1361 | mov 0x60(%rsp), %r12 | ||
| 1362 | mov 0x68(%rsp), %rbx | ||
| 1363 | mov 0x70(%rsp), %rax | ||
| 1364 | lea 0x78(%rsp), %rsp | ||
| 1365 | mov %rax, %rbp | ||
| 1366 | .Lecb_enc_epilogue: | ||
| 1367 | ret | ||
| 1368 | .size bsaes_ecb_encrypt_blocks,.-bsaes_ecb_encrypt_blocks | ||
| 1369 | |||
| 1370 | .globl bsaes_ecb_decrypt_blocks | ||
| 1371 | .type bsaes_ecb_decrypt_blocks,\@abi-omnipotent | ||
| 1372 | .align 16 | ||
| 1373 | bsaes_ecb_decrypt_blocks: | ||
| 1374 | _CET_ENDBR | ||
| 1375 | mov %rsp, %rax | ||
| 1376 | .Lecb_dec_prologue: | ||
| 1377 | push %rbp | ||
| 1378 | push %rbx | ||
| 1379 | push %r12 | ||
| 1380 | push %r13 | ||
| 1381 | push %r14 | ||
| 1382 | push %r15 | ||
| 1383 | lea -0x48(%rsp),%rsp | ||
| 1384 | ___ | ||
| 1385 | $code.=<<___ if ($win64); | ||
| 1386 | lea -0xa0(%rsp), %rsp | ||
| 1387 | movaps %xmm6, 0x40(%rsp) | ||
| 1388 | movaps %xmm7, 0x50(%rsp) | ||
| 1389 | movaps %xmm8, 0x60(%rsp) | ||
| 1390 | movaps %xmm9, 0x70(%rsp) | ||
| 1391 | movaps %xmm10, 0x80(%rsp) | ||
| 1392 | movaps %xmm11, 0x90(%rsp) | ||
| 1393 | movaps %xmm12, 0xa0(%rsp) | ||
| 1394 | movaps %xmm13, 0xb0(%rsp) | ||
| 1395 | movaps %xmm14, 0xc0(%rsp) | ||
| 1396 | movaps %xmm15, 0xd0(%rsp) | ||
| 1397 | .Lecb_dec_body: | ||
| 1398 | ___ | ||
| 1399 | $code.=<<___; | ||
| 1400 | mov %rsp,%rbp # backup %rsp | ||
| 1401 | mov 240($arg4),%eax # rounds | ||
| 1402 | mov $arg1,$inp # backup arguments | ||
| 1403 | mov $arg2,$out | ||
| 1404 | mov $arg3,$len | ||
| 1405 | mov $arg4,$key | ||
| 1406 | cmp \$8,$arg3 | ||
| 1407 | jb .Lecb_dec_short | ||
| 1408 | |||
| 1409 | mov %eax,%ebx # backup rounds | ||
| 1410 | shl \$7,%rax # 128 bytes per inner round key | ||
| 1411 | sub \$`128-32`,%rax # size of bit-sliced key schedule | ||
| 1412 | sub %rax,%rsp | ||
| 1413 | mov %rsp,%rax # pass key schedule | ||
| 1414 | mov $key,%rcx # pass key | ||
| 1415 | mov %ebx,%r10d # pass rounds | ||
| 1416 | call _bsaes_key_convert | ||
| 1417 | pxor (%rsp),%xmm7 # fix up 0 round key | ||
| 1418 | movdqa %xmm6,(%rax) # save last round key | ||
| 1419 | movdqa %xmm7,(%rsp) | ||
| 1420 | |||
| 1421 | sub \$8,$len | ||
| 1422 | .Lecb_dec_loop: | ||
| 1423 | movdqu 0x00($inp), @XMM[0] # load input | ||
| 1424 | movdqu 0x10($inp), @XMM[1] | ||
| 1425 | movdqu 0x20($inp), @XMM[2] | ||
| 1426 | movdqu 0x30($inp), @XMM[3] | ||
| 1427 | movdqu 0x40($inp), @XMM[4] | ||
| 1428 | movdqu 0x50($inp), @XMM[5] | ||
| 1429 | mov %rsp, %rax # pass key schedule | ||
| 1430 | movdqu 0x60($inp), @XMM[6] | ||
| 1431 | mov %ebx,%r10d # pass rounds | ||
| 1432 | movdqu 0x70($inp), @XMM[7] | ||
| 1433 | lea 0x80($inp), $inp | ||
| 1434 | |||
| 1435 | call _bsaes_decrypt8 | ||
| 1436 | |||
| 1437 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1438 | movdqu @XMM[1], 0x10($out) | ||
| 1439 | movdqu @XMM[6], 0x20($out) | ||
| 1440 | movdqu @XMM[4], 0x30($out) | ||
| 1441 | movdqu @XMM[2], 0x40($out) | ||
| 1442 | movdqu @XMM[7], 0x50($out) | ||
| 1443 | movdqu @XMM[3], 0x60($out) | ||
| 1444 | movdqu @XMM[5], 0x70($out) | ||
| 1445 | lea 0x80($out), $out | ||
| 1446 | sub \$8,$len | ||
| 1447 | jnc .Lecb_dec_loop | ||
| 1448 | |||
| 1449 | add \$8,$len | ||
| 1450 | jz .Lecb_dec_done | ||
| 1451 | |||
| 1452 | movdqu 0x00($inp), @XMM[0] # load input | ||
| 1453 | mov %rsp, %rax # pass key schedule | ||
| 1454 | mov %ebx,%r10d # pass rounds | ||
| 1455 | cmp \$2,$len | ||
| 1456 | jb .Lecb_dec_one | ||
| 1457 | movdqu 0x10($inp), @XMM[1] | ||
| 1458 | je .Lecb_dec_two | ||
| 1459 | movdqu 0x20($inp), @XMM[2] | ||
| 1460 | cmp \$4,$len | ||
| 1461 | jb .Lecb_dec_three | ||
| 1462 | movdqu 0x30($inp), @XMM[3] | ||
| 1463 | je .Lecb_dec_four | ||
| 1464 | movdqu 0x40($inp), @XMM[4] | ||
| 1465 | cmp \$6,$len | ||
| 1466 | jb .Lecb_dec_five | ||
| 1467 | movdqu 0x50($inp), @XMM[5] | ||
| 1468 | je .Lecb_dec_six | ||
| 1469 | movdqu 0x60($inp), @XMM[6] | ||
| 1470 | call _bsaes_decrypt8 | ||
| 1471 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1472 | movdqu @XMM[1], 0x10($out) | ||
| 1473 | movdqu @XMM[6], 0x20($out) | ||
| 1474 | movdqu @XMM[4], 0x30($out) | ||
| 1475 | movdqu @XMM[2], 0x40($out) | ||
| 1476 | movdqu @XMM[7], 0x50($out) | ||
| 1477 | movdqu @XMM[3], 0x60($out) | ||
| 1478 | jmp .Lecb_dec_done | ||
| 1479 | .align 16 | ||
| 1480 | .Lecb_dec_six: | ||
| 1481 | call _bsaes_decrypt8 | ||
| 1482 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1483 | movdqu @XMM[1], 0x10($out) | ||
| 1484 | movdqu @XMM[6], 0x20($out) | ||
| 1485 | movdqu @XMM[4], 0x30($out) | ||
| 1486 | movdqu @XMM[2], 0x40($out) | ||
| 1487 | movdqu @XMM[7], 0x50($out) | ||
| 1488 | jmp .Lecb_dec_done | ||
| 1489 | .align 16 | ||
| 1490 | .Lecb_dec_five: | ||
| 1491 | call _bsaes_decrypt8 | ||
| 1492 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1493 | movdqu @XMM[1], 0x10($out) | ||
| 1494 | movdqu @XMM[6], 0x20($out) | ||
| 1495 | movdqu @XMM[4], 0x30($out) | ||
| 1496 | movdqu @XMM[2], 0x40($out) | ||
| 1497 | jmp .Lecb_dec_done | ||
| 1498 | .align 16 | ||
| 1499 | .Lecb_dec_four: | ||
| 1500 | call _bsaes_decrypt8 | ||
| 1501 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1502 | movdqu @XMM[1], 0x10($out) | ||
| 1503 | movdqu @XMM[6], 0x20($out) | ||
| 1504 | movdqu @XMM[4], 0x30($out) | ||
| 1505 | jmp .Lecb_dec_done | ||
| 1506 | .align 16 | ||
| 1507 | .Lecb_dec_three: | ||
| 1508 | call _bsaes_decrypt8 | ||
| 1509 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1510 | movdqu @XMM[1], 0x10($out) | ||
| 1511 | movdqu @XMM[6], 0x20($out) | ||
| 1512 | jmp .Lecb_dec_done | ||
| 1513 | .align 16 | ||
| 1514 | .Lecb_dec_two: | ||
| 1515 | call _bsaes_decrypt8 | ||
| 1516 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1517 | movdqu @XMM[1], 0x10($out) | ||
| 1518 | jmp .Lecb_dec_done | ||
| 1519 | .align 16 | ||
| 1520 | .Lecb_dec_one: | ||
| 1521 | call _bsaes_decrypt8 | ||
| 1522 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1523 | jmp .Lecb_dec_done | ||
| 1524 | .align 16 | ||
| 1525 | .Lecb_dec_short: | ||
| 1526 | lea ($inp), $arg1 | ||
| 1527 | lea ($out), $arg2 | ||
| 1528 | lea ($key), $arg3 | ||
| 1529 | call asm_AES_decrypt | ||
| 1530 | lea 16($inp), $inp | ||
| 1531 | lea 16($out), $out | ||
| 1532 | dec $len | ||
| 1533 | jnz .Lecb_dec_short | ||
| 1534 | |||
| 1535 | .Lecb_dec_done: | ||
| 1536 | lea (%rsp),%rax | ||
| 1537 | pxor %xmm0, %xmm0 | ||
| 1538 | .Lecb_dec_bzero: # wipe key schedule [if any] | ||
| 1539 | movdqa %xmm0, 0x00(%rax) | ||
| 1540 | movdqa %xmm0, 0x10(%rax) | ||
| 1541 | lea 0x20(%rax), %rax | ||
| 1542 | cmp %rax, %rbp | ||
| 1543 | jb .Lecb_dec_bzero | ||
| 1544 | |||
| 1545 | lea (%rbp),%rsp # restore %rsp | ||
| 1546 | ___ | ||
| 1547 | $code.=<<___ if ($win64); | ||
| 1548 | movaps 0x40(%rbp), %xmm6 | ||
| 1549 | movaps 0x50(%rbp), %xmm7 | ||
| 1550 | movaps 0x60(%rbp), %xmm8 | ||
| 1551 | movaps 0x70(%rbp), %xmm9 | ||
| 1552 | movaps 0x80(%rbp), %xmm10 | ||
| 1553 | movaps 0x90(%rbp), %xmm11 | ||
| 1554 | movaps 0xa0(%rbp), %xmm12 | ||
| 1555 | movaps 0xb0(%rbp), %xmm13 | ||
| 1556 | movaps 0xc0(%rbp), %xmm14 | ||
| 1557 | movaps 0xd0(%rbp), %xmm15 | ||
| 1558 | lea 0xa0(%rbp), %rsp | ||
| 1559 | ___ | ||
| 1560 | $code.=<<___; | ||
| 1561 | mov 0x48(%rsp), %r15 | ||
| 1562 | mov 0x50(%rsp), %r14 | ||
| 1563 | mov 0x58(%rsp), %r13 | ||
| 1564 | mov 0x60(%rsp), %r12 | ||
| 1565 | mov 0x68(%rsp), %rbx | ||
| 1566 | mov 0x70(%rsp), %rax | ||
| 1567 | lea 0x78(%rsp), %rsp | ||
| 1568 | mov %rax, %rbp | ||
| 1569 | .Lecb_dec_epilogue: | ||
| 1570 | ret | ||
| 1571 | .size bsaes_ecb_decrypt_blocks,.-bsaes_ecb_decrypt_blocks | ||
| 1572 | ___ | ||
| 1573 | } | ||
| 1574 | $code.=<<___; | ||
| 1575 | .extern asm_AES_cbc_encrypt | ||
| 1576 | .globl bsaes_cbc_encrypt | ||
| 1577 | .type bsaes_cbc_encrypt,\@abi-omnipotent | ||
| 1578 | .align 16 | ||
| 1579 | bsaes_cbc_encrypt: | ||
| 1580 | _CET_ENDBR | ||
| 1581 | ___ | ||
| 1582 | $code.=<<___ if ($win64); | ||
| 1583 | mov 48(%rsp),$arg6 # pull direction flag | ||
| 1584 | ___ | ||
| 1585 | $code.=<<___; | ||
| 1586 | cmp \$0,$arg6 | ||
| 1587 | jne asm_AES_cbc_encrypt | ||
| 1588 | cmp \$128,$arg3 | ||
| 1589 | jb asm_AES_cbc_encrypt | ||
| 1590 | |||
| 1591 | mov %rsp, %rax | ||
| 1592 | .Lcbc_dec_prologue: | ||
| 1593 | push %rbp | ||
| 1594 | push %rbx | ||
| 1595 | push %r12 | ||
| 1596 | push %r13 | ||
| 1597 | push %r14 | ||
| 1598 | push %r15 | ||
| 1599 | lea -0x48(%rsp), %rsp | ||
| 1600 | ___ | ||
| 1601 | $code.=<<___ if ($win64); | ||
| 1602 | mov 0xa0(%rsp),$arg5 # pull ivp | ||
| 1603 | lea -0xa0(%rsp), %rsp | ||
| 1604 | movaps %xmm6, 0x40(%rsp) | ||
| 1605 | movaps %xmm7, 0x50(%rsp) | ||
| 1606 | movaps %xmm8, 0x60(%rsp) | ||
| 1607 | movaps %xmm9, 0x70(%rsp) | ||
| 1608 | movaps %xmm10, 0x80(%rsp) | ||
| 1609 | movaps %xmm11, 0x90(%rsp) | ||
| 1610 | movaps %xmm12, 0xa0(%rsp) | ||
| 1611 | movaps %xmm13, 0xb0(%rsp) | ||
| 1612 | movaps %xmm14, 0xc0(%rsp) | ||
| 1613 | movaps %xmm15, 0xd0(%rsp) | ||
| 1614 | .Lcbc_dec_body: | ||
| 1615 | ___ | ||
| 1616 | $code.=<<___; | ||
| 1617 | mov %rsp, %rbp # backup %rsp | ||
| 1618 | mov 240($arg4), %eax # rounds | ||
| 1619 | mov $arg1, $inp # backup arguments | ||
| 1620 | mov $arg2, $out | ||
| 1621 | mov $arg3, $len | ||
| 1622 | mov $arg4, $key | ||
| 1623 | mov $arg5, %rbx | ||
| 1624 | shr \$4, $len # bytes to blocks | ||
| 1625 | |||
| 1626 | mov %eax, %edx # rounds | ||
| 1627 | shl \$7, %rax # 128 bytes per inner round key | ||
| 1628 | sub \$`128-32`, %rax # size of bit-sliced key schedule | ||
| 1629 | sub %rax, %rsp | ||
| 1630 | |||
| 1631 | mov %rsp, %rax # pass key schedule | ||
| 1632 | mov $key, %rcx # pass key | ||
| 1633 | mov %edx, %r10d # pass rounds | ||
| 1634 | call _bsaes_key_convert | ||
| 1635 | pxor (%rsp),%xmm7 # fix up 0 round key | ||
| 1636 | movdqa %xmm6,(%rax) # save last round key | ||
| 1637 | movdqa %xmm7,(%rsp) | ||
| 1638 | |||
| 1639 | movdqu (%rbx), @XMM[15] # load IV | ||
| 1640 | sub \$8,$len | ||
| 1641 | .Lcbc_dec_loop: | ||
| 1642 | movdqu 0x00($inp), @XMM[0] # load input | ||
| 1643 | movdqu 0x10($inp), @XMM[1] | ||
| 1644 | movdqu 0x20($inp), @XMM[2] | ||
| 1645 | movdqu 0x30($inp), @XMM[3] | ||
| 1646 | movdqu 0x40($inp), @XMM[4] | ||
| 1647 | movdqu 0x50($inp), @XMM[5] | ||
| 1648 | mov %rsp, %rax # pass key schedule | ||
| 1649 | movdqu 0x60($inp), @XMM[6] | ||
| 1650 | mov %edx,%r10d # pass rounds | ||
| 1651 | movdqu 0x70($inp), @XMM[7] | ||
| 1652 | movdqa @XMM[15], 0x20(%rbp) # put aside IV | ||
| 1653 | |||
| 1654 | call _bsaes_decrypt8 | ||
| 1655 | |||
| 1656 | pxor 0x20(%rbp), @XMM[0] # ^= IV | ||
| 1657 | movdqu 0x00($inp), @XMM[8] # re-load input | ||
| 1658 | movdqu 0x10($inp), @XMM[9] | ||
| 1659 | pxor @XMM[8], @XMM[1] | ||
| 1660 | movdqu 0x20($inp), @XMM[10] | ||
| 1661 | pxor @XMM[9], @XMM[6] | ||
| 1662 | movdqu 0x30($inp), @XMM[11] | ||
| 1663 | pxor @XMM[10], @XMM[4] | ||
| 1664 | movdqu 0x40($inp), @XMM[12] | ||
| 1665 | pxor @XMM[11], @XMM[2] | ||
| 1666 | movdqu 0x50($inp), @XMM[13] | ||
| 1667 | pxor @XMM[12], @XMM[7] | ||
| 1668 | movdqu 0x60($inp), @XMM[14] | ||
| 1669 | pxor @XMM[13], @XMM[3] | ||
| 1670 | movdqu 0x70($inp), @XMM[15] # IV | ||
| 1671 | pxor @XMM[14], @XMM[5] | ||
| 1672 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1673 | lea 0x80($inp), $inp | ||
| 1674 | movdqu @XMM[1], 0x10($out) | ||
| 1675 | movdqu @XMM[6], 0x20($out) | ||
| 1676 | movdqu @XMM[4], 0x30($out) | ||
| 1677 | movdqu @XMM[2], 0x40($out) | ||
| 1678 | movdqu @XMM[7], 0x50($out) | ||
| 1679 | movdqu @XMM[3], 0x60($out) | ||
| 1680 | movdqu @XMM[5], 0x70($out) | ||
| 1681 | lea 0x80($out), $out | ||
| 1682 | sub \$8,$len | ||
| 1683 | jnc .Lcbc_dec_loop | ||
| 1684 | |||
| 1685 | add \$8,$len | ||
| 1686 | jz .Lcbc_dec_done | ||
| 1687 | |||
| 1688 | movdqu 0x00($inp), @XMM[0] # load input | ||
| 1689 | mov %rsp, %rax # pass key schedule | ||
| 1690 | mov %edx, %r10d # pass rounds | ||
| 1691 | cmp \$2,$len | ||
| 1692 | jb .Lcbc_dec_one | ||
| 1693 | movdqu 0x10($inp), @XMM[1] | ||
| 1694 | je .Lcbc_dec_two | ||
| 1695 | movdqu 0x20($inp), @XMM[2] | ||
| 1696 | cmp \$4,$len | ||
| 1697 | jb .Lcbc_dec_three | ||
| 1698 | movdqu 0x30($inp), @XMM[3] | ||
| 1699 | je .Lcbc_dec_four | ||
| 1700 | movdqu 0x40($inp), @XMM[4] | ||
| 1701 | cmp \$6,$len | ||
| 1702 | jb .Lcbc_dec_five | ||
| 1703 | movdqu 0x50($inp), @XMM[5] | ||
| 1704 | je .Lcbc_dec_six | ||
| 1705 | movdqu 0x60($inp), @XMM[6] | ||
| 1706 | movdqa @XMM[15], 0x20(%rbp) # put aside IV | ||
| 1707 | call _bsaes_decrypt8 | ||
| 1708 | pxor 0x20(%rbp), @XMM[0] # ^= IV | ||
| 1709 | movdqu 0x00($inp), @XMM[8] # re-load input | ||
| 1710 | movdqu 0x10($inp), @XMM[9] | ||
| 1711 | pxor @XMM[8], @XMM[1] | ||
| 1712 | movdqu 0x20($inp), @XMM[10] | ||
| 1713 | pxor @XMM[9], @XMM[6] | ||
| 1714 | movdqu 0x30($inp), @XMM[11] | ||
| 1715 | pxor @XMM[10], @XMM[4] | ||
| 1716 | movdqu 0x40($inp), @XMM[12] | ||
| 1717 | pxor @XMM[11], @XMM[2] | ||
| 1718 | movdqu 0x50($inp), @XMM[13] | ||
| 1719 | pxor @XMM[12], @XMM[7] | ||
| 1720 | movdqu 0x60($inp), @XMM[15] # IV | ||
| 1721 | pxor @XMM[13], @XMM[3] | ||
| 1722 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1723 | movdqu @XMM[1], 0x10($out) | ||
| 1724 | movdqu @XMM[6], 0x20($out) | ||
| 1725 | movdqu @XMM[4], 0x30($out) | ||
| 1726 | movdqu @XMM[2], 0x40($out) | ||
| 1727 | movdqu @XMM[7], 0x50($out) | ||
| 1728 | movdqu @XMM[3], 0x60($out) | ||
| 1729 | jmp .Lcbc_dec_done | ||
| 1730 | .align 16 | ||
| 1731 | .Lcbc_dec_six: | ||
| 1732 | movdqa @XMM[15], 0x20(%rbp) # put aside IV | ||
| 1733 | call _bsaes_decrypt8 | ||
| 1734 | pxor 0x20(%rbp), @XMM[0] # ^= IV | ||
| 1735 | movdqu 0x00($inp), @XMM[8] # re-load input | ||
| 1736 | movdqu 0x10($inp), @XMM[9] | ||
| 1737 | pxor @XMM[8], @XMM[1] | ||
| 1738 | movdqu 0x20($inp), @XMM[10] | ||
| 1739 | pxor @XMM[9], @XMM[6] | ||
| 1740 | movdqu 0x30($inp), @XMM[11] | ||
| 1741 | pxor @XMM[10], @XMM[4] | ||
| 1742 | movdqu 0x40($inp), @XMM[12] | ||
| 1743 | pxor @XMM[11], @XMM[2] | ||
| 1744 | movdqu 0x50($inp), @XMM[15] # IV | ||
| 1745 | pxor @XMM[12], @XMM[7] | ||
| 1746 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1747 | movdqu @XMM[1], 0x10($out) | ||
| 1748 | movdqu @XMM[6], 0x20($out) | ||
| 1749 | movdqu @XMM[4], 0x30($out) | ||
| 1750 | movdqu @XMM[2], 0x40($out) | ||
| 1751 | movdqu @XMM[7], 0x50($out) | ||
| 1752 | jmp .Lcbc_dec_done | ||
| 1753 | .align 16 | ||
| 1754 | .Lcbc_dec_five: | ||
| 1755 | movdqa @XMM[15], 0x20(%rbp) # put aside IV | ||
| 1756 | call _bsaes_decrypt8 | ||
| 1757 | pxor 0x20(%rbp), @XMM[0] # ^= IV | ||
| 1758 | movdqu 0x00($inp), @XMM[8] # re-load input | ||
| 1759 | movdqu 0x10($inp), @XMM[9] | ||
| 1760 | pxor @XMM[8], @XMM[1] | ||
| 1761 | movdqu 0x20($inp), @XMM[10] | ||
| 1762 | pxor @XMM[9], @XMM[6] | ||
| 1763 | movdqu 0x30($inp), @XMM[11] | ||
| 1764 | pxor @XMM[10], @XMM[4] | ||
| 1765 | movdqu 0x40($inp), @XMM[15] # IV | ||
| 1766 | pxor @XMM[11], @XMM[2] | ||
| 1767 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1768 | movdqu @XMM[1], 0x10($out) | ||
| 1769 | movdqu @XMM[6], 0x20($out) | ||
| 1770 | movdqu @XMM[4], 0x30($out) | ||
| 1771 | movdqu @XMM[2], 0x40($out) | ||
| 1772 | jmp .Lcbc_dec_done | ||
| 1773 | .align 16 | ||
| 1774 | .Lcbc_dec_four: | ||
| 1775 | movdqa @XMM[15], 0x20(%rbp) # put aside IV | ||
| 1776 | call _bsaes_decrypt8 | ||
| 1777 | pxor 0x20(%rbp), @XMM[0] # ^= IV | ||
| 1778 | movdqu 0x00($inp), @XMM[8] # re-load input | ||
| 1779 | movdqu 0x10($inp), @XMM[9] | ||
| 1780 | pxor @XMM[8], @XMM[1] | ||
| 1781 | movdqu 0x20($inp), @XMM[10] | ||
| 1782 | pxor @XMM[9], @XMM[6] | ||
| 1783 | movdqu 0x30($inp), @XMM[15] # IV | ||
| 1784 | pxor @XMM[10], @XMM[4] | ||
| 1785 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1786 | movdqu @XMM[1], 0x10($out) | ||
| 1787 | movdqu @XMM[6], 0x20($out) | ||
| 1788 | movdqu @XMM[4], 0x30($out) | ||
| 1789 | jmp .Lcbc_dec_done | ||
| 1790 | .align 16 | ||
| 1791 | .Lcbc_dec_three: | ||
| 1792 | movdqa @XMM[15], 0x20(%rbp) # put aside IV | ||
| 1793 | call _bsaes_decrypt8 | ||
| 1794 | pxor 0x20(%rbp), @XMM[0] # ^= IV | ||
| 1795 | movdqu 0x00($inp), @XMM[8] # re-load input | ||
| 1796 | movdqu 0x10($inp), @XMM[9] | ||
| 1797 | pxor @XMM[8], @XMM[1] | ||
| 1798 | movdqu 0x20($inp), @XMM[15] # IV | ||
| 1799 | pxor @XMM[9], @XMM[6] | ||
| 1800 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1801 | movdqu @XMM[1], 0x10($out) | ||
| 1802 | movdqu @XMM[6], 0x20($out) | ||
| 1803 | jmp .Lcbc_dec_done | ||
| 1804 | .align 16 | ||
| 1805 | .Lcbc_dec_two: | ||
| 1806 | movdqa @XMM[15], 0x20(%rbp) # put aside IV | ||
| 1807 | call _bsaes_decrypt8 | ||
| 1808 | pxor 0x20(%rbp), @XMM[0] # ^= IV | ||
| 1809 | movdqu 0x00($inp), @XMM[8] # re-load input | ||
| 1810 | movdqu 0x10($inp), @XMM[15] # IV | ||
| 1811 | pxor @XMM[8], @XMM[1] | ||
| 1812 | movdqu @XMM[0], 0x00($out) # write output | ||
| 1813 | movdqu @XMM[1], 0x10($out) | ||
| 1814 | jmp .Lcbc_dec_done | ||
| 1815 | .align 16 | ||
| 1816 | .Lcbc_dec_one: | ||
| 1817 | lea ($inp), $arg1 | ||
| 1818 | lea 0x20(%rbp), $arg2 # buffer output | ||
| 1819 | lea ($key), $arg3 | ||
| 1820 | call asm_AES_decrypt # doesn't touch %xmm | ||
| 1821 | pxor 0x20(%rbp), @XMM[15] # ^= IV | ||
| 1822 | movdqu @XMM[15], ($out) # write output | ||
| 1823 | movdqa @XMM[0], @XMM[15] # IV | ||
| 1824 | |||
| 1825 | .Lcbc_dec_done: | ||
| 1826 | movdqu @XMM[15], (%rbx) # return IV | ||
| 1827 | lea (%rsp), %rax | ||
| 1828 | pxor %xmm0, %xmm0 | ||
| 1829 | .Lcbc_dec_bzero: # wipe key schedule [if any] | ||
| 1830 | movdqa %xmm0, 0x00(%rax) | ||
| 1831 | movdqa %xmm0, 0x10(%rax) | ||
| 1832 | lea 0x20(%rax), %rax | ||
| 1833 | cmp %rax, %rbp | ||
| 1834 | ja .Lcbc_dec_bzero | ||
| 1835 | |||
| 1836 | lea (%rbp),%rsp # restore %rsp | ||
| 1837 | ___ | ||
| 1838 | $code.=<<___ if ($win64); | ||
| 1839 | movaps 0x40(%rbp), %xmm6 | ||
| 1840 | movaps 0x50(%rbp), %xmm7 | ||
| 1841 | movaps 0x60(%rbp), %xmm8 | ||
| 1842 | movaps 0x70(%rbp), %xmm9 | ||
| 1843 | movaps 0x80(%rbp), %xmm10 | ||
| 1844 | movaps 0x90(%rbp), %xmm11 | ||
| 1845 | movaps 0xa0(%rbp), %xmm12 | ||
| 1846 | movaps 0xb0(%rbp), %xmm13 | ||
| 1847 | movaps 0xc0(%rbp), %xmm14 | ||
| 1848 | movaps 0xd0(%rbp), %xmm15 | ||
| 1849 | lea 0xa0(%rbp), %rsp | ||
| 1850 | ___ | ||
| 1851 | $code.=<<___; | ||
| 1852 | mov 0x48(%rsp), %r15 | ||
| 1853 | mov 0x50(%rsp), %r14 | ||
| 1854 | mov 0x58(%rsp), %r13 | ||
| 1855 | mov 0x60(%rsp), %r12 | ||
| 1856 | mov 0x68(%rsp), %rbx | ||
| 1857 | mov 0x70(%rsp), %rax | ||
| 1858 | lea 0x78(%rsp), %rsp | ||
| 1859 | mov %rax, %rbp | ||
| 1860 | .Lcbc_dec_epilogue: | ||
| 1861 | ret | ||
| 1862 | .size bsaes_cbc_encrypt,.-bsaes_cbc_encrypt | ||
| 1863 | |||
| 1864 | .globl bsaes_ctr32_encrypt_blocks | ||
| 1865 | .type bsaes_ctr32_encrypt_blocks,\@abi-omnipotent | ||
| 1866 | .align 16 | ||
| 1867 | bsaes_ctr32_encrypt_blocks: | ||
| 1868 | _CET_ENDBR | ||
| 1869 | mov %rsp, %rax | ||
| 1870 | .Lctr_enc_prologue: | ||
| 1871 | push %rbp | ||
| 1872 | push %rbx | ||
| 1873 | push %r12 | ||
| 1874 | push %r13 | ||
| 1875 | push %r14 | ||
| 1876 | push %r15 | ||
| 1877 | lea -0x48(%rsp), %rsp | ||
| 1878 | ___ | ||
| 1879 | $code.=<<___ if ($win64); | ||
| 1880 | mov 0xa0(%rsp),$arg5 # pull ivp | ||
| 1881 | lea -0xa0(%rsp), %rsp | ||
| 1882 | movaps %xmm6, 0x40(%rsp) | ||
| 1883 | movaps %xmm7, 0x50(%rsp) | ||
| 1884 | movaps %xmm8, 0x60(%rsp) | ||
| 1885 | movaps %xmm9, 0x70(%rsp) | ||
| 1886 | movaps %xmm10, 0x80(%rsp) | ||
| 1887 | movaps %xmm11, 0x90(%rsp) | ||
| 1888 | movaps %xmm12, 0xa0(%rsp) | ||
| 1889 | movaps %xmm13, 0xb0(%rsp) | ||
| 1890 | movaps %xmm14, 0xc0(%rsp) | ||
| 1891 | movaps %xmm15, 0xd0(%rsp) | ||
| 1892 | .Lctr_enc_body: | ||
| 1893 | ___ | ||
| 1894 | $code.=<<___; | ||
| 1895 | mov %rsp, %rbp # backup %rsp | ||
| 1896 | movdqu ($arg5), %xmm0 # load counter | ||
| 1897 | mov 240($arg4), %eax # rounds | ||
| 1898 | mov $arg1, $inp # backup arguments | ||
| 1899 | mov $arg2, $out | ||
| 1900 | mov $arg3, $len | ||
| 1901 | mov $arg4, $key | ||
| 1902 | movdqa %xmm0, 0x20(%rbp) # copy counter | ||
| 1903 | cmp \$8, $arg3 | ||
| 1904 | jb .Lctr_enc_short | ||
| 1905 | |||
| 1906 | mov %eax, %ebx # rounds | ||
| 1907 | shl \$7, %rax # 128 bytes per inner round key | ||
| 1908 | sub \$`128-32`, %rax # size of bit-sliced key schedule | ||
| 1909 | sub %rax, %rsp | ||
| 1910 | |||
| 1911 | mov %rsp, %rax # pass key schedule | ||
| 1912 | mov $key, %rcx # pass key | ||
| 1913 | mov %ebx, %r10d # pass rounds | ||
| 1914 | call _bsaes_key_convert | ||
| 1915 | pxor %xmm6,%xmm7 # fix up last round key | ||
| 1916 | movdqa %xmm7,(%rax) # save last round key | ||
| 1917 | |||
| 1918 | movdqa (%rsp), @XMM[9] # load round0 key | ||
| 1919 | lea .LADD1(%rip), %r11 | ||
| 1920 | movdqa 0x20(%rbp), @XMM[0] # counter copy | ||
| 1921 | movdqa -0x20(%r11), @XMM[8] # .LSWPUP | ||
| 1922 | pshufb @XMM[8], @XMM[9] # byte swap upper part | ||
| 1923 | pshufb @XMM[8], @XMM[0] | ||
| 1924 | movdqa @XMM[9], (%rsp) # save adjusted round0 key | ||
| 1925 | jmp .Lctr_enc_loop | ||
| 1926 | .align 16 | ||
| 1927 | .Lctr_enc_loop: | ||
| 1928 | movdqa @XMM[0], 0x20(%rbp) # save counter | ||
| 1929 | movdqa @XMM[0], @XMM[1] # prepare 8 counter values | ||
| 1930 | movdqa @XMM[0], @XMM[2] | ||
| 1931 | paddd 0x00(%r11), @XMM[1] # .LADD1 | ||
| 1932 | movdqa @XMM[0], @XMM[3] | ||
| 1933 | paddd 0x10(%r11), @XMM[2] # .LADD2 | ||
| 1934 | movdqa @XMM[0], @XMM[4] | ||
| 1935 | paddd 0x20(%r11), @XMM[3] # .LADD3 | ||
| 1936 | movdqa @XMM[0], @XMM[5] | ||
| 1937 | paddd 0x30(%r11), @XMM[4] # .LADD4 | ||
| 1938 | movdqa @XMM[0], @XMM[6] | ||
| 1939 | paddd 0x40(%r11), @XMM[5] # .LADD5 | ||
| 1940 | movdqa @XMM[0], @XMM[7] | ||
| 1941 | paddd 0x50(%r11), @XMM[6] # .LADD6 | ||
| 1942 | paddd 0x60(%r11), @XMM[7] # .LADD7 | ||
| 1943 | |||
| 1944 | # Borrow prologue from _bsaes_encrypt8 to use the opportunity | ||
| 1945 | # to flip byte order in 32-bit counter | ||
| 1946 | movdqa (%rsp), @XMM[9] # round 0 key | ||
| 1947 | lea 0x10(%rsp), %rax # pass key schedule | ||
| 1948 | movdqa -0x10(%r11), @XMM[8] # .LSWPUPM0SR | ||
| 1949 | pxor @XMM[9], @XMM[0] # xor with round0 key | ||
| 1950 | pxor @XMM[9], @XMM[1] | ||
| 1951 | pshufb @XMM[8], @XMM[0] | ||
| 1952 | pxor @XMM[9], @XMM[2] | ||
| 1953 | pshufb @XMM[8], @XMM[1] | ||
| 1954 | pxor @XMM[9], @XMM[3] | ||
| 1955 | pshufb @XMM[8], @XMM[2] | ||
| 1956 | pxor @XMM[9], @XMM[4] | ||
| 1957 | pshufb @XMM[8], @XMM[3] | ||
| 1958 | pxor @XMM[9], @XMM[5] | ||
| 1959 | pshufb @XMM[8], @XMM[4] | ||
| 1960 | pxor @XMM[9], @XMM[6] | ||
| 1961 | pshufb @XMM[8], @XMM[5] | ||
| 1962 | pxor @XMM[9], @XMM[7] | ||
| 1963 | pshufb @XMM[8], @XMM[6] | ||
| 1964 | lea .LBS0(%rip), %r11 # constants table | ||
| 1965 | pshufb @XMM[8], @XMM[7] | ||
| 1966 | mov %ebx,%r10d # pass rounds | ||
| 1967 | |||
| 1968 | call _bsaes_encrypt8_bitslice | ||
| 1969 | |||
| 1970 | sub \$8,$len | ||
| 1971 | jc .Lctr_enc_loop_done | ||
| 1972 | |||
| 1973 | movdqu 0x00($inp), @XMM[8] # load input | ||
| 1974 | movdqu 0x10($inp), @XMM[9] | ||
| 1975 | movdqu 0x20($inp), @XMM[10] | ||
| 1976 | movdqu 0x30($inp), @XMM[11] | ||
| 1977 | movdqu 0x40($inp), @XMM[12] | ||
| 1978 | movdqu 0x50($inp), @XMM[13] | ||
| 1979 | movdqu 0x60($inp), @XMM[14] | ||
| 1980 | movdqu 0x70($inp), @XMM[15] | ||
| 1981 | lea 0x80($inp),$inp | ||
| 1982 | pxor @XMM[0], @XMM[8] | ||
| 1983 | movdqa 0x20(%rbp), @XMM[0] # load counter | ||
| 1984 | pxor @XMM[9], @XMM[1] | ||
| 1985 | movdqu @XMM[8], 0x00($out) # write output | ||
| 1986 | pxor @XMM[10], @XMM[4] | ||
| 1987 | movdqu @XMM[1], 0x10($out) | ||
| 1988 | pxor @XMM[11], @XMM[6] | ||
| 1989 | movdqu @XMM[4], 0x20($out) | ||
| 1990 | pxor @XMM[12], @XMM[3] | ||
| 1991 | movdqu @XMM[6], 0x30($out) | ||
| 1992 | pxor @XMM[13], @XMM[7] | ||
| 1993 | movdqu @XMM[3], 0x40($out) | ||
| 1994 | pxor @XMM[14], @XMM[2] | ||
| 1995 | movdqu @XMM[7], 0x50($out) | ||
| 1996 | pxor @XMM[15], @XMM[5] | ||
| 1997 | movdqu @XMM[2], 0x60($out) | ||
| 1998 | lea .LADD1(%rip), %r11 | ||
| 1999 | movdqu @XMM[5], 0x70($out) | ||
| 2000 | lea 0x80($out), $out | ||
| 2001 | paddd 0x70(%r11), @XMM[0] # .LADD8 | ||
| 2002 | jnz .Lctr_enc_loop | ||
| 2003 | |||
| 2004 | jmp .Lctr_enc_done | ||
| 2005 | .align 16 | ||
| 2006 | .Lctr_enc_loop_done: | ||
| 2007 | add \$8, $len | ||
| 2008 | movdqu 0x00($inp), @XMM[8] # load input | ||
| 2009 | pxor @XMM[8], @XMM[0] | ||
| 2010 | movdqu @XMM[0], 0x00($out) # write output | ||
| 2011 | cmp \$2,$len | ||
| 2012 | jb .Lctr_enc_done | ||
| 2013 | movdqu 0x10($inp), @XMM[9] | ||
| 2014 | pxor @XMM[9], @XMM[1] | ||
| 2015 | movdqu @XMM[1], 0x10($out) | ||
| 2016 | je .Lctr_enc_done | ||
| 2017 | movdqu 0x20($inp), @XMM[10] | ||
| 2018 | pxor @XMM[10], @XMM[4] | ||
| 2019 | movdqu @XMM[4], 0x20($out) | ||
| 2020 | cmp \$4,$len | ||
| 2021 | jb .Lctr_enc_done | ||
| 2022 | movdqu 0x30($inp), @XMM[11] | ||
| 2023 | pxor @XMM[11], @XMM[6] | ||
| 2024 | movdqu @XMM[6], 0x30($out) | ||
| 2025 | je .Lctr_enc_done | ||
| 2026 | movdqu 0x40($inp), @XMM[12] | ||
| 2027 | pxor @XMM[12], @XMM[3] | ||
| 2028 | movdqu @XMM[3], 0x40($out) | ||
| 2029 | cmp \$6,$len | ||
| 2030 | jb .Lctr_enc_done | ||
| 2031 | movdqu 0x50($inp), @XMM[13] | ||
| 2032 | pxor @XMM[13], @XMM[7] | ||
| 2033 | movdqu @XMM[7], 0x50($out) | ||
| 2034 | je .Lctr_enc_done | ||
| 2035 | movdqu 0x60($inp), @XMM[14] | ||
| 2036 | pxor @XMM[14], @XMM[2] | ||
| 2037 | movdqu @XMM[2], 0x60($out) | ||
| 2038 | jmp .Lctr_enc_done | ||
| 2039 | |||
| 2040 | .align 16 | ||
| 2041 | .Lctr_enc_short: | ||
| 2042 | lea 0x20(%rbp), $arg1 | ||
| 2043 | lea 0x30(%rbp), $arg2 | ||
| 2044 | lea ($key), $arg3 | ||
| 2045 | call asm_AES_encrypt | ||
| 2046 | movdqu ($inp), @XMM[1] | ||
| 2047 | lea 16($inp), $inp | ||
| 2048 | mov 0x2c(%rbp), %eax # load 32-bit counter | ||
| 2049 | bswap %eax | ||
| 2050 | pxor 0x30(%rbp), @XMM[1] | ||
| 2051 | inc %eax # increment | ||
| 2052 | movdqu @XMM[1], ($out) | ||
| 2053 | bswap %eax | ||
| 2054 | lea 16($out), $out | ||
| 2055 | mov %eax, 0x2c(%rsp) # save 32-bit counter | ||
| 2056 | dec $len | ||
| 2057 | jnz .Lctr_enc_short | ||
| 2058 | |||
| 2059 | .Lctr_enc_done: | ||
| 2060 | lea (%rsp), %rax | ||
| 2061 | pxor %xmm0, %xmm0 | ||
| 2062 | .Lctr_enc_bzero: # wipe key schedule [if any] | ||
| 2063 | movdqa %xmm0, 0x00(%rax) | ||
| 2064 | movdqa %xmm0, 0x10(%rax) | ||
| 2065 | lea 0x20(%rax), %rax | ||
| 2066 | cmp %rax, %rbp | ||
| 2067 | ja .Lctr_enc_bzero | ||
| 2068 | |||
| 2069 | lea (%rbp),%rsp # restore %rsp | ||
| 2070 | ___ | ||
| 2071 | $code.=<<___ if ($win64); | ||
| 2072 | movaps 0x40(%rbp), %xmm6 | ||
| 2073 | movaps 0x50(%rbp), %xmm7 | ||
| 2074 | movaps 0x60(%rbp), %xmm8 | ||
| 2075 | movaps 0x70(%rbp), %xmm9 | ||
| 2076 | movaps 0x80(%rbp), %xmm10 | ||
| 2077 | movaps 0x90(%rbp), %xmm11 | ||
| 2078 | movaps 0xa0(%rbp), %xmm12 | ||
| 2079 | movaps 0xb0(%rbp), %xmm13 | ||
| 2080 | movaps 0xc0(%rbp), %xmm14 | ||
| 2081 | movaps 0xd0(%rbp), %xmm15 | ||
| 2082 | lea 0xa0(%rbp), %rsp | ||
| 2083 | ___ | ||
| 2084 | $code.=<<___; | ||
| 2085 | mov 0x48(%rsp), %r15 | ||
| 2086 | mov 0x50(%rsp), %r14 | ||
| 2087 | mov 0x58(%rsp), %r13 | ||
| 2088 | mov 0x60(%rsp), %r12 | ||
| 2089 | mov 0x68(%rsp), %rbx | ||
| 2090 | mov 0x70(%rsp), %rax | ||
| 2091 | lea 0x78(%rsp), %rsp | ||
| 2092 | mov %rax, %rbp | ||
| 2093 | .Lctr_enc_epilogue: | ||
| 2094 | ret | ||
| 2095 | .size bsaes_ctr32_encrypt_blocks,.-bsaes_ctr32_encrypt_blocks | ||
| 2096 | ___ | ||
| 2097 | ###################################################################### | ||
| 2098 | # void bsaes_xts_[en|de]crypt(const char *inp,char *out,size_t len, | ||
| 2099 | # const AES_KEY *key1, const AES_KEY *key2, | ||
| 2100 | # const unsigned char iv[16]); | ||
| 2101 | # | ||
| 2102 | my ($twmask,$twres,$twtmp)=@XMM[13..15]; | ||
| 2103 | $arg6=~s/d$//; | ||
| 2104 | |||
| 2105 | $code.=<<___; | ||
| 2106 | .globl bsaes_xts_encrypt | ||
| 2107 | .type bsaes_xts_encrypt,\@abi-omnipotent | ||
| 2108 | .align 16 | ||
| 2109 | bsaes_xts_encrypt: | ||
| 2110 | _CET_ENDBR | ||
| 2111 | mov %rsp, %rax | ||
| 2112 | .Lxts_enc_prologue: | ||
| 2113 | push %rbp | ||
| 2114 | push %rbx | ||
| 2115 | push %r12 | ||
| 2116 | push %r13 | ||
| 2117 | push %r14 | ||
| 2118 | push %r15 | ||
| 2119 | lea -0x48(%rsp), %rsp | ||
| 2120 | ___ | ||
| 2121 | $code.=<<___ if ($win64); | ||
| 2122 | mov 0xa0(%rsp),$arg5 # pull key2 | ||
| 2123 | mov 0xa8(%rsp),$arg6 # pull ivp | ||
| 2124 | lea -0xa0(%rsp), %rsp | ||
| 2125 | movaps %xmm6, 0x40(%rsp) | ||
| 2126 | movaps %xmm7, 0x50(%rsp) | ||
| 2127 | movaps %xmm8, 0x60(%rsp) | ||
| 2128 | movaps %xmm9, 0x70(%rsp) | ||
| 2129 | movaps %xmm10, 0x80(%rsp) | ||
| 2130 | movaps %xmm11, 0x90(%rsp) | ||
| 2131 | movaps %xmm12, 0xa0(%rsp) | ||
| 2132 | movaps %xmm13, 0xb0(%rsp) | ||
| 2133 | movaps %xmm14, 0xc0(%rsp) | ||
| 2134 | movaps %xmm15, 0xd0(%rsp) | ||
| 2135 | .Lxts_enc_body: | ||
| 2136 | ___ | ||
| 2137 | $code.=<<___; | ||
| 2138 | mov %rsp, %rbp # backup %rsp | ||
| 2139 | mov $arg1, $inp # backup arguments | ||
| 2140 | mov $arg2, $out | ||
| 2141 | mov $arg3, $len | ||
| 2142 | mov $arg4, $key | ||
| 2143 | |||
| 2144 | lea ($arg6), $arg1 | ||
| 2145 | lea 0x20(%rbp), $arg2 | ||
| 2146 | lea ($arg5), $arg3 | ||
| 2147 | call asm_AES_encrypt # generate initial tweak | ||
| 2148 | |||
| 2149 | mov 240($key), %eax # rounds | ||
| 2150 | mov $len, %rbx # backup $len | ||
| 2151 | |||
| 2152 | mov %eax, %edx # rounds | ||
| 2153 | shl \$7, %rax # 128 bytes per inner round key | ||
| 2154 | sub \$`128-32`, %rax # size of bit-sliced key schedule | ||
| 2155 | sub %rax, %rsp | ||
| 2156 | |||
| 2157 | mov %rsp, %rax # pass key schedule | ||
| 2158 | mov $key, %rcx # pass key | ||
| 2159 | mov %edx, %r10d # pass rounds | ||
| 2160 | call _bsaes_key_convert | ||
| 2161 | pxor %xmm6, %xmm7 # fix up last round key | ||
| 2162 | movdqa %xmm7, (%rax) # save last round key | ||
| 2163 | |||
| 2164 | and \$-16, $len | ||
| 2165 | sub \$0x80, %rsp # place for tweak[8] | ||
| 2166 | movdqa 0x20(%rbp), @XMM[7] # initial tweak | ||
| 2167 | |||
| 2168 | pxor $twtmp, $twtmp | ||
| 2169 | movdqa .Lxts_magic(%rip), $twmask | ||
| 2170 | pcmpgtd @XMM[7], $twtmp # broadcast upper bits | ||
| 2171 | |||
| 2172 | sub \$0x80, $len | ||
| 2173 | jc .Lxts_enc_short | ||
| 2174 | jmp .Lxts_enc_loop | ||
| 2175 | |||
| 2176 | .align 16 | ||
| 2177 | .Lxts_enc_loop: | ||
| 2178 | ___ | ||
| 2179 | for ($i=0;$i<7;$i++) { | ||
| 2180 | $code.=<<___; | ||
| 2181 | pshufd \$0x13, $twtmp, $twres | ||
| 2182 | pxor $twtmp, $twtmp | ||
| 2183 | movdqa @XMM[7], @XMM[$i] | ||
| 2184 | movdqa @XMM[7], `0x10*$i`(%rsp)# save tweak[$i] | ||
| 2185 | paddq @XMM[7], @XMM[7] # psllq 1,$tweak | ||
| 2186 | pand $twmask, $twres # isolate carry and residue | ||
| 2187 | pcmpgtd @XMM[7], $twtmp # broadcast upper bits | ||
| 2188 | pxor $twres, @XMM[7] | ||
| 2189 | ___ | ||
| 2190 | $code.=<<___ if ($i>=1); | ||
| 2191 | movdqu `0x10*($i-1)`($inp), @XMM[8+$i-1] | ||
| 2192 | ___ | ||
| 2193 | $code.=<<___ if ($i>=2); | ||
| 2194 | pxor @XMM[8+$i-2], @XMM[$i-2]# input[] ^ tweak[] | ||
| 2195 | ___ | ||
| 2196 | } | ||
| 2197 | $code.=<<___; | ||
| 2198 | movdqu 0x60($inp), @XMM[8+6] | ||
| 2199 | pxor @XMM[8+5], @XMM[5] | ||
| 2200 | movdqu 0x70($inp), @XMM[8+7] | ||
| 2201 | lea 0x80($inp), $inp | ||
| 2202 | movdqa @XMM[7], 0x70(%rsp) | ||
| 2203 | pxor @XMM[8+6], @XMM[6] | ||
| 2204 | lea 0x80(%rsp), %rax # pass key schedule | ||
| 2205 | pxor @XMM[8+7], @XMM[7] | ||
| 2206 | mov %edx, %r10d # pass rounds | ||
| 2207 | |||
| 2208 | call _bsaes_encrypt8 | ||
| 2209 | |||
| 2210 | pxor 0x00(%rsp), @XMM[0] # ^= tweak[] | ||
| 2211 | pxor 0x10(%rsp), @XMM[1] | ||
| 2212 | movdqu @XMM[0], 0x00($out) # write output | ||
| 2213 | pxor 0x20(%rsp), @XMM[4] | ||
| 2214 | movdqu @XMM[1], 0x10($out) | ||
| 2215 | pxor 0x30(%rsp), @XMM[6] | ||
| 2216 | movdqu @XMM[4], 0x20($out) | ||
| 2217 | pxor 0x40(%rsp), @XMM[3] | ||
| 2218 | movdqu @XMM[6], 0x30($out) | ||
| 2219 | pxor 0x50(%rsp), @XMM[7] | ||
| 2220 | movdqu @XMM[3], 0x40($out) | ||
| 2221 | pxor 0x60(%rsp), @XMM[2] | ||
| 2222 | movdqu @XMM[7], 0x50($out) | ||
| 2223 | pxor 0x70(%rsp), @XMM[5] | ||
| 2224 | movdqu @XMM[2], 0x60($out) | ||
| 2225 | movdqu @XMM[5], 0x70($out) | ||
| 2226 | lea 0x80($out), $out | ||
| 2227 | |||
| 2228 | movdqa 0x70(%rsp), @XMM[7] # prepare next iteration tweak | ||
| 2229 | pxor $twtmp, $twtmp | ||
| 2230 | movdqa .Lxts_magic(%rip), $twmask | ||
| 2231 | pcmpgtd @XMM[7], $twtmp | ||
| 2232 | pshufd \$0x13, $twtmp, $twres | ||
| 2233 | pxor $twtmp, $twtmp | ||
| 2234 | paddq @XMM[7], @XMM[7] # psllq 1,$tweak | ||
| 2235 | pand $twmask, $twres # isolate carry and residue | ||
| 2236 | pcmpgtd @XMM[7], $twtmp # broadcast upper bits | ||
| 2237 | pxor $twres, @XMM[7] | ||
| 2238 | |||
| 2239 | sub \$0x80,$len | ||
| 2240 | jnc .Lxts_enc_loop | ||
| 2241 | |||
| 2242 | .Lxts_enc_short: | ||
| 2243 | add \$0x80, $len | ||
| 2244 | jz .Lxts_enc_done | ||
| 2245 | ___ | ||
| 2246 | for ($i=0;$i<7;$i++) { | ||
| 2247 | $code.=<<___; | ||
| 2248 | pshufd \$0x13, $twtmp, $twres | ||
| 2249 | pxor $twtmp, $twtmp | ||
| 2250 | movdqa @XMM[7], @XMM[$i] | ||
| 2251 | movdqa @XMM[7], `0x10*$i`(%rsp)# save tweak[$i] | ||
| 2252 | paddq @XMM[7], @XMM[7] # psllq 1,$tweak | ||
| 2253 | pand $twmask, $twres # isolate carry and residue | ||
| 2254 | pcmpgtd @XMM[7], $twtmp # broadcast upper bits | ||
| 2255 | pxor $twres, @XMM[7] | ||
| 2256 | ___ | ||
| 2257 | $code.=<<___ if ($i>=1); | ||
| 2258 | movdqu `0x10*($i-1)`($inp), @XMM[8+$i-1] | ||
| 2259 | cmp \$`0x10*$i`,$len | ||
| 2260 | je .Lxts_enc_$i | ||
| 2261 | ___ | ||
| 2262 | $code.=<<___ if ($i>=2); | ||
| 2263 | pxor @XMM[8+$i-2], @XMM[$i-2]# input[] ^ tweak[] | ||
| 2264 | ___ | ||
| 2265 | } | ||
| 2266 | $code.=<<___; | ||
| 2267 | movdqu 0x60($inp), @XMM[8+6] | ||
| 2268 | pxor @XMM[8+5], @XMM[5] | ||
| 2269 | movdqa @XMM[7], 0x70(%rsp) | ||
| 2270 | lea 0x70($inp), $inp | ||
| 2271 | pxor @XMM[8+6], @XMM[6] | ||
| 2272 | lea 0x80(%rsp), %rax # pass key schedule | ||
| 2273 | mov %edx, %r10d # pass rounds | ||
| 2274 | |||
| 2275 | call _bsaes_encrypt8 | ||
| 2276 | |||
| 2277 | pxor 0x00(%rsp), @XMM[0] # ^= tweak[] | ||
| 2278 | pxor 0x10(%rsp), @XMM[1] | ||
| 2279 | movdqu @XMM[0], 0x00($out) # write output | ||
| 2280 | pxor 0x20(%rsp), @XMM[4] | ||
| 2281 | movdqu @XMM[1], 0x10($out) | ||
| 2282 | pxor 0x30(%rsp), @XMM[6] | ||
| 2283 | movdqu @XMM[4], 0x20($out) | ||
| 2284 | pxor 0x40(%rsp), @XMM[3] | ||
| 2285 | movdqu @XMM[6], 0x30($out) | ||
| 2286 | pxor 0x50(%rsp), @XMM[7] | ||
| 2287 | movdqu @XMM[3], 0x40($out) | ||
| 2288 | pxor 0x60(%rsp), @XMM[2] | ||
| 2289 | movdqu @XMM[7], 0x50($out) | ||
| 2290 | movdqu @XMM[2], 0x60($out) | ||
| 2291 | lea 0x70($out), $out | ||
| 2292 | |||
| 2293 | movdqa 0x70(%rsp), @XMM[7] # next iteration tweak | ||
| 2294 | jmp .Lxts_enc_done | ||
| 2295 | .align 16 | ||
| 2296 | .Lxts_enc_6: | ||
| 2297 | pxor @XMM[8+4], @XMM[4] | ||
| 2298 | lea 0x60($inp), $inp | ||
| 2299 | pxor @XMM[8+5], @XMM[5] | ||
| 2300 | lea 0x80(%rsp), %rax # pass key schedule | ||
| 2301 | mov %edx, %r10d # pass rounds | ||
| 2302 | |||
| 2303 | call _bsaes_encrypt8 | ||
| 2304 | |||
| 2305 | pxor 0x00(%rsp), @XMM[0] # ^= tweak[] | ||
| 2306 | pxor 0x10(%rsp), @XMM[1] | ||
| 2307 | movdqu @XMM[0], 0x00($out) # write output | ||
| 2308 | pxor 0x20(%rsp), @XMM[4] | ||
| 2309 | movdqu @XMM[1], 0x10($out) | ||
| 2310 | pxor 0x30(%rsp), @XMM[6] | ||
| 2311 | movdqu @XMM[4], 0x20($out) | ||
| 2312 | pxor 0x40(%rsp), @XMM[3] | ||
| 2313 | movdqu @XMM[6], 0x30($out) | ||
| 2314 | pxor 0x50(%rsp), @XMM[7] | ||
| 2315 | movdqu @XMM[3], 0x40($out) | ||
| 2316 | movdqu @XMM[7], 0x50($out) | ||
| 2317 | lea 0x60($out), $out | ||
| 2318 | |||
| 2319 | movdqa 0x60(%rsp), @XMM[7] # next iteration tweak | ||
| 2320 | jmp .Lxts_enc_done | ||
| 2321 | .align 16 | ||
| 2322 | .Lxts_enc_5: | ||
| 2323 | pxor @XMM[8+3], @XMM[3] | ||
| 2324 | lea 0x50($inp), $inp | ||
| 2325 | pxor @XMM[8+4], @XMM[4] | ||
| 2326 | lea 0x80(%rsp), %rax # pass key schedule | ||
| 2327 | mov %edx, %r10d # pass rounds | ||
| 2328 | |||
| 2329 | call _bsaes_encrypt8 | ||
| 2330 | |||
| 2331 | pxor 0x00(%rsp), @XMM[0] # ^= tweak[] | ||
| 2332 | pxor 0x10(%rsp), @XMM[1] | ||
| 2333 | movdqu @XMM[0], 0x00($out) # write output | ||
| 2334 | pxor 0x20(%rsp), @XMM[4] | ||
| 2335 | movdqu @XMM[1], 0x10($out) | ||
| 2336 | pxor 0x30(%rsp), @XMM[6] | ||
| 2337 | movdqu @XMM[4], 0x20($out) | ||
| 2338 | pxor 0x40(%rsp), @XMM[3] | ||
| 2339 | movdqu @XMM[6], 0x30($out) | ||
| 2340 | movdqu @XMM[3], 0x40($out) | ||
| 2341 | lea 0x50($out), $out | ||
| 2342 | |||
| 2343 | movdqa 0x50(%rsp), @XMM[7] # next iteration tweak | ||
| 2344 | jmp .Lxts_enc_done | ||
| 2345 | .align 16 | ||
| 2346 | .Lxts_enc_4: | ||
| 2347 | pxor @XMM[8+2], @XMM[2] | ||
| 2348 | lea 0x40($inp), $inp | ||
| 2349 | pxor @XMM[8+3], @XMM[3] | ||
| 2350 | lea 0x80(%rsp), %rax # pass key schedule | ||
| 2351 | mov %edx, %r10d # pass rounds | ||
| 2352 | |||
| 2353 | call _bsaes_encrypt8 | ||
| 2354 | |||
| 2355 | pxor 0x00(%rsp), @XMM[0] # ^= tweak[] | ||
| 2356 | pxor 0x10(%rsp), @XMM[1] | ||
| 2357 | movdqu @XMM[0], 0x00($out) # write output | ||
| 2358 | pxor 0x20(%rsp), @XMM[4] | ||
| 2359 | movdqu @XMM[1], 0x10($out) | ||
| 2360 | pxor 0x30(%rsp), @XMM[6] | ||
| 2361 | movdqu @XMM[4], 0x20($out) | ||
| 2362 | movdqu @XMM[6], 0x30($out) | ||
| 2363 | lea 0x40($out), $out | ||
| 2364 | |||
| 2365 | movdqa 0x40(%rsp), @XMM[7] # next iteration tweak | ||
| 2366 | jmp .Lxts_enc_done | ||
| 2367 | .align 16 | ||
| 2368 | .Lxts_enc_3: | ||
| 2369 | pxor @XMM[8+1], @XMM[1] | ||
| 2370 | lea 0x30($inp), $inp | ||
| 2371 | pxor @XMM[8+2], @XMM[2] | ||
| 2372 | lea 0x80(%rsp), %rax # pass key schedule | ||
| 2373 | mov %edx, %r10d # pass rounds | ||
| 2374 | |||
| 2375 | call _bsaes_encrypt8 | ||
| 2376 | |||
| 2377 | pxor 0x00(%rsp), @XMM[0] # ^= tweak[] | ||
| 2378 | pxor 0x10(%rsp), @XMM[1] | ||
| 2379 | movdqu @XMM[0], 0x00($out) # write output | ||
| 2380 | pxor 0x20(%rsp), @XMM[4] | ||
| 2381 | movdqu @XMM[1], 0x10($out) | ||
| 2382 | movdqu @XMM[4], 0x20($out) | ||
| 2383 | lea 0x30($out), $out | ||
| 2384 | |||
| 2385 | movdqa 0x30(%rsp), @XMM[7] # next iteration tweak | ||
| 2386 | jmp .Lxts_enc_done | ||
| 2387 | .align 16 | ||
| 2388 | .Lxts_enc_2: | ||
| 2389 | pxor @XMM[8+0], @XMM[0] | ||
| 2390 | lea 0x20($inp), $inp | ||
| 2391 | pxor @XMM[8+1], @XMM[1] | ||
| 2392 | lea 0x80(%rsp), %rax # pass key schedule | ||
| 2393 | mov %edx, %r10d # pass rounds | ||
| 2394 | |||
| 2395 | call _bsaes_encrypt8 | ||
| 2396 | |||
| 2397 | pxor 0x00(%rsp), @XMM[0] # ^= tweak[] | ||
| 2398 | pxor 0x10(%rsp), @XMM[1] | ||
| 2399 | movdqu @XMM[0], 0x00($out) # write output | ||
| 2400 | movdqu @XMM[1], 0x10($out) | ||
| 2401 | lea 0x20($out), $out | ||
| 2402 | |||
| 2403 | movdqa 0x20(%rsp), @XMM[7] # next iteration tweak | ||
| 2404 | jmp .Lxts_enc_done | ||
| 2405 | .align 16 | ||
| 2406 | .Lxts_enc_1: | ||
| 2407 | pxor @XMM[0], @XMM[8] | ||
| 2408 | lea 0x10($inp), $inp | ||
| 2409 | movdqa @XMM[8], 0x20(%rbp) | ||
| 2410 | lea 0x20(%rbp), $arg1 | ||
| 2411 | lea 0x20(%rbp), $arg2 | ||
| 2412 | lea ($key), $arg3 | ||
| 2413 | call asm_AES_encrypt # doesn't touch %xmm | ||
| 2414 | pxor 0x20(%rbp), @XMM[0] # ^= tweak[] | ||
| 2415 | #pxor @XMM[8], @XMM[0] | ||
| 2416 | #lea 0x80(%rsp), %rax # pass key schedule | ||
| 2417 | #mov %edx, %r10d # pass rounds | ||
| 2418 | #call _bsaes_encrypt8 | ||
| 2419 | #pxor 0x00(%rsp), @XMM[0] # ^= tweak[] | ||
| 2420 | movdqu @XMM[0], 0x00($out) # write output | ||
| 2421 | lea 0x10($out), $out | ||
| 2422 | |||
| 2423 | movdqa 0x10(%rsp), @XMM[7] # next iteration tweak | ||
| 2424 | |||
| 2425 | .Lxts_enc_done: | ||
| 2426 | and \$15, %ebx | ||
| 2427 | jz .Lxts_enc_ret | ||
| 2428 | mov $out, %rdx | ||
| 2429 | |||
| 2430 | .Lxts_enc_steal: | ||
| 2431 | movzb ($inp), %eax | ||
| 2432 | movzb -16(%rdx), %ecx | ||
| 2433 | lea 1($inp), $inp | ||
| 2434 | mov %al, -16(%rdx) | ||
| 2435 | mov %cl, 0(%rdx) | ||
| 2436 | lea 1(%rdx), %rdx | ||
| 2437 | sub \$1,%ebx | ||
| 2438 | jnz .Lxts_enc_steal | ||
| 2439 | |||
| 2440 | movdqu -16($out), @XMM[0] | ||
| 2441 | lea 0x20(%rbp), $arg1 | ||
| 2442 | pxor @XMM[7], @XMM[0] | ||
| 2443 | lea 0x20(%rbp), $arg2 | ||
| 2444 | movdqa @XMM[0], 0x20(%rbp) | ||
| 2445 | lea ($key), $arg3 | ||
| 2446 | call asm_AES_encrypt # doesn't touch %xmm | ||
| 2447 | pxor 0x20(%rbp), @XMM[7] | ||
| 2448 | movdqu @XMM[7], -16($out) | ||
| 2449 | |||
| 2450 | .Lxts_enc_ret: | ||
| 2451 | lea (%rsp), %rax | ||
| 2452 | pxor %xmm0, %xmm0 | ||
| 2453 | .Lxts_enc_bzero: # wipe key schedule [if any] | ||
| 2454 | movdqa %xmm0, 0x00(%rax) | ||
| 2455 | movdqa %xmm0, 0x10(%rax) | ||
| 2456 | lea 0x20(%rax), %rax | ||
| 2457 | cmp %rax, %rbp | ||
| 2458 | ja .Lxts_enc_bzero | ||
| 2459 | |||
| 2460 | lea (%rbp),%rsp # restore %rsp | ||
| 2461 | ___ | ||
| 2462 | $code.=<<___ if ($win64); | ||
| 2463 | movaps 0x40(%rbp), %xmm6 | ||
| 2464 | movaps 0x50(%rbp), %xmm7 | ||
| 2465 | movaps 0x60(%rbp), %xmm8 | ||
| 2466 | movaps 0x70(%rbp), %xmm9 | ||
| 2467 | movaps 0x80(%rbp), %xmm10 | ||
| 2468 | movaps 0x90(%rbp), %xmm11 | ||
| 2469 | movaps 0xa0(%rbp), %xmm12 | ||
| 2470 | movaps 0xb0(%rbp), %xmm13 | ||
| 2471 | movaps 0xc0(%rbp), %xmm14 | ||
| 2472 | movaps 0xd0(%rbp), %xmm15 | ||
| 2473 | lea 0xa0(%rbp), %rsp | ||
| 2474 | ___ | ||
| 2475 | $code.=<<___; | ||
| 2476 | mov 0x48(%rsp), %r15 | ||
| 2477 | mov 0x50(%rsp), %r14 | ||
| 2478 | mov 0x58(%rsp), %r13 | ||
| 2479 | mov 0x60(%rsp), %r12 | ||
| 2480 | mov 0x68(%rsp), %rbx | ||
| 2481 | mov 0x70(%rsp), %rax | ||
| 2482 | lea 0x78(%rsp), %rsp | ||
| 2483 | mov %rax, %rbp | ||
| 2484 | .Lxts_enc_epilogue: | ||
| 2485 | ret | ||
| 2486 | .size bsaes_xts_encrypt,.-bsaes_xts_encrypt | ||
| 2487 | |||
| 2488 | .globl bsaes_xts_decrypt | ||
| 2489 | .type bsaes_xts_decrypt,\@abi-omnipotent | ||
| 2490 | .align 16 | ||
| 2491 | bsaes_xts_decrypt: | ||
| 2492 | _CET_ENDBR | ||
| 2493 | mov %rsp, %rax | ||
| 2494 | .Lxts_dec_prologue: | ||
| 2495 | push %rbp | ||
| 2496 | push %rbx | ||
| 2497 | push %r12 | ||
| 2498 | push %r13 | ||
| 2499 | push %r14 | ||
| 2500 | push %r15 | ||
| 2501 | lea -0x48(%rsp), %rsp | ||
| 2502 | ___ | ||
| 2503 | $code.=<<___ if ($win64); | ||
| 2504 | mov 0xa0(%rsp),$arg5 # pull key2 | ||
| 2505 | mov 0xa8(%rsp),$arg6 # pull ivp | ||
| 2506 | lea -0xa0(%rsp), %rsp | ||
| 2507 | movaps %xmm6, 0x40(%rsp) | ||
| 2508 | movaps %xmm7, 0x50(%rsp) | ||
| 2509 | movaps %xmm8, 0x60(%rsp) | ||
| 2510 | movaps %xmm9, 0x70(%rsp) | ||
| 2511 | movaps %xmm10, 0x80(%rsp) | ||
| 2512 | movaps %xmm11, 0x90(%rsp) | ||
| 2513 | movaps %xmm12, 0xa0(%rsp) | ||
| 2514 | movaps %xmm13, 0xb0(%rsp) | ||
| 2515 | movaps %xmm14, 0xc0(%rsp) | ||
| 2516 | movaps %xmm15, 0xd0(%rsp) | ||
| 2517 | .Lxts_dec_body: | ||
| 2518 | ___ | ||
| 2519 | $code.=<<___; | ||
| 2520 | mov %rsp, %rbp # backup %rsp | ||
| 2521 | mov $arg1, $inp # backup arguments | ||
| 2522 | mov $arg2, $out | ||
| 2523 | mov $arg3, $len | ||
| 2524 | mov $arg4, $key | ||
| 2525 | |||
| 2526 | lea ($arg6), $arg1 | ||
| 2527 | lea 0x20(%rbp), $arg2 | ||
| 2528 | lea ($arg5), $arg3 | ||
| 2529 | call asm_AES_encrypt # generate initial tweak | ||
| 2530 | |||
| 2531 | mov 240($key), %eax # rounds | ||
| 2532 | mov $len, %rbx # backup $len | ||
| 2533 | |||
| 2534 | mov %eax, %edx # rounds | ||
| 2535 | shl \$7, %rax # 128 bytes per inner round key | ||
| 2536 | sub \$`128-32`, %rax # size of bit-sliced key schedule | ||
| 2537 | sub %rax, %rsp | ||
| 2538 | |||
| 2539 | mov %rsp, %rax # pass key schedule | ||
| 2540 | mov $key, %rcx # pass key | ||
| 2541 | mov %edx, %r10d # pass rounds | ||
| 2542 | call _bsaes_key_convert | ||
| 2543 | pxor (%rsp), %xmm7 # fix up round 0 key | ||
| 2544 | movdqa %xmm6, (%rax) # save last round key | ||
| 2545 | movdqa %xmm7, (%rsp) | ||
| 2546 | |||
| 2547 | xor %eax, %eax # if ($len%16) len-=16; | ||
| 2548 | and \$-16, $len | ||
| 2549 | test \$15, %ebx | ||
| 2550 | setnz %al | ||
| 2551 | shl \$4, %rax | ||
| 2552 | sub %rax, $len | ||
| 2553 | |||
| 2554 | sub \$0x80, %rsp # place for tweak[8] | ||
| 2555 | movdqa 0x20(%rbp), @XMM[7] # initial tweak | ||
| 2556 | |||
| 2557 | pxor $twtmp, $twtmp | ||
| 2558 | movdqa .Lxts_magic(%rip), $twmask | ||
| 2559 | pcmpgtd @XMM[7], $twtmp # broadcast upper bits | ||
| 2560 | |||
| 2561 | sub \$0x80, $len | ||
| 2562 | jc .Lxts_dec_short | ||
| 2563 | jmp .Lxts_dec_loop | ||
| 2564 | |||
| 2565 | .align 16 | ||
| 2566 | .Lxts_dec_loop: | ||
| 2567 | ___ | ||
| 2568 | for ($i=0;$i<7;$i++) { | ||
| 2569 | $code.=<<___; | ||
| 2570 | pshufd \$0x13, $twtmp, $twres | ||
| 2571 | pxor $twtmp, $twtmp | ||
| 2572 | movdqa @XMM[7], @XMM[$i] | ||
| 2573 | movdqa @XMM[7], `0x10*$i`(%rsp)# save tweak[$i] | ||
| 2574 | paddq @XMM[7], @XMM[7] # psllq 1,$tweak | ||
| 2575 | pand $twmask, $twres # isolate carry and residue | ||
| 2576 | pcmpgtd @XMM[7], $twtmp # broadcast upper bits | ||
| 2577 | pxor $twres, @XMM[7] | ||
| 2578 | ___ | ||
| 2579 | $code.=<<___ if ($i>=1); | ||
| 2580 | movdqu `0x10*($i-1)`($inp), @XMM[8+$i-1] | ||
| 2581 | ___ | ||
| 2582 | $code.=<<___ if ($i>=2); | ||
| 2583 | pxor @XMM[8+$i-2], @XMM[$i-2]# input[] ^ tweak[] | ||
| 2584 | ___ | ||
| 2585 | } | ||
| 2586 | $code.=<<___; | ||
| 2587 | movdqu 0x60($inp), @XMM[8+6] | ||
| 2588 | pxor @XMM[8+5], @XMM[5] | ||
| 2589 | movdqu 0x70($inp), @XMM[8+7] | ||
| 2590 | lea 0x80($inp), $inp | ||
| 2591 | movdqa @XMM[7], 0x70(%rsp) | ||
| 2592 | pxor @XMM[8+6], @XMM[6] | ||
| 2593 | lea 0x80(%rsp), %rax # pass key schedule | ||
| 2594 | pxor @XMM[8+7], @XMM[7] | ||
| 2595 | mov %edx, %r10d # pass rounds | ||
| 2596 | |||
| 2597 | call _bsaes_decrypt8 | ||
| 2598 | |||
| 2599 | pxor 0x00(%rsp), @XMM[0] # ^= tweak[] | ||
| 2600 | pxor 0x10(%rsp), @XMM[1] | ||
| 2601 | movdqu @XMM[0], 0x00($out) # write output | ||
| 2602 | pxor 0x20(%rsp), @XMM[6] | ||
| 2603 | movdqu @XMM[1], 0x10($out) | ||
| 2604 | pxor 0x30(%rsp), @XMM[4] | ||
| 2605 | movdqu @XMM[6], 0x20($out) | ||
| 2606 | pxor 0x40(%rsp), @XMM[2] | ||
| 2607 | movdqu @XMM[4], 0x30($out) | ||
| 2608 | pxor 0x50(%rsp), @XMM[7] | ||
| 2609 | movdqu @XMM[2], 0x40($out) | ||
| 2610 | pxor 0x60(%rsp), @XMM[3] | ||
| 2611 | movdqu @XMM[7], 0x50($out) | ||
| 2612 | pxor 0x70(%rsp), @XMM[5] | ||
| 2613 | movdqu @XMM[3], 0x60($out) | ||
| 2614 | movdqu @XMM[5], 0x70($out) | ||
| 2615 | lea 0x80($out), $out | ||
| 2616 | |||
| 2617 | movdqa 0x70(%rsp), @XMM[7] # prepare next iteration tweak | ||
| 2618 | pxor $twtmp, $twtmp | ||
| 2619 | movdqa .Lxts_magic(%rip), $twmask | ||
| 2620 | pcmpgtd @XMM[7], $twtmp | ||
| 2621 | pshufd \$0x13, $twtmp, $twres | ||
| 2622 | pxor $twtmp, $twtmp | ||
| 2623 | paddq @XMM[7], @XMM[7] # psllq 1,$tweak | ||
| 2624 | pand $twmask, $twres # isolate carry and residue | ||
| 2625 | pcmpgtd @XMM[7], $twtmp # broadcast upper bits | ||
| 2626 | pxor $twres, @XMM[7] | ||
| 2627 | |||
| 2628 | sub \$0x80,$len | ||
| 2629 | jnc .Lxts_dec_loop | ||
| 2630 | |||
| 2631 | .Lxts_dec_short: | ||
| 2632 | add \$0x80, $len | ||
| 2633 | jz .Lxts_dec_done | ||
| 2634 | ___ | ||
| 2635 | for ($i=0;$i<7;$i++) { | ||
| 2636 | $code.=<<___; | ||
| 2637 | pshufd \$0x13, $twtmp, $twres | ||
| 2638 | pxor $twtmp, $twtmp | ||
| 2639 | movdqa @XMM[7], @XMM[$i] | ||
| 2640 | movdqa @XMM[7], `0x10*$i`(%rsp)# save tweak[$i] | ||
| 2641 | paddq @XMM[7], @XMM[7] # psllq 1,$tweak | ||
| 2642 | pand $twmask, $twres # isolate carry and residue | ||
| 2643 | pcmpgtd @XMM[7], $twtmp # broadcast upper bits | ||
| 2644 | pxor $twres, @XMM[7] | ||
| 2645 | ___ | ||
| 2646 | $code.=<<___ if ($i>=1); | ||
| 2647 | movdqu `0x10*($i-1)`($inp), @XMM[8+$i-1] | ||
| 2648 | cmp \$`0x10*$i`,$len | ||
| 2649 | je .Lxts_dec_$i | ||
| 2650 | ___ | ||
| 2651 | $code.=<<___ if ($i>=2); | ||
| 2652 | pxor @XMM[8+$i-2], @XMM[$i-2]# input[] ^ tweak[] | ||
| 2653 | ___ | ||
| 2654 | } | ||
| 2655 | $code.=<<___; | ||
| 2656 | movdqu 0x60($inp), @XMM[8+6] | ||
| 2657 | pxor @XMM[8+5], @XMM[5] | ||
| 2658 | movdqa @XMM[7], 0x70(%rsp) | ||
| 2659 | lea 0x70($inp), $inp | ||
| 2660 | pxor @XMM[8+6], @XMM[6] | ||
| 2661 | lea 0x80(%rsp), %rax # pass key schedule | ||
| 2662 | mov %edx, %r10d # pass rounds | ||
| 2663 | |||
| 2664 | call _bsaes_decrypt8 | ||
| 2665 | |||
| 2666 | pxor 0x00(%rsp), @XMM[0] # ^= tweak[] | ||
| 2667 | pxor 0x10(%rsp), @XMM[1] | ||
| 2668 | movdqu @XMM[0], 0x00($out) # write output | ||
| 2669 | pxor 0x20(%rsp), @XMM[6] | ||
| 2670 | movdqu @XMM[1], 0x10($out) | ||
| 2671 | pxor 0x30(%rsp), @XMM[4] | ||
| 2672 | movdqu @XMM[6], 0x20($out) | ||
| 2673 | pxor 0x40(%rsp), @XMM[2] | ||
| 2674 | movdqu @XMM[4], 0x30($out) | ||
| 2675 | pxor 0x50(%rsp), @XMM[7] | ||
| 2676 | movdqu @XMM[2], 0x40($out) | ||
| 2677 | pxor 0x60(%rsp), @XMM[3] | ||
| 2678 | movdqu @XMM[7], 0x50($out) | ||
| 2679 | movdqu @XMM[3], 0x60($out) | ||
| 2680 | lea 0x70($out), $out | ||
| 2681 | |||
| 2682 | movdqa 0x70(%rsp), @XMM[7] # next iteration tweak | ||
| 2683 | jmp .Lxts_dec_done | ||
| 2684 | .align 16 | ||
| 2685 | .Lxts_dec_6: | ||
| 2686 | pxor @XMM[8+4], @XMM[4] | ||
| 2687 | lea 0x60($inp), $inp | ||
| 2688 | pxor @XMM[8+5], @XMM[5] | ||
| 2689 | lea 0x80(%rsp), %rax # pass key schedule | ||
| 2690 | mov %edx, %r10d # pass rounds | ||
| 2691 | |||
| 2692 | call _bsaes_decrypt8 | ||
| 2693 | |||
| 2694 | pxor 0x00(%rsp), @XMM[0] # ^= tweak[] | ||
| 2695 | pxor 0x10(%rsp), @XMM[1] | ||
| 2696 | movdqu @XMM[0], 0x00($out) # write output | ||
| 2697 | pxor 0x20(%rsp), @XMM[6] | ||
| 2698 | movdqu @XMM[1], 0x10($out) | ||
| 2699 | pxor 0x30(%rsp), @XMM[4] | ||
| 2700 | movdqu @XMM[6], 0x20($out) | ||
| 2701 | pxor 0x40(%rsp), @XMM[2] | ||
| 2702 | movdqu @XMM[4], 0x30($out) | ||
| 2703 | pxor 0x50(%rsp), @XMM[7] | ||
| 2704 | movdqu @XMM[2], 0x40($out) | ||
| 2705 | movdqu @XMM[7], 0x50($out) | ||
| 2706 | lea 0x60($out), $out | ||
| 2707 | |||
| 2708 | movdqa 0x60(%rsp), @XMM[7] # next iteration tweak | ||
| 2709 | jmp .Lxts_dec_done | ||
| 2710 | .align 16 | ||
| 2711 | .Lxts_dec_5: | ||
| 2712 | pxor @XMM[8+3], @XMM[3] | ||
| 2713 | lea 0x50($inp), $inp | ||
| 2714 | pxor @XMM[8+4], @XMM[4] | ||
| 2715 | lea 0x80(%rsp), %rax # pass key schedule | ||
| 2716 | mov %edx, %r10d # pass rounds | ||
| 2717 | |||
| 2718 | call _bsaes_decrypt8 | ||
| 2719 | |||
| 2720 | pxor 0x00(%rsp), @XMM[0] # ^= tweak[] | ||
| 2721 | pxor 0x10(%rsp), @XMM[1] | ||
| 2722 | movdqu @XMM[0], 0x00($out) # write output | ||
| 2723 | pxor 0x20(%rsp), @XMM[6] | ||
| 2724 | movdqu @XMM[1], 0x10($out) | ||
| 2725 | pxor 0x30(%rsp), @XMM[4] | ||
| 2726 | movdqu @XMM[6], 0x20($out) | ||
| 2727 | pxor 0x40(%rsp), @XMM[2] | ||
| 2728 | movdqu @XMM[4], 0x30($out) | ||
| 2729 | movdqu @XMM[2], 0x40($out) | ||
| 2730 | lea 0x50($out), $out | ||
| 2731 | |||
| 2732 | movdqa 0x50(%rsp), @XMM[7] # next iteration tweak | ||
| 2733 | jmp .Lxts_dec_done | ||
| 2734 | .align 16 | ||
| 2735 | .Lxts_dec_4: | ||
| 2736 | pxor @XMM[8+2], @XMM[2] | ||
| 2737 | lea 0x40($inp), $inp | ||
| 2738 | pxor @XMM[8+3], @XMM[3] | ||
| 2739 | lea 0x80(%rsp), %rax # pass key schedule | ||
| 2740 | mov %edx, %r10d # pass rounds | ||
| 2741 | |||
| 2742 | call _bsaes_decrypt8 | ||
| 2743 | |||
| 2744 | pxor 0x00(%rsp), @XMM[0] # ^= tweak[] | ||
| 2745 | pxor 0x10(%rsp), @XMM[1] | ||
| 2746 | movdqu @XMM[0], 0x00($out) # write output | ||
| 2747 | pxor 0x20(%rsp), @XMM[6] | ||
| 2748 | movdqu @XMM[1], 0x10($out) | ||
| 2749 | pxor 0x30(%rsp), @XMM[4] | ||
| 2750 | movdqu @XMM[6], 0x20($out) | ||
| 2751 | movdqu @XMM[4], 0x30($out) | ||
| 2752 | lea 0x40($out), $out | ||
| 2753 | |||
| 2754 | movdqa 0x40(%rsp), @XMM[7] # next iteration tweak | ||
| 2755 | jmp .Lxts_dec_done | ||
| 2756 | .align 16 | ||
| 2757 | .Lxts_dec_3: | ||
| 2758 | pxor @XMM[8+1], @XMM[1] | ||
| 2759 | lea 0x30($inp), $inp | ||
| 2760 | pxor @XMM[8+2], @XMM[2] | ||
| 2761 | lea 0x80(%rsp), %rax # pass key schedule | ||
| 2762 | mov %edx, %r10d # pass rounds | ||
| 2763 | |||
| 2764 | call _bsaes_decrypt8 | ||
| 2765 | |||
| 2766 | pxor 0x00(%rsp), @XMM[0] # ^= tweak[] | ||
| 2767 | pxor 0x10(%rsp), @XMM[1] | ||
| 2768 | movdqu @XMM[0], 0x00($out) # write output | ||
| 2769 | pxor 0x20(%rsp), @XMM[6] | ||
| 2770 | movdqu @XMM[1], 0x10($out) | ||
| 2771 | movdqu @XMM[6], 0x20($out) | ||
| 2772 | lea 0x30($out), $out | ||
| 2773 | |||
| 2774 | movdqa 0x30(%rsp), @XMM[7] # next iteration tweak | ||
| 2775 | jmp .Lxts_dec_done | ||
| 2776 | .align 16 | ||
| 2777 | .Lxts_dec_2: | ||
| 2778 | pxor @XMM[8+0], @XMM[0] | ||
| 2779 | lea 0x20($inp), $inp | ||
| 2780 | pxor @XMM[8+1], @XMM[1] | ||
| 2781 | lea 0x80(%rsp), %rax # pass key schedule | ||
| 2782 | mov %edx, %r10d # pass rounds | ||
| 2783 | |||
| 2784 | call _bsaes_decrypt8 | ||
| 2785 | |||
| 2786 | pxor 0x00(%rsp), @XMM[0] # ^= tweak[] | ||
| 2787 | pxor 0x10(%rsp), @XMM[1] | ||
| 2788 | movdqu @XMM[0], 0x00($out) # write output | ||
| 2789 | movdqu @XMM[1], 0x10($out) | ||
| 2790 | lea 0x20($out), $out | ||
| 2791 | |||
| 2792 | movdqa 0x20(%rsp), @XMM[7] # next iteration tweak | ||
| 2793 | jmp .Lxts_dec_done | ||
| 2794 | .align 16 | ||
| 2795 | .Lxts_dec_1: | ||
| 2796 | pxor @XMM[0], @XMM[8] | ||
| 2797 | lea 0x10($inp), $inp | ||
| 2798 | movdqa @XMM[8], 0x20(%rbp) | ||
| 2799 | lea 0x20(%rbp), $arg1 | ||
| 2800 | lea 0x20(%rbp), $arg2 | ||
| 2801 | lea ($key), $arg3 | ||
| 2802 | call asm_AES_decrypt # doesn't touch %xmm | ||
| 2803 | pxor 0x20(%rbp), @XMM[0] # ^= tweak[] | ||
| 2804 | #pxor @XMM[8], @XMM[0] | ||
| 2805 | #lea 0x80(%rsp), %rax # pass key schedule | ||
| 2806 | #mov %edx, %r10d # pass rounds | ||
| 2807 | #call _bsaes_decrypt8 | ||
| 2808 | #pxor 0x00(%rsp), @XMM[0] # ^= tweak[] | ||
| 2809 | movdqu @XMM[0], 0x00($out) # write output | ||
| 2810 | lea 0x10($out), $out | ||
| 2811 | |||
| 2812 | movdqa 0x10(%rsp), @XMM[7] # next iteration tweak | ||
| 2813 | |||
| 2814 | .Lxts_dec_done: | ||
| 2815 | and \$15, %ebx | ||
| 2816 | jz .Lxts_dec_ret | ||
| 2817 | |||
| 2818 | pxor $twtmp, $twtmp | ||
| 2819 | movdqa .Lxts_magic(%rip), $twmask | ||
| 2820 | pcmpgtd @XMM[7], $twtmp | ||
| 2821 | pshufd \$0x13, $twtmp, $twres | ||
| 2822 | movdqa @XMM[7], @XMM[6] | ||
| 2823 | paddq @XMM[7], @XMM[7] # psllq 1,$tweak | ||
| 2824 | pand $twmask, $twres # isolate carry and residue | ||
| 2825 | movdqu ($inp), @XMM[0] | ||
| 2826 | pxor $twres, @XMM[7] | ||
| 2827 | |||
| 2828 | lea 0x20(%rbp), $arg1 | ||
| 2829 | pxor @XMM[7], @XMM[0] | ||
| 2830 | lea 0x20(%rbp), $arg2 | ||
| 2831 | movdqa @XMM[0], 0x20(%rbp) | ||
| 2832 | lea ($key), $arg3 | ||
| 2833 | call asm_AES_decrypt # doesn't touch %xmm | ||
| 2834 | pxor 0x20(%rbp), @XMM[7] | ||
| 2835 | mov $out, %rdx | ||
| 2836 | movdqu @XMM[7], ($out) | ||
| 2837 | |||
| 2838 | .Lxts_dec_steal: | ||
| 2839 | movzb 16($inp), %eax | ||
| 2840 | movzb (%rdx), %ecx | ||
| 2841 | lea 1($inp), $inp | ||
| 2842 | mov %al, (%rdx) | ||
| 2843 | mov %cl, 16(%rdx) | ||
| 2844 | lea 1(%rdx), %rdx | ||
| 2845 | sub \$1,%ebx | ||
| 2846 | jnz .Lxts_dec_steal | ||
| 2847 | |||
| 2848 | movdqu ($out), @XMM[0] | ||
| 2849 | lea 0x20(%rbp), $arg1 | ||
| 2850 | pxor @XMM[6], @XMM[0] | ||
| 2851 | lea 0x20(%rbp), $arg2 | ||
| 2852 | movdqa @XMM[0], 0x20(%rbp) | ||
| 2853 | lea ($key), $arg3 | ||
| 2854 | call asm_AES_decrypt # doesn't touch %xmm | ||
| 2855 | pxor 0x20(%rbp), @XMM[6] | ||
| 2856 | movdqu @XMM[6], ($out) | ||
| 2857 | |||
| 2858 | .Lxts_dec_ret: | ||
| 2859 | lea (%rsp), %rax | ||
| 2860 | pxor %xmm0, %xmm0 | ||
| 2861 | .Lxts_dec_bzero: # wipe key schedule [if any] | ||
| 2862 | movdqa %xmm0, 0x00(%rax) | ||
| 2863 | movdqa %xmm0, 0x10(%rax) | ||
| 2864 | lea 0x20(%rax), %rax | ||
| 2865 | cmp %rax, %rbp | ||
| 2866 | ja .Lxts_dec_bzero | ||
| 2867 | |||
| 2868 | lea (%rbp),%rsp # restore %rsp | ||
| 2869 | ___ | ||
| 2870 | $code.=<<___ if ($win64); | ||
| 2871 | movaps 0x40(%rbp), %xmm6 | ||
| 2872 | movaps 0x50(%rbp), %xmm7 | ||
| 2873 | movaps 0x60(%rbp), %xmm8 | ||
| 2874 | movaps 0x70(%rbp), %xmm9 | ||
| 2875 | movaps 0x80(%rbp), %xmm10 | ||
| 2876 | movaps 0x90(%rbp), %xmm11 | ||
| 2877 | movaps 0xa0(%rbp), %xmm12 | ||
| 2878 | movaps 0xb0(%rbp), %xmm13 | ||
| 2879 | movaps 0xc0(%rbp), %xmm14 | ||
| 2880 | movaps 0xd0(%rbp), %xmm15 | ||
| 2881 | lea 0xa0(%rbp), %rsp | ||
| 2882 | ___ | ||
| 2883 | $code.=<<___; | ||
| 2884 | mov 0x48(%rsp), %r15 | ||
| 2885 | mov 0x50(%rsp), %r14 | ||
| 2886 | mov 0x58(%rsp), %r13 | ||
| 2887 | mov 0x60(%rsp), %r12 | ||
| 2888 | mov 0x68(%rsp), %rbx | ||
| 2889 | mov 0x70(%rsp), %rax | ||
| 2890 | lea 0x78(%rsp), %rsp | ||
| 2891 | mov %rax, %rbp | ||
| 2892 | .Lxts_dec_epilogue: | ||
| 2893 | ret | ||
| 2894 | .size bsaes_xts_decrypt,.-bsaes_xts_decrypt | ||
| 2895 | ___ | ||
| 2896 | } | ||
| 2897 | $code.=<<___; | ||
| 2898 | .section .rodata | ||
| 2899 | .type _bsaes_const,\@object | ||
| 2900 | .align 64 | ||
| 2901 | _bsaes_const: | ||
| 2902 | .LM0ISR: # InvShiftRows constants | ||
| 2903 | .quad 0x0a0e0206070b0f03, 0x0004080c0d010509 | ||
| 2904 | .LISRM0: | ||
| 2905 | .quad 0x01040b0e0205080f, 0x0306090c00070a0d | ||
| 2906 | .LISR: | ||
| 2907 | .quad 0x0504070602010003, 0x0f0e0d0c080b0a09 | ||
| 2908 | .LBS0: # bit-slice constants | ||
| 2909 | .quad 0x5555555555555555, 0x5555555555555555 | ||
| 2910 | .LBS1: | ||
| 2911 | .quad 0x3333333333333333, 0x3333333333333333 | ||
| 2912 | .LBS2: | ||
| 2913 | .quad 0x0f0f0f0f0f0f0f0f, 0x0f0f0f0f0f0f0f0f | ||
| 2914 | .LSR: # shiftrows constants | ||
| 2915 | .quad 0x0504070600030201, 0x0f0e0d0c0a09080b | ||
| 2916 | .LSRM0: | ||
| 2917 | .quad 0x0304090e00050a0f, 0x01060b0c0207080d | ||
| 2918 | .LM0SR: | ||
| 2919 | .quad 0x0a0e02060f03070b, 0x0004080c05090d01 | ||
| 2920 | .LSWPUP: # byte-swap upper dword | ||
| 2921 | .quad 0x0706050403020100, 0x0c0d0e0f0b0a0908 | ||
| 2922 | .LSWPUPM0SR: | ||
| 2923 | .quad 0x0a0d02060c03070b, 0x0004080f05090e01 | ||
| 2924 | .LADD1: # counter increment constants | ||
| 2925 | .quad 0x0000000000000000, 0x0000000100000000 | ||
| 2926 | .LADD2: | ||
| 2927 | .quad 0x0000000000000000, 0x0000000200000000 | ||
| 2928 | .LADD3: | ||
| 2929 | .quad 0x0000000000000000, 0x0000000300000000 | ||
| 2930 | .LADD4: | ||
| 2931 | .quad 0x0000000000000000, 0x0000000400000000 | ||
| 2932 | .LADD5: | ||
| 2933 | .quad 0x0000000000000000, 0x0000000500000000 | ||
| 2934 | .LADD6: | ||
| 2935 | .quad 0x0000000000000000, 0x0000000600000000 | ||
| 2936 | .LADD7: | ||
| 2937 | .quad 0x0000000000000000, 0x0000000700000000 | ||
| 2938 | .LADD8: | ||
| 2939 | .quad 0x0000000000000000, 0x0000000800000000 | ||
| 2940 | .Lxts_magic: | ||
| 2941 | .long 0x87,0,1,0 | ||
| 2942 | .Lmasks: | ||
| 2943 | .quad 0x0101010101010101, 0x0101010101010101 | ||
| 2944 | .quad 0x0202020202020202, 0x0202020202020202 | ||
| 2945 | .quad 0x0404040404040404, 0x0404040404040404 | ||
| 2946 | .quad 0x0808080808080808, 0x0808080808080808 | ||
| 2947 | .LM0: | ||
| 2948 | .quad 0x02060a0e03070b0f, 0x0004080c0105090d | ||
| 2949 | .L63: | ||
| 2950 | .quad 0x6363636363636363, 0x6363636363636363 | ||
| 2951 | .align 64 | ||
| 2952 | .size _bsaes_const,.-_bsaes_const | ||
| 2953 | .text | ||
| 2954 | ___ | ||
| 2955 | |||
| 2956 | # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, | ||
| 2957 | # CONTEXT *context,DISPATCHER_CONTEXT *disp) | ||
| 2958 | if ($win64) { | ||
| 2959 | $rec="%rcx"; | ||
| 2960 | $frame="%rdx"; | ||
| 2961 | $context="%r8"; | ||
| 2962 | $disp="%r9"; | ||
| 2963 | |||
| 2964 | $code.=<<___; | ||
| 2965 | .extern __imp_RtlVirtualUnwind | ||
| 2966 | .type se_handler,\@abi-omnipotent | ||
| 2967 | .align 16 | ||
| 2968 | se_handler: | ||
| 2969 | _CET_ENDBR | ||
| 2970 | push %rsi | ||
| 2971 | push %rdi | ||
| 2972 | push %rbx | ||
| 2973 | push %rbp | ||
| 2974 | push %r12 | ||
| 2975 | push %r13 | ||
| 2976 | push %r14 | ||
| 2977 | push %r15 | ||
| 2978 | pushfq | ||
| 2979 | sub \$64,%rsp | ||
| 2980 | |||
| 2981 | mov 120($context),%rax # pull context->Rax | ||
| 2982 | mov 248($context),%rbx # pull context->Rip | ||
| 2983 | |||
| 2984 | mov 8($disp),%rsi # disp->ImageBase | ||
| 2985 | mov 56($disp),%r11 # disp->HandlerData | ||
| 2986 | |||
| 2987 | mov 0(%r11),%r10d # HandlerData[0] | ||
| 2988 | lea (%rsi,%r10),%r10 # prologue label | ||
| 2989 | cmp %r10,%rbx # context->Rip<prologue label | ||
| 2990 | jb .Lin_prologue | ||
| 2991 | |||
| 2992 | mov 152($context),%rax # pull context->Rsp | ||
| 2993 | |||
| 2994 | mov 4(%r11),%r10d # HandlerData[1] | ||
| 2995 | lea (%rsi,%r10),%r10 # epilogue label | ||
| 2996 | cmp %r10,%rbx # context->Rip>=epilogue label | ||
| 2997 | jae .Lin_prologue | ||
| 2998 | |||
| 2999 | mov 160($context),%rax # pull context->Rbp | ||
| 3000 | |||
| 3001 | lea 0x40(%rax),%rsi # %xmm save area | ||
| 3002 | lea 512($context),%rdi # &context.Xmm6 | ||
| 3003 | mov \$20,%ecx # 10*sizeof(%xmm0)/sizeof(%rax) | ||
| 3004 | .long 0xa548f3fc # cld; rep movsq | ||
| 3005 | lea 0xa0(%rax),%rax # adjust stack pointer | ||
| 3006 | |||
| 3007 | mov 0x70(%rax),%rbp | ||
| 3008 | mov 0x68(%rax),%rbx | ||
| 3009 | mov 0x60(%rax),%r12 | ||
| 3010 | mov 0x58(%rax),%r13 | ||
| 3011 | mov 0x50(%rax),%r14 | ||
| 3012 | mov 0x48(%rax),%r15 | ||
| 3013 | lea 0x78(%rax),%rax # adjust stack pointer | ||
| 3014 | mov %rbx,144($context) # restore context->Rbx | ||
| 3015 | mov %rbp,160($context) # restore context->Rbp | ||
| 3016 | mov %r12,216($context) # restore context->R12 | ||
| 3017 | mov %r13,224($context) # restore context->R13 | ||
| 3018 | mov %r14,232($context) # restore context->R14 | ||
| 3019 | mov %r15,240($context) # restore context->R15 | ||
| 3020 | |||
| 3021 | .Lin_prologue: | ||
| 3022 | mov %rax,152($context) # restore context->Rsp | ||
| 3023 | |||
| 3024 | mov 40($disp),%rdi # disp->ContextRecord | ||
| 3025 | mov $context,%rsi # context | ||
| 3026 | mov \$`1232/8`,%ecx # sizeof(CONTEXT) | ||
| 3027 | .long 0xa548f3fc # cld; rep movsq | ||
| 3028 | |||
| 3029 | mov $disp,%rsi | ||
| 3030 | xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER | ||
| 3031 | mov 8(%rsi),%rdx # arg2, disp->ImageBase | ||
| 3032 | mov 0(%rsi),%r8 # arg3, disp->ControlPc | ||
| 3033 | mov 16(%rsi),%r9 # arg4, disp->FunctionEntry | ||
| 3034 | mov 40(%rsi),%r10 # disp->ContextRecord | ||
| 3035 | lea 56(%rsi),%r11 # &disp->HandlerData | ||
| 3036 | lea 24(%rsi),%r12 # &disp->EstablisherFrame | ||
| 3037 | mov %r10,32(%rsp) # arg5 | ||
| 3038 | mov %r11,40(%rsp) # arg6 | ||
| 3039 | mov %r12,48(%rsp) # arg7 | ||
| 3040 | mov %rcx,56(%rsp) # arg8, (NULL) | ||
| 3041 | call *__imp_RtlVirtualUnwind(%rip) | ||
| 3042 | |||
| 3043 | mov \$1,%eax # ExceptionContinueSearch | ||
| 3044 | add \$64,%rsp | ||
| 3045 | popfq | ||
| 3046 | pop %r15 | ||
| 3047 | pop %r14 | ||
| 3048 | pop %r13 | ||
| 3049 | pop %r12 | ||
| 3050 | pop %rbp | ||
| 3051 | pop %rbx | ||
| 3052 | pop %rdi | ||
| 3053 | pop %rsi | ||
| 3054 | ret | ||
| 3055 | .size se_handler,.-se_handler | ||
| 3056 | |||
| 3057 | .section .pdata | ||
| 3058 | .align 4 | ||
| 3059 | ___ | ||
| 3060 | $code.=<<___ if ($ecb); | ||
| 3061 | .rva .Lecb_enc_prologue | ||
| 3062 | .rva .Lecb_enc_epilogue | ||
| 3063 | .rva .Lecb_enc_info | ||
| 3064 | |||
| 3065 | .rva .Lecb_dec_prologue | ||
| 3066 | .rva .Lecb_dec_epilogue | ||
| 3067 | .rva .Lecb_dec_info | ||
| 3068 | ___ | ||
| 3069 | $code.=<<___; | ||
| 3070 | .rva .Lcbc_dec_prologue | ||
| 3071 | .rva .Lcbc_dec_epilogue | ||
| 3072 | .rva .Lcbc_dec_info | ||
| 3073 | |||
| 3074 | .rva .Lctr_enc_prologue | ||
| 3075 | .rva .Lctr_enc_epilogue | ||
| 3076 | .rva .Lctr_enc_info | ||
| 3077 | |||
| 3078 | .rva .Lxts_enc_prologue | ||
| 3079 | .rva .Lxts_enc_epilogue | ||
| 3080 | .rva .Lxts_enc_info | ||
| 3081 | |||
| 3082 | .rva .Lxts_dec_prologue | ||
| 3083 | .rva .Lxts_dec_epilogue | ||
| 3084 | .rva .Lxts_dec_info | ||
| 3085 | |||
| 3086 | .section .xdata | ||
| 3087 | .align 8 | ||
| 3088 | ___ | ||
| 3089 | $code.=<<___ if ($ecb); | ||
| 3090 | .Lecb_enc_info: | ||
| 3091 | .byte 9,0,0,0 | ||
| 3092 | .rva se_handler | ||
| 3093 | .rva .Lecb_enc_body,.Lecb_enc_epilogue # HandlerData[] | ||
| 3094 | .Lecb_dec_info: | ||
| 3095 | .byte 9,0,0,0 | ||
| 3096 | .rva se_handler | ||
| 3097 | .rva .Lecb_dec_body,.Lecb_dec_epilogue # HandlerData[] | ||
| 3098 | ___ | ||
| 3099 | $code.=<<___; | ||
| 3100 | .Lcbc_dec_info: | ||
| 3101 | .byte 9,0,0,0 | ||
| 3102 | .rva se_handler | ||
| 3103 | .rva .Lcbc_dec_body,.Lcbc_dec_epilogue # HandlerData[] | ||
| 3104 | .Lctr_enc_info: | ||
| 3105 | .byte 9,0,0,0 | ||
| 3106 | .rva se_handler | ||
| 3107 | .rva .Lctr_enc_body,.Lctr_enc_epilogue # HandlerData[] | ||
| 3108 | .Lxts_enc_info: | ||
| 3109 | .byte 9,0,0,0 | ||
| 3110 | .rva se_handler | ||
| 3111 | .rva .Lxts_enc_body,.Lxts_enc_epilogue # HandlerData[] | ||
| 3112 | .Lxts_dec_info: | ||
| 3113 | .byte 9,0,0,0 | ||
| 3114 | .rva se_handler | ||
| 3115 | .rva .Lxts_dec_body,.Lxts_dec_epilogue # HandlerData[] | ||
| 3116 | ___ | ||
| 3117 | } | ||
| 3118 | |||
| 3119 | $code =~ s/\`([^\`]*)\`/eval($1)/gem; | ||
| 3120 | |||
| 3121 | print $code; | ||
| 3122 | |||
| 3123 | close STDOUT; | ||
diff --git a/src/lib/libcrypto/aes/asm/vpaes-x86.pl b/src/lib/libcrypto/aes/asm/vpaes-x86.pl deleted file mode 100644 index 6e7bd36d05..0000000000 --- a/src/lib/libcrypto/aes/asm/vpaes-x86.pl +++ /dev/null | |||
| @@ -1,911 +0,0 @@ | |||
| 1 | #!/usr/bin/env perl | ||
| 2 | |||
| 3 | ###################################################################### | ||
| 4 | ## Constant-time SSSE3 AES core implementation. | ||
| 5 | ## version 0.1 | ||
| 6 | ## | ||
| 7 | ## By Mike Hamburg (Stanford University), 2009 | ||
| 8 | ## Public domain. | ||
| 9 | ## | ||
| 10 | ## For details see http://shiftleft.org/papers/vector_aes/ and | ||
| 11 | ## http://crypto.stanford.edu/vpaes/. | ||
| 12 | |||
| 13 | ###################################################################### | ||
| 14 | # September 2011. | ||
| 15 | # | ||
| 16 | # Port vpaes-x86_64.pl as 32-bit "almost" drop-in replacement for | ||
| 17 | # aes-586.pl. "Almost" refers to the fact that AES_cbc_encrypt | ||
| 18 | # doesn't handle partial vectors (doesn't have to if called from | ||
| 19 | # EVP only). "Drop-in" implies that this module doesn't share key | ||
| 20 | # schedule structure with the original nor does it make assumption | ||
| 21 | # about its alignment... | ||
| 22 | # | ||
| 23 | # Performance summary. aes-586.pl column lists large-block CBC | ||
| 24 | # encrypt/decrypt/with-hyper-threading-off(*) results in cycles per | ||
| 25 | # byte processed with 128-bit key, and vpaes-x86.pl column - [also | ||
| 26 | # large-block CBC] encrypt/decrypt. | ||
| 27 | # | ||
| 28 | # aes-586.pl vpaes-x86.pl | ||
| 29 | # | ||
| 30 | # Core 2(**) 29.1/42.3/18.3 22.0/25.6(***) | ||
| 31 | # Nehalem 27.9/40.4/18.1 10.3/12.0 | ||
| 32 | # Atom 102./119./60.1 64.5/85.3(***) | ||
| 33 | # | ||
| 34 | # (*) "Hyper-threading" in the context refers rather to cache shared | ||
| 35 | # among multiple cores, than to specifically Intel HTT. As vast | ||
| 36 | # majority of contemporary cores share cache, slower code path | ||
| 37 | # is common place. In other words "with-hyper-threading-off" | ||
| 38 | # results are presented mostly for reference purposes. | ||
| 39 | # | ||
| 40 | # (**) "Core 2" refers to initial 65nm design, a.k.a. Conroe. | ||
| 41 | # | ||
| 42 | # (***) Less impressive improvement on Core 2 and Atom is due to slow | ||
| 43 | # pshufb, yet it's respectable +32%/65% improvement on Core 2 | ||
| 44 | # and +58%/40% on Atom (as implied, over "hyper-threading-safe" | ||
| 45 | # code path). | ||
| 46 | # | ||
| 47 | # <appro@openssl.org> | ||
| 48 | |||
| 49 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; | ||
| 50 | push(@INC,"${dir}","${dir}../../perlasm"); | ||
| 51 | require "x86asm.pl"; | ||
| 52 | |||
| 53 | &asm_init($ARGV[0],"vpaes-x86.pl",$x86only = $ARGV[$#ARGV] eq "386"); | ||
| 54 | |||
| 55 | $PREFIX="vpaes"; | ||
| 56 | |||
| 57 | my ($round, $base, $magic, $key, $const, $inp, $out)= | ||
| 58 | ("eax", "ebx", "ecx", "edx","ebp", "esi","edi"); | ||
| 59 | |||
| 60 | &rodataseg(); | ||
| 61 | &static_label("_vpaes_consts"); | ||
| 62 | &static_label("_vpaes_schedule_low_round"); | ||
| 63 | |||
| 64 | &set_label("_vpaes_consts",64); | ||
| 65 | $k_inv=-0x30; # inv, inva | ||
| 66 | &data_word(0x0D080180,0x0E05060F,0x0A0B0C02,0x04070309); | ||
| 67 | &data_word(0x0F0B0780,0x01040A06,0x02050809,0x030D0E0C); | ||
| 68 | |||
| 69 | $k_s0F=-0x10; # s0F | ||
| 70 | &data_word(0x0F0F0F0F,0x0F0F0F0F,0x0F0F0F0F,0x0F0F0F0F); | ||
| 71 | |||
| 72 | $k_ipt=0x00; # input transform (lo, hi) | ||
| 73 | &data_word(0x5A2A7000,0xC2B2E898,0x52227808,0xCABAE090); | ||
| 74 | &data_word(0x317C4D00,0x4C01307D,0xB0FDCC81,0xCD80B1FC); | ||
| 75 | |||
| 76 | $k_sb1=0x20; # sb1u, sb1t | ||
| 77 | &data_word(0xCB503E00,0xB19BE18F,0x142AF544,0xA5DF7A6E); | ||
| 78 | &data_word(0xFAE22300,0x3618D415,0x0D2ED9EF,0x3BF7CCC1); | ||
| 79 | $k_sb2=0x40; # sb2u, sb2t | ||
| 80 | &data_word(0x0B712400,0xE27A93C6,0xBC982FCD,0x5EB7E955); | ||
| 81 | &data_word(0x0AE12900,0x69EB8840,0xAB82234A,0xC2A163C8); | ||
| 82 | $k_sbo=0x60; # sbou, sbot | ||
| 83 | &data_word(0x6FBDC700,0xD0D26D17,0xC502A878,0x15AABF7A); | ||
| 84 | &data_word(0x5FBB6A00,0xCFE474A5,0x412B35FA,0x8E1E90D1); | ||
| 85 | |||
| 86 | $k_mc_forward=0x80; # mc_forward | ||
| 87 | &data_word(0x00030201,0x04070605,0x080B0A09,0x0C0F0E0D); | ||
| 88 | &data_word(0x04070605,0x080B0A09,0x0C0F0E0D,0x00030201); | ||
| 89 | &data_word(0x080B0A09,0x0C0F0E0D,0x00030201,0x04070605); | ||
| 90 | &data_word(0x0C0F0E0D,0x00030201,0x04070605,0x080B0A09); | ||
| 91 | |||
| 92 | $k_mc_backward=0xc0; # mc_backward | ||
| 93 | &data_word(0x02010003,0x06050407,0x0A09080B,0x0E0D0C0F); | ||
| 94 | &data_word(0x0E0D0C0F,0x02010003,0x06050407,0x0A09080B); | ||
| 95 | &data_word(0x0A09080B,0x0E0D0C0F,0x02010003,0x06050407); | ||
| 96 | &data_word(0x06050407,0x0A09080B,0x0E0D0C0F,0x02010003); | ||
| 97 | |||
| 98 | $k_sr=0x100; # sr | ||
| 99 | &data_word(0x03020100,0x07060504,0x0B0A0908,0x0F0E0D0C); | ||
| 100 | &data_word(0x0F0A0500,0x030E0904,0x07020D08,0x0B06010C); | ||
| 101 | &data_word(0x0B020900,0x0F060D04,0x030A0108,0x070E050C); | ||
| 102 | &data_word(0x070A0D00,0x0B0E0104,0x0F020508,0x0306090C); | ||
| 103 | |||
| 104 | $k_rcon=0x140; # rcon | ||
| 105 | &data_word(0xAF9DEEB6,0x1F8391B9,0x4D7C7D81,0x702A9808); | ||
| 106 | |||
| 107 | $k_s63=0x150; # s63: all equal to 0x63 transformed | ||
| 108 | &data_word(0x5B5B5B5B,0x5B5B5B5B,0x5B5B5B5B,0x5B5B5B5B); | ||
| 109 | |||
| 110 | $k_opt=0x160; # output transform | ||
| 111 | &data_word(0xD6B66000,0xFF9F4929,0xDEBE6808,0xF7974121); | ||
| 112 | &data_word(0x50BCEC00,0x01EDBD51,0xB05C0CE0,0xE10D5DB1); | ||
| 113 | |||
| 114 | $k_deskew=0x180; # deskew tables: inverts the sbox's "skew" | ||
| 115 | &data_word(0x47A4E300,0x07E4A340,0x5DBEF91A,0x1DFEB95A); | ||
| 116 | &data_word(0x83EA6900,0x5F36B5DC,0xF49D1E77,0x2841C2AB); | ||
| 117 | ## | ||
| 118 | ## Decryption stuff | ||
| 119 | ## Key schedule constants | ||
| 120 | ## | ||
| 121 | $k_dksd=0x1a0; # decryption key schedule: invskew x*D | ||
| 122 | &data_word(0xA3E44700,0xFEB91A5D,0x5A1DBEF9,0x0740E3A4); | ||
| 123 | &data_word(0xB5368300,0x41C277F4,0xAB289D1E,0x5FDC69EA); | ||
| 124 | $k_dksb=0x1c0; # decryption key schedule: invskew x*B | ||
| 125 | &data_word(0x8550D500,0x9A4FCA1F,0x1CC94C99,0x03D65386); | ||
| 126 | &data_word(0xB6FC4A00,0x115BEDA7,0x7E3482C8,0xD993256F); | ||
| 127 | $k_dkse=0x1e0; # decryption key schedule: invskew x*E + 0x63 | ||
| 128 | &data_word(0x1FC9D600,0xD5031CCA,0x994F5086,0x53859A4C); | ||
| 129 | &data_word(0x4FDC7BE8,0xA2319605,0x20B31487,0xCD5EF96A); | ||
| 130 | $k_dks9=0x200; # decryption key schedule: invskew x*9 | ||
| 131 | &data_word(0x7ED9A700,0xB6116FC8,0x82255BFC,0x4AED9334); | ||
| 132 | &data_word(0x27143300,0x45765162,0xE9DAFDCE,0x8BB89FAC); | ||
| 133 | |||
| 134 | ## | ||
| 135 | ## Decryption stuff | ||
| 136 | ## Round function constants | ||
| 137 | ## | ||
| 138 | $k_dipt=0x220; # decryption input transform | ||
| 139 | &data_word(0x0B545F00,0x0F505B04,0x114E451A,0x154A411E); | ||
| 140 | &data_word(0x60056500,0x86E383E6,0xF491F194,0x12771772); | ||
| 141 | |||
| 142 | $k_dsb9=0x240; # decryption sbox output *9*u, *9*t | ||
| 143 | &data_word(0x9A86D600,0x851C0353,0x4F994CC9,0xCAD51F50); | ||
| 144 | &data_word(0xECD74900,0xC03B1789,0xB2FBA565,0x725E2C9E); | ||
| 145 | $k_dsbd=0x260; # decryption sbox output *D*u, *D*t | ||
| 146 | &data_word(0xE6B1A200,0x7D57CCDF,0x882A4439,0xF56E9B13); | ||
| 147 | &data_word(0x24C6CB00,0x3CE2FAF7,0x15DEEFD3,0x2931180D); | ||
| 148 | $k_dsbb=0x280; # decryption sbox output *B*u, *B*t | ||
| 149 | &data_word(0x96B44200,0xD0226492,0xB0F2D404,0x602646F6); | ||
| 150 | &data_word(0xCD596700,0xC19498A6,0x3255AA6B,0xF3FF0C3E); | ||
| 151 | $k_dsbe=0x2a0; # decryption sbox output *E*u, *E*t | ||
| 152 | &data_word(0x26D4D000,0x46F29296,0x64B4F6B0,0x22426004); | ||
| 153 | &data_word(0xFFAAC100,0x0C55A6CD,0x98593E32,0x9467F36B); | ||
| 154 | $k_dsbo=0x2c0; # decryption sbox final output | ||
| 155 | &data_word(0x7EF94000,0x1387EA53,0xD4943E2D,0xC7AA6DB9); | ||
| 156 | &data_word(0x93441D00,0x12D7560F,0xD8C58E9C,0xCA4B8159); | ||
| 157 | &previous(); | ||
| 158 | |||
| 159 | &function_begin_B("_vpaes_preheat"); | ||
| 160 | &movdqa ("xmm7",&QWP($k_inv,$const)); | ||
| 161 | &movdqa ("xmm6",&QWP($k_s0F,$const)); | ||
| 162 | &ret (); | ||
| 163 | &function_end_B("_vpaes_preheat"); | ||
| 164 | |||
| 165 | ## | ||
| 166 | ## _aes_encrypt_core | ||
| 167 | ## | ||
| 168 | ## AES-encrypt %xmm0. | ||
| 169 | ## | ||
| 170 | ## Inputs: | ||
| 171 | ## %xmm0 = input | ||
| 172 | ## %xmm6-%xmm7 as in _vpaes_preheat | ||
| 173 | ## (%edx) = scheduled keys | ||
| 174 | ## | ||
| 175 | ## Output in %xmm0 | ||
| 176 | ## Clobbers %xmm1-%xmm5, %eax, %ebx, %ecx, %edx | ||
| 177 | ## | ||
| 178 | ## | ||
| 179 | &function_begin_B("_vpaes_encrypt_core"); | ||
| 180 | &mov ($magic,16); | ||
| 181 | &mov ($round,&DWP(240,$key)); | ||
| 182 | &movdqa ("xmm1","xmm6") | ||
| 183 | &movdqa ("xmm2",&QWP($k_ipt,$const)); | ||
| 184 | &pandn ("xmm1","xmm0"); | ||
| 185 | &movdqu ("xmm5",&QWP(0,$key)); | ||
| 186 | &psrld ("xmm1",4); | ||
| 187 | &pand ("xmm0","xmm6"); | ||
| 188 | &pshufb ("xmm2","xmm0"); | ||
| 189 | &movdqa ("xmm0",&QWP($k_ipt+16,$const)); | ||
| 190 | &pshufb ("xmm0","xmm1"); | ||
| 191 | &pxor ("xmm2","xmm5"); | ||
| 192 | &pxor ("xmm0","xmm2"); | ||
| 193 | &add ($key,16); | ||
| 194 | &lea ($base,&DWP($k_mc_backward,$const)); | ||
| 195 | &jmp (&label("enc_entry")); | ||
| 196 | |||
| 197 | |||
| 198 | &set_label("enc_loop",16); | ||
| 199 | # middle of middle round | ||
| 200 | &movdqa ("xmm4",&QWP($k_sb1,$const)); # 4 : sb1u | ||
| 201 | &pshufb ("xmm4","xmm2"); # 4 = sb1u | ||
| 202 | &pxor ("xmm4","xmm5"); # 4 = sb1u + k | ||
| 203 | &movdqa ("xmm0",&QWP($k_sb1+16,$const));# 0 : sb1t | ||
| 204 | &pshufb ("xmm0","xmm3"); # 0 = sb1t | ||
| 205 | &pxor ("xmm0","xmm4"); # 0 = A | ||
| 206 | &movdqa ("xmm5",&QWP($k_sb2,$const)); # 4 : sb2u | ||
| 207 | &pshufb ("xmm5","xmm2"); # 4 = sb2u | ||
| 208 | &movdqa ("xmm1",&QWP(-0x40,$base,$magic));# .Lk_mc_forward[] | ||
| 209 | &movdqa ("xmm2",&QWP($k_sb2+16,$const));# 2 : sb2t | ||
| 210 | &pshufb ("xmm2","xmm3"); # 2 = sb2t | ||
| 211 | &pxor ("xmm2","xmm5"); # 2 = 2A | ||
| 212 | &movdqa ("xmm4",&QWP(0,$base,$magic)); # .Lk_mc_backward[] | ||
| 213 | &movdqa ("xmm3","xmm0"); # 3 = A | ||
| 214 | &pshufb ("xmm0","xmm1"); # 0 = B | ||
| 215 | &add ($key,16); # next key | ||
| 216 | &pxor ("xmm0","xmm2"); # 0 = 2A+B | ||
| 217 | &pshufb ("xmm3","xmm4"); # 3 = D | ||
| 218 | &add ($magic,16); # next mc | ||
| 219 | &pxor ("xmm3","xmm0"); # 3 = 2A+B+D | ||
| 220 | &pshufb ("xmm0","xmm1"); # 0 = 2B+C | ||
| 221 | &and ($magic,0x30); # ... mod 4 | ||
| 222 | &pxor ("xmm0","xmm3"); # 0 = 2A+3B+C+D | ||
| 223 | &sub ($round,1); # nr-- | ||
| 224 | |||
| 225 | &set_label("enc_entry"); | ||
| 226 | # top of round | ||
| 227 | &movdqa ("xmm1","xmm6"); # 1 : i | ||
| 228 | &pandn ("xmm1","xmm0"); # 1 = i<<4 | ||
| 229 | &psrld ("xmm1",4); # 1 = i | ||
| 230 | &pand ("xmm0","xmm6"); # 0 = k | ||
| 231 | &movdqa ("xmm5",&QWP($k_inv+16,$const));# 2 : a/k | ||
| 232 | &pshufb ("xmm5","xmm0"); # 2 = a/k | ||
| 233 | &pxor ("xmm0","xmm1"); # 0 = j | ||
| 234 | &movdqa ("xmm3","xmm7"); # 3 : 1/i | ||
| 235 | &pshufb ("xmm3","xmm1"); # 3 = 1/i | ||
| 236 | &pxor ("xmm3","xmm5"); # 3 = iak = 1/i + a/k | ||
| 237 | &movdqa ("xmm4","xmm7"); # 4 : 1/j | ||
| 238 | &pshufb ("xmm4","xmm0"); # 4 = 1/j | ||
| 239 | &pxor ("xmm4","xmm5"); # 4 = jak = 1/j + a/k | ||
| 240 | &movdqa ("xmm2","xmm7"); # 2 : 1/iak | ||
| 241 | &pshufb ("xmm2","xmm3"); # 2 = 1/iak | ||
| 242 | &pxor ("xmm2","xmm0"); # 2 = io | ||
| 243 | &movdqa ("xmm3","xmm7"); # 3 : 1/jak | ||
| 244 | &movdqu ("xmm5",&QWP(0,$key)); | ||
| 245 | &pshufb ("xmm3","xmm4"); # 3 = 1/jak | ||
| 246 | &pxor ("xmm3","xmm1"); # 3 = jo | ||
| 247 | &jnz (&label("enc_loop")); | ||
| 248 | |||
| 249 | # middle of last round | ||
| 250 | &movdqa ("xmm4",&QWP($k_sbo,$const)); # 3 : sbou .Lk_sbo | ||
| 251 | &movdqa ("xmm0",&QWP($k_sbo+16,$const));# 3 : sbot .Lk_sbo+16 | ||
| 252 | &pshufb ("xmm4","xmm2"); # 4 = sbou | ||
| 253 | &pxor ("xmm4","xmm5"); # 4 = sb1u + k | ||
| 254 | &pshufb ("xmm0","xmm3"); # 0 = sb1t | ||
| 255 | &movdqa ("xmm1",&QWP(0x40,$base,$magic));# .Lk_sr[] | ||
| 256 | &pxor ("xmm0","xmm4"); # 0 = A | ||
| 257 | &pshufb ("xmm0","xmm1"); | ||
| 258 | &ret (); | ||
| 259 | &function_end_B("_vpaes_encrypt_core"); | ||
| 260 | |||
| 261 | ## | ||
| 262 | ## Decryption core | ||
| 263 | ## | ||
| 264 | ## Same API as encryption core. | ||
| 265 | ## | ||
| 266 | &function_begin_B("_vpaes_decrypt_core"); | ||
| 267 | &mov ($round,&DWP(240,$key)); | ||
| 268 | &lea ($base,&DWP($k_dsbd,$const)); | ||
| 269 | &movdqa ("xmm1","xmm6"); | ||
| 270 | &movdqa ("xmm2",&QWP($k_dipt-$k_dsbd,$base)); | ||
| 271 | &pandn ("xmm1","xmm0"); | ||
| 272 | &mov ($magic,$round); | ||
| 273 | &psrld ("xmm1",4) | ||
| 274 | &movdqu ("xmm5",&QWP(0,$key)); | ||
| 275 | &shl ($magic,4); | ||
| 276 | &pand ("xmm0","xmm6"); | ||
| 277 | &pshufb ("xmm2","xmm0"); | ||
| 278 | &movdqa ("xmm0",&QWP($k_dipt-$k_dsbd+16,$base)); | ||
| 279 | &xor ($magic,0x30); | ||
| 280 | &pshufb ("xmm0","xmm1"); | ||
| 281 | &and ($magic,0x30); | ||
| 282 | &pxor ("xmm2","xmm5"); | ||
| 283 | &movdqa ("xmm5",&QWP($k_mc_forward+48,$const)); | ||
| 284 | &pxor ("xmm0","xmm2"); | ||
| 285 | &add ($key,16); | ||
| 286 | &lea ($magic,&DWP($k_sr-$k_dsbd,$base,$magic)); | ||
| 287 | &jmp (&label("dec_entry")); | ||
| 288 | |||
| 289 | &set_label("dec_loop",16); | ||
| 290 | ## | ||
| 291 | ## Inverse mix columns | ||
| 292 | ## | ||
| 293 | &movdqa ("xmm4",&QWP(-0x20,$base)); # 4 : sb9u | ||
| 294 | &pshufb ("xmm4","xmm2"); # 4 = sb9u | ||
| 295 | &pxor ("xmm4","xmm0"); | ||
| 296 | &movdqa ("xmm0",&QWP(-0x10,$base)); # 0 : sb9t | ||
| 297 | &pshufb ("xmm0","xmm3"); # 0 = sb9t | ||
| 298 | &pxor ("xmm0","xmm4"); # 0 = ch | ||
| 299 | &add ($key,16); # next round key | ||
| 300 | |||
| 301 | &pshufb ("xmm0","xmm5"); # MC ch | ||
| 302 | &movdqa ("xmm4",&QWP(0,$base)); # 4 : sbdu | ||
| 303 | &pshufb ("xmm4","xmm2"); # 4 = sbdu | ||
| 304 | &pxor ("xmm4","xmm0"); # 4 = ch | ||
| 305 | &movdqa ("xmm0",&QWP(0x10,$base)); # 0 : sbdt | ||
| 306 | &pshufb ("xmm0","xmm3"); # 0 = sbdt | ||
| 307 | &pxor ("xmm0","xmm4"); # 0 = ch | ||
| 308 | &sub ($round,1); # nr-- | ||
| 309 | |||
| 310 | &pshufb ("xmm0","xmm5"); # MC ch | ||
| 311 | &movdqa ("xmm4",&QWP(0x20,$base)); # 4 : sbbu | ||
| 312 | &pshufb ("xmm4","xmm2"); # 4 = sbbu | ||
| 313 | &pxor ("xmm4","xmm0"); # 4 = ch | ||
| 314 | &movdqa ("xmm0",&QWP(0x30,$base)); # 0 : sbbt | ||
| 315 | &pshufb ("xmm0","xmm3"); # 0 = sbbt | ||
| 316 | &pxor ("xmm0","xmm4"); # 0 = ch | ||
| 317 | |||
| 318 | &pshufb ("xmm0","xmm5"); # MC ch | ||
| 319 | &movdqa ("xmm4",&QWP(0x40,$base)); # 4 : sbeu | ||
| 320 | &pshufb ("xmm4","xmm2"); # 4 = sbeu | ||
| 321 | &pxor ("xmm4","xmm0"); # 4 = ch | ||
| 322 | &movdqa ("xmm0",&QWP(0x50,$base)); # 0 : sbet | ||
| 323 | &pshufb ("xmm0","xmm3"); # 0 = sbet | ||
| 324 | &pxor ("xmm0","xmm4"); # 0 = ch | ||
| 325 | |||
| 326 | &palignr("xmm5","xmm5",12); | ||
| 327 | |||
| 328 | &set_label("dec_entry"); | ||
| 329 | # top of round | ||
| 330 | &movdqa ("xmm1","xmm6"); # 1 : i | ||
| 331 | &pandn ("xmm1","xmm0"); # 1 = i<<4 | ||
| 332 | &psrld ("xmm1",4); # 1 = i | ||
| 333 | &pand ("xmm0","xmm6"); # 0 = k | ||
| 334 | &movdqa ("xmm2",&QWP($k_inv+16,$const));# 2 : a/k | ||
| 335 | &pshufb ("xmm2","xmm0"); # 2 = a/k | ||
| 336 | &pxor ("xmm0","xmm1"); # 0 = j | ||
| 337 | &movdqa ("xmm3","xmm7"); # 3 : 1/i | ||
| 338 | &pshufb ("xmm3","xmm1"); # 3 = 1/i | ||
| 339 | &pxor ("xmm3","xmm2"); # 3 = iak = 1/i + a/k | ||
| 340 | &movdqa ("xmm4","xmm7"); # 4 : 1/j | ||
| 341 | &pshufb ("xmm4","xmm0"); # 4 = 1/j | ||
| 342 | &pxor ("xmm4","xmm2"); # 4 = jak = 1/j + a/k | ||
| 343 | &movdqa ("xmm2","xmm7"); # 2 : 1/iak | ||
| 344 | &pshufb ("xmm2","xmm3"); # 2 = 1/iak | ||
| 345 | &pxor ("xmm2","xmm0"); # 2 = io | ||
| 346 | &movdqa ("xmm3","xmm7"); # 3 : 1/jak | ||
| 347 | &pshufb ("xmm3","xmm4"); # 3 = 1/jak | ||
| 348 | &pxor ("xmm3","xmm1"); # 3 = jo | ||
| 349 | &movdqu ("xmm0",&QWP(0,$key)); | ||
| 350 | &jnz (&label("dec_loop")); | ||
| 351 | |||
| 352 | # middle of last round | ||
| 353 | &movdqa ("xmm4",&QWP(0x60,$base)); # 3 : sbou | ||
| 354 | &pshufb ("xmm4","xmm2"); # 4 = sbou | ||
| 355 | &pxor ("xmm4","xmm0"); # 4 = sb1u + k | ||
| 356 | &movdqa ("xmm0",&QWP(0x70,$base)); # 0 : sbot | ||
| 357 | &movdqa ("xmm2",&QWP(0,$magic)); | ||
| 358 | &pshufb ("xmm0","xmm3"); # 0 = sb1t | ||
| 359 | &pxor ("xmm0","xmm4"); # 0 = A | ||
| 360 | &pshufb ("xmm0","xmm2"); | ||
| 361 | &ret (); | ||
| 362 | &function_end_B("_vpaes_decrypt_core"); | ||
| 363 | |||
| 364 | ######################################################## | ||
| 365 | ## ## | ||
| 366 | ## AES key schedule ## | ||
| 367 | ## ## | ||
| 368 | ######################################################## | ||
| 369 | &function_begin_B("_vpaes_schedule_core"); | ||
| 370 | &movdqu ("xmm0",&QWP(0,$inp)); # load key (unaligned) | ||
| 371 | &movdqa ("xmm2",&QWP($k_rcon,$const)); # load rcon | ||
| 372 | |||
| 373 | # input transform | ||
| 374 | &movdqa ("xmm3","xmm0"); | ||
| 375 | &lea ($base,&DWP($k_ipt,$const)); | ||
| 376 | &movdqa (&QWP(4,"esp"),"xmm2"); # xmm8 | ||
| 377 | &call ("_vpaes_schedule_transform"); | ||
| 378 | &movdqa ("xmm7","xmm0"); | ||
| 379 | |||
| 380 | &test ($out,$out); | ||
| 381 | &jnz (&label("schedule_am_decrypting")); | ||
| 382 | |||
| 383 | # encrypting, output zeroth round key after transform | ||
| 384 | &movdqu (&QWP(0,$key),"xmm0"); | ||
| 385 | &jmp (&label("schedule_go")); | ||
| 386 | |||
| 387 | &set_label("schedule_am_decrypting"); | ||
| 388 | # decrypting, output zeroth round key after shiftrows | ||
| 389 | &movdqa ("xmm1",&QWP($k_sr,$const,$magic)); | ||
| 390 | &pshufb ("xmm3","xmm1"); | ||
| 391 | &movdqu (&QWP(0,$key),"xmm3"); | ||
| 392 | &xor ($magic,0x30); | ||
| 393 | |||
| 394 | &set_label("schedule_go"); | ||
| 395 | &cmp ($round,192); | ||
| 396 | &ja (&label("schedule_256")); | ||
| 397 | &je (&label("schedule_192")); | ||
| 398 | # 128: fall though | ||
| 399 | |||
| 400 | ## | ||
| 401 | ## .schedule_128 | ||
| 402 | ## | ||
| 403 | ## 128-bit specific part of key schedule. | ||
| 404 | ## | ||
| 405 | ## This schedule is really simple, because all its parts | ||
| 406 | ## are accomplished by the subroutines. | ||
| 407 | ## | ||
| 408 | &set_label("schedule_128"); | ||
| 409 | &mov ($round,10); | ||
| 410 | |||
| 411 | &set_label("loop_schedule_128"); | ||
| 412 | &call ("_vpaes_schedule_round"); | ||
| 413 | &dec ($round); | ||
| 414 | &jz (&label("schedule_mangle_last")); | ||
| 415 | &call ("_vpaes_schedule_mangle"); # write output | ||
| 416 | &jmp (&label("loop_schedule_128")); | ||
| 417 | |||
| 418 | ## | ||
| 419 | ## .aes_schedule_192 | ||
| 420 | ## | ||
| 421 | ## 192-bit specific part of key schedule. | ||
| 422 | ## | ||
| 423 | ## The main body of this schedule is the same as the 128-bit | ||
| 424 | ## schedule, but with more smearing. The long, high side is | ||
| 425 | ## stored in %xmm7 as before, and the short, low side is in | ||
| 426 | ## the high bits of %xmm6. | ||
| 427 | ## | ||
| 428 | ## This schedule is somewhat nastier, however, because each | ||
| 429 | ## round produces 192 bits of key material, or 1.5 round keys. | ||
| 430 | ## Therefore, on each cycle we do 2 rounds and produce 3 round | ||
| 431 | ## keys. | ||
| 432 | ## | ||
| 433 | &set_label("schedule_192",16); | ||
| 434 | &movdqu ("xmm0",&QWP(8,$inp)); # load key part 2 (very unaligned) | ||
| 435 | &call ("_vpaes_schedule_transform"); # input transform | ||
| 436 | &movdqa ("xmm6","xmm0"); # save short part | ||
| 437 | &pxor ("xmm4","xmm4"); # clear 4 | ||
| 438 | &movhlps("xmm6","xmm4"); # clobber low side with zeros | ||
| 439 | &mov ($round,4); | ||
| 440 | |||
| 441 | &set_label("loop_schedule_192"); | ||
| 442 | &call ("_vpaes_schedule_round"); | ||
| 443 | &palignr("xmm0","xmm6",8); | ||
| 444 | &call ("_vpaes_schedule_mangle"); # save key n | ||
| 445 | &call ("_vpaes_schedule_192_smear"); | ||
| 446 | &call ("_vpaes_schedule_mangle"); # save key n+1 | ||
| 447 | &call ("_vpaes_schedule_round"); | ||
| 448 | &dec ($round); | ||
| 449 | &jz (&label("schedule_mangle_last")); | ||
| 450 | &call ("_vpaes_schedule_mangle"); # save key n+2 | ||
| 451 | &call ("_vpaes_schedule_192_smear"); | ||
| 452 | &jmp (&label("loop_schedule_192")); | ||
| 453 | |||
| 454 | ## | ||
| 455 | ## .aes_schedule_256 | ||
| 456 | ## | ||
| 457 | ## 256-bit specific part of key schedule. | ||
| 458 | ## | ||
| 459 | ## The structure here is very similar to the 128-bit | ||
| 460 | ## schedule, but with an additional "low side" in | ||
| 461 | ## %xmm6. The low side's rounds are the same as the | ||
| 462 | ## high side's, except no rcon and no rotation. | ||
| 463 | ## | ||
| 464 | &set_label("schedule_256",16); | ||
| 465 | &movdqu ("xmm0",&QWP(16,$inp)); # load key part 2 (unaligned) | ||
| 466 | &call ("_vpaes_schedule_transform"); # input transform | ||
| 467 | &mov ($round,7); | ||
| 468 | |||
| 469 | &set_label("loop_schedule_256"); | ||
| 470 | &call ("_vpaes_schedule_mangle"); # output low result | ||
| 471 | &movdqa ("xmm6","xmm0"); # save cur_lo in xmm6 | ||
| 472 | |||
| 473 | # high round | ||
| 474 | &call ("_vpaes_schedule_round"); | ||
| 475 | &dec ($round); | ||
| 476 | &jz (&label("schedule_mangle_last")); | ||
| 477 | &call ("_vpaes_schedule_mangle"); | ||
| 478 | |||
| 479 | # low round. swap xmm7 and xmm6 | ||
| 480 | &pshufd ("xmm0","xmm0",0xFF); | ||
| 481 | &movdqa (&QWP(20,"esp"),"xmm7"); | ||
| 482 | &movdqa ("xmm7","xmm6"); | ||
| 483 | &call ("_vpaes_schedule_low_round"); | ||
| 484 | &movdqa ("xmm7",&QWP(20,"esp")); | ||
| 485 | |||
| 486 | &jmp (&label("loop_schedule_256")); | ||
| 487 | |||
| 488 | ## | ||
| 489 | ## .aes_schedule_mangle_last | ||
| 490 | ## | ||
| 491 | ## Mangler for last round of key schedule | ||
| 492 | ## Mangles %xmm0 | ||
| 493 | ## when encrypting, outputs out(%xmm0) ^ 63 | ||
| 494 | ## when decrypting, outputs unskew(%xmm0) | ||
| 495 | ## | ||
| 496 | ## Always called right before return... jumps to cleanup and exits | ||
| 497 | ## | ||
| 498 | &set_label("schedule_mangle_last",16); | ||
| 499 | # schedule last round key from xmm0 | ||
| 500 | &lea ($base,&DWP($k_deskew,$const)); | ||
| 501 | &test ($out,$out); | ||
| 502 | &jnz (&label("schedule_mangle_last_dec")); | ||
| 503 | |||
| 504 | # encrypting | ||
| 505 | &movdqa ("xmm1",&QWP($k_sr,$const,$magic)); | ||
| 506 | &pshufb ("xmm0","xmm1"); # output permute | ||
| 507 | &lea ($base,&DWP($k_opt,$const)); # prepare to output transform | ||
| 508 | &add ($key,32); | ||
| 509 | |||
| 510 | &set_label("schedule_mangle_last_dec"); | ||
| 511 | &add ($key,-16); | ||
| 512 | &pxor ("xmm0",&QWP($k_s63,$const)); | ||
| 513 | &call ("_vpaes_schedule_transform"); # output transform | ||
| 514 | &movdqu (&QWP(0,$key),"xmm0"); # save last key | ||
| 515 | |||
| 516 | # cleanup | ||
| 517 | &pxor ("xmm0","xmm0"); | ||
| 518 | &pxor ("xmm1","xmm1"); | ||
| 519 | &pxor ("xmm2","xmm2"); | ||
| 520 | &pxor ("xmm3","xmm3"); | ||
| 521 | &pxor ("xmm4","xmm4"); | ||
| 522 | &pxor ("xmm5","xmm5"); | ||
| 523 | &pxor ("xmm6","xmm6"); | ||
| 524 | &pxor ("xmm7","xmm7"); | ||
| 525 | &ret (); | ||
| 526 | &function_end_B("_vpaes_schedule_core"); | ||
| 527 | |||
| 528 | ## | ||
| 529 | ## .aes_schedule_192_smear | ||
| 530 | ## | ||
| 531 | ## Smear the short, low side in the 192-bit key schedule. | ||
| 532 | ## | ||
| 533 | ## Inputs: | ||
| 534 | ## %xmm7: high side, b a x y | ||
| 535 | ## %xmm6: low side, d c 0 0 | ||
| 536 | ## %xmm13: 0 | ||
| 537 | ## | ||
| 538 | ## Outputs: | ||
| 539 | ## %xmm6: b+c+d b+c 0 0 | ||
| 540 | ## %xmm0: b+c+d b+c b a | ||
| 541 | ## | ||
| 542 | &function_begin_B("_vpaes_schedule_192_smear"); | ||
| 543 | &pshufd ("xmm0","xmm6",0x80); # d c 0 0 -> c 0 0 0 | ||
| 544 | &pxor ("xmm6","xmm0"); # -> c+d c 0 0 | ||
| 545 | &pshufd ("xmm0","xmm7",0xFE); # b a _ _ -> b b b a | ||
| 546 | &pxor ("xmm6","xmm0"); # -> b+c+d b+c b a | ||
| 547 | &movdqa ("xmm0","xmm6"); | ||
| 548 | &pxor ("xmm1","xmm1"); | ||
| 549 | &movhlps("xmm6","xmm1"); # clobber low side with zeros | ||
| 550 | &ret (); | ||
| 551 | &function_end_B("_vpaes_schedule_192_smear"); | ||
| 552 | |||
| 553 | ## | ||
| 554 | ## .aes_schedule_round | ||
| 555 | ## | ||
| 556 | ## Runs one main round of the key schedule on %xmm0, %xmm7 | ||
| 557 | ## | ||
| 558 | ## Specifically, runs subbytes on the high dword of %xmm0 | ||
| 559 | ## then rotates it by one byte and xors into the low dword of | ||
| 560 | ## %xmm7. | ||
| 561 | ## | ||
| 562 | ## Adds rcon from low byte of %xmm8, then rotates %xmm8 for | ||
| 563 | ## next rcon. | ||
| 564 | ## | ||
| 565 | ## Smears the dwords of %xmm7 by xoring the low into the | ||
| 566 | ## second low, result into third, result into highest. | ||
| 567 | ## | ||
| 568 | ## Returns results in %xmm7 = %xmm0. | ||
| 569 | ## Clobbers %xmm1-%xmm5. | ||
| 570 | ## | ||
| 571 | &function_begin_B("_vpaes_schedule_round"); | ||
| 572 | # extract rcon from xmm8 | ||
| 573 | &movdqa ("xmm2",&QWP(8,"esp")); # xmm8 | ||
| 574 | &pxor ("xmm1","xmm1"); | ||
| 575 | &palignr("xmm1","xmm2",15); | ||
| 576 | &palignr("xmm2","xmm2",15); | ||
| 577 | &pxor ("xmm7","xmm1"); | ||
| 578 | |||
| 579 | # rotate | ||
| 580 | &pshufd ("xmm0","xmm0",0xFF); | ||
| 581 | &palignr("xmm0","xmm0",1); | ||
| 582 | |||
| 583 | # fall through... | ||
| 584 | &movdqa (&QWP(8,"esp"),"xmm2"); # xmm8 | ||
| 585 | |||
| 586 | # low round: same as high round, but no rotation and no rcon. | ||
| 587 | &set_label("_vpaes_schedule_low_round"); | ||
| 588 | # smear xmm7 | ||
| 589 | &movdqa ("xmm1","xmm7"); | ||
| 590 | &pslldq ("xmm7",4); | ||
| 591 | &pxor ("xmm7","xmm1"); | ||
| 592 | &movdqa ("xmm1","xmm7"); | ||
| 593 | &pslldq ("xmm7",8); | ||
| 594 | &pxor ("xmm7","xmm1"); | ||
| 595 | &pxor ("xmm7",&QWP($k_s63,$const)); | ||
| 596 | |||
| 597 | # subbyte | ||
| 598 | &movdqa ("xmm4",&QWP($k_s0F,$const)); | ||
| 599 | &movdqa ("xmm5",&QWP($k_inv,$const)); # 4 : 1/j | ||
| 600 | &movdqa ("xmm1","xmm4"); | ||
| 601 | &pandn ("xmm1","xmm0"); | ||
| 602 | &psrld ("xmm1",4); # 1 = i | ||
| 603 | &pand ("xmm0","xmm4"); # 0 = k | ||
| 604 | &movdqa ("xmm2",&QWP($k_inv+16,$const));# 2 : a/k | ||
| 605 | &pshufb ("xmm2","xmm0"); # 2 = a/k | ||
| 606 | &pxor ("xmm0","xmm1"); # 0 = j | ||
| 607 | &movdqa ("xmm3","xmm5"); # 3 : 1/i | ||
| 608 | &pshufb ("xmm3","xmm1"); # 3 = 1/i | ||
| 609 | &pxor ("xmm3","xmm2"); # 3 = iak = 1/i + a/k | ||
| 610 | &movdqa ("xmm4","xmm5"); # 4 : 1/j | ||
| 611 | &pshufb ("xmm4","xmm0"); # 4 = 1/j | ||
| 612 | &pxor ("xmm4","xmm2"); # 4 = jak = 1/j + a/k | ||
| 613 | &movdqa ("xmm2","xmm5"); # 2 : 1/iak | ||
| 614 | &pshufb ("xmm2","xmm3"); # 2 = 1/iak | ||
| 615 | &pxor ("xmm2","xmm0"); # 2 = io | ||
| 616 | &movdqa ("xmm3","xmm5"); # 3 : 1/jak | ||
| 617 | &pshufb ("xmm3","xmm4"); # 3 = 1/jak | ||
| 618 | &pxor ("xmm3","xmm1"); # 3 = jo | ||
| 619 | &movdqa ("xmm4",&QWP($k_sb1,$const)); # 4 : sbou | ||
| 620 | &pshufb ("xmm4","xmm2"); # 4 = sbou | ||
| 621 | &movdqa ("xmm0",&QWP($k_sb1+16,$const));# 0 : sbot | ||
| 622 | &pshufb ("xmm0","xmm3"); # 0 = sb1t | ||
| 623 | &pxor ("xmm0","xmm4"); # 0 = sbox output | ||
| 624 | |||
| 625 | # add in smeared stuff | ||
| 626 | &pxor ("xmm0","xmm7"); | ||
| 627 | &movdqa ("xmm7","xmm0"); | ||
| 628 | &ret (); | ||
| 629 | &function_end_B("_vpaes_schedule_round"); | ||
| 630 | |||
| 631 | ## | ||
| 632 | ## .aes_schedule_transform | ||
| 633 | ## | ||
| 634 | ## Linear-transform %xmm0 according to tables at (%ebx) | ||
| 635 | ## | ||
| 636 | ## Output in %xmm0 | ||
| 637 | ## Clobbers %xmm1, %xmm2 | ||
| 638 | ## | ||
| 639 | &function_begin_B("_vpaes_schedule_transform"); | ||
| 640 | &movdqa ("xmm2",&QWP($k_s0F,$const)); | ||
| 641 | &movdqa ("xmm1","xmm2"); | ||
| 642 | &pandn ("xmm1","xmm0"); | ||
| 643 | &psrld ("xmm1",4); | ||
| 644 | &pand ("xmm0","xmm2"); | ||
| 645 | &movdqa ("xmm2",&QWP(0,$base)); | ||
| 646 | &pshufb ("xmm2","xmm0"); | ||
| 647 | &movdqa ("xmm0",&QWP(16,$base)); | ||
| 648 | &pshufb ("xmm0","xmm1"); | ||
| 649 | &pxor ("xmm0","xmm2"); | ||
| 650 | &ret (); | ||
| 651 | &function_end_B("_vpaes_schedule_transform"); | ||
| 652 | |||
| 653 | ## | ||
| 654 | ## .aes_schedule_mangle | ||
| 655 | ## | ||
| 656 | ## Mangle xmm0 from (basis-transformed) standard version | ||
| 657 | ## to our version. | ||
| 658 | ## | ||
| 659 | ## On encrypt, | ||
| 660 | ## xor with 0x63 | ||
| 661 | ## multiply by circulant 0,1,1,1 | ||
| 662 | ## apply shiftrows transform | ||
| 663 | ## | ||
| 664 | ## On decrypt, | ||
| 665 | ## xor with 0x63 | ||
| 666 | ## multiply by "inverse mixcolumns" circulant E,B,D,9 | ||
| 667 | ## deskew | ||
| 668 | ## apply shiftrows transform | ||
| 669 | ## | ||
| 670 | ## | ||
| 671 | ## Writes out to (%edx), and increments or decrements it | ||
| 672 | ## Keeps track of round number mod 4 in %ecx | ||
| 673 | ## Preserves xmm0 | ||
| 674 | ## Clobbers xmm1-xmm5 | ||
| 675 | ## | ||
| 676 | &function_begin_B("_vpaes_schedule_mangle"); | ||
| 677 | &movdqa ("xmm4","xmm0"); # save xmm0 for later | ||
| 678 | &movdqa ("xmm5",&QWP($k_mc_forward,$const)); | ||
| 679 | &test ($out,$out); | ||
| 680 | &jnz (&label("schedule_mangle_dec")); | ||
| 681 | |||
| 682 | # encrypting | ||
| 683 | &add ($key,16); | ||
| 684 | &pxor ("xmm4",&QWP($k_s63,$const)); | ||
| 685 | &pshufb ("xmm4","xmm5"); | ||
| 686 | &movdqa ("xmm3","xmm4"); | ||
| 687 | &pshufb ("xmm4","xmm5"); | ||
| 688 | &pxor ("xmm3","xmm4"); | ||
| 689 | &pshufb ("xmm4","xmm5"); | ||
| 690 | &pxor ("xmm3","xmm4"); | ||
| 691 | |||
| 692 | &jmp (&label("schedule_mangle_both")); | ||
| 693 | |||
| 694 | &set_label("schedule_mangle_dec",16); | ||
| 695 | # inverse mix columns | ||
| 696 | &movdqa ("xmm2",&QWP($k_s0F,$const)); | ||
| 697 | &lea ($inp,&DWP($k_dksd,$const)); | ||
| 698 | &movdqa ("xmm1","xmm2"); | ||
| 699 | &pandn ("xmm1","xmm4"); | ||
| 700 | &psrld ("xmm1",4); # 1 = hi | ||
| 701 | &pand ("xmm4","xmm2"); # 4 = lo | ||
| 702 | |||
| 703 | &movdqa ("xmm2",&QWP(0,$inp)); | ||
| 704 | &pshufb ("xmm2","xmm4"); | ||
| 705 | &movdqa ("xmm3",&QWP(0x10,$inp)); | ||
| 706 | &pshufb ("xmm3","xmm1"); | ||
| 707 | &pxor ("xmm3","xmm2"); | ||
| 708 | &pshufb ("xmm3","xmm5"); | ||
| 709 | |||
| 710 | &movdqa ("xmm2",&QWP(0x20,$inp)); | ||
| 711 | &pshufb ("xmm2","xmm4"); | ||
| 712 | &pxor ("xmm2","xmm3"); | ||
| 713 | &movdqa ("xmm3",&QWP(0x30,$inp)); | ||
| 714 | &pshufb ("xmm3","xmm1"); | ||
| 715 | &pxor ("xmm3","xmm2"); | ||
| 716 | &pshufb ("xmm3","xmm5"); | ||
| 717 | |||
| 718 | &movdqa ("xmm2",&QWP(0x40,$inp)); | ||
| 719 | &pshufb ("xmm2","xmm4"); | ||
| 720 | &pxor ("xmm2","xmm3"); | ||
| 721 | &movdqa ("xmm3",&QWP(0x50,$inp)); | ||
| 722 | &pshufb ("xmm3","xmm1"); | ||
| 723 | &pxor ("xmm3","xmm2"); | ||
| 724 | &pshufb ("xmm3","xmm5"); | ||
| 725 | |||
| 726 | &movdqa ("xmm2",&QWP(0x60,$inp)); | ||
| 727 | &pshufb ("xmm2","xmm4"); | ||
| 728 | &pxor ("xmm2","xmm3"); | ||
| 729 | &movdqa ("xmm3",&QWP(0x70,$inp)); | ||
| 730 | &pshufb ("xmm3","xmm1"); | ||
| 731 | &pxor ("xmm3","xmm2"); | ||
| 732 | |||
| 733 | &add ($key,-16); | ||
| 734 | |||
| 735 | &set_label("schedule_mangle_both"); | ||
| 736 | &movdqa ("xmm1",&QWP($k_sr,$const,$magic)); | ||
| 737 | &pshufb ("xmm3","xmm1"); | ||
| 738 | &add ($magic,-16); | ||
| 739 | &and ($magic,0x30); | ||
| 740 | &movdqu (&QWP(0,$key),"xmm3"); | ||
| 741 | &ret (); | ||
| 742 | &function_end_B("_vpaes_schedule_mangle"); | ||
| 743 | |||
| 744 | # | ||
| 745 | # Interface to OpenSSL | ||
| 746 | # | ||
| 747 | &function_begin("${PREFIX}_set_encrypt_key"); | ||
| 748 | &mov ($inp,&wparam(0)); # inp | ||
| 749 | &lea ($base,&DWP(-56,"esp")); | ||
| 750 | &mov ($round,&wparam(1)); # bits | ||
| 751 | &and ($base,-16); | ||
| 752 | &mov ($key,&wparam(2)); # key | ||
| 753 | &xchg ($base,"esp"); # alloca | ||
| 754 | &mov (&DWP(48,"esp"),$base); | ||
| 755 | |||
| 756 | &mov ($base,$round); | ||
| 757 | &shr ($base,5); | ||
| 758 | &add ($base,5); | ||
| 759 | &mov (&DWP(240,$key),$base); # AES_KEY->rounds = nbits/32+5; | ||
| 760 | &mov ($magic,0x30); | ||
| 761 | &mov ($out,0); | ||
| 762 | |||
| 763 | &picsetup($const); | ||
| 764 | &picsymbol($const, &label("_vpaes_consts"), $const); | ||
| 765 | &lea ($const,&DWP(0x30,$const)) | ||
| 766 | |||
| 767 | &call ("_vpaes_schedule_core"); | ||
| 768 | |||
| 769 | &mov ("esp",&DWP(48,"esp")); | ||
| 770 | &xor ("eax","eax"); | ||
| 771 | &function_end("${PREFIX}_set_encrypt_key"); | ||
| 772 | |||
| 773 | &function_begin("${PREFIX}_set_decrypt_key"); | ||
| 774 | &mov ($inp,&wparam(0)); # inp | ||
| 775 | &lea ($base,&DWP(-56,"esp")); | ||
| 776 | &mov ($round,&wparam(1)); # bits | ||
| 777 | &and ($base,-16); | ||
| 778 | &mov ($key,&wparam(2)); # key | ||
| 779 | &xchg ($base,"esp"); # alloca | ||
| 780 | &mov (&DWP(48,"esp"),$base); | ||
| 781 | |||
| 782 | &mov ($base,$round); | ||
| 783 | &shr ($base,5); | ||
| 784 | &add ($base,5); | ||
| 785 | &mov (&DWP(240,$key),$base); # AES_KEY->rounds = nbits/32+5; | ||
| 786 | &shl ($base,4); | ||
| 787 | &lea ($key,&DWP(16,$key,$base)); | ||
| 788 | |||
| 789 | &mov ($out,1); | ||
| 790 | &mov ($magic,$round); | ||
| 791 | &shr ($magic,1); | ||
| 792 | &and ($magic,32); | ||
| 793 | &xor ($magic,32); # nbist==192?0:32; | ||
| 794 | |||
| 795 | &picsetup($const); | ||
| 796 | &picsymbol($const, &label("_vpaes_consts"), $const); | ||
| 797 | &lea ($const,&DWP(0x30,$const)) | ||
| 798 | |||
| 799 | &call ("_vpaes_schedule_core"); | ||
| 800 | |||
| 801 | &mov ("esp",&DWP(48,"esp")); | ||
| 802 | &xor ("eax","eax"); | ||
| 803 | &function_end("${PREFIX}_set_decrypt_key"); | ||
| 804 | |||
| 805 | &function_begin("${PREFIX}_encrypt"); | ||
| 806 | &picsetup($const); | ||
| 807 | &picsymbol($const, &label("_vpaes_consts"), $const); | ||
| 808 | &lea ($const,&DWP(0x30,$const)) | ||
| 809 | |||
| 810 | &call ("_vpaes_preheat"); | ||
| 811 | &mov ($inp,&wparam(0)); # inp | ||
| 812 | &lea ($base,&DWP(-56,"esp")); | ||
| 813 | &mov ($out,&wparam(1)); # out | ||
| 814 | &and ($base,-16); | ||
| 815 | &mov ($key,&wparam(2)); # key | ||
| 816 | &xchg ($base,"esp"); # alloca | ||
| 817 | &mov (&DWP(48,"esp"),$base); | ||
| 818 | |||
| 819 | &movdqu ("xmm0",&QWP(0,$inp)); | ||
| 820 | &call ("_vpaes_encrypt_core"); | ||
| 821 | &movdqu (&QWP(0,$out),"xmm0"); | ||
| 822 | |||
| 823 | &mov ("esp",&DWP(48,"esp")); | ||
| 824 | &function_end("${PREFIX}_encrypt"); | ||
| 825 | |||
| 826 | &function_begin("${PREFIX}_decrypt"); | ||
| 827 | &picsetup($const); | ||
| 828 | &picsymbol($const, &label("_vpaes_consts"), $const); | ||
| 829 | &lea ($const,&DWP(0x30,$const)) | ||
| 830 | |||
| 831 | &call ("_vpaes_preheat"); | ||
| 832 | &mov ($inp,&wparam(0)); # inp | ||
| 833 | &lea ($base,&DWP(-56,"esp")); | ||
| 834 | &mov ($out,&wparam(1)); # out | ||
| 835 | &and ($base,-16); | ||
| 836 | &mov ($key,&wparam(2)); # key | ||
| 837 | &xchg ($base,"esp"); # alloca | ||
| 838 | &mov (&DWP(48,"esp"),$base); | ||
| 839 | |||
| 840 | &movdqu ("xmm0",&QWP(0,$inp)); | ||
| 841 | &call ("_vpaes_decrypt_core"); | ||
| 842 | &movdqu (&QWP(0,$out),"xmm0"); | ||
| 843 | |||
| 844 | &mov ("esp",&DWP(48,"esp")); | ||
| 845 | &function_end("${PREFIX}_decrypt"); | ||
| 846 | |||
| 847 | &function_begin("${PREFIX}_cbc_encrypt"); | ||
| 848 | &mov ($inp,&wparam(0)); # inp | ||
| 849 | &mov ($out,&wparam(1)); # out | ||
| 850 | &mov ($round,&wparam(2)); # len | ||
| 851 | &mov ($key,&wparam(3)); # key | ||
| 852 | &sub ($round,16); | ||
| 853 | &jc (&label("cbc_abort")); | ||
| 854 | &lea ($base,&DWP(-56,"esp")); | ||
| 855 | &mov ($const,&wparam(4)); # ivp | ||
| 856 | &and ($base,-16); | ||
| 857 | &mov ($magic,&wparam(5)); # enc | ||
| 858 | &xchg ($base,"esp"); # alloca | ||
| 859 | &movdqu ("xmm1",&QWP(0,$const)); # load IV | ||
| 860 | &sub ($out,$inp); | ||
| 861 | &mov (&DWP(48,"esp"),$base); | ||
| 862 | |||
| 863 | &mov (&DWP(0,"esp"),$out); # save out | ||
| 864 | &mov (&DWP(4,"esp"),$key) # save key | ||
| 865 | &mov (&DWP(8,"esp"),$const); # save ivp | ||
| 866 | &mov ($out,$round); # $out works as $len | ||
| 867 | |||
| 868 | &picsetup($const); | ||
| 869 | &picsymbol($const, &label("_vpaes_consts"), $const); | ||
| 870 | &lea ($const,&DWP(0x30,$const)) | ||
| 871 | |||
| 872 | &call ("_vpaes_preheat"); | ||
| 873 | &cmp ($magic,0); | ||
| 874 | &je (&label("cbc_dec_loop")); | ||
| 875 | &jmp (&label("cbc_enc_loop")); | ||
| 876 | |||
| 877 | &set_label("cbc_enc_loop",16); | ||
| 878 | &movdqu ("xmm0",&QWP(0,$inp)); # load input | ||
| 879 | &pxor ("xmm0","xmm1"); # inp^=iv | ||
| 880 | &call ("_vpaes_encrypt_core"); | ||
| 881 | &mov ($base,&DWP(0,"esp")); # restore out | ||
| 882 | &mov ($key,&DWP(4,"esp")); # restore key | ||
| 883 | &movdqa ("xmm1","xmm0"); | ||
| 884 | &movdqu (&QWP(0,$base,$inp),"xmm0"); # write output | ||
| 885 | &lea ($inp,&DWP(16,$inp)); | ||
| 886 | &sub ($out,16); | ||
| 887 | &jnc (&label("cbc_enc_loop")); | ||
| 888 | &jmp (&label("cbc_done")); | ||
| 889 | |||
| 890 | &set_label("cbc_dec_loop",16); | ||
| 891 | &movdqu ("xmm0",&QWP(0,$inp)); # load input | ||
| 892 | &movdqa (&QWP(16,"esp"),"xmm1"); # save IV | ||
| 893 | &movdqa (&QWP(32,"esp"),"xmm0"); # save future IV | ||
| 894 | &call ("_vpaes_decrypt_core"); | ||
| 895 | &mov ($base,&DWP(0,"esp")); # restore out | ||
| 896 | &mov ($key,&DWP(4,"esp")); # restore key | ||
| 897 | &pxor ("xmm0",&QWP(16,"esp")); # out^=iv | ||
| 898 | &movdqa ("xmm1",&QWP(32,"esp")); # load next IV | ||
| 899 | &movdqu (&QWP(0,$base,$inp),"xmm0"); # write output | ||
| 900 | &lea ($inp,&DWP(16,$inp)); | ||
| 901 | &sub ($out,16); | ||
| 902 | &jnc (&label("cbc_dec_loop")); | ||
| 903 | |||
| 904 | &set_label("cbc_done"); | ||
| 905 | &mov ($base,&DWP(8,"esp")); # restore ivp | ||
| 906 | &mov ("esp",&DWP(48,"esp")); | ||
| 907 | &movdqu (&QWP(0,$base),"xmm1"); # write IV | ||
| 908 | &set_label("cbc_abort"); | ||
| 909 | &function_end("${PREFIX}_cbc_encrypt"); | ||
| 910 | |||
| 911 | &asm_finish(); | ||
diff --git a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl deleted file mode 100644 index 7d92e8d8ca..0000000000 --- a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl +++ /dev/null | |||
| @@ -1,1222 +0,0 @@ | |||
| 1 | #!/usr/bin/env perl | ||
| 2 | |||
| 3 | ###################################################################### | ||
| 4 | ## Constant-time SSSE3 AES core implementation. | ||
| 5 | ## version 0.1 | ||
| 6 | ## | ||
| 7 | ## By Mike Hamburg (Stanford University), 2009 | ||
| 8 | ## Public domain. | ||
| 9 | ## | ||
| 10 | ## For details see http://shiftleft.org/papers/vector_aes/ and | ||
| 11 | ## http://crypto.stanford.edu/vpaes/. | ||
| 12 | |||
| 13 | ###################################################################### | ||
| 14 | # September 2011. | ||
| 15 | # | ||
| 16 | # Interface to OpenSSL as "almost" drop-in replacement for | ||
| 17 | # aes-x86_64.pl. "Almost" refers to the fact that AES_cbc_encrypt | ||
| 18 | # doesn't handle partial vectors (doesn't have to if called from | ||
| 19 | # EVP only). "Drop-in" implies that this module doesn't share key | ||
| 20 | # schedule structure with the original nor does it make assumption | ||
| 21 | # about its alignment... | ||
| 22 | # | ||
| 23 | # Performance summary. aes-x86_64.pl column lists large-block CBC | ||
| 24 | # encrypt/decrypt/with-hyper-threading-off(*) results in cycles per | ||
| 25 | # byte processed with 128-bit key, and vpaes-x86_64.pl column - | ||
| 26 | # [also large-block CBC] encrypt/decrypt. | ||
| 27 | # | ||
| 28 | # aes-x86_64.pl vpaes-x86_64.pl | ||
| 29 | # | ||
| 30 | # Core 2(**) 30.5/43.7/14.3 21.8/25.7(***) | ||
| 31 | # Nehalem 30.5/42.2/14.6 9.8/11.8 | ||
| 32 | # Atom 63.9/79.0/32.1 64.0/84.8(***) | ||
| 33 | # | ||
| 34 | # (*) "Hyper-threading" in the context refers rather to cache shared | ||
| 35 | # among multiple cores, than to specifically Intel HTT. As vast | ||
| 36 | # majority of contemporary cores share cache, slower code path | ||
| 37 | # is common place. In other words "with-hyper-threading-off" | ||
| 38 | # results are presented mostly for reference purposes. | ||
| 39 | # | ||
| 40 | # (**) "Core 2" refers to initial 65nm design, a.k.a. Conroe. | ||
| 41 | # | ||
| 42 | # (***) Less impressive improvement on Core 2 and Atom is due to slow | ||
| 43 | # pshufb, yet it's respectable +40%/78% improvement on Core 2 | ||
| 44 | # (as implied, over "hyper-threading-safe" code path). | ||
| 45 | # | ||
| 46 | # <appro@openssl.org> | ||
| 47 | |||
| 48 | $flavour = shift; | ||
| 49 | $output = shift; | ||
| 50 | if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } | ||
| 51 | |||
| 52 | $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); | ||
| 53 | |||
| 54 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; | ||
| 55 | ( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or | ||
| 56 | ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or | ||
| 57 | die "can't locate x86_64-xlate.pl"; | ||
| 58 | |||
| 59 | open OUT,"| \"$^X\" $xlate $flavour $output"; | ||
| 60 | *STDOUT=*OUT; | ||
| 61 | |||
| 62 | $PREFIX="vpaes"; | ||
| 63 | |||
| 64 | $code.=<<___; | ||
| 65 | .text | ||
| 66 | |||
| 67 | ## | ||
| 68 | ## _aes_encrypt_core | ||
| 69 | ## | ||
| 70 | ## AES-encrypt %xmm0. | ||
| 71 | ## | ||
| 72 | ## Inputs: | ||
| 73 | ## %xmm0 = input | ||
| 74 | ## %xmm9-%xmm15 as in _vpaes_preheat | ||
| 75 | ## (%rdx) = scheduled keys | ||
| 76 | ## | ||
| 77 | ## Output in %xmm0 | ||
| 78 | ## Clobbers %xmm1-%xmm5, %r9, %r10, %r11, %rax | ||
| 79 | ## Preserves %xmm6 - %xmm8 so you get some local vectors | ||
| 80 | ## | ||
| 81 | ## | ||
| 82 | .type _vpaes_encrypt_core,\@abi-omnipotent | ||
| 83 | .align 16 | ||
| 84 | _vpaes_encrypt_core: | ||
| 85 | _CET_ENDBR | ||
| 86 | mov %rdx, %r9 | ||
| 87 | mov \$16, %r11 | ||
| 88 | mov 240(%rdx),%eax | ||
| 89 | movdqa %xmm9, %xmm1 | ||
| 90 | movdqa .Lk_ipt(%rip), %xmm2 # iptlo | ||
| 91 | pandn %xmm0, %xmm1 | ||
| 92 | movdqu (%r9), %xmm5 # round0 key | ||
| 93 | psrld \$4, %xmm1 | ||
| 94 | pand %xmm9, %xmm0 | ||
| 95 | pshufb %xmm0, %xmm2 | ||
| 96 | movdqa .Lk_ipt+16(%rip), %xmm0 # ipthi | ||
| 97 | pshufb %xmm1, %xmm0 | ||
| 98 | pxor %xmm5, %xmm2 | ||
| 99 | pxor %xmm2, %xmm0 | ||
| 100 | add \$16, %r9 | ||
| 101 | lea .Lk_mc_backward(%rip),%r10 | ||
| 102 | jmp .Lenc_entry | ||
| 103 | |||
| 104 | .align 16 | ||
| 105 | .Lenc_loop: | ||
| 106 | # middle of middle round | ||
| 107 | movdqa %xmm13, %xmm4 # 4 : sb1u | ||
| 108 | pshufb %xmm2, %xmm4 # 4 = sb1u | ||
| 109 | pxor %xmm5, %xmm4 # 4 = sb1u + k | ||
| 110 | movdqa %xmm12, %xmm0 # 0 : sb1t | ||
| 111 | pshufb %xmm3, %xmm0 # 0 = sb1t | ||
| 112 | pxor %xmm4, %xmm0 # 0 = A | ||
| 113 | movdqa %xmm15, %xmm5 # 4 : sb2u | ||
| 114 | pshufb %xmm2, %xmm5 # 4 = sb2u | ||
| 115 | movdqa -0x40(%r11,%r10), %xmm1 # .Lk_mc_forward[] | ||
| 116 | movdqa %xmm14, %xmm2 # 2 : sb2t | ||
| 117 | pshufb %xmm3, %xmm2 # 2 = sb2t | ||
| 118 | pxor %xmm5, %xmm2 # 2 = 2A | ||
| 119 | movdqa (%r11,%r10), %xmm4 # .Lk_mc_backward[] | ||
| 120 | movdqa %xmm0, %xmm3 # 3 = A | ||
| 121 | pshufb %xmm1, %xmm0 # 0 = B | ||
| 122 | add \$16, %r9 # next key | ||
| 123 | pxor %xmm2, %xmm0 # 0 = 2A+B | ||
| 124 | pshufb %xmm4, %xmm3 # 3 = D | ||
| 125 | add \$16, %r11 # next mc | ||
| 126 | pxor %xmm0, %xmm3 # 3 = 2A+B+D | ||
| 127 | pshufb %xmm1, %xmm0 # 0 = 2B+C | ||
| 128 | and \$0x30, %r11 # ... mod 4 | ||
| 129 | pxor %xmm3, %xmm0 # 0 = 2A+3B+C+D | ||
| 130 | sub \$1,%rax # nr-- | ||
| 131 | |||
| 132 | .Lenc_entry: | ||
| 133 | # top of round | ||
| 134 | movdqa %xmm9, %xmm1 # 1 : i | ||
| 135 | pandn %xmm0, %xmm1 # 1 = i<<4 | ||
| 136 | psrld \$4, %xmm1 # 1 = i | ||
| 137 | pand %xmm9, %xmm0 # 0 = k | ||
| 138 | movdqa %xmm11, %xmm5 # 2 : a/k | ||
| 139 | pshufb %xmm0, %xmm5 # 2 = a/k | ||
| 140 | pxor %xmm1, %xmm0 # 0 = j | ||
| 141 | movdqa %xmm10, %xmm3 # 3 : 1/i | ||
| 142 | pshufb %xmm1, %xmm3 # 3 = 1/i | ||
| 143 | pxor %xmm5, %xmm3 # 3 = iak = 1/i + a/k | ||
| 144 | movdqa %xmm10, %xmm4 # 4 : 1/j | ||
| 145 | pshufb %xmm0, %xmm4 # 4 = 1/j | ||
| 146 | pxor %xmm5, %xmm4 # 4 = jak = 1/j + a/k | ||
| 147 | movdqa %xmm10, %xmm2 # 2 : 1/iak | ||
| 148 | pshufb %xmm3, %xmm2 # 2 = 1/iak | ||
| 149 | pxor %xmm0, %xmm2 # 2 = io | ||
| 150 | movdqa %xmm10, %xmm3 # 3 : 1/jak | ||
| 151 | movdqu (%r9), %xmm5 | ||
| 152 | pshufb %xmm4, %xmm3 # 3 = 1/jak | ||
| 153 | pxor %xmm1, %xmm3 # 3 = jo | ||
| 154 | jnz .Lenc_loop | ||
| 155 | |||
| 156 | # middle of last round | ||
| 157 | movdqa -0x60(%r10), %xmm4 # 3 : sbou .Lk_sbo | ||
| 158 | movdqa -0x50(%r10), %xmm0 # 0 : sbot .Lk_sbo+16 | ||
| 159 | pshufb %xmm2, %xmm4 # 4 = sbou | ||
| 160 | pxor %xmm5, %xmm4 # 4 = sb1u + k | ||
| 161 | pshufb %xmm3, %xmm0 # 0 = sb1t | ||
| 162 | movdqa 0x40(%r11,%r10), %xmm1 # .Lk_sr[] | ||
| 163 | pxor %xmm4, %xmm0 # 0 = A | ||
| 164 | pshufb %xmm1, %xmm0 | ||
| 165 | ret | ||
| 166 | .size _vpaes_encrypt_core,.-_vpaes_encrypt_core | ||
| 167 | |||
| 168 | ## | ||
| 169 | ## Decryption core | ||
| 170 | ## | ||
| 171 | ## Same API as encryption core. | ||
| 172 | ## | ||
| 173 | .type _vpaes_decrypt_core,\@abi-omnipotent | ||
| 174 | .align 16 | ||
| 175 | _vpaes_decrypt_core: | ||
| 176 | _CET_ENDBR | ||
| 177 | mov %rdx, %r9 # load key | ||
| 178 | mov 240(%rdx),%eax | ||
| 179 | movdqa %xmm9, %xmm1 | ||
| 180 | movdqa .Lk_dipt(%rip), %xmm2 # iptlo | ||
| 181 | pandn %xmm0, %xmm1 | ||
| 182 | mov %rax, %r11 | ||
| 183 | psrld \$4, %xmm1 | ||
| 184 | movdqu (%r9), %xmm5 # round0 key | ||
| 185 | shl \$4, %r11 | ||
| 186 | pand %xmm9, %xmm0 | ||
| 187 | pshufb %xmm0, %xmm2 | ||
| 188 | movdqa .Lk_dipt+16(%rip), %xmm0 # ipthi | ||
| 189 | xor \$0x30, %r11 | ||
| 190 | lea .Lk_dsbd(%rip),%r10 | ||
| 191 | pshufb %xmm1, %xmm0 | ||
| 192 | and \$0x30, %r11 | ||
| 193 | pxor %xmm5, %xmm2 | ||
| 194 | movdqa .Lk_mc_forward+48(%rip), %xmm5 | ||
| 195 | pxor %xmm2, %xmm0 | ||
| 196 | add \$16, %r9 | ||
| 197 | add %r10, %r11 | ||
| 198 | jmp .Ldec_entry | ||
| 199 | |||
| 200 | .align 16 | ||
| 201 | .Ldec_loop: | ||
| 202 | ## | ||
| 203 | ## Inverse mix columns | ||
| 204 | ## | ||
| 205 | movdqa -0x20(%r10),%xmm4 # 4 : sb9u | ||
| 206 | pshufb %xmm2, %xmm4 # 4 = sb9u | ||
| 207 | pxor %xmm0, %xmm4 | ||
| 208 | movdqa -0x10(%r10),%xmm0 # 0 : sb9t | ||
| 209 | pshufb %xmm3, %xmm0 # 0 = sb9t | ||
| 210 | pxor %xmm4, %xmm0 # 0 = ch | ||
| 211 | add \$16, %r9 # next round key | ||
| 212 | |||
| 213 | pshufb %xmm5, %xmm0 # MC ch | ||
| 214 | movdqa 0x00(%r10),%xmm4 # 4 : sbdu | ||
| 215 | pshufb %xmm2, %xmm4 # 4 = sbdu | ||
| 216 | pxor %xmm0, %xmm4 # 4 = ch | ||
| 217 | movdqa 0x10(%r10),%xmm0 # 0 : sbdt | ||
| 218 | pshufb %xmm3, %xmm0 # 0 = sbdt | ||
| 219 | pxor %xmm4, %xmm0 # 0 = ch | ||
| 220 | sub \$1,%rax # nr-- | ||
| 221 | |||
| 222 | pshufb %xmm5, %xmm0 # MC ch | ||
| 223 | movdqa 0x20(%r10),%xmm4 # 4 : sbbu | ||
| 224 | pshufb %xmm2, %xmm4 # 4 = sbbu | ||
| 225 | pxor %xmm0, %xmm4 # 4 = ch | ||
| 226 | movdqa 0x30(%r10),%xmm0 # 0 : sbbt | ||
| 227 | pshufb %xmm3, %xmm0 # 0 = sbbt | ||
| 228 | pxor %xmm4, %xmm0 # 0 = ch | ||
| 229 | |||
| 230 | pshufb %xmm5, %xmm0 # MC ch | ||
| 231 | movdqa 0x40(%r10),%xmm4 # 4 : sbeu | ||
| 232 | pshufb %xmm2, %xmm4 # 4 = sbeu | ||
| 233 | pxor %xmm0, %xmm4 # 4 = ch | ||
| 234 | movdqa 0x50(%r10),%xmm0 # 0 : sbet | ||
| 235 | pshufb %xmm3, %xmm0 # 0 = sbet | ||
| 236 | pxor %xmm4, %xmm0 # 0 = ch | ||
| 237 | |||
| 238 | palignr \$12, %xmm5, %xmm5 | ||
| 239 | |||
| 240 | .Ldec_entry: | ||
| 241 | # top of round | ||
| 242 | movdqa %xmm9, %xmm1 # 1 : i | ||
| 243 | pandn %xmm0, %xmm1 # 1 = i<<4 | ||
| 244 | psrld \$4, %xmm1 # 1 = i | ||
| 245 | pand %xmm9, %xmm0 # 0 = k | ||
| 246 | movdqa %xmm11, %xmm2 # 2 : a/k | ||
| 247 | pshufb %xmm0, %xmm2 # 2 = a/k | ||
| 248 | pxor %xmm1, %xmm0 # 0 = j | ||
| 249 | movdqa %xmm10, %xmm3 # 3 : 1/i | ||
| 250 | pshufb %xmm1, %xmm3 # 3 = 1/i | ||
| 251 | pxor %xmm2, %xmm3 # 3 = iak = 1/i + a/k | ||
| 252 | movdqa %xmm10, %xmm4 # 4 : 1/j | ||
| 253 | pshufb %xmm0, %xmm4 # 4 = 1/j | ||
| 254 | pxor %xmm2, %xmm4 # 4 = jak = 1/j + a/k | ||
| 255 | movdqa %xmm10, %xmm2 # 2 : 1/iak | ||
| 256 | pshufb %xmm3, %xmm2 # 2 = 1/iak | ||
| 257 | pxor %xmm0, %xmm2 # 2 = io | ||
| 258 | movdqa %xmm10, %xmm3 # 3 : 1/jak | ||
| 259 | pshufb %xmm4, %xmm3 # 3 = 1/jak | ||
| 260 | pxor %xmm1, %xmm3 # 3 = jo | ||
| 261 | movdqu (%r9), %xmm0 | ||
| 262 | jnz .Ldec_loop | ||
| 263 | |||
| 264 | # middle of last round | ||
| 265 | movdqa 0x60(%r10), %xmm4 # 3 : sbou | ||
| 266 | pshufb %xmm2, %xmm4 # 4 = sbou | ||
| 267 | pxor %xmm0, %xmm4 # 4 = sb1u + k | ||
| 268 | movdqa 0x70(%r10), %xmm0 # 0 : sbot | ||
| 269 | movdqa -0x160(%r11), %xmm2 # .Lk_sr-.Lk_dsbd=-0x160 | ||
| 270 | pshufb %xmm3, %xmm0 # 0 = sb1t | ||
| 271 | pxor %xmm4, %xmm0 # 0 = A | ||
| 272 | pshufb %xmm2, %xmm0 | ||
| 273 | ret | ||
| 274 | .size _vpaes_decrypt_core,.-_vpaes_decrypt_core | ||
| 275 | |||
| 276 | ######################################################## | ||
| 277 | ## ## | ||
| 278 | ## AES key schedule ## | ||
| 279 | ## ## | ||
| 280 | ######################################################## | ||
| 281 | .type _vpaes_schedule_core,\@abi-omnipotent | ||
| 282 | .align 16 | ||
| 283 | _vpaes_schedule_core: | ||
| 284 | _CET_ENDBR | ||
| 285 | # rdi = key | ||
| 286 | # rsi = size in bits | ||
| 287 | # rdx = buffer | ||
| 288 | # rcx = direction. 0=encrypt, 1=decrypt | ||
| 289 | |||
| 290 | call _vpaes_preheat # load the tables | ||
| 291 | movdqa .Lk_rcon(%rip), %xmm8 # load rcon | ||
| 292 | movdqu (%rdi), %xmm0 # load key (unaligned) | ||
| 293 | |||
| 294 | # input transform | ||
| 295 | movdqa %xmm0, %xmm3 | ||
| 296 | lea .Lk_ipt(%rip), %r11 | ||
| 297 | call _vpaes_schedule_transform | ||
| 298 | movdqa %xmm0, %xmm7 | ||
| 299 | |||
| 300 | lea .Lk_sr(%rip),%r10 | ||
| 301 | test %rcx, %rcx | ||
| 302 | jnz .Lschedule_am_decrypting | ||
| 303 | |||
| 304 | # encrypting, output zeroth round key after transform | ||
| 305 | movdqu %xmm0, (%rdx) | ||
| 306 | jmp .Lschedule_go | ||
| 307 | |||
| 308 | .Lschedule_am_decrypting: | ||
| 309 | # decrypting, output zeroth round key after shiftrows | ||
| 310 | movdqa (%r8,%r10),%xmm1 | ||
| 311 | pshufb %xmm1, %xmm3 | ||
| 312 | movdqu %xmm3, (%rdx) | ||
| 313 | xor \$0x30, %r8 | ||
| 314 | |||
| 315 | .Lschedule_go: | ||
| 316 | cmp \$192, %esi | ||
| 317 | ja .Lschedule_256 | ||
| 318 | je .Lschedule_192 | ||
| 319 | # 128: fall though | ||
| 320 | |||
| 321 | ## | ||
| 322 | ## .schedule_128 | ||
| 323 | ## | ||
| 324 | ## 128-bit specific part of key schedule. | ||
| 325 | ## | ||
| 326 | ## This schedule is really simple, because all its parts | ||
| 327 | ## are accomplished by the subroutines. | ||
| 328 | ## | ||
| 329 | .Lschedule_128: | ||
| 330 | mov \$10, %esi | ||
| 331 | |||
| 332 | .Loop_schedule_128: | ||
| 333 | call _vpaes_schedule_round | ||
| 334 | dec %rsi | ||
| 335 | jz .Lschedule_mangle_last | ||
| 336 | call _vpaes_schedule_mangle # write output | ||
| 337 | jmp .Loop_schedule_128 | ||
| 338 | |||
| 339 | ## | ||
| 340 | ## .aes_schedule_192 | ||
| 341 | ## | ||
| 342 | ## 192-bit specific part of key schedule. | ||
| 343 | ## | ||
| 344 | ## The main body of this schedule is the same as the 128-bit | ||
| 345 | ## schedule, but with more smearing. The long, high side is | ||
| 346 | ## stored in %xmm7 as before, and the short, low side is in | ||
| 347 | ## the high bits of %xmm6. | ||
| 348 | ## | ||
| 349 | ## This schedule is somewhat nastier, however, because each | ||
| 350 | ## round produces 192 bits of key material, or 1.5 round keys. | ||
| 351 | ## Therefore, on each cycle we do 2 rounds and produce 3 round | ||
| 352 | ## keys. | ||
| 353 | ## | ||
| 354 | .align 16 | ||
| 355 | .Lschedule_192: | ||
| 356 | movdqu 8(%rdi),%xmm0 # load key part 2 (very unaligned) | ||
| 357 | call _vpaes_schedule_transform # input transform | ||
| 358 | movdqa %xmm0, %xmm6 # save short part | ||
| 359 | pxor %xmm4, %xmm4 # clear 4 | ||
| 360 | movhlps %xmm4, %xmm6 # clobber low side with zeros | ||
| 361 | mov \$4, %esi | ||
| 362 | |||
| 363 | .Loop_schedule_192: | ||
| 364 | call _vpaes_schedule_round | ||
| 365 | palignr \$8,%xmm6,%xmm0 | ||
| 366 | call _vpaes_schedule_mangle # save key n | ||
| 367 | call _vpaes_schedule_192_smear | ||
| 368 | call _vpaes_schedule_mangle # save key n+1 | ||
| 369 | call _vpaes_schedule_round | ||
| 370 | dec %rsi | ||
| 371 | jz .Lschedule_mangle_last | ||
| 372 | call _vpaes_schedule_mangle # save key n+2 | ||
| 373 | call _vpaes_schedule_192_smear | ||
| 374 | jmp .Loop_schedule_192 | ||
| 375 | |||
| 376 | ## | ||
| 377 | ## .aes_schedule_256 | ||
| 378 | ## | ||
| 379 | ## 256-bit specific part of key schedule. | ||
| 380 | ## | ||
| 381 | ## The structure here is very similar to the 128-bit | ||
| 382 | ## schedule, but with an additional "low side" in | ||
| 383 | ## %xmm6. The low side's rounds are the same as the | ||
| 384 | ## high side's, except no rcon and no rotation. | ||
| 385 | ## | ||
| 386 | .align 16 | ||
| 387 | .Lschedule_256: | ||
| 388 | movdqu 16(%rdi),%xmm0 # load key part 2 (unaligned) | ||
| 389 | call _vpaes_schedule_transform # input transform | ||
| 390 | mov \$7, %esi | ||
| 391 | |||
| 392 | .Loop_schedule_256: | ||
| 393 | call _vpaes_schedule_mangle # output low result | ||
| 394 | movdqa %xmm0, %xmm6 # save cur_lo in xmm6 | ||
| 395 | |||
| 396 | # high round | ||
| 397 | call _vpaes_schedule_round | ||
| 398 | dec %rsi | ||
| 399 | jz .Lschedule_mangle_last | ||
| 400 | call _vpaes_schedule_mangle | ||
| 401 | |||
| 402 | # low round. swap xmm7 and xmm6 | ||
| 403 | pshufd \$0xFF, %xmm0, %xmm0 | ||
| 404 | movdqa %xmm7, %xmm5 | ||
| 405 | movdqa %xmm6, %xmm7 | ||
| 406 | call _vpaes_schedule_low_round | ||
| 407 | movdqa %xmm5, %xmm7 | ||
| 408 | |||
| 409 | jmp .Loop_schedule_256 | ||
| 410 | |||
| 411 | |||
| 412 | ## | ||
| 413 | ## .aes_schedule_mangle_last | ||
| 414 | ## | ||
| 415 | ## Mangler for last round of key schedule | ||
| 416 | ## Mangles %xmm0 | ||
| 417 | ## when encrypting, outputs out(%xmm0) ^ 63 | ||
| 418 | ## when decrypting, outputs unskew(%xmm0) | ||
| 419 | ## | ||
| 420 | ## Always called right before return... jumps to cleanup and exits | ||
| 421 | ## | ||
| 422 | .align 16 | ||
| 423 | .Lschedule_mangle_last: | ||
| 424 | # schedule last round key from xmm0 | ||
| 425 | lea .Lk_deskew(%rip),%r11 # prepare to deskew | ||
| 426 | test %rcx, %rcx | ||
| 427 | jnz .Lschedule_mangle_last_dec | ||
| 428 | |||
| 429 | # encrypting | ||
| 430 | movdqa (%r8,%r10),%xmm1 | ||
| 431 | pshufb %xmm1, %xmm0 # output permute | ||
| 432 | lea .Lk_opt(%rip), %r11 # prepare to output transform | ||
| 433 | add \$32, %rdx | ||
| 434 | |||
| 435 | .Lschedule_mangle_last_dec: | ||
| 436 | add \$-16, %rdx | ||
| 437 | pxor .Lk_s63(%rip), %xmm0 | ||
| 438 | call _vpaes_schedule_transform # output transform | ||
| 439 | movdqu %xmm0, (%rdx) # save last key | ||
| 440 | |||
| 441 | # cleanup | ||
| 442 | pxor %xmm0, %xmm0 | ||
| 443 | pxor %xmm1, %xmm1 | ||
| 444 | pxor %xmm2, %xmm2 | ||
| 445 | pxor %xmm3, %xmm3 | ||
| 446 | pxor %xmm4, %xmm4 | ||
| 447 | pxor %xmm5, %xmm5 | ||
| 448 | pxor %xmm6, %xmm6 | ||
| 449 | pxor %xmm7, %xmm7 | ||
| 450 | ret | ||
| 451 | .size _vpaes_schedule_core,.-_vpaes_schedule_core | ||
| 452 | |||
| 453 | ## | ||
| 454 | ## .aes_schedule_192_smear | ||
| 455 | ## | ||
| 456 | ## Smear the short, low side in the 192-bit key schedule. | ||
| 457 | ## | ||
| 458 | ## Inputs: | ||
| 459 | ## %xmm7: high side, b a x y | ||
| 460 | ## %xmm6: low side, d c 0 0 | ||
| 461 | ## %xmm13: 0 | ||
| 462 | ## | ||
| 463 | ## Outputs: | ||
| 464 | ## %xmm6: b+c+d b+c 0 0 | ||
| 465 | ## %xmm0: b+c+d b+c b a | ||
| 466 | ## | ||
| 467 | .type _vpaes_schedule_192_smear,\@abi-omnipotent | ||
| 468 | .align 16 | ||
| 469 | _vpaes_schedule_192_smear: | ||
| 470 | _CET_ENDBR | ||
| 471 | pshufd \$0x80, %xmm6, %xmm0 # d c 0 0 -> c 0 0 0 | ||
| 472 | pxor %xmm0, %xmm6 # -> c+d c 0 0 | ||
| 473 | pshufd \$0xFE, %xmm7, %xmm0 # b a _ _ -> b b b a | ||
| 474 | pxor %xmm0, %xmm6 # -> b+c+d b+c b a | ||
| 475 | movdqa %xmm6, %xmm0 | ||
| 476 | pxor %xmm1, %xmm1 | ||
| 477 | movhlps %xmm1, %xmm6 # clobber low side with zeros | ||
| 478 | ret | ||
| 479 | .size _vpaes_schedule_192_smear,.-_vpaes_schedule_192_smear | ||
| 480 | |||
| 481 | ## | ||
| 482 | ## .aes_schedule_round | ||
| 483 | ## | ||
| 484 | ## Runs one main round of the key schedule on %xmm0, %xmm7 | ||
| 485 | ## | ||
| 486 | ## Specifically, runs subbytes on the high dword of %xmm0 | ||
| 487 | ## then rotates it by one byte and xors into the low dword of | ||
| 488 | ## %xmm7. | ||
| 489 | ## | ||
| 490 | ## Adds rcon from low byte of %xmm8, then rotates %xmm8 for | ||
| 491 | ## next rcon. | ||
| 492 | ## | ||
| 493 | ## Smears the dwords of %xmm7 by xoring the low into the | ||
| 494 | ## second low, result into third, result into highest. | ||
| 495 | ## | ||
| 496 | ## Returns results in %xmm7 = %xmm0. | ||
| 497 | ## Clobbers %xmm1-%xmm4, %r11. | ||
| 498 | ## | ||
| 499 | .type _vpaes_schedule_round,\@abi-omnipotent | ||
| 500 | .align 16 | ||
| 501 | _vpaes_schedule_round: | ||
| 502 | _CET_ENDBR | ||
| 503 | # extract rcon from xmm8 | ||
| 504 | pxor %xmm1, %xmm1 | ||
| 505 | palignr \$15, %xmm8, %xmm1 | ||
| 506 | palignr \$15, %xmm8, %xmm8 | ||
| 507 | pxor %xmm1, %xmm7 | ||
| 508 | |||
| 509 | # rotate | ||
| 510 | pshufd \$0xFF, %xmm0, %xmm0 | ||
| 511 | palignr \$1, %xmm0, %xmm0 | ||
| 512 | |||
| 513 | # fall through... | ||
| 514 | |||
| 515 | # low round: same as high round, but no rotation and no rcon. | ||
| 516 | _vpaes_schedule_low_round: | ||
| 517 | # smear xmm7 | ||
| 518 | movdqa %xmm7, %xmm1 | ||
| 519 | pslldq \$4, %xmm7 | ||
| 520 | pxor %xmm1, %xmm7 | ||
| 521 | movdqa %xmm7, %xmm1 | ||
| 522 | pslldq \$8, %xmm7 | ||
| 523 | pxor %xmm1, %xmm7 | ||
| 524 | pxor .Lk_s63(%rip), %xmm7 | ||
| 525 | |||
| 526 | # subbytes | ||
| 527 | movdqa %xmm9, %xmm1 | ||
| 528 | pandn %xmm0, %xmm1 | ||
| 529 | psrld \$4, %xmm1 # 1 = i | ||
| 530 | pand %xmm9, %xmm0 # 0 = k | ||
| 531 | movdqa %xmm11, %xmm2 # 2 : a/k | ||
| 532 | pshufb %xmm0, %xmm2 # 2 = a/k | ||
| 533 | pxor %xmm1, %xmm0 # 0 = j | ||
| 534 | movdqa %xmm10, %xmm3 # 3 : 1/i | ||
| 535 | pshufb %xmm1, %xmm3 # 3 = 1/i | ||
| 536 | pxor %xmm2, %xmm3 # 3 = iak = 1/i + a/k | ||
| 537 | movdqa %xmm10, %xmm4 # 4 : 1/j | ||
| 538 | pshufb %xmm0, %xmm4 # 4 = 1/j | ||
| 539 | pxor %xmm2, %xmm4 # 4 = jak = 1/j + a/k | ||
| 540 | movdqa %xmm10, %xmm2 # 2 : 1/iak | ||
| 541 | pshufb %xmm3, %xmm2 # 2 = 1/iak | ||
| 542 | pxor %xmm0, %xmm2 # 2 = io | ||
| 543 | movdqa %xmm10, %xmm3 # 3 : 1/jak | ||
| 544 | pshufb %xmm4, %xmm3 # 3 = 1/jak | ||
| 545 | pxor %xmm1, %xmm3 # 3 = jo | ||
| 546 | movdqa %xmm13, %xmm4 # 4 : sbou | ||
| 547 | pshufb %xmm2, %xmm4 # 4 = sbou | ||
| 548 | movdqa %xmm12, %xmm0 # 0 : sbot | ||
| 549 | pshufb %xmm3, %xmm0 # 0 = sb1t | ||
| 550 | pxor %xmm4, %xmm0 # 0 = sbox output | ||
| 551 | |||
| 552 | # add in smeared stuff | ||
| 553 | pxor %xmm7, %xmm0 | ||
| 554 | movdqa %xmm0, %xmm7 | ||
| 555 | ret | ||
| 556 | .size _vpaes_schedule_round,.-_vpaes_schedule_round | ||
| 557 | |||
| 558 | ## | ||
| 559 | ## .aes_schedule_transform | ||
| 560 | ## | ||
| 561 | ## Linear-transform %xmm0 according to tables at (%r11) | ||
| 562 | ## | ||
| 563 | ## Requires that %xmm9 = 0x0F0F... as in preheat | ||
| 564 | ## Output in %xmm0 | ||
| 565 | ## Clobbers %xmm1, %xmm2 | ||
| 566 | ## | ||
| 567 | .type _vpaes_schedule_transform,\@abi-omnipotent | ||
| 568 | .align 16 | ||
| 569 | _vpaes_schedule_transform: | ||
| 570 | _CET_ENDBR | ||
| 571 | movdqa %xmm9, %xmm1 | ||
| 572 | pandn %xmm0, %xmm1 | ||
| 573 | psrld \$4, %xmm1 | ||
| 574 | pand %xmm9, %xmm0 | ||
| 575 | movdqa (%r11), %xmm2 # lo | ||
| 576 | pshufb %xmm0, %xmm2 | ||
| 577 | movdqa 16(%r11), %xmm0 # hi | ||
| 578 | pshufb %xmm1, %xmm0 | ||
| 579 | pxor %xmm2, %xmm0 | ||
| 580 | ret | ||
| 581 | .size _vpaes_schedule_transform,.-_vpaes_schedule_transform | ||
| 582 | |||
| 583 | ## | ||
| 584 | ## .aes_schedule_mangle | ||
| 585 | ## | ||
| 586 | ## Mangle xmm0 from (basis-transformed) standard version | ||
| 587 | ## to our version. | ||
| 588 | ## | ||
| 589 | ## On encrypt, | ||
| 590 | ## xor with 0x63 | ||
| 591 | ## multiply by circulant 0,1,1,1 | ||
| 592 | ## apply shiftrows transform | ||
| 593 | ## | ||
| 594 | ## On decrypt, | ||
| 595 | ## xor with 0x63 | ||
| 596 | ## multiply by "inverse mixcolumns" circulant E,B,D,9 | ||
| 597 | ## deskew | ||
| 598 | ## apply shiftrows transform | ||
| 599 | ## | ||
| 600 | ## | ||
| 601 | ## Writes out to (%rdx), and increments or decrements it | ||
| 602 | ## Keeps track of round number mod 4 in %r8 | ||
| 603 | ## Preserves xmm0 | ||
| 604 | ## Clobbers xmm1-xmm5 | ||
| 605 | ## | ||
| 606 | .type _vpaes_schedule_mangle,\@abi-omnipotent | ||
| 607 | .align 16 | ||
| 608 | _vpaes_schedule_mangle: | ||
| 609 | _CET_ENDBR | ||
| 610 | movdqa %xmm0, %xmm4 # save xmm0 for later | ||
| 611 | movdqa .Lk_mc_forward(%rip),%xmm5 | ||
| 612 | test %rcx, %rcx | ||
| 613 | jnz .Lschedule_mangle_dec | ||
| 614 | |||
| 615 | # encrypting | ||
| 616 | add \$16, %rdx | ||
| 617 | pxor .Lk_s63(%rip),%xmm4 | ||
| 618 | pshufb %xmm5, %xmm4 | ||
| 619 | movdqa %xmm4, %xmm3 | ||
| 620 | pshufb %xmm5, %xmm4 | ||
| 621 | pxor %xmm4, %xmm3 | ||
| 622 | pshufb %xmm5, %xmm4 | ||
| 623 | pxor %xmm4, %xmm3 | ||
| 624 | |||
| 625 | jmp .Lschedule_mangle_both | ||
| 626 | .align 16 | ||
| 627 | .Lschedule_mangle_dec: | ||
| 628 | # inverse mix columns | ||
| 629 | lea .Lk_dksd(%rip),%r11 | ||
| 630 | movdqa %xmm9, %xmm1 | ||
| 631 | pandn %xmm4, %xmm1 | ||
| 632 | psrld \$4, %xmm1 # 1 = hi | ||
| 633 | pand %xmm9, %xmm4 # 4 = lo | ||
| 634 | |||
| 635 | movdqa 0x00(%r11), %xmm2 | ||
| 636 | pshufb %xmm4, %xmm2 | ||
| 637 | movdqa 0x10(%r11), %xmm3 | ||
| 638 | pshufb %xmm1, %xmm3 | ||
| 639 | pxor %xmm2, %xmm3 | ||
| 640 | pshufb %xmm5, %xmm3 | ||
| 641 | |||
| 642 | movdqa 0x20(%r11), %xmm2 | ||
| 643 | pshufb %xmm4, %xmm2 | ||
| 644 | pxor %xmm3, %xmm2 | ||
| 645 | movdqa 0x30(%r11), %xmm3 | ||
| 646 | pshufb %xmm1, %xmm3 | ||
| 647 | pxor %xmm2, %xmm3 | ||
| 648 | pshufb %xmm5, %xmm3 | ||
| 649 | |||
| 650 | movdqa 0x40(%r11), %xmm2 | ||
| 651 | pshufb %xmm4, %xmm2 | ||
| 652 | pxor %xmm3, %xmm2 | ||
| 653 | movdqa 0x50(%r11), %xmm3 | ||
| 654 | pshufb %xmm1, %xmm3 | ||
| 655 | pxor %xmm2, %xmm3 | ||
| 656 | pshufb %xmm5, %xmm3 | ||
| 657 | |||
| 658 | movdqa 0x60(%r11), %xmm2 | ||
| 659 | pshufb %xmm4, %xmm2 | ||
| 660 | pxor %xmm3, %xmm2 | ||
| 661 | movdqa 0x70(%r11), %xmm3 | ||
| 662 | pshufb %xmm1, %xmm3 | ||
| 663 | pxor %xmm2, %xmm3 | ||
| 664 | |||
| 665 | add \$-16, %rdx | ||
| 666 | |||
| 667 | .Lschedule_mangle_both: | ||
| 668 | movdqa (%r8,%r10),%xmm1 | ||
| 669 | pshufb %xmm1,%xmm3 | ||
| 670 | add \$-16, %r8 | ||
| 671 | and \$0x30, %r8 | ||
| 672 | movdqu %xmm3, (%rdx) | ||
| 673 | ret | ||
| 674 | .size _vpaes_schedule_mangle,.-_vpaes_schedule_mangle | ||
| 675 | |||
| 676 | # | ||
| 677 | # Interface to OpenSSL | ||
| 678 | # | ||
| 679 | .globl ${PREFIX}_set_encrypt_key | ||
| 680 | .type ${PREFIX}_set_encrypt_key,\@function,3 | ||
| 681 | .align 16 | ||
| 682 | ${PREFIX}_set_encrypt_key: | ||
| 683 | _CET_ENDBR | ||
| 684 | ___ | ||
| 685 | $code.=<<___ if ($win64); | ||
| 686 | lea -0xb8(%rsp),%rsp | ||
| 687 | movaps %xmm6,0x10(%rsp) | ||
| 688 | movaps %xmm7,0x20(%rsp) | ||
| 689 | movaps %xmm8,0x30(%rsp) | ||
| 690 | movaps %xmm9,0x40(%rsp) | ||
| 691 | movaps %xmm10,0x50(%rsp) | ||
| 692 | movaps %xmm11,0x60(%rsp) | ||
| 693 | movaps %xmm12,0x70(%rsp) | ||
| 694 | movaps %xmm13,0x80(%rsp) | ||
| 695 | movaps %xmm14,0x90(%rsp) | ||
| 696 | movaps %xmm15,0xa0(%rsp) | ||
| 697 | .Lenc_key_body: | ||
| 698 | ___ | ||
| 699 | $code.=<<___; | ||
| 700 | mov %esi,%eax | ||
| 701 | shr \$5,%eax | ||
| 702 | add \$5,%eax | ||
| 703 | mov %eax,240(%rdx) # AES_KEY->rounds = nbits/32+5; | ||
| 704 | |||
| 705 | mov \$0,%ecx | ||
| 706 | mov \$0x30,%r8d | ||
| 707 | call _vpaes_schedule_core | ||
| 708 | ___ | ||
| 709 | $code.=<<___ if ($win64); | ||
| 710 | movaps 0x10(%rsp),%xmm6 | ||
| 711 | movaps 0x20(%rsp),%xmm7 | ||
| 712 | movaps 0x30(%rsp),%xmm8 | ||
| 713 | movaps 0x40(%rsp),%xmm9 | ||
| 714 | movaps 0x50(%rsp),%xmm10 | ||
| 715 | movaps 0x60(%rsp),%xmm11 | ||
| 716 | movaps 0x70(%rsp),%xmm12 | ||
| 717 | movaps 0x80(%rsp),%xmm13 | ||
| 718 | movaps 0x90(%rsp),%xmm14 | ||
| 719 | movaps 0xa0(%rsp),%xmm15 | ||
| 720 | lea 0xb8(%rsp),%rsp | ||
| 721 | .Lenc_key_epilogue: | ||
| 722 | ___ | ||
| 723 | $code.=<<___; | ||
| 724 | xor %eax,%eax | ||
| 725 | ret | ||
| 726 | .size ${PREFIX}_set_encrypt_key,.-${PREFIX}_set_encrypt_key | ||
| 727 | |||
| 728 | .globl ${PREFIX}_set_decrypt_key | ||
| 729 | .type ${PREFIX}_set_decrypt_key,\@function,3 | ||
| 730 | .align 16 | ||
| 731 | ${PREFIX}_set_decrypt_key: | ||
| 732 | _CET_ENDBR | ||
| 733 | ___ | ||
| 734 | $code.=<<___ if ($win64); | ||
| 735 | lea -0xb8(%rsp),%rsp | ||
| 736 | movaps %xmm6,0x10(%rsp) | ||
| 737 | movaps %xmm7,0x20(%rsp) | ||
| 738 | movaps %xmm8,0x30(%rsp) | ||
| 739 | movaps %xmm9,0x40(%rsp) | ||
| 740 | movaps %xmm10,0x50(%rsp) | ||
| 741 | movaps %xmm11,0x60(%rsp) | ||
| 742 | movaps %xmm12,0x70(%rsp) | ||
| 743 | movaps %xmm13,0x80(%rsp) | ||
| 744 | movaps %xmm14,0x90(%rsp) | ||
| 745 | movaps %xmm15,0xa0(%rsp) | ||
| 746 | .Ldec_key_body: | ||
| 747 | ___ | ||
| 748 | $code.=<<___; | ||
| 749 | mov %esi,%eax | ||
| 750 | shr \$5,%eax | ||
| 751 | add \$5,%eax | ||
| 752 | mov %eax,240(%rdx) # AES_KEY->rounds = nbits/32+5; | ||
| 753 | shl \$4,%eax | ||
| 754 | lea 16(%rdx,%rax),%rdx | ||
| 755 | |||
| 756 | mov \$1,%ecx | ||
| 757 | mov %esi,%r8d | ||
| 758 | shr \$1,%r8d | ||
| 759 | and \$32,%r8d | ||
| 760 | xor \$32,%r8d # nbits==192?0:32 | ||
| 761 | call _vpaes_schedule_core | ||
| 762 | ___ | ||
| 763 | $code.=<<___ if ($win64); | ||
| 764 | movaps 0x10(%rsp),%xmm6 | ||
| 765 | movaps 0x20(%rsp),%xmm7 | ||
| 766 | movaps 0x30(%rsp),%xmm8 | ||
| 767 | movaps 0x40(%rsp),%xmm9 | ||
| 768 | movaps 0x50(%rsp),%xmm10 | ||
| 769 | movaps 0x60(%rsp),%xmm11 | ||
| 770 | movaps 0x70(%rsp),%xmm12 | ||
| 771 | movaps 0x80(%rsp),%xmm13 | ||
| 772 | movaps 0x90(%rsp),%xmm14 | ||
| 773 | movaps 0xa0(%rsp),%xmm15 | ||
| 774 | lea 0xb8(%rsp),%rsp | ||
| 775 | .Ldec_key_epilogue: | ||
| 776 | ___ | ||
| 777 | $code.=<<___; | ||
| 778 | xor %eax,%eax | ||
| 779 | ret | ||
| 780 | .size ${PREFIX}_set_decrypt_key,.-${PREFIX}_set_decrypt_key | ||
| 781 | |||
| 782 | .globl ${PREFIX}_encrypt | ||
| 783 | .type ${PREFIX}_encrypt,\@function,3 | ||
| 784 | .align 16 | ||
| 785 | ${PREFIX}_encrypt: | ||
| 786 | _CET_ENDBR | ||
| 787 | ___ | ||
| 788 | $code.=<<___ if ($win64); | ||
| 789 | lea -0xb8(%rsp),%rsp | ||
| 790 | movaps %xmm6,0x10(%rsp) | ||
| 791 | movaps %xmm7,0x20(%rsp) | ||
| 792 | movaps %xmm8,0x30(%rsp) | ||
| 793 | movaps %xmm9,0x40(%rsp) | ||
| 794 | movaps %xmm10,0x50(%rsp) | ||
| 795 | movaps %xmm11,0x60(%rsp) | ||
| 796 | movaps %xmm12,0x70(%rsp) | ||
| 797 | movaps %xmm13,0x80(%rsp) | ||
| 798 | movaps %xmm14,0x90(%rsp) | ||
| 799 | movaps %xmm15,0xa0(%rsp) | ||
| 800 | .Lenc_body: | ||
| 801 | ___ | ||
| 802 | $code.=<<___; | ||
| 803 | movdqu (%rdi),%xmm0 | ||
| 804 | call _vpaes_preheat | ||
| 805 | call _vpaes_encrypt_core | ||
| 806 | movdqu %xmm0,(%rsi) | ||
| 807 | ___ | ||
| 808 | $code.=<<___ if ($win64); | ||
| 809 | movaps 0x10(%rsp),%xmm6 | ||
| 810 | movaps 0x20(%rsp),%xmm7 | ||
| 811 | movaps 0x30(%rsp),%xmm8 | ||
| 812 | movaps 0x40(%rsp),%xmm9 | ||
| 813 | movaps 0x50(%rsp),%xmm10 | ||
| 814 | movaps 0x60(%rsp),%xmm11 | ||
| 815 | movaps 0x70(%rsp),%xmm12 | ||
| 816 | movaps 0x80(%rsp),%xmm13 | ||
| 817 | movaps 0x90(%rsp),%xmm14 | ||
| 818 | movaps 0xa0(%rsp),%xmm15 | ||
| 819 | lea 0xb8(%rsp),%rsp | ||
| 820 | .Lenc_epilogue: | ||
| 821 | ___ | ||
| 822 | $code.=<<___; | ||
| 823 | ret | ||
| 824 | .size ${PREFIX}_encrypt,.-${PREFIX}_encrypt | ||
| 825 | |||
| 826 | .globl ${PREFIX}_decrypt | ||
| 827 | .type ${PREFIX}_decrypt,\@function,3 | ||
| 828 | .align 16 | ||
| 829 | ${PREFIX}_decrypt: | ||
| 830 | _CET_ENDBR | ||
| 831 | ___ | ||
| 832 | $code.=<<___ if ($win64); | ||
| 833 | lea -0xb8(%rsp),%rsp | ||
| 834 | movaps %xmm6,0x10(%rsp) | ||
| 835 | movaps %xmm7,0x20(%rsp) | ||
| 836 | movaps %xmm8,0x30(%rsp) | ||
| 837 | movaps %xmm9,0x40(%rsp) | ||
| 838 | movaps %xmm10,0x50(%rsp) | ||
| 839 | movaps %xmm11,0x60(%rsp) | ||
| 840 | movaps %xmm12,0x70(%rsp) | ||
| 841 | movaps %xmm13,0x80(%rsp) | ||
| 842 | movaps %xmm14,0x90(%rsp) | ||
| 843 | movaps %xmm15,0xa0(%rsp) | ||
| 844 | .Ldec_body: | ||
| 845 | ___ | ||
| 846 | $code.=<<___; | ||
| 847 | movdqu (%rdi),%xmm0 | ||
| 848 | call _vpaes_preheat | ||
| 849 | call _vpaes_decrypt_core | ||
| 850 | movdqu %xmm0,(%rsi) | ||
| 851 | ___ | ||
| 852 | $code.=<<___ if ($win64); | ||
| 853 | movaps 0x10(%rsp),%xmm6 | ||
| 854 | movaps 0x20(%rsp),%xmm7 | ||
| 855 | movaps 0x30(%rsp),%xmm8 | ||
| 856 | movaps 0x40(%rsp),%xmm9 | ||
| 857 | movaps 0x50(%rsp),%xmm10 | ||
| 858 | movaps 0x60(%rsp),%xmm11 | ||
| 859 | movaps 0x70(%rsp),%xmm12 | ||
| 860 | movaps 0x80(%rsp),%xmm13 | ||
| 861 | movaps 0x90(%rsp),%xmm14 | ||
| 862 | movaps 0xa0(%rsp),%xmm15 | ||
| 863 | lea 0xb8(%rsp),%rsp | ||
| 864 | .Ldec_epilogue: | ||
| 865 | ___ | ||
| 866 | $code.=<<___; | ||
| 867 | ret | ||
| 868 | .size ${PREFIX}_decrypt,.-${PREFIX}_decrypt | ||
| 869 | ___ | ||
| 870 | { | ||
| 871 | my ($inp,$out,$len,$key,$ivp,$enc)=("%rdi","%rsi","%rdx","%rcx","%r8","%r9"); | ||
| 872 | # void AES_cbc_encrypt (const void char *inp, unsigned char *out, | ||
| 873 | # size_t length, const AES_KEY *key, | ||
| 874 | # unsigned char *ivp,const int enc); | ||
| 875 | $code.=<<___; | ||
| 876 | .globl ${PREFIX}_cbc_encrypt | ||
| 877 | .type ${PREFIX}_cbc_encrypt,\@function,6 | ||
| 878 | .align 16 | ||
| 879 | ${PREFIX}_cbc_encrypt: | ||
| 880 | _CET_ENDBR | ||
| 881 | xchg $key,$len | ||
| 882 | ___ | ||
| 883 | ($len,$key)=($key,$len); | ||
| 884 | $code.=<<___; | ||
| 885 | sub \$16,$len | ||
| 886 | jc .Lcbc_abort | ||
| 887 | ___ | ||
| 888 | $code.=<<___ if ($win64); | ||
| 889 | lea -0xb8(%rsp),%rsp | ||
| 890 | movaps %xmm6,0x10(%rsp) | ||
| 891 | movaps %xmm7,0x20(%rsp) | ||
| 892 | movaps %xmm8,0x30(%rsp) | ||
| 893 | movaps %xmm9,0x40(%rsp) | ||
| 894 | movaps %xmm10,0x50(%rsp) | ||
| 895 | movaps %xmm11,0x60(%rsp) | ||
| 896 | movaps %xmm12,0x70(%rsp) | ||
| 897 | movaps %xmm13,0x80(%rsp) | ||
| 898 | movaps %xmm14,0x90(%rsp) | ||
| 899 | movaps %xmm15,0xa0(%rsp) | ||
| 900 | .Lcbc_body: | ||
| 901 | ___ | ||
| 902 | $code.=<<___; | ||
| 903 | movdqu ($ivp),%xmm6 # load IV | ||
| 904 | sub $inp,$out | ||
| 905 | call _vpaes_preheat | ||
| 906 | cmp \$0,${enc}d | ||
| 907 | je .Lcbc_dec_loop | ||
| 908 | jmp .Lcbc_enc_loop | ||
| 909 | .align 16 | ||
| 910 | .Lcbc_enc_loop: | ||
| 911 | movdqu ($inp),%xmm0 | ||
| 912 | pxor %xmm6,%xmm0 | ||
| 913 | call _vpaes_encrypt_core | ||
| 914 | movdqa %xmm0,%xmm6 | ||
| 915 | movdqu %xmm0,($out,$inp) | ||
| 916 | lea 16($inp),$inp | ||
| 917 | sub \$16,$len | ||
| 918 | jnc .Lcbc_enc_loop | ||
| 919 | jmp .Lcbc_done | ||
| 920 | .align 16 | ||
| 921 | .Lcbc_dec_loop: | ||
| 922 | movdqu ($inp),%xmm0 | ||
| 923 | movdqa %xmm0,%xmm7 | ||
| 924 | call _vpaes_decrypt_core | ||
| 925 | pxor %xmm6,%xmm0 | ||
| 926 | movdqa %xmm7,%xmm6 | ||
| 927 | movdqu %xmm0,($out,$inp) | ||
| 928 | lea 16($inp),$inp | ||
| 929 | sub \$16,$len | ||
| 930 | jnc .Lcbc_dec_loop | ||
| 931 | .Lcbc_done: | ||
| 932 | movdqu %xmm6,($ivp) # save IV | ||
| 933 | ___ | ||
| 934 | $code.=<<___ if ($win64); | ||
| 935 | movaps 0x10(%rsp),%xmm6 | ||
| 936 | movaps 0x20(%rsp),%xmm7 | ||
| 937 | movaps 0x30(%rsp),%xmm8 | ||
| 938 | movaps 0x40(%rsp),%xmm9 | ||
| 939 | movaps 0x50(%rsp),%xmm10 | ||
| 940 | movaps 0x60(%rsp),%xmm11 | ||
| 941 | movaps 0x70(%rsp),%xmm12 | ||
| 942 | movaps 0x80(%rsp),%xmm13 | ||
| 943 | movaps 0x90(%rsp),%xmm14 | ||
| 944 | movaps 0xa0(%rsp),%xmm15 | ||
| 945 | lea 0xb8(%rsp),%rsp | ||
| 946 | .Lcbc_epilogue: | ||
| 947 | ___ | ||
| 948 | $code.=<<___; | ||
| 949 | .Lcbc_abort: | ||
| 950 | ret | ||
| 951 | .size ${PREFIX}_cbc_encrypt,.-${PREFIX}_cbc_encrypt | ||
| 952 | ___ | ||
| 953 | } | ||
| 954 | $code.=<<___; | ||
| 955 | ## | ||
| 956 | ## _aes_preheat | ||
| 957 | ## | ||
| 958 | ## Fills register %r10 -> .aes_consts (so you can -fPIC) | ||
| 959 | ## and %xmm9-%xmm15 as specified below. | ||
| 960 | ## | ||
| 961 | .type _vpaes_preheat,\@abi-omnipotent | ||
| 962 | .align 16 | ||
| 963 | _vpaes_preheat: | ||
| 964 | _CET_ENDBR | ||
| 965 | lea .Lk_s0F(%rip), %r10 | ||
| 966 | movdqa -0x20(%r10), %xmm10 # .Lk_inv | ||
| 967 | movdqa -0x10(%r10), %xmm11 # .Lk_inv+16 | ||
| 968 | movdqa 0x00(%r10), %xmm9 # .Lk_s0F | ||
| 969 | movdqa 0x30(%r10), %xmm13 # .Lk_sb1 | ||
| 970 | movdqa 0x40(%r10), %xmm12 # .Lk_sb1+16 | ||
| 971 | movdqa 0x50(%r10), %xmm15 # .Lk_sb2 | ||
| 972 | movdqa 0x60(%r10), %xmm14 # .Lk_sb2+16 | ||
| 973 | ret | ||
| 974 | .size _vpaes_preheat,.-_vpaes_preheat | ||
| 975 | ######################################################## | ||
| 976 | ## ## | ||
| 977 | ## Constants ## | ||
| 978 | ## ## | ||
| 979 | ######################################################## | ||
| 980 | .section .rodata | ||
| 981 | .type _vpaes_consts,\@object | ||
| 982 | .align 64 | ||
| 983 | _vpaes_consts: | ||
| 984 | .Lk_inv: # inv, inva | ||
| 985 | .quad 0x0E05060F0D080180, 0x040703090A0B0C02 | ||
| 986 | .quad 0x01040A060F0B0780, 0x030D0E0C02050809 | ||
| 987 | |||
| 988 | .Lk_s0F: # s0F | ||
| 989 | .quad 0x0F0F0F0F0F0F0F0F, 0x0F0F0F0F0F0F0F0F | ||
| 990 | |||
| 991 | .Lk_ipt: # input transform (lo, hi) | ||
| 992 | .quad 0xC2B2E8985A2A7000, 0xCABAE09052227808 | ||
| 993 | .quad 0x4C01307D317C4D00, 0xCD80B1FCB0FDCC81 | ||
| 994 | |||
| 995 | .Lk_sb1: # sb1u, sb1t | ||
| 996 | .quad 0xB19BE18FCB503E00, 0xA5DF7A6E142AF544 | ||
| 997 | .quad 0x3618D415FAE22300, 0x3BF7CCC10D2ED9EF | ||
| 998 | .Lk_sb2: # sb2u, sb2t | ||
| 999 | .quad 0xE27A93C60B712400, 0x5EB7E955BC982FCD | ||
| 1000 | .quad 0x69EB88400AE12900, 0xC2A163C8AB82234A | ||
| 1001 | .Lk_sbo: # sbou, sbot | ||
| 1002 | .quad 0xD0D26D176FBDC700, 0x15AABF7AC502A878 | ||
| 1003 | .quad 0xCFE474A55FBB6A00, 0x8E1E90D1412B35FA | ||
| 1004 | |||
| 1005 | .Lk_mc_forward: # mc_forward | ||
| 1006 | .quad 0x0407060500030201, 0x0C0F0E0D080B0A09 | ||
| 1007 | .quad 0x080B0A0904070605, 0x000302010C0F0E0D | ||
| 1008 | .quad 0x0C0F0E0D080B0A09, 0x0407060500030201 | ||
| 1009 | .quad 0x000302010C0F0E0D, 0x080B0A0904070605 | ||
| 1010 | |||
| 1011 | .Lk_mc_backward:# mc_backward | ||
| 1012 | .quad 0x0605040702010003, 0x0E0D0C0F0A09080B | ||
| 1013 | .quad 0x020100030E0D0C0F, 0x0A09080B06050407 | ||
| 1014 | .quad 0x0E0D0C0F0A09080B, 0x0605040702010003 | ||
| 1015 | .quad 0x0A09080B06050407, 0x020100030E0D0C0F | ||
| 1016 | |||
| 1017 | .Lk_sr: # sr | ||
| 1018 | .quad 0x0706050403020100, 0x0F0E0D0C0B0A0908 | ||
| 1019 | .quad 0x030E09040F0A0500, 0x0B06010C07020D08 | ||
| 1020 | .quad 0x0F060D040B020900, 0x070E050C030A0108 | ||
| 1021 | .quad 0x0B0E0104070A0D00, 0x0306090C0F020508 | ||
| 1022 | |||
| 1023 | .Lk_rcon: # rcon | ||
| 1024 | .quad 0x1F8391B9AF9DEEB6, 0x702A98084D7C7D81 | ||
| 1025 | |||
| 1026 | .Lk_s63: # s63: all equal to 0x63 transformed | ||
| 1027 | .quad 0x5B5B5B5B5B5B5B5B, 0x5B5B5B5B5B5B5B5B | ||
| 1028 | |||
| 1029 | .Lk_opt: # output transform | ||
| 1030 | .quad 0xFF9F4929D6B66000, 0xF7974121DEBE6808 | ||
| 1031 | .quad 0x01EDBD5150BCEC00, 0xE10D5DB1B05C0CE0 | ||
| 1032 | |||
| 1033 | .Lk_deskew: # deskew tables: inverts the sbox's "skew" | ||
| 1034 | .quad 0x07E4A34047A4E300, 0x1DFEB95A5DBEF91A | ||
| 1035 | .quad 0x5F36B5DC83EA6900, 0x2841C2ABF49D1E77 | ||
| 1036 | |||
| 1037 | ## | ||
| 1038 | ## Decryption stuff | ||
| 1039 | ## Key schedule constants | ||
| 1040 | ## | ||
| 1041 | .Lk_dksd: # decryption key schedule: invskew x*D | ||
| 1042 | .quad 0xFEB91A5DA3E44700, 0x0740E3A45A1DBEF9 | ||
| 1043 | .quad 0x41C277F4B5368300, 0x5FDC69EAAB289D1E | ||
| 1044 | .Lk_dksb: # decryption key schedule: invskew x*B | ||
| 1045 | .quad 0x9A4FCA1F8550D500, 0x03D653861CC94C99 | ||
| 1046 | .quad 0x115BEDA7B6FC4A00, 0xD993256F7E3482C8 | ||
| 1047 | .Lk_dkse: # decryption key schedule: invskew x*E + 0x63 | ||
| 1048 | .quad 0xD5031CCA1FC9D600, 0x53859A4C994F5086 | ||
| 1049 | .quad 0xA23196054FDC7BE8, 0xCD5EF96A20B31487 | ||
| 1050 | .Lk_dks9: # decryption key schedule: invskew x*9 | ||
| 1051 | .quad 0xB6116FC87ED9A700, 0x4AED933482255BFC | ||
| 1052 | .quad 0x4576516227143300, 0x8BB89FACE9DAFDCE | ||
| 1053 | |||
| 1054 | ## | ||
| 1055 | ## Decryption stuff | ||
| 1056 | ## Round function constants | ||
| 1057 | ## | ||
| 1058 | .Lk_dipt: # decryption input transform | ||
| 1059 | .quad 0x0F505B040B545F00, 0x154A411E114E451A | ||
| 1060 | .quad 0x86E383E660056500, 0x12771772F491F194 | ||
| 1061 | |||
| 1062 | .Lk_dsb9: # decryption sbox output *9*u, *9*t | ||
| 1063 | .quad 0x851C03539A86D600, 0xCAD51F504F994CC9 | ||
| 1064 | .quad 0xC03B1789ECD74900, 0x725E2C9EB2FBA565 | ||
| 1065 | .Lk_dsbd: # decryption sbox output *D*u, *D*t | ||
| 1066 | .quad 0x7D57CCDFE6B1A200, 0xF56E9B13882A4439 | ||
| 1067 | .quad 0x3CE2FAF724C6CB00, 0x2931180D15DEEFD3 | ||
| 1068 | .Lk_dsbb: # decryption sbox output *B*u, *B*t | ||
| 1069 | .quad 0xD022649296B44200, 0x602646F6B0F2D404 | ||
| 1070 | .quad 0xC19498A6CD596700, 0xF3FF0C3E3255AA6B | ||
| 1071 | .Lk_dsbe: # decryption sbox output *E*u, *E*t | ||
| 1072 | .quad 0x46F2929626D4D000, 0x2242600464B4F6B0 | ||
| 1073 | .quad 0x0C55A6CDFFAAC100, 0x9467F36B98593E32 | ||
| 1074 | .Lk_dsbo: # decryption sbox final output | ||
| 1075 | .quad 0x1387EA537EF94000, 0xC7AA6DB9D4943E2D | ||
| 1076 | .quad 0x12D7560F93441D00, 0xCA4B8159D8C58E9C | ||
| 1077 | .align 64 | ||
| 1078 | .size _vpaes_consts,.-_vpaes_consts | ||
| 1079 | .text | ||
| 1080 | ___ | ||
| 1081 | |||
| 1082 | if ($win64) { | ||
| 1083 | # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, | ||
| 1084 | # CONTEXT *context,DISPATCHER_CONTEXT *disp) | ||
| 1085 | $rec="%rcx"; | ||
| 1086 | $frame="%rdx"; | ||
| 1087 | $context="%r8"; | ||
| 1088 | $disp="%r9"; | ||
| 1089 | |||
| 1090 | $code.=<<___; | ||
| 1091 | .extern __imp_RtlVirtualUnwind | ||
| 1092 | .type se_handler,\@abi-omnipotent | ||
| 1093 | .align 16 | ||
| 1094 | se_handler: | ||
| 1095 | _CET_ENDBR | ||
| 1096 | push %rsi | ||
| 1097 | push %rdi | ||
| 1098 | push %rbx | ||
| 1099 | push %rbp | ||
| 1100 | push %r12 | ||
| 1101 | push %r13 | ||
| 1102 | push %r14 | ||
| 1103 | push %r15 | ||
| 1104 | pushfq | ||
| 1105 | sub \$64,%rsp | ||
| 1106 | |||
| 1107 | mov 120($context),%rax # pull context->Rax | ||
| 1108 | mov 248($context),%rbx # pull context->Rip | ||
| 1109 | |||
| 1110 | mov 8($disp),%rsi # disp->ImageBase | ||
| 1111 | mov 56($disp),%r11 # disp->HandlerData | ||
| 1112 | |||
| 1113 | mov 0(%r11),%r10d # HandlerData[0] | ||
| 1114 | lea (%rsi,%r10),%r10 # prologue label | ||
| 1115 | cmp %r10,%rbx # context->Rip<prologue label | ||
| 1116 | jb .Lin_prologue | ||
| 1117 | |||
| 1118 | mov 152($context),%rax # pull context->Rsp | ||
| 1119 | |||
| 1120 | mov 4(%r11),%r10d # HandlerData[1] | ||
| 1121 | lea (%rsi,%r10),%r10 # epilogue label | ||
| 1122 | cmp %r10,%rbx # context->Rip>=epilogue label | ||
| 1123 | jae .Lin_prologue | ||
| 1124 | |||
| 1125 | lea 16(%rax),%rsi # %xmm save area | ||
| 1126 | lea 512($context),%rdi # &context.Xmm6 | ||
| 1127 | mov \$20,%ecx # 10*sizeof(%xmm0)/sizeof(%rax) | ||
| 1128 | .long 0xa548f3fc # cld; rep movsq | ||
| 1129 | lea 0xb8(%rax),%rax # adjust stack pointer | ||
| 1130 | |||
| 1131 | .Lin_prologue: | ||
| 1132 | mov 8(%rax),%rdi | ||
| 1133 | mov 16(%rax),%rsi | ||
| 1134 | mov %rax,152($context) # restore context->Rsp | ||
| 1135 | mov %rsi,168($context) # restore context->Rsi | ||
| 1136 | mov %rdi,176($context) # restore context->Rdi | ||
| 1137 | |||
| 1138 | mov 40($disp),%rdi # disp->ContextRecord | ||
| 1139 | mov $context,%rsi # context | ||
| 1140 | mov \$`1232/8`,%ecx # sizeof(CONTEXT) | ||
| 1141 | .long 0xa548f3fc # cld; rep movsq | ||
| 1142 | |||
| 1143 | mov $disp,%rsi | ||
| 1144 | xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER | ||
| 1145 | mov 8(%rsi),%rdx # arg2, disp->ImageBase | ||
| 1146 | mov 0(%rsi),%r8 # arg3, disp->ControlPc | ||
| 1147 | mov 16(%rsi),%r9 # arg4, disp->FunctionEntry | ||
| 1148 | mov 40(%rsi),%r10 # disp->ContextRecord | ||
| 1149 | lea 56(%rsi),%r11 # &disp->HandlerData | ||
| 1150 | lea 24(%rsi),%r12 # &disp->EstablisherFrame | ||
| 1151 | mov %r10,32(%rsp) # arg5 | ||
| 1152 | mov %r11,40(%rsp) # arg6 | ||
| 1153 | mov %r12,48(%rsp) # arg7 | ||
| 1154 | mov %rcx,56(%rsp) # arg8, (NULL) | ||
| 1155 | call *__imp_RtlVirtualUnwind(%rip) | ||
| 1156 | |||
| 1157 | mov \$1,%eax # ExceptionContinueSearch | ||
| 1158 | add \$64,%rsp | ||
| 1159 | popfq | ||
| 1160 | pop %r15 | ||
| 1161 | pop %r14 | ||
| 1162 | pop %r13 | ||
| 1163 | pop %r12 | ||
| 1164 | pop %rbp | ||
| 1165 | pop %rbx | ||
| 1166 | pop %rdi | ||
| 1167 | pop %rsi | ||
| 1168 | ret | ||
| 1169 | .size se_handler,.-se_handler | ||
| 1170 | |||
| 1171 | .section .pdata | ||
| 1172 | .align 4 | ||
| 1173 | .rva .LSEH_begin_${PREFIX}_set_encrypt_key | ||
| 1174 | .rva .LSEH_end_${PREFIX}_set_encrypt_key | ||
| 1175 | .rva .LSEH_info_${PREFIX}_set_encrypt_key | ||
| 1176 | |||
| 1177 | .rva .LSEH_begin_${PREFIX}_set_decrypt_key | ||
| 1178 | .rva .LSEH_end_${PREFIX}_set_decrypt_key | ||
| 1179 | .rva .LSEH_info_${PREFIX}_set_decrypt_key | ||
| 1180 | |||
| 1181 | .rva .LSEH_begin_${PREFIX}_encrypt | ||
| 1182 | .rva .LSEH_end_${PREFIX}_encrypt | ||
| 1183 | .rva .LSEH_info_${PREFIX}_encrypt | ||
| 1184 | |||
| 1185 | .rva .LSEH_begin_${PREFIX}_decrypt | ||
| 1186 | .rva .LSEH_end_${PREFIX}_decrypt | ||
| 1187 | .rva .LSEH_info_${PREFIX}_decrypt | ||
| 1188 | |||
| 1189 | .rva .LSEH_begin_${PREFIX}_cbc_encrypt | ||
| 1190 | .rva .LSEH_end_${PREFIX}_cbc_encrypt | ||
| 1191 | .rva .LSEH_info_${PREFIX}_cbc_encrypt | ||
| 1192 | |||
| 1193 | .section .xdata | ||
| 1194 | .align 8 | ||
| 1195 | .LSEH_info_${PREFIX}_set_encrypt_key: | ||
| 1196 | .byte 9,0,0,0 | ||
| 1197 | .rva se_handler | ||
| 1198 | .rva .Lenc_key_body,.Lenc_key_epilogue # HandlerData[] | ||
| 1199 | .LSEH_info_${PREFIX}_set_decrypt_key: | ||
| 1200 | .byte 9,0,0,0 | ||
| 1201 | .rva se_handler | ||
| 1202 | .rva .Ldec_key_body,.Ldec_key_epilogue # HandlerData[] | ||
| 1203 | .LSEH_info_${PREFIX}_encrypt: | ||
| 1204 | .byte 9,0,0,0 | ||
| 1205 | .rva se_handler | ||
| 1206 | .rva .Lenc_body,.Lenc_epilogue # HandlerData[] | ||
| 1207 | .LSEH_info_${PREFIX}_decrypt: | ||
| 1208 | .byte 9,0,0,0 | ||
| 1209 | .rva se_handler | ||
| 1210 | .rva .Ldec_body,.Ldec_epilogue # HandlerData[] | ||
| 1211 | .LSEH_info_${PREFIX}_cbc_encrypt: | ||
| 1212 | .byte 9,0,0,0 | ||
| 1213 | .rva se_handler | ||
| 1214 | .rva .Lcbc_body,.Lcbc_epilogue # HandlerData[] | ||
| 1215 | ___ | ||
| 1216 | } | ||
| 1217 | |||
| 1218 | $code =~ s/\`([^\`]*)\`/eval($1)/gem; | ||
| 1219 | |||
| 1220 | print $code; | ||
| 1221 | |||
| 1222 | close STDOUT; | ||
diff --git a/src/lib/libcrypto/arch/aarch64/Makefile.inc b/src/lib/libcrypto/arch/aarch64/Makefile.inc index d93cb815ef..596e98fe69 100644 --- a/src/lib/libcrypto/arch/aarch64/Makefile.inc +++ b/src/lib/libcrypto/arch/aarch64/Makefile.inc | |||
| @@ -1,9 +1,12 @@ | |||
| 1 | # $OpenBSD: Makefile.inc,v 1.16 2025/03/12 14:13:41 jsing Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.18 2026/01/17 16:18:31 jsing Exp $ |
| 2 | 2 | ||
| 3 | # aarch64-specific libcrypto build rules | 3 | # aarch64-specific libcrypto build rules |
| 4 | 4 | ||
| 5 | SRCS += crypto_cpu_caps.c | 5 | SRCS += crypto_cpu_caps.c |
| 6 | 6 | ||
| 7 | CFLAGS+= -DLIBRESSL_USE_SHA_ASSEMBLY | ||
| 8 | SRCS += sha1_aarch64.c | ||
| 9 | SRCS += sha1_aarch64_ce.S | ||
| 7 | SRCS += sha256_aarch64.c | 10 | SRCS += sha256_aarch64.c |
| 8 | SRCS += sha256_aarch64_ce.S | 11 | SRCS += sha256_aarch64_ce.S |
| 9 | SRCS += sha512_aarch64.c | 12 | SRCS += sha512_aarch64.c |
diff --git a/src/lib/libcrypto/arch/aarch64/crypto_arch.h b/src/lib/libcrypto/arch/aarch64/crypto_arch.h index 35ecba9394..8b5d83311e 100644 --- a/src/lib/libcrypto/arch/aarch64/crypto_arch.h +++ b/src/lib/libcrypto/arch/aarch64/crypto_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_arch.h,v 1.4 2025/03/12 14:13:41 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_arch.h,v 1.6 2026/01/17 16:18:31 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -35,8 +35,11 @@ extern uint64_t crypto_cpu_caps_aarch64; | |||
| 35 | 35 | ||
| 36 | #ifndef OPENSSL_NO_ASM | 36 | #ifndef OPENSSL_NO_ASM |
| 37 | 37 | ||
| 38 | #ifdef LIBRESSL_USE_SHA_ASSEMBLY | ||
| 39 | #define HAVE_SHA1_BLOCK_DATA_ORDER | ||
| 38 | #define HAVE_SHA256_BLOCK_DATA_ORDER | 40 | #define HAVE_SHA256_BLOCK_DATA_ORDER |
| 39 | #define HAVE_SHA512_BLOCK_DATA_ORDER | 41 | #define HAVE_SHA512_BLOCK_DATA_ORDER |
| 42 | #endif | ||
| 40 | 43 | ||
| 41 | #endif | 44 | #endif |
| 42 | 45 | ||
diff --git a/src/lib/libcrypto/arch/aarch64/opensslconf.h b/src/lib/libcrypto/arch/aarch64/opensslconf.h deleted file mode 100644 index 731b06aecc..0000000000 --- a/src/lib/libcrypto/arch/aarch64/opensslconf.h +++ /dev/null | |||
| @@ -1,154 +0,0 @@ | |||
| 1 | #include <openssl/opensslfeatures.h> | ||
| 2 | /* crypto/opensslconf.h.in */ | ||
| 3 | |||
| 4 | #if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR) | ||
| 5 | #define OPENSSLDIR "/etc/ssl" | ||
| 6 | #endif | ||
| 7 | |||
| 8 | #undef OPENSSL_EXPORT_VAR_AS_FUNCTION | ||
| 9 | |||
| 10 | #ifndef OPENSSL_FILE | ||
| 11 | #ifdef OPENSSL_NO_FILENAMES | ||
| 12 | #define OPENSSL_FILE "" | ||
| 13 | #define OPENSSL_LINE 0 | ||
| 14 | #else | ||
| 15 | #define OPENSSL_FILE __FILE__ | ||
| 16 | #define OPENSSL_LINE __LINE__ | ||
| 17 | #endif | ||
| 18 | #endif | ||
| 19 | |||
| 20 | #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) | ||
| 21 | #define IDEA_INT unsigned int | ||
| 22 | #endif | ||
| 23 | |||
| 24 | #if defined(HEADER_MD2_H) && !defined(MD2_INT) | ||
| 25 | #define MD2_INT unsigned int | ||
| 26 | #endif | ||
| 27 | |||
| 28 | #if defined(HEADER_RC2_H) && !defined(RC2_INT) | ||
| 29 | /* I need to put in a mod for the alpha - eay */ | ||
| 30 | #define RC2_INT unsigned int | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #if defined(HEADER_RC4_H) | ||
| 34 | #if !defined(RC4_INT) | ||
| 35 | /* using int types make the structure larger but make the code faster | ||
| 36 | * on most boxes I have tested - up to %20 faster. */ | ||
| 37 | /* | ||
| 38 | * I don't know what does "most" mean, but declaring "int" is a must on: | ||
| 39 | * - Intel P6 because partial register stalls are very expensive; | ||
| 40 | * - elder Alpha because it lacks byte load/store instructions; | ||
| 41 | */ | ||
| 42 | #define RC4_INT unsigned int | ||
| 43 | #endif | ||
| 44 | #if !defined(RC4_CHUNK) | ||
| 45 | /* | ||
| 46 | * This enables code handling data aligned at natural CPU word | ||
| 47 | * boundary. See crypto/rc4/rc4_enc.c for further details. | ||
| 48 | */ | ||
| 49 | #define RC4_CHUNK unsigned long | ||
| 50 | #endif | ||
| 51 | #endif | ||
| 52 | |||
| 53 | #if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) | ||
| 54 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a | ||
| 55 | * %20 speed up (longs are 8 bytes, int's are 4). */ | ||
| 56 | #ifndef DES_LONG | ||
| 57 | #define DES_LONG unsigned int | ||
| 58 | #endif | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) | ||
| 62 | #define CONFIG_HEADER_BN_H | ||
| 63 | #undef BN_LLONG | ||
| 64 | |||
| 65 | /* Should we define BN_DIV2W here? */ | ||
| 66 | |||
| 67 | /* Only one for the following should be defined */ | ||
| 68 | /* The prime number generation stuff may not work when | ||
| 69 | * EIGHT_BIT but I don't care since I've only used this mode | ||
| 70 | * for debugging the bignum libraries */ | ||
| 71 | #define SIXTY_FOUR_BIT_LONG | ||
| 72 | #undef SIXTY_FOUR_BIT | ||
| 73 | #undef THIRTY_TWO_BIT | ||
| 74 | #undef SIXTEEN_BIT | ||
| 75 | #undef EIGHT_BIT | ||
| 76 | #endif | ||
| 77 | |||
| 78 | #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) | ||
| 79 | #define CONFIG_HEADER_BF_LOCL_H | ||
| 80 | #undef BF_PTR | ||
| 81 | #endif /* HEADER_BF_LOCL_H */ | ||
| 82 | |||
| 83 | #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) | ||
| 84 | #define CONFIG_HEADER_DES_LOCL_H | ||
| 85 | #ifndef DES_DEFAULT_OPTIONS | ||
| 86 | /* the following is tweaked from a config script, that is why it is a | ||
| 87 | * protected undef/define */ | ||
| 88 | #ifndef DES_PTR | ||
| 89 | #undef DES_PTR | ||
| 90 | #endif | ||
| 91 | |||
| 92 | /* This helps C compiler generate the correct code for multiple functional | ||
| 93 | * units. It reduces register dependencies at the expense of 2 more | ||
| 94 | * registers */ | ||
| 95 | #ifndef DES_RISC1 | ||
| 96 | #undef DES_RISC1 | ||
| 97 | #endif | ||
| 98 | |||
| 99 | #ifndef DES_RISC2 | ||
| 100 | #undef DES_RISC2 | ||
| 101 | #endif | ||
| 102 | |||
| 103 | #if defined(DES_RISC1) && defined(DES_RISC2) | ||
| 104 | YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! | ||
| 105 | #endif | ||
| 106 | |||
| 107 | /* Unroll the inner loop, this sometimes helps, sometimes hinders. | ||
| 108 | * Very much CPU dependent */ | ||
| 109 | #ifndef DES_UNROLL | ||
| 110 | #define DES_UNROLL | ||
| 111 | #endif | ||
| 112 | |||
| 113 | /* These default values were supplied by | ||
| 114 | * Peter Gutman <pgut001@cs.auckland.ac.nz> | ||
| 115 | * They are only used if nothing else has been defined */ | ||
| 116 | #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) | ||
| 117 | /* Special defines which change the way the code is built depending on the | ||
| 118 | CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find | ||
| 119 | even newer MIPS CPU's, but at the moment one size fits all for | ||
| 120 | optimization options. Older Sparc's work better with only UNROLL, but | ||
| 121 | there's no way to tell at compile time what it is you're running on */ | ||
| 122 | |||
| 123 | #if defined( sun ) /* Newer Sparc's */ | ||
| 124 | # define DES_PTR | ||
| 125 | # define DES_RISC1 | ||
| 126 | # define DES_UNROLL | ||
| 127 | #elif defined( __ultrix ) /* Older MIPS */ | ||
| 128 | # define DES_PTR | ||
| 129 | # define DES_RISC2 | ||
| 130 | # define DES_UNROLL | ||
| 131 | #elif defined( __osf1__ ) /* Alpha */ | ||
| 132 | # define DES_PTR | ||
| 133 | # define DES_RISC2 | ||
| 134 | #elif defined ( _AIX ) /* RS6000 */ | ||
| 135 | /* Unknown */ | ||
| 136 | #elif defined( __hpux ) /* HP-PA */ | ||
| 137 | /* Unknown */ | ||
| 138 | #elif defined( __aux ) /* 68K */ | ||
| 139 | /* Unknown */ | ||
| 140 | #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ | ||
| 141 | # define DES_UNROLL | ||
| 142 | #elif defined( __sgi ) /* Newer MIPS */ | ||
| 143 | # define DES_PTR | ||
| 144 | # define DES_RISC2 | ||
| 145 | # define DES_UNROLL | ||
| 146 | #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ | ||
| 147 | # define DES_PTR | ||
| 148 | # define DES_RISC1 | ||
| 149 | # define DES_UNROLL | ||
| 150 | #endif /* Systems-specific speed defines */ | ||
| 151 | #endif | ||
| 152 | |||
| 153 | #endif /* DES_DEFAULT_OPTIONS */ | ||
| 154 | #endif /* HEADER_DES_LOCL_H */ | ||
diff --git a/src/lib/libcrypto/arch/alpha/Makefile.inc b/src/lib/libcrypto/arch/alpha/Makefile.inc index 1073ac3c1e..b2358a8494 100644 --- a/src/lib/libcrypto/arch/alpha/Makefile.inc +++ b/src/lib/libcrypto/arch/alpha/Makefile.inc | |||
| @@ -1,14 +1,18 @@ | |||
| 1 | # $OpenBSD: Makefile.inc,v 1.15 2025/02/14 12:01:58 jsing Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.17 2026/01/17 16:18:31 jsing Exp $ |
| 2 | 2 | ||
| 3 | # alpha-specific libcrypto build rules | 3 | # alpha-specific libcrypto build rules |
| 4 | 4 | ||
| 5 | # bn | 5 | # bn |
| 6 | CFLAGS+= -DLIBRESSL_USE_BN_ASSEMBLY | ||
| 6 | SSLASM+= bn alpha-mont | 7 | SSLASM+= bn alpha-mont |
| 7 | CFLAGS+= -DOPENSSL_BN_ASM_MONT | 8 | CFLAGS+= -DOPENSSL_BN_ASM_MONT |
| 9 | |||
| 8 | # modes | 10 | # modes |
| 9 | CFLAGS+= -DGHASH_ASM | 11 | CFLAGS+= -DLIBRESSL_USE_GCM_ASSEMBLY |
| 10 | SSLASM+= modes ghash-alpha | 12 | SSLASM+= modes ghash-alpha |
| 13 | |||
| 11 | # sha | 14 | # sha |
| 15 | CFLAGS+= -DLIBRESSL_USE_SHA_ASSEMBLY | ||
| 12 | SSLASM+= sha sha1-alpha | 16 | SSLASM+= sha sha1-alpha |
| 13 | 17 | ||
| 14 | .for dir f in ${SSLASM} | 18 | .for dir f in ${SSLASM} |
diff --git a/src/lib/libcrypto/arch/alpha/crypto_arch.h b/src/lib/libcrypto/arch/alpha/crypto_arch.h index 1d553b7e07..ba1803ddf8 100644 --- a/src/lib/libcrypto/arch/alpha/crypto_arch.h +++ b/src/lib/libcrypto/arch/alpha/crypto_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_arch.h,v 1.2 2025/02/14 12:01:58 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_arch.h,v 1.4 2026/01/17 16:18:32 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -18,7 +18,18 @@ | |||
| 18 | #ifndef HEADER_CRYPTO_ARCH_H | 18 | #ifndef HEADER_CRYPTO_ARCH_H |
| 19 | #define HEADER_CRYPTO_ARCH_H | 19 | #define HEADER_CRYPTO_ARCH_H |
| 20 | 20 | ||
| 21 | #ifndef OPENSSL_NO_ASM | ||
| 22 | |||
| 23 | #ifdef LIBRESSL_USE_GCM_ASSEMBLY | ||
| 24 | #define HAVE_GCM_GHASH_4BIT | ||
| 25 | #define HAVE_GCM_GMULT_4BIT | ||
| 26 | #endif | ||
| 27 | |||
| 28 | #ifdef LIBRESSL_USE_SHA_ASSEMBLY | ||
| 21 | #define HAVE_SHA1_BLOCK_DATA_ORDER | 29 | #define HAVE_SHA1_BLOCK_DATA_ORDER |
| 22 | #define HAVE_SHA1_BLOCK_GENERIC | 30 | #define HAVE_SHA1_BLOCK_GENERIC |
| 31 | #endif | ||
| 32 | |||
| 33 | #endif | ||
| 23 | 34 | ||
| 24 | #endif | 35 | #endif |
diff --git a/src/lib/libcrypto/arch/alpha/opensslconf.h b/src/lib/libcrypto/arch/alpha/opensslconf.h deleted file mode 100644 index 0ec9c25891..0000000000 --- a/src/lib/libcrypto/arch/alpha/opensslconf.h +++ /dev/null | |||
| @@ -1,152 +0,0 @@ | |||
| 1 | #include <openssl/opensslfeatures.h> | ||
| 2 | /* crypto/opensslconf.h.in */ | ||
| 3 | |||
| 4 | #if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR) | ||
| 5 | #define OPENSSLDIR "/etc/ssl" | ||
| 6 | #endif | ||
| 7 | |||
| 8 | #undef OPENSSL_EXPORT_VAR_AS_FUNCTION | ||
| 9 | |||
| 10 | #ifndef OPENSSL_FILE | ||
| 11 | #ifdef OPENSSL_NO_FILENAMES | ||
| 12 | #define OPENSSL_FILE "" | ||
| 13 | #define OPENSSL_LINE 0 | ||
| 14 | #else | ||
| 15 | #define OPENSSL_FILE __FILE__ | ||
| 16 | #define OPENSSL_LINE __LINE__ | ||
| 17 | #endif | ||
| 18 | #endif | ||
| 19 | |||
| 20 | #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) | ||
| 21 | #define IDEA_INT unsigned int | ||
| 22 | #endif | ||
| 23 | |||
| 24 | #if defined(HEADER_MD2_H) && !defined(MD2_INT) | ||
| 25 | #define MD2_INT unsigned int | ||
| 26 | #endif | ||
| 27 | |||
| 28 | #if defined(HEADER_RC2_H) && !defined(RC2_INT) | ||
| 29 | /* I need to put in a mod for the alpha - eay */ | ||
| 30 | #define RC2_INT unsigned int | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #if defined(HEADER_RC4_H) | ||
| 34 | #if !defined(RC4_INT) | ||
| 35 | /* using int types make the structure larger but make the code faster | ||
| 36 | * on most boxes I have tested - up to %20 faster. */ | ||
| 37 | /* | ||
| 38 | * I don't know what does "most" mean, but declaring "int" is a must on: | ||
| 39 | * - Intel P6 because partial register stalls are very expensive; | ||
| 40 | * - elder Alpha because it lacks byte load/store instructions; | ||
| 41 | */ | ||
| 42 | #define RC4_INT unsigned int | ||
| 43 | #endif | ||
| 44 | #if !defined(RC4_CHUNK) | ||
| 45 | /* | ||
| 46 | * This enables code handling data aligned at natural CPU word | ||
| 47 | * boundary. See crypto/rc4/rc4_enc.c for further details. | ||
| 48 | */ | ||
| 49 | #define RC4_CHUNK unsigned long | ||
| 50 | #endif | ||
| 51 | #endif | ||
| 52 | |||
| 53 | #if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) | ||
| 54 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a | ||
| 55 | * %20 speed up (longs are 8 bytes, int's are 4). */ | ||
| 56 | #ifndef DES_LONG | ||
| 57 | #define DES_LONG unsigned int | ||
| 58 | #endif | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) | ||
| 62 | #define CONFIG_HEADER_BN_H | ||
| 63 | #undef BN_LLONG | ||
| 64 | |||
| 65 | /* Should we define BN_DIV2W here? */ | ||
| 66 | |||
| 67 | /* Only one for the following should be defined */ | ||
| 68 | /* The prime number generation stuff may not work when | ||
| 69 | * EIGHT_BIT but I don't care since I've only used this mode | ||
| 70 | * for debugging the bignum libraries */ | ||
| 71 | #define SIXTY_FOUR_BIT_LONG | ||
| 72 | #undef SIXTY_FOUR_BIT | ||
| 73 | #undef THIRTY_TWO_BIT | ||
| 74 | #endif | ||
| 75 | |||
| 76 | #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) | ||
| 77 | #define CONFIG_HEADER_BF_LOCL_H | ||
| 78 | #define BF_PTR | ||
| 79 | #endif /* HEADER_BF_LOCL_H */ | ||
| 80 | |||
| 81 | #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) | ||
| 82 | #define CONFIG_HEADER_DES_LOCL_H | ||
| 83 | #ifndef DES_DEFAULT_OPTIONS | ||
| 84 | /* the following is tweaked from a config script, that is why it is a | ||
| 85 | * protected undef/define */ | ||
| 86 | #ifndef DES_PTR | ||
| 87 | #define DES_PTR | ||
| 88 | #endif | ||
| 89 | |||
| 90 | /* This helps C compiler generate the correct code for multiple functional | ||
| 91 | * units. It reduces register dependencies at the expense of 2 more | ||
| 92 | * registers */ | ||
| 93 | #ifndef DES_RISC1 | ||
| 94 | #undef DES_RISC1 | ||
| 95 | #endif | ||
| 96 | |||
| 97 | #ifndef DES_RISC2 | ||
| 98 | #define DES_RISC2 | ||
| 99 | #endif | ||
| 100 | |||
| 101 | #if defined(DES_RISC1) && defined(DES_RISC2) | ||
| 102 | YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! | ||
| 103 | #endif | ||
| 104 | |||
| 105 | /* Unroll the inner loop, this sometimes helps, sometimes hinders. | ||
| 106 | * Very much CPU dependent */ | ||
| 107 | #ifndef DES_UNROLL | ||
| 108 | #undef DES_UNROLL | ||
| 109 | #endif | ||
| 110 | |||
| 111 | /* These default values were supplied by | ||
| 112 | * Peter Gutman <pgut001@cs.auckland.ac.nz> | ||
| 113 | * They are only used if nothing else has been defined */ | ||
| 114 | #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) | ||
| 115 | /* Special defines which change the way the code is built depending on the | ||
| 116 | CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find | ||
| 117 | even newer MIPS CPU's, but at the moment one size fits all for | ||
| 118 | optimization options. Older Sparc's work better with only UNROLL, but | ||
| 119 | there's no way to tell at compile time what it is you're running on */ | ||
| 120 | |||
| 121 | #if defined( sun ) /* Newer Sparc's */ | ||
| 122 | # define DES_PTR | ||
| 123 | # define DES_RISC1 | ||
| 124 | # define DES_UNROLL | ||
| 125 | #elif defined( __ultrix ) /* Older MIPS */ | ||
| 126 | # define DES_PTR | ||
| 127 | # define DES_RISC2 | ||
| 128 | # define DES_UNROLL | ||
| 129 | #elif defined( __osf1__ ) /* Alpha */ | ||
| 130 | # define DES_PTR | ||
| 131 | # define DES_RISC2 | ||
| 132 | #elif defined ( _AIX ) /* RS6000 */ | ||
| 133 | /* Unknown */ | ||
| 134 | #elif defined( __hpux ) /* HP-PA */ | ||
| 135 | /* Unknown */ | ||
| 136 | #elif defined( __aux ) /* 68K */ | ||
| 137 | /* Unknown */ | ||
| 138 | #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ | ||
| 139 | # define DES_UNROLL | ||
| 140 | #elif defined( __sgi ) /* Newer MIPS */ | ||
| 141 | # define DES_PTR | ||
| 142 | # define DES_RISC2 | ||
| 143 | # define DES_UNROLL | ||
| 144 | #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ | ||
| 145 | # define DES_PTR | ||
| 146 | # define DES_RISC1 | ||
| 147 | # define DES_UNROLL | ||
| 148 | #endif /* Systems-specific speed defines */ | ||
| 149 | #endif | ||
| 150 | |||
| 151 | #endif /* DES_DEFAULT_OPTIONS */ | ||
| 152 | #endif /* HEADER_DES_LOCL_H */ | ||
diff --git a/src/lib/libcrypto/arch/amd64/Makefile.inc b/src/lib/libcrypto/arch/amd64/Makefile.inc index b1a6563931..ea03944273 100644 --- a/src/lib/libcrypto/arch/amd64/Makefile.inc +++ b/src/lib/libcrypto/arch/amd64/Makefile.inc | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile.inc,v 1.37 2025/02/14 12:01:58 jsing Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.46 2026/01/17 16:18:32 jsing Exp $ |
| 2 | 2 | ||
| 3 | # amd64-specific libcrypto build rules | 3 | # amd64-specific libcrypto build rules |
| 4 | 4 | ||
| @@ -8,16 +8,12 @@ EXTRA_PL = ${LCRYPTO_SRC}/perlasm/x86_64-xlate.pl | |||
| 8 | SRCS += crypto_cpu_caps.c | 8 | SRCS += crypto_cpu_caps.c |
| 9 | 9 | ||
| 10 | # aes | 10 | # aes |
| 11 | CFLAGS+= -DAES_ASM | 11 | CFLAGS+= -DLIBRESSL_USE_AES_ASSEMBLY |
| 12 | SSLASM+= aes aes-x86_64 | 12 | SSLASM+= aes aes-x86_64 |
| 13 | CFLAGS+= -DBSAES_ASM | ||
| 14 | SSLASM+= aes bsaes-x86_64 | ||
| 15 | CFLAGS+= -DVPAES_ASM | ||
| 16 | SSLASM+= aes vpaes-x86_64 | ||
| 17 | SSLASM+= aes aesni-x86_64 | 13 | SSLASM+= aes aesni-x86_64 |
| 14 | SRCS += aes_amd64.c | ||
| 15 | |||
| 18 | # bn | 16 | # bn |
| 19 | CFLAGS+= -DOPENSSL_IA32_SSE2 | ||
| 20 | CFLAGS+= -DRSA_ASM | ||
| 21 | SSLASM+= bn modexp512-x86_64 | 17 | SSLASM+= bn modexp512-x86_64 |
| 22 | CFLAGS+= -DOPENSSL_BN_ASM_MONT | 18 | CFLAGS+= -DOPENSSL_BN_ASM_MONT |
| 23 | SSLASM+= bn x86_64-mont | 19 | SSLASM+= bn x86_64-mont |
| @@ -25,29 +21,45 @@ CFLAGS+= -DOPENSSL_BN_ASM_MONT5 | |||
| 25 | SSLASM+= bn x86_64-mont5 | 21 | SSLASM+= bn x86_64-mont5 |
| 26 | 22 | ||
| 27 | # bn s2n-bignum | 23 | # bn s2n-bignum |
| 24 | CFLAGS+= -DLIBRESSL_USE_BN_ASSEMBLY | ||
| 28 | SRCS += bn_arch.c | 25 | SRCS += bn_arch.c |
| 29 | SRCS += bignum_add.S | 26 | SRCS += bignum_add.S |
| 30 | SRCS += bignum_cmadd.S | 27 | SRCS += bignum_cmadd.S |
| 31 | SRCS += bignum_cmul.S | 28 | SRCS += bignum_cmul.S |
| 29 | SRCS += bignum_modadd.S | ||
| 30 | SRCS += bignum_modsub.S | ||
| 32 | SRCS += bignum_mul.S | 31 | SRCS += bignum_mul.S |
| 32 | SRCS += bignum_mul_4_8.S | ||
| 33 | SRCS += bignum_mul_4_8_alt.S | 33 | SRCS += bignum_mul_4_8_alt.S |
| 34 | SRCS += bignum_mul_6_12.S | ||
| 35 | SRCS += bignum_mul_6_12_alt.S | ||
| 36 | SRCS += bignum_mul_8_16.S | ||
| 34 | SRCS += bignum_mul_8_16_alt.S | 37 | SRCS += bignum_mul_8_16_alt.S |
| 35 | SRCS += bignum_sqr.S | 38 | SRCS += bignum_sqr.S |
| 39 | SRCS += bignum_sqr_4_8.S | ||
| 36 | SRCS += bignum_sqr_4_8_alt.S | 40 | SRCS += bignum_sqr_4_8_alt.S |
| 41 | SRCS += bignum_sqr_6_12.S | ||
| 42 | SRCS += bignum_sqr_6_12_alt.S | ||
| 43 | SRCS += bignum_sqr_8_16.S | ||
| 37 | SRCS += bignum_sqr_8_16_alt.S | 44 | SRCS += bignum_sqr_8_16_alt.S |
| 38 | SRCS += bignum_sub.S | 45 | SRCS += bignum_sub.S |
| 39 | SRCS += word_clz.S | 46 | SRCS += word_clz.S |
| 40 | 47 | ||
| 41 | # md5 | 48 | # md5 |
| 42 | CFLAGS+= -DMD5_ASM | 49 | CFLAGS+= -DLIBRESSL_USE_MD5_ASSEMBLY |
| 43 | SRCS+= md5_amd64_generic.S | 50 | SRCS+= md5_amd64_generic.S |
| 51 | |||
| 44 | # modes | 52 | # modes |
| 45 | CFLAGS+= -DGHASH_ASM | 53 | CFLAGS+= -DLIBRESSL_USE_GCM_ASSEMBLY |
| 46 | SSLASM+= modes ghash-x86_64 | 54 | SSLASM+= modes ghash-x86_64 |
| 55 | SRCS += gcm128_amd64.c | ||
| 56 | |||
| 47 | # rc4 | 57 | # rc4 |
| 58 | CFLAGS+= -DLIBRESSL_USE_RC4_ASSEMBLY | ||
| 48 | SSLASM+= rc4 rc4-x86_64 | 59 | SSLASM+= rc4 rc4-x86_64 |
| 49 | # ripemd | 60 | |
| 50 | # sha | 61 | # sha |
| 62 | CFLAGS+= -DLIBRESSL_USE_SHA_ASSEMBLY | ||
| 51 | SRCS+= sha1_amd64.c | 63 | SRCS+= sha1_amd64.c |
| 52 | SRCS+= sha1_amd64_generic.S | 64 | SRCS+= sha1_amd64_generic.S |
| 53 | SRCS+= sha1_amd64_shani.S | 65 | SRCS+= sha1_amd64_shani.S |
diff --git a/src/lib/libcrypto/arch/amd64/crypto_arch.h b/src/lib/libcrypto/arch/amd64/crypto_arch.h index 951374250d..09f771b6c6 100644 --- a/src/lib/libcrypto/arch/amd64/crypto_arch.h +++ b/src/lib/libcrypto/arch/amd64/crypto_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_arch.h,v 1.5 2025/02/14 12:01:58 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_arch.h,v 1.18 2026/01/17 16:18:32 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -21,33 +21,57 @@ | |||
| 21 | #define HEADER_CRYPTO_ARCH_H | 21 | #define HEADER_CRYPTO_ARCH_H |
| 22 | 22 | ||
| 23 | #define HAVE_CRYPTO_CPU_CAPS_INIT | 23 | #define HAVE_CRYPTO_CPU_CAPS_INIT |
| 24 | #define HAVE_CRYPTO_CPU_CAPS_IA32 | ||
| 25 | 24 | ||
| 26 | #ifndef __ASSEMBLER__ | 25 | #ifndef __ASSEMBLER__ |
| 27 | extern uint64_t crypto_cpu_caps_amd64; | 26 | extern uint64_t crypto_cpu_caps_amd64; |
| 28 | #endif | 27 | #endif |
| 29 | 28 | ||
| 30 | #define CRYPTO_CPU_CAPS_AMD64_SHA (1ULL << 0) | 29 | #define CRYPTO_CPU_CAPS_AMD64_ADX (1ULL << 0) |
| 30 | #define CRYPTO_CPU_CAPS_AMD64_AES (1ULL << 1) | ||
| 31 | #define CRYPTO_CPU_CAPS_AMD64_CLMUL (1ULL << 2) | ||
| 32 | #define CRYPTO_CPU_CAPS_AMD64_SHA (1ULL << 3) | ||
| 31 | 33 | ||
| 32 | #ifndef OPENSSL_NO_ASM | 34 | #ifndef OPENSSL_NO_ASM |
| 33 | 35 | ||
| 34 | #define HAVE_AES_CBC_ENCRYPT_INTERNAL | 36 | #ifdef LIBRESSL_USE_AES_ASSEMBLY |
| 37 | #define HAVE_AES_SET_ENCRYPT_KEY_GENERIC | ||
| 38 | #define HAVE_AES_SET_DECRYPT_KEY_GENERIC | ||
| 39 | #define HAVE_AES_ENCRYPT_GENERIC | ||
| 40 | #define HAVE_AES_DECRYPT_GENERIC | ||
| 35 | #define HAVE_AES_SET_ENCRYPT_KEY_INTERNAL | 41 | #define HAVE_AES_SET_ENCRYPT_KEY_INTERNAL |
| 36 | #define HAVE_AES_SET_DECRYPT_KEY_INTERNAL | 42 | #define HAVE_AES_SET_DECRYPT_KEY_INTERNAL |
| 37 | #define HAVE_AES_ENCRYPT_INTERNAL | 43 | #define HAVE_AES_ENCRYPT_INTERNAL |
| 38 | #define HAVE_AES_DECRYPT_INTERNAL | 44 | #define HAVE_AES_DECRYPT_INTERNAL |
| 45 | #define HAVE_AES_CBC_ENCRYPT_INTERNAL | ||
| 46 | #define HAVE_AES_CCM64_ENCRYPT_INTERNAL | ||
| 47 | #define HAVE_AES_CTR32_ENCRYPT_INTERNAL | ||
| 48 | #define HAVE_AES_ECB_ENCRYPT_INTERNAL | ||
| 49 | #define HAVE_AES_XTS_ENCRYPT_INTERNAL | ||
| 50 | #endif | ||
| 39 | 51 | ||
| 52 | #ifdef LIBRESSL_USE_GCM_ASSEMBLY | ||
| 53 | #define HAVE_GCM128_INIT | ||
| 54 | #define HAVE_GCM_GHASH_4BIT | ||
| 55 | #define HAVE_GCM_GMULT_4BIT | ||
| 56 | #endif | ||
| 57 | |||
| 58 | #ifdef LIBRESSL_USE_MD5_ASSEMBLY | ||
| 59 | #define HAVE_MD5_BLOCK_DATA_ORDER | ||
| 60 | #endif | ||
| 61 | |||
| 62 | #ifdef LIBRESSL_USE_RC4_ASSEMBLY | ||
| 40 | #define HAVE_RC4_INTERNAL | 63 | #define HAVE_RC4_INTERNAL |
| 41 | #define HAVE_RC4_SET_KEY_INTERNAL | 64 | #define HAVE_RC4_SET_KEY_INTERNAL |
| 65 | #endif | ||
| 42 | 66 | ||
| 67 | #ifdef LIBRESSL_USE_SHA_ASSEMBLY | ||
| 43 | #define HAVE_SHA1_BLOCK_DATA_ORDER | 68 | #define HAVE_SHA1_BLOCK_DATA_ORDER |
| 44 | #define HAVE_SHA1_BLOCK_GENERIC | 69 | #define HAVE_SHA1_BLOCK_GENERIC |
| 45 | |||
| 46 | #define HAVE_SHA256_BLOCK_DATA_ORDER | 70 | #define HAVE_SHA256_BLOCK_DATA_ORDER |
| 47 | #define HAVE_SHA256_BLOCK_GENERIC | 71 | #define HAVE_SHA256_BLOCK_GENERIC |
| 48 | |||
| 49 | #define HAVE_SHA512_BLOCK_DATA_ORDER | 72 | #define HAVE_SHA512_BLOCK_DATA_ORDER |
| 50 | #define HAVE_SHA512_BLOCK_GENERIC | 73 | #define HAVE_SHA512_BLOCK_GENERIC |
| 74 | #endif | ||
| 51 | 75 | ||
| 52 | #endif | 76 | #endif |
| 53 | 77 | ||
diff --git a/src/lib/libcrypto/arch/amd64/crypto_cpu_caps.c b/src/lib/libcrypto/arch/amd64/crypto_cpu_caps.c index 63b7b64cda..51a2da4616 100644 --- a/src/lib/libcrypto/arch/amd64/crypto_cpu_caps.c +++ b/src/lib/libcrypto/arch/amd64/crypto_cpu_caps.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_cpu_caps.c,v 1.4 2024/11/16 13:05:35 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_cpu_caps.c,v 1.8 2025/08/14 15:11:01 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -98,10 +98,14 @@ crypto_cpu_caps_init(void) | |||
| 98 | if ((edx & IA32CAP_MASK0_SSE2) != 0) | 98 | if ((edx & IA32CAP_MASK0_SSE2) != 0) |
| 99 | caps |= CPUCAP_MASK_SSE2; | 99 | caps |= CPUCAP_MASK_SSE2; |
| 100 | 100 | ||
| 101 | if ((ecx & IA32CAP_MASK1_AESNI) != 0) | 101 | if ((ecx & IA32CAP_MASK1_AESNI) != 0) { |
| 102 | caps |= CPUCAP_MASK_AESNI; | 102 | caps |= CPUCAP_MASK_AESNI; |
| 103 | if ((ecx & IA32CAP_MASK1_PCLMUL) != 0) | 103 | crypto_cpu_caps_amd64 |= CRYPTO_CPU_CAPS_AMD64_AES; |
| 104 | } | ||
| 105 | if ((ecx & IA32CAP_MASK1_PCLMUL) != 0) { | ||
| 104 | caps |= CPUCAP_MASK_PCLMUL; | 106 | caps |= CPUCAP_MASK_PCLMUL; |
| 107 | crypto_cpu_caps_amd64 |= CRYPTO_CPU_CAPS_AMD64_CLMUL; | ||
| 108 | } | ||
| 105 | if ((ecx & IA32CAP_MASK1_SSSE3) != 0) | 109 | if ((ecx & IA32CAP_MASK1_SSSE3) != 0) |
| 106 | caps |= CPUCAP_MASK_SSSE3; | 110 | caps |= CPUCAP_MASK_SSSE3; |
| 107 | 111 | ||
| @@ -115,6 +119,10 @@ crypto_cpu_caps_init(void) | |||
| 115 | if (max_cpuid >= 7) { | 119 | if (max_cpuid >= 7) { |
| 116 | cpuid(7, NULL, &ebx, NULL, NULL); | 120 | cpuid(7, NULL, &ebx, NULL, NULL); |
| 117 | 121 | ||
| 122 | /* Intel ADX feature bit - ebx[19]. */ | ||
| 123 | if (((ebx >> 19) & 1) != 0) | ||
| 124 | crypto_cpu_caps_amd64 |= CRYPTO_CPU_CAPS_AMD64_ADX; | ||
| 125 | |||
| 118 | /* Intel SHA extensions feature bit - ebx[29]. */ | 126 | /* Intel SHA extensions feature bit - ebx[29]. */ |
| 119 | if (((ebx >> 29) & 1) != 0) | 127 | if (((ebx >> 29) & 1) != 0) |
| 120 | crypto_cpu_caps_amd64 |= CRYPTO_CPU_CAPS_AMD64_SHA; | 128 | crypto_cpu_caps_amd64 |= CRYPTO_CPU_CAPS_AMD64_SHA; |
| @@ -126,9 +134,3 @@ crypto_cpu_caps_init(void) | |||
| 126 | 134 | ||
| 127 | OPENSSL_ia32cap_P = caps; | 135 | OPENSSL_ia32cap_P = caps; |
| 128 | } | 136 | } |
| 129 | |||
| 130 | uint64_t | ||
| 131 | crypto_cpu_caps_ia32(void) | ||
| 132 | { | ||
| 133 | return OPENSSL_ia32cap_P; | ||
| 134 | } | ||
diff --git a/src/lib/libcrypto/arch/amd64/opensslconf.h b/src/lib/libcrypto/arch/amd64/opensslconf.h deleted file mode 100644 index cc193762f1..0000000000 --- a/src/lib/libcrypto/arch/amd64/opensslconf.h +++ /dev/null | |||
| @@ -1,149 +0,0 @@ | |||
| 1 | #include <openssl/opensslfeatures.h> | ||
| 2 | /* crypto/opensslconf.h.in */ | ||
| 3 | |||
| 4 | #if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR) | ||
| 5 | #define OPENSSLDIR "/etc/ssl" | ||
| 6 | #endif | ||
| 7 | |||
| 8 | #undef OPENSSL_EXPORT_VAR_AS_FUNCTION | ||
| 9 | |||
| 10 | #ifndef OPENSSL_FILE | ||
| 11 | #ifdef OPENSSL_NO_FILENAMES | ||
| 12 | #define OPENSSL_FILE "" | ||
| 13 | #define OPENSSL_LINE 0 | ||
| 14 | #else | ||
| 15 | #define OPENSSL_FILE __FILE__ | ||
| 16 | #define OPENSSL_LINE __LINE__ | ||
| 17 | #endif | ||
| 18 | #endif | ||
| 19 | |||
| 20 | #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) | ||
| 21 | #define IDEA_INT unsigned int | ||
| 22 | #endif | ||
| 23 | |||
| 24 | #if defined(HEADER_MD2_H) && !defined(MD2_INT) | ||
| 25 | #define MD2_INT unsigned int | ||
| 26 | #endif | ||
| 27 | |||
| 28 | #if defined(HEADER_RC2_H) && !defined(RC2_INT) | ||
| 29 | /* I need to put in a mod for the alpha - eay */ | ||
| 30 | #define RC2_INT unsigned int | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #if defined(HEADER_RC4_H) | ||
| 34 | #if !defined(RC4_INT) | ||
| 35 | /* using int types make the structure larger but make the code faster | ||
| 36 | * on most boxes I have tested - up to %20 faster. */ | ||
| 37 | /* | ||
| 38 | * I don't know what does "most" mean, but declaring "int" is a must on: | ||
| 39 | * - Intel P6 because partial register stalls are very expensive; | ||
| 40 | * - elder Alpha because it lacks byte load/store instructions; | ||
| 41 | */ | ||
| 42 | #define RC4_INT unsigned int | ||
| 43 | #endif | ||
| 44 | #if !defined(RC4_CHUNK) | ||
| 45 | /* | ||
| 46 | * This enables code handling data aligned at natural CPU word | ||
| 47 | * boundary. See crypto/rc4/rc4_enc.c for further details. | ||
| 48 | */ | ||
| 49 | #define RC4_CHUNK unsigned long | ||
| 50 | #endif | ||
| 51 | #endif | ||
| 52 | |||
| 53 | #if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) | ||
| 54 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a | ||
| 55 | * %20 speed up (longs are 8 bytes, int's are 4). */ | ||
| 56 | #ifndef DES_LONG | ||
| 57 | #define DES_LONG unsigned int | ||
| 58 | #endif | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) | ||
| 62 | #define CONFIG_HEADER_BN_H | ||
| 63 | #undef BN_LLONG | ||
| 64 | |||
| 65 | /* Should we define BN_DIV2W here? */ | ||
| 66 | |||
| 67 | /* Only one for the following should be defined */ | ||
| 68 | #define SIXTY_FOUR_BIT_LONG | ||
| 69 | #undef SIXTY_FOUR_BIT | ||
| 70 | #undef THIRTY_TWO_BIT | ||
| 71 | #endif | ||
| 72 | |||
| 73 | #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) | ||
| 74 | #define CONFIG_HEADER_BF_LOCL_H | ||
| 75 | #undef BF_PTR | ||
| 76 | #endif /* HEADER_BF_LOCL_H */ | ||
| 77 | |||
| 78 | #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) | ||
| 79 | #define CONFIG_HEADER_DES_LOCL_H | ||
| 80 | #ifndef DES_DEFAULT_OPTIONS | ||
| 81 | /* the following is tweaked from a config script, that is why it is a | ||
| 82 | * protected undef/define */ | ||
| 83 | #ifndef DES_PTR | ||
| 84 | #undef DES_PTR | ||
| 85 | #endif | ||
| 86 | |||
| 87 | /* This helps C compiler generate the correct code for multiple functional | ||
| 88 | * units. It reduces register dependencies at the expense of 2 more | ||
| 89 | * registers */ | ||
| 90 | #ifndef DES_RISC1 | ||
| 91 | #undef DES_RISC1 | ||
| 92 | #endif | ||
| 93 | |||
| 94 | #ifndef DES_RISC2 | ||
| 95 | #undef DES_RISC2 | ||
| 96 | #endif | ||
| 97 | |||
| 98 | #if defined(DES_RISC1) && defined(DES_RISC2) | ||
| 99 | YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! | ||
| 100 | #endif | ||
| 101 | |||
| 102 | /* Unroll the inner loop, this sometimes helps, sometimes hinders. | ||
| 103 | * Very much CPU dependent */ | ||
| 104 | #ifndef DES_UNROLL | ||
| 105 | #define DES_UNROLL | ||
| 106 | #endif | ||
| 107 | |||
| 108 | /* These default values were supplied by | ||
| 109 | * Peter Gutman <pgut001@cs.auckland.ac.nz> | ||
| 110 | * They are only used if nothing else has been defined */ | ||
| 111 | #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) | ||
| 112 | /* Special defines which change the way the code is built depending on the | ||
| 113 | CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find | ||
| 114 | even newer MIPS CPU's, but at the moment one size fits all for | ||
| 115 | optimization options. Older Sparc's work better with only UNROLL, but | ||
| 116 | there's no way to tell at compile time what it is you're running on */ | ||
| 117 | |||
| 118 | #if defined( sun ) /* Newer Sparc's */ | ||
| 119 | # define DES_PTR | ||
| 120 | # define DES_RISC1 | ||
| 121 | # define DES_UNROLL | ||
| 122 | #elif defined( __ultrix ) /* Older MIPS */ | ||
| 123 | # define DES_PTR | ||
| 124 | # define DES_RISC2 | ||
| 125 | # define DES_UNROLL | ||
| 126 | #elif defined( __osf1__ ) /* Alpha */ | ||
| 127 | # define DES_PTR | ||
| 128 | # define DES_RISC2 | ||
| 129 | #elif defined ( _AIX ) /* RS6000 */ | ||
| 130 | /* Unknown */ | ||
| 131 | #elif defined( __hpux ) /* HP-PA */ | ||
| 132 | /* Unknown */ | ||
| 133 | #elif defined( __aux ) /* 68K */ | ||
| 134 | /* Unknown */ | ||
| 135 | #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ | ||
| 136 | # define DES_UNROLL | ||
| 137 | #elif defined( __sgi ) /* Newer MIPS */ | ||
| 138 | # define DES_PTR | ||
| 139 | # define DES_RISC2 | ||
| 140 | # define DES_UNROLL | ||
| 141 | #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ | ||
| 142 | # define DES_PTR | ||
| 143 | # define DES_RISC1 | ||
| 144 | # define DES_UNROLL | ||
| 145 | #endif /* Systems-specific speed defines */ | ||
| 146 | #endif | ||
| 147 | |||
| 148 | #endif /* DES_DEFAULT_OPTIONS */ | ||
| 149 | #endif /* HEADER_DES_LOCL_H */ | ||
diff --git a/src/lib/libcrypto/arch/arm/Makefile.inc b/src/lib/libcrypto/arch/arm/Makefile.inc index e078c51d98..271dff04f6 100644 --- a/src/lib/libcrypto/arch/arm/Makefile.inc +++ b/src/lib/libcrypto/arch/arm/Makefile.inc | |||
| @@ -1,28 +1,3 @@ | |||
| 1 | # $oPenBSD: Makefile.inc,v 1.2 2014/05/02 18:21:39 miod Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.20 2025/05/24 07:07:18 jsing Exp $ |
| 2 | 2 | ||
| 3 | # arm-specific libcrypto build rules | 3 | # arm-specific libcrypto build rules |
| 4 | |||
| 5 | # aes | ||
| 6 | CFLAGS+= -DAES_ASM | ||
| 7 | SSLASM+= aes aes-armv4 | ||
| 8 | # bn | ||
| 9 | CFLAGS+= -DOPENSSL_BN_ASM_MONT | ||
| 10 | SSLASM+= bn armv4-mont | ||
| 11 | # modes | ||
| 12 | CFLAGS+= -DGHASH_ASM | ||
| 13 | SSLASM+= modes ghash-armv4 | ||
| 14 | # sha | ||
| 15 | SSLASM+= sha sha1-armv4-large | ||
| 16 | SSLASM+= sha sha256-armv4 | ||
| 17 | SSLASM+= sha sha512-armv4 | ||
| 18 | |||
| 19 | .for dir f in ${SSLASM} | ||
| 20 | SRCS+= ${f}.S | ||
| 21 | GENERATED+=${f}.S | ||
| 22 | ${f}.S: ${LCRYPTO_SRC}/${dir}/asm/${f}.pl | ||
| 23 | /usr/bin/perl \ | ||
| 24 | ${LCRYPTO_SRC}/${dir}/asm/${f}.pl void ${.TARGET} > ${.TARGET} | ||
| 25 | .endfor | ||
| 26 | |||
| 27 | CFLAGS+= -DOPENSSL_CPUID_OBJ | ||
| 28 | SRCS+= armv4cpuid.S armcap.c | ||
diff --git a/src/lib/libcrypto/arch/arm/arm_arch.h b/src/lib/libcrypto/arch/arm/arm_arch.h deleted file mode 100644 index 5ac3b935f1..0000000000 --- a/src/lib/libcrypto/arch/arm/arm_arch.h +++ /dev/null | |||
| @@ -1,59 +0,0 @@ | |||
| 1 | /* $OpenBSD: arm_arch.h,v 1.1 2022/03/23 15:13:31 tb Exp $ */ | ||
| 2 | #ifndef __ARM_ARCH_H__ | ||
| 3 | #define __ARM_ARCH_H__ | ||
| 4 | |||
| 5 | #if !defined(__ARM_ARCH__) | ||
| 6 | # if defined(__CC_ARM) | ||
| 7 | # define __ARM_ARCH__ __TARGET_ARCH_ARM | ||
| 8 | # if defined(__BIG_ENDIAN) | ||
| 9 | # define __ARMEB__ | ||
| 10 | # else | ||
| 11 | # define __ARMEL__ | ||
| 12 | # endif | ||
| 13 | # elif defined(__GNUC__) | ||
| 14 | /* | ||
| 15 | * Why doesn't gcc define __ARM_ARCH__? Instead it defines | ||
| 16 | * bunch of below macros. See all_architectures[] table in | ||
| 17 | * gcc/config/arm/arm.c. On a side note it defines | ||
| 18 | * __ARMEL__/__ARMEB__ for little-/big-endian. | ||
| 19 | */ | ||
| 20 | # if defined(__ARM_ARCH) | ||
| 21 | # define __ARM_ARCH__ __ARM_ARCH | ||
| 22 | # elif defined(__ARM_ARCH_8A__) | ||
| 23 | # define __ARM_ARCH__ 8 | ||
| 24 | # elif defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || \ | ||
| 25 | defined(__ARM_ARCH_7R__)|| defined(__ARM_ARCH_7M__) || \ | ||
| 26 | defined(__ARM_ARCH_7EM__) | ||
| 27 | # define __ARM_ARCH__ 7 | ||
| 28 | # elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || \ | ||
| 29 | defined(__ARM_ARCH_6K__)|| defined(__ARM_ARCH_6M__) || \ | ||
| 30 | defined(__ARM_ARCH_6Z__)|| defined(__ARM_ARCH_6ZK__) || \ | ||
| 31 | defined(__ARM_ARCH_6T2__) | ||
| 32 | # define __ARM_ARCH__ 6 | ||
| 33 | # elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) || \ | ||
| 34 | defined(__ARM_ARCH_5E__)|| defined(__ARM_ARCH_5TE__) || \ | ||
| 35 | defined(__ARM_ARCH_5TEJ__) | ||
| 36 | # define __ARM_ARCH__ 5 | ||
| 37 | # elif defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) | ||
| 38 | # define __ARM_ARCH__ 4 | ||
| 39 | # else | ||
| 40 | # error "unsupported ARM architecture" | ||
| 41 | # endif | ||
| 42 | # endif | ||
| 43 | #endif | ||
| 44 | |||
| 45 | #if !defined(__ASSEMBLER__) | ||
| 46 | extern unsigned int OPENSSL_armcap_P; | ||
| 47 | |||
| 48 | #define ARMV7_NEON (1<<0) | ||
| 49 | #define ARMV8_AES (1<<1) | ||
| 50 | #define ARMV8_SHA1 (1<<2) | ||
| 51 | #define ARMV8_SHA256 (1<<3) | ||
| 52 | #define ARMV8_PMULL (1<<4) | ||
| 53 | #endif | ||
| 54 | |||
| 55 | #if defined(__OpenBSD__) | ||
| 56 | #define __STRICT_ALIGNMENT | ||
| 57 | #endif | ||
| 58 | |||
| 59 | #endif | ||
diff --git a/src/lib/libcrypto/arch/arm/armcap.c b/src/lib/libcrypto/arch/arm/armcap.c deleted file mode 100644 index 0238195397..0000000000 --- a/src/lib/libcrypto/arch/arm/armcap.c +++ /dev/null | |||
| @@ -1,88 +0,0 @@ | |||
| 1 | /* $OpenBSD: armcap.c,v 1.3 2024/08/29 03:30:05 deraadt Exp $ */ | ||
| 2 | #include <stdio.h> | ||
| 3 | #include <stdlib.h> | ||
| 4 | #include <string.h> | ||
| 5 | #include <setjmp.h> | ||
| 6 | #include <signal.h> | ||
| 7 | #include <openssl/crypto.h> | ||
| 8 | |||
| 9 | #include "arm_arch.h" | ||
| 10 | |||
| 11 | unsigned int OPENSSL_armcap_P; | ||
| 12 | |||
| 13 | #if __ARM_ARCH__ >= 7 | ||
| 14 | static sigset_t all_masked; | ||
| 15 | |||
| 16 | static sigjmp_buf ill_jmp; | ||
| 17 | |||
| 18 | static void | ||
| 19 | ill_handler(int sig) | ||
| 20 | { | ||
| 21 | siglongjmp(ill_jmp, sig); | ||
| 22 | } | ||
| 23 | |||
| 24 | /* | ||
| 25 | * Following subroutines could have been inlined, but it's not all | ||
| 26 | * ARM compilers support inline assembler... | ||
| 27 | */ | ||
| 28 | void _armv7_neon_probe(void); | ||
| 29 | void _armv8_aes_probe(void); | ||
| 30 | void _armv8_sha1_probe(void); | ||
| 31 | void _armv8_sha256_probe(void); | ||
| 32 | void _armv8_pmull_probe(void); | ||
| 33 | #endif | ||
| 34 | |||
| 35 | void | ||
| 36 | OPENSSL_cpuid_setup(void) | ||
| 37 | { | ||
| 38 | #if __ARM_ARCH__ >= 7 | ||
| 39 | struct sigaction ill_oact, ill_act; | ||
| 40 | sigset_t oset; | ||
| 41 | #endif | ||
| 42 | static int trigger = 0; | ||
| 43 | |||
| 44 | if (trigger) | ||
| 45 | return; | ||
| 46 | trigger = 1; | ||
| 47 | |||
| 48 | OPENSSL_armcap_P = 0; | ||
| 49 | |||
| 50 | #if __ARM_ARCH__ >= 7 | ||
| 51 | sigfillset(&all_masked); | ||
| 52 | sigdelset(&all_masked, SIGILL); | ||
| 53 | sigdelset(&all_masked, SIGTRAP); | ||
| 54 | sigdelset(&all_masked, SIGFPE); | ||
| 55 | sigdelset(&all_masked, SIGBUS); | ||
| 56 | sigdelset(&all_masked, SIGSEGV); | ||
| 57 | |||
| 58 | memset(&ill_act, 0, sizeof(ill_act)); | ||
| 59 | ill_act.sa_handler = ill_handler; | ||
| 60 | ill_act.sa_mask = all_masked; | ||
| 61 | |||
| 62 | sigprocmask(SIG_SETMASK, &ill_act.sa_mask, &oset); | ||
| 63 | sigaction(SIGILL, &ill_act, &ill_oact); | ||
| 64 | |||
| 65 | if (sigsetjmp(ill_jmp, 1) == 0) { | ||
| 66 | _armv7_neon_probe(); | ||
| 67 | OPENSSL_armcap_P |= ARMV7_NEON; | ||
| 68 | if (sigsetjmp(ill_jmp, 1) == 0) { | ||
| 69 | _armv8_pmull_probe(); | ||
| 70 | OPENSSL_armcap_P |= ARMV8_PMULL | ARMV8_AES; | ||
| 71 | } else if (sigsetjmp(ill_jmp, 1) == 0) { | ||
| 72 | _armv8_aes_probe(); | ||
| 73 | OPENSSL_armcap_P |= ARMV8_AES; | ||
| 74 | } | ||
| 75 | if (sigsetjmp(ill_jmp, 1) == 0) { | ||
| 76 | _armv8_sha1_probe(); | ||
| 77 | OPENSSL_armcap_P |= ARMV8_SHA1; | ||
| 78 | } | ||
| 79 | if (sigsetjmp(ill_jmp, 1) == 0) { | ||
| 80 | _armv8_sha256_probe(); | ||
| 81 | OPENSSL_armcap_P |= ARMV8_SHA256; | ||
| 82 | } | ||
| 83 | } | ||
| 84 | |||
| 85 | sigaction (SIGILL, &ill_oact, NULL); | ||
| 86 | sigprocmask(SIG_SETMASK, &oset, NULL); | ||
| 87 | #endif | ||
| 88 | } | ||
diff --git a/src/lib/libcrypto/arch/arm/armv4cpuid.S b/src/lib/libcrypto/arch/arm/armv4cpuid.S deleted file mode 100644 index db0b54e496..0000000000 --- a/src/lib/libcrypto/arch/arm/armv4cpuid.S +++ /dev/null | |||
| @@ -1,69 +0,0 @@ | |||
| 1 | #include "arm_arch.h" | ||
| 2 | |||
| 3 | .text | ||
| 4 | #if defined(__thumb2__) && !defined(__APPLE__) | ||
| 5 | .syntax unified | ||
| 6 | .thumb | ||
| 7 | #else | ||
| 8 | .code 32 | ||
| 9 | #undef __thumb2__ | ||
| 10 | #endif | ||
| 11 | |||
| 12 | #if __ARM_ARCH__>=7 | ||
| 13 | .arch armv7-a | ||
| 14 | .fpu neon | ||
| 15 | |||
| 16 | .align 5 | ||
| 17 | .globl _armv7_neon_probe | ||
| 18 | .type _armv7_neon_probe,%function | ||
| 19 | _armv7_neon_probe: | ||
| 20 | vorr q0,q0,q0 | ||
| 21 | bx lr | ||
| 22 | .size _armv7_neon_probe,.-_armv7_neon_probe | ||
| 23 | |||
| 24 | .globl _armv8_aes_probe | ||
| 25 | .type _armv8_aes_probe,%function | ||
| 26 | _armv8_aes_probe: | ||
| 27 | #if defined(__thumb2__) && !defined(__APPLE__) | ||
| 28 | .byte 0xb0,0xff,0x00,0x03 @ aese.8 q0,q0 | ||
| 29 | #else | ||
| 30 | .byte 0x00,0x03,0xb0,0xf3 @ aese.8 q0,q0 | ||
| 31 | #endif | ||
| 32 | bx lr | ||
| 33 | .size _armv8_aes_probe,.-_armv8_aes_probe | ||
| 34 | |||
| 35 | .globl _armv8_sha1_probe | ||
| 36 | .type _armv8_sha1_probe,%function | ||
| 37 | _armv8_sha1_probe: | ||
| 38 | #if defined(__thumb2__) && !defined(__APPLE__) | ||
| 39 | .byte 0x00,0xef,0x40,0x0c @ sha1c.32 q0,q0,q0 | ||
| 40 | #else | ||
| 41 | .byte 0x40,0x0c,0x00,0xf2 @ sha1c.32 q0,q0,q0 | ||
| 42 | #endif | ||
| 43 | bx lr | ||
| 44 | .size _armv8_sha1_probe,.-_armv8_sha1_probe | ||
| 45 | |||
| 46 | .globl _armv8_sha256_probe | ||
| 47 | .type _armv8_sha256_probe,%function | ||
| 48 | _armv8_sha256_probe: | ||
| 49 | #if defined(__thumb2__) && !defined(__APPLE__) | ||
| 50 | .byte 0x00,0xff,0x40,0x0c @ sha256h.32 q0,q0,q0 | ||
| 51 | #else | ||
| 52 | .byte 0x40,0x0c,0x00,0xf3 @ sha256h.32 q0,q0,q0 | ||
| 53 | #endif | ||
| 54 | bx lr | ||
| 55 | .size _armv8_sha256_probe,.-_armv8_sha256_probe | ||
| 56 | .globl _armv8_pmull_probe | ||
| 57 | .type _armv8_pmull_probe,%function | ||
| 58 | _armv8_pmull_probe: | ||
| 59 | #if defined(__thumb2__) && !defined(__APPLE__) | ||
| 60 | .byte 0xa0,0xef,0x00,0x0e @ vmull.p64 q0,d0,d0 | ||
| 61 | #else | ||
| 62 | .byte 0x00,0x0e,0xa0,0xf2 @ vmull.p64 q0,d0,d0 | ||
| 63 | #endif | ||
| 64 | bx lr | ||
| 65 | .size _armv8_pmull_probe,.-_armv8_pmull_probe | ||
| 66 | #endif | ||
| 67 | |||
| 68 | .comm OPENSSL_armcap_P,4,4 | ||
| 69 | .hidden OPENSSL_armcap_P | ||
diff --git a/src/lib/libcrypto/arch/arm/crypto_arch.h b/src/lib/libcrypto/arch/arm/crypto_arch.h index 07d7829fe3..732a59cf72 100644 --- a/src/lib/libcrypto/arch/arm/crypto_arch.h +++ b/src/lib/libcrypto/arch/arm/crypto_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_arch.h,v 1.2 2025/02/14 12:01:58 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_arch.h,v 1.3 2025/05/24 07:07:18 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -20,20 +20,6 @@ | |||
| 20 | 20 | ||
| 21 | #ifndef OPENSSL_NO_ASM | 21 | #ifndef OPENSSL_NO_ASM |
| 22 | 22 | ||
| 23 | #define HAVE_AES_SET_ENCRYPT_KEY_INTERNAL | ||
| 24 | #define HAVE_AES_SET_DECRYPT_KEY_INTERNAL | ||
| 25 | #define HAVE_AES_ENCRYPT_INTERNAL | ||
| 26 | #define HAVE_AES_DECRYPT_INTERNAL | ||
| 27 | |||
| 28 | #define HAVE_SHA1_BLOCK_DATA_ORDER | ||
| 29 | #define HAVE_SHA1_BLOCK_GENERIC | ||
| 30 | |||
| 31 | #define HAVE_SHA256_BLOCK_DATA_ORDER | ||
| 32 | #define HAVE_SHA256_BLOCK_GENERIC | ||
| 33 | |||
| 34 | #define HAVE_SHA512_BLOCK_DATA_ORDER | ||
| 35 | #define HAVE_SHA512_BLOCK_GENERIC | ||
| 36 | |||
| 37 | #endif | 23 | #endif |
| 38 | 24 | ||
| 39 | #endif | 25 | #endif |
diff --git a/src/lib/libcrypto/arch/arm/opensslconf.h b/src/lib/libcrypto/arch/arm/opensslconf.h deleted file mode 100644 index a5d26b6fdc..0000000000 --- a/src/lib/libcrypto/arch/arm/opensslconf.h +++ /dev/null | |||
| @@ -1,154 +0,0 @@ | |||
| 1 | #include <openssl/opensslfeatures.h> | ||
| 2 | /* crypto/opensslconf.h.in */ | ||
| 3 | |||
| 4 | #if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR) | ||
| 5 | #define OPENSSLDIR "/etc/ssl" | ||
| 6 | #endif | ||
| 7 | |||
| 8 | #undef OPENSSL_EXPORT_VAR_AS_FUNCTION | ||
| 9 | |||
| 10 | #ifndef OPENSSL_FILE | ||
| 11 | #ifdef OPENSSL_NO_FILENAMES | ||
| 12 | #define OPENSSL_FILE "" | ||
| 13 | #define OPENSSL_LINE 0 | ||
| 14 | #else | ||
| 15 | #define OPENSSL_FILE __FILE__ | ||
| 16 | #define OPENSSL_LINE __LINE__ | ||
| 17 | #endif | ||
| 18 | #endif | ||
| 19 | |||
| 20 | #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) | ||
| 21 | #define IDEA_INT unsigned int | ||
| 22 | #endif | ||
| 23 | |||
| 24 | #if defined(HEADER_MD2_H) && !defined(MD2_INT) | ||
| 25 | #define MD2_INT unsigned int | ||
| 26 | #endif | ||
| 27 | |||
| 28 | #if defined(HEADER_RC2_H) && !defined(RC2_INT) | ||
| 29 | /* I need to put in a mod for the alpha - eay */ | ||
| 30 | #define RC2_INT unsigned int | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #if defined(HEADER_RC4_H) | ||
| 34 | #if !defined(RC4_INT) | ||
| 35 | /* using int types make the structure larger but make the code faster | ||
| 36 | * on most boxes I have tested - up to %20 faster. */ | ||
| 37 | /* | ||
| 38 | * I don't know what does "most" mean, but declaring "int" is a must on: | ||
| 39 | * - Intel P6 because partial register stalls are very expensive; | ||
| 40 | * - elder Alpha because it lacks byte load/store instructions; | ||
| 41 | */ | ||
| 42 | #define RC4_INT unsigned int | ||
| 43 | #endif | ||
| 44 | #if !defined(RC4_CHUNK) | ||
| 45 | /* | ||
| 46 | * This enables code handling data aligned at natural CPU word | ||
| 47 | * boundary. See crypto/rc4/rc4_enc.c for further details. | ||
| 48 | */ | ||
| 49 | #undef RC4_CHUNK | ||
| 50 | #endif | ||
| 51 | #endif | ||
| 52 | |||
| 53 | #if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) | ||
| 54 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a | ||
| 55 | * %20 speed up (longs are 8 bytes, int's are 4). */ | ||
| 56 | #ifndef DES_LONG | ||
| 57 | #define DES_LONG unsigned int | ||
| 58 | #endif | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) | ||
| 62 | #define CONFIG_HEADER_BN_H | ||
| 63 | #define BN_LLONG | ||
| 64 | |||
| 65 | /* Should we define BN_DIV2W here? */ | ||
| 66 | |||
| 67 | /* Only one for the following should be defined */ | ||
| 68 | /* The prime number generation stuff may not work when | ||
| 69 | * EIGHT_BIT but I don't care since I've only used this mode | ||
| 70 | * for debugging the bignum libraries */ | ||
| 71 | #undef SIXTY_FOUR_BIT_LONG | ||
| 72 | #undef SIXTY_FOUR_BIT | ||
| 73 | #define THIRTY_TWO_BIT | ||
| 74 | #undef SIXTEEN_BIT | ||
| 75 | #undef EIGHT_BIT | ||
| 76 | #endif | ||
| 77 | |||
| 78 | #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) | ||
| 79 | #define CONFIG_HEADER_BF_LOCL_H | ||
| 80 | #undef BF_PTR | ||
| 81 | #endif /* HEADER_BF_LOCL_H */ | ||
| 82 | |||
| 83 | #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) | ||
| 84 | #define CONFIG_HEADER_DES_LOCL_H | ||
| 85 | #ifndef DES_DEFAULT_OPTIONS | ||
| 86 | /* the following is tweaked from a config script, that is why it is a | ||
| 87 | * protected undef/define */ | ||
| 88 | #ifndef DES_PTR | ||
| 89 | #undef DES_PTR | ||
| 90 | #endif | ||
| 91 | |||
| 92 | /* This helps C compiler generate the correct code for multiple functional | ||
| 93 | * units. It reduces register dependencies at the expense of 2 more | ||
| 94 | * registers */ | ||
| 95 | #ifndef DES_RISC1 | ||
| 96 | #undef DES_RISC1 | ||
| 97 | #endif | ||
| 98 | |||
| 99 | #ifndef DES_RISC2 | ||
| 100 | #undef DES_RISC2 | ||
| 101 | #endif | ||
| 102 | |||
| 103 | #if defined(DES_RISC1) && defined(DES_RISC2) | ||
| 104 | YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! | ||
| 105 | #endif | ||
| 106 | |||
| 107 | /* Unroll the inner loop, this sometimes helps, sometimes hinders. | ||
| 108 | * Very much CPU dependent */ | ||
| 109 | #ifndef DES_UNROLL | ||
| 110 | #define DES_UNROLL | ||
| 111 | #endif | ||
| 112 | |||
| 113 | /* These default values were supplied by | ||
| 114 | * Peter Gutman <pgut001@cs.auckland.ac.nz> | ||
| 115 | * They are only used if nothing else has been defined */ | ||
| 116 | #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) | ||
| 117 | /* Special defines which change the way the code is built depending on the | ||
| 118 | CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find | ||
| 119 | even newer MIPS CPU's, but at the moment one size fits all for | ||
| 120 | optimization options. Older Sparc's work better with only UNROLL, but | ||
| 121 | there's no way to tell at compile time what it is you're running on */ | ||
| 122 | |||
| 123 | #if defined( sun ) /* Newer Sparc's */ | ||
| 124 | # define DES_PTR | ||
| 125 | # define DES_RISC1 | ||
| 126 | # define DES_UNROLL | ||
| 127 | #elif defined( __ultrix ) /* Older MIPS */ | ||
| 128 | # define DES_PTR | ||
| 129 | # define DES_RISC2 | ||
| 130 | # define DES_UNROLL | ||
| 131 | #elif defined( __osf1__ ) /* Alpha */ | ||
| 132 | # define DES_PTR | ||
| 133 | # define DES_RISC2 | ||
| 134 | #elif defined ( _AIX ) /* RS6000 */ | ||
| 135 | /* Unknown */ | ||
| 136 | #elif defined( __hpux ) /* HP-PA */ | ||
| 137 | /* Unknown */ | ||
| 138 | #elif defined( __aux ) /* 68K */ | ||
| 139 | /* Unknown */ | ||
| 140 | #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ | ||
| 141 | # define DES_UNROLL | ||
| 142 | #elif defined( __sgi ) /* Newer MIPS */ | ||
| 143 | # define DES_PTR | ||
| 144 | # define DES_RISC2 | ||
| 145 | # define DES_UNROLL | ||
| 146 | #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ | ||
| 147 | # define DES_PTR | ||
| 148 | # define DES_RISC1 | ||
| 149 | # define DES_UNROLL | ||
| 150 | #endif /* Systems-specific speed defines */ | ||
| 151 | #endif | ||
| 152 | |||
| 153 | #endif /* DES_DEFAULT_OPTIONS */ | ||
| 154 | #endif /* HEADER_DES_LOCL_H */ | ||
diff --git a/src/lib/libcrypto/arch/hppa/Makefile.inc b/src/lib/libcrypto/arch/hppa/Makefile.inc index 11bfa4a5d3..c18e68d21c 100644 --- a/src/lib/libcrypto/arch/hppa/Makefile.inc +++ b/src/lib/libcrypto/arch/hppa/Makefile.inc | |||
| @@ -1,17 +1,22 @@ | |||
| 1 | # $OpenBSD: Makefile.inc,v 1.26 2025/02/14 12:01:58 jsing Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.30 2026/01/17 16:18:32 jsing Exp $ |
| 2 | 2 | ||
| 3 | # hppa-specific libcrypto build rules | 3 | # hppa-specific libcrypto build rules |
| 4 | 4 | ||
| 5 | # aes | 5 | # aes |
| 6 | CFLAGS+= -DAES_ASM | 6 | CFLAGS+= -DLIBRESSL_USE_AES_ASSEMBLY |
| 7 | SSLASM+= aes aes-parisc aes-parisc | 7 | SSLASM+= aes aes-parisc aes-parisc |
| 8 | |||
| 8 | # bn | 9 | # bn |
| 10 | CFLAGS+= -DLIBRESSL_USE_BN_ASSEMBLY | ||
| 9 | SSLASM+= bn parisc-mont parisc-mont | 11 | SSLASM+= bn parisc-mont parisc-mont |
| 10 | CFLAGS+= -DOPENSSL_BN_ASM_MONT -DBN_DIV2W | 12 | CFLAGS+= -DOPENSSL_BN_ASM_MONT |
| 13 | |||
| 11 | # modes | 14 | # modes |
| 12 | CFLAGS+= -DGHASH_ASM | 15 | CFLAGS+= -DLIBRESSL_USE_GCM_ASSEMBLY |
| 13 | SSLASM+= modes ghash-parisc ghash-parisc | 16 | SSLASM+= modes ghash-parisc ghash-parisc |
| 17 | |||
| 14 | # sha | 18 | # sha |
| 19 | CFLAGS+= -DLIBRESSL_USE_SHA_ASSEMBLY | ||
| 15 | SSLASM+= sha sha1-parisc sha1-parisc | 20 | SSLASM+= sha sha1-parisc sha1-parisc |
| 16 | SSLASM+= sha sha512-parisc sha256-parisc | 21 | SSLASM+= sha sha512-parisc sha256-parisc |
| 17 | 22 | ||
diff --git a/src/lib/libcrypto/arch/hppa/crypto_arch.h b/src/lib/libcrypto/arch/hppa/crypto_arch.h index 08fcaca045..f1e7d2dcbf 100644 --- a/src/lib/libcrypto/arch/hppa/crypto_arch.h +++ b/src/lib/libcrypto/arch/hppa/crypto_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_arch.h,v 1.2 2025/02/14 12:01:58 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_arch.h,v 1.4 2026/01/17 16:18:32 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -20,14 +20,22 @@ | |||
| 20 | 20 | ||
| 21 | #ifndef OPENSSL_NO_ASM | 21 | #ifndef OPENSSL_NO_ASM |
| 22 | 22 | ||
| 23 | #ifdef LIBRESSL_USE_AES_ASSEMBLY | ||
| 23 | #define HAVE_AES_ENCRYPT_INTERNAL | 24 | #define HAVE_AES_ENCRYPT_INTERNAL |
| 24 | #define HAVE_AES_DECRYPT_INTERNAL | 25 | #define HAVE_AES_DECRYPT_INTERNAL |
| 26 | #endif | ||
| 27 | |||
| 28 | #ifdef LIBRESSL_USE_GCM_ASSEMBLY | ||
| 29 | #define HAVE_GCM_GHASH_4BIT | ||
| 30 | #define HAVE_GCM_GMULT_4BIT | ||
| 31 | #endif | ||
| 25 | 32 | ||
| 33 | #ifdef LIBRESSL_USE_SHA_ASSEMBLY | ||
| 26 | #define HAVE_SHA1_BLOCK_DATA_ORDER | 34 | #define HAVE_SHA1_BLOCK_DATA_ORDER |
| 27 | #define HAVE_SHA1_BLOCK_GENERIC | 35 | #define HAVE_SHA1_BLOCK_GENERIC |
| 28 | |||
| 29 | #define HAVE_SHA256_BLOCK_DATA_ORDER | 36 | #define HAVE_SHA256_BLOCK_DATA_ORDER |
| 30 | #define HAVE_SHA256_BLOCK_GENERIC | 37 | #define HAVE_SHA256_BLOCK_GENERIC |
| 38 | #endif | ||
| 31 | 39 | ||
| 32 | #endif | 40 | #endif |
| 33 | 41 | ||
diff --git a/src/lib/libcrypto/arch/hppa/opensslconf.h b/src/lib/libcrypto/arch/hppa/opensslconf.h deleted file mode 100644 index a5d26b6fdc..0000000000 --- a/src/lib/libcrypto/arch/hppa/opensslconf.h +++ /dev/null | |||
| @@ -1,154 +0,0 @@ | |||
| 1 | #include <openssl/opensslfeatures.h> | ||
| 2 | /* crypto/opensslconf.h.in */ | ||
| 3 | |||
| 4 | #if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR) | ||
| 5 | #define OPENSSLDIR "/etc/ssl" | ||
| 6 | #endif | ||
| 7 | |||
| 8 | #undef OPENSSL_EXPORT_VAR_AS_FUNCTION | ||
| 9 | |||
| 10 | #ifndef OPENSSL_FILE | ||
| 11 | #ifdef OPENSSL_NO_FILENAMES | ||
| 12 | #define OPENSSL_FILE "" | ||
| 13 | #define OPENSSL_LINE 0 | ||
| 14 | #else | ||
| 15 | #define OPENSSL_FILE __FILE__ | ||
| 16 | #define OPENSSL_LINE __LINE__ | ||
| 17 | #endif | ||
| 18 | #endif | ||
| 19 | |||
| 20 | #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) | ||
| 21 | #define IDEA_INT unsigned int | ||
| 22 | #endif | ||
| 23 | |||
| 24 | #if defined(HEADER_MD2_H) && !defined(MD2_INT) | ||
| 25 | #define MD2_INT unsigned int | ||
| 26 | #endif | ||
| 27 | |||
| 28 | #if defined(HEADER_RC2_H) && !defined(RC2_INT) | ||
| 29 | /* I need to put in a mod for the alpha - eay */ | ||
| 30 | #define RC2_INT unsigned int | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #if defined(HEADER_RC4_H) | ||
| 34 | #if !defined(RC4_INT) | ||
| 35 | /* using int types make the structure larger but make the code faster | ||
| 36 | * on most boxes I have tested - up to %20 faster. */ | ||
| 37 | /* | ||
| 38 | * I don't know what does "most" mean, but declaring "int" is a must on: | ||
| 39 | * - Intel P6 because partial register stalls are very expensive; | ||
| 40 | * - elder Alpha because it lacks byte load/store instructions; | ||
| 41 | */ | ||
| 42 | #define RC4_INT unsigned int | ||
| 43 | #endif | ||
| 44 | #if !defined(RC4_CHUNK) | ||
| 45 | /* | ||
| 46 | * This enables code handling data aligned at natural CPU word | ||
| 47 | * boundary. See crypto/rc4/rc4_enc.c for further details. | ||
| 48 | */ | ||
| 49 | #undef RC4_CHUNK | ||
| 50 | #endif | ||
| 51 | #endif | ||
| 52 | |||
| 53 | #if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) | ||
| 54 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a | ||
| 55 | * %20 speed up (longs are 8 bytes, int's are 4). */ | ||
| 56 | #ifndef DES_LONG | ||
| 57 | #define DES_LONG unsigned int | ||
| 58 | #endif | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) | ||
| 62 | #define CONFIG_HEADER_BN_H | ||
| 63 | #define BN_LLONG | ||
| 64 | |||
| 65 | /* Should we define BN_DIV2W here? */ | ||
| 66 | |||
| 67 | /* Only one for the following should be defined */ | ||
| 68 | /* The prime number generation stuff may not work when | ||
| 69 | * EIGHT_BIT but I don't care since I've only used this mode | ||
| 70 | * for debugging the bignum libraries */ | ||
| 71 | #undef SIXTY_FOUR_BIT_LONG | ||
| 72 | #undef SIXTY_FOUR_BIT | ||
| 73 | #define THIRTY_TWO_BIT | ||
| 74 | #undef SIXTEEN_BIT | ||
| 75 | #undef EIGHT_BIT | ||
| 76 | #endif | ||
| 77 | |||
| 78 | #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) | ||
| 79 | #define CONFIG_HEADER_BF_LOCL_H | ||
| 80 | #undef BF_PTR | ||
| 81 | #endif /* HEADER_BF_LOCL_H */ | ||
| 82 | |||
| 83 | #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) | ||
| 84 | #define CONFIG_HEADER_DES_LOCL_H | ||
| 85 | #ifndef DES_DEFAULT_OPTIONS | ||
| 86 | /* the following is tweaked from a config script, that is why it is a | ||
| 87 | * protected undef/define */ | ||
| 88 | #ifndef DES_PTR | ||
| 89 | #undef DES_PTR | ||
| 90 | #endif | ||
| 91 | |||
| 92 | /* This helps C compiler generate the correct code for multiple functional | ||
| 93 | * units. It reduces register dependencies at the expense of 2 more | ||
| 94 | * registers */ | ||
| 95 | #ifndef DES_RISC1 | ||
| 96 | #undef DES_RISC1 | ||
| 97 | #endif | ||
| 98 | |||
| 99 | #ifndef DES_RISC2 | ||
| 100 | #undef DES_RISC2 | ||
| 101 | #endif | ||
| 102 | |||
| 103 | #if defined(DES_RISC1) && defined(DES_RISC2) | ||
| 104 | YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! | ||
| 105 | #endif | ||
| 106 | |||
| 107 | /* Unroll the inner loop, this sometimes helps, sometimes hinders. | ||
| 108 | * Very much CPU dependent */ | ||
| 109 | #ifndef DES_UNROLL | ||
| 110 | #define DES_UNROLL | ||
| 111 | #endif | ||
| 112 | |||
| 113 | /* These default values were supplied by | ||
| 114 | * Peter Gutman <pgut001@cs.auckland.ac.nz> | ||
| 115 | * They are only used if nothing else has been defined */ | ||
| 116 | #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) | ||
| 117 | /* Special defines which change the way the code is built depending on the | ||
| 118 | CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find | ||
| 119 | even newer MIPS CPU's, but at the moment one size fits all for | ||
| 120 | optimization options. Older Sparc's work better with only UNROLL, but | ||
| 121 | there's no way to tell at compile time what it is you're running on */ | ||
| 122 | |||
| 123 | #if defined( sun ) /* Newer Sparc's */ | ||
| 124 | # define DES_PTR | ||
| 125 | # define DES_RISC1 | ||
| 126 | # define DES_UNROLL | ||
| 127 | #elif defined( __ultrix ) /* Older MIPS */ | ||
| 128 | # define DES_PTR | ||
| 129 | # define DES_RISC2 | ||
| 130 | # define DES_UNROLL | ||
| 131 | #elif defined( __osf1__ ) /* Alpha */ | ||
| 132 | # define DES_PTR | ||
| 133 | # define DES_RISC2 | ||
| 134 | #elif defined ( _AIX ) /* RS6000 */ | ||
| 135 | /* Unknown */ | ||
| 136 | #elif defined( __hpux ) /* HP-PA */ | ||
| 137 | /* Unknown */ | ||
| 138 | #elif defined( __aux ) /* 68K */ | ||
| 139 | /* Unknown */ | ||
| 140 | #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ | ||
| 141 | # define DES_UNROLL | ||
| 142 | #elif defined( __sgi ) /* Newer MIPS */ | ||
| 143 | # define DES_PTR | ||
| 144 | # define DES_RISC2 | ||
| 145 | # define DES_UNROLL | ||
| 146 | #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ | ||
| 147 | # define DES_PTR | ||
| 148 | # define DES_RISC1 | ||
| 149 | # define DES_UNROLL | ||
| 150 | #endif /* Systems-specific speed defines */ | ||
| 151 | #endif | ||
| 152 | |||
| 153 | #endif /* DES_DEFAULT_OPTIONS */ | ||
| 154 | #endif /* HEADER_DES_LOCL_H */ | ||
diff --git a/src/lib/libcrypto/arch/i386/Makefile.inc b/src/lib/libcrypto/arch/i386/Makefile.inc index 6989b35686..a81b18880d 100644 --- a/src/lib/libcrypto/arch/i386/Makefile.inc +++ b/src/lib/libcrypto/arch/i386/Makefile.inc | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile.inc,v 1.27 2025/02/14 12:01:58 jsing Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.35 2026/01/17 16:18:32 jsing Exp $ |
| 2 | 2 | ||
| 3 | # i386-specific libcrypto build rules | 3 | # i386-specific libcrypto build rules |
| 4 | 4 | ||
| @@ -8,26 +8,33 @@ EXTRA_PL = ${LCRYPTO_SRC}/perlasm/x86gas.pl ${LCRYPTO_SRC}/perlasm/x86asm.pl | |||
| 8 | SRCS += crypto_cpu_caps.c | 8 | SRCS += crypto_cpu_caps.c |
| 9 | 9 | ||
| 10 | # aes | 10 | # aes |
| 11 | CFLAGS+= -DAES_ASM | 11 | CFLAGS+= -DLIBRESSL_USE_AES_ASSEMBLY |
| 12 | SSLASM+= aes aes-586 | 12 | SSLASM+= aes aes-586 |
| 13 | CFLAGS+= -DVPAES_ASM | ||
| 14 | SSLASM+= aes vpaes-x86 | ||
| 15 | SSLASM+= aes aesni-x86 | 13 | SSLASM+= aes aesni-x86 |
| 14 | SRCS += aes_i386.c | ||
| 15 | |||
| 16 | # bn | 16 | # bn |
| 17 | CFLAGS+= -DOPENSSL_IA32_SSE2 | 17 | CFLAGS+= -DLIBRESSL_USE_BN_ASSEMBLY |
| 18 | SSLASM+= bn bn-586 | 18 | SSLASM+= bn bn-586 |
| 19 | SSLASM+= bn co-586 | 19 | SSLASM+= bn co-586 |
| 20 | CFLAGS+= -DOPENSSL_BN_ASM_MONT | 20 | CFLAGS+= -DOPENSSL_BN_ASM_MONT |
| 21 | SSLASM+= bn x86-mont | 21 | SSLASM+= bn x86-mont |
| 22 | |||
| 22 | # md5 | 23 | # md5 |
| 23 | CFLAGS+= -DMD5_ASM | 24 | CFLAGS+= -DLIBRESSL_USE_MD5_ASSEMBLY |
| 24 | SSLASM+= md5 md5-586 | 25 | SSLASM+= md5 md5-586 |
| 26 | |||
| 25 | # modes | 27 | # modes |
| 26 | CFLAGS+= -DGHASH_ASM | 28 | CFLAGS+= -DLIBRESSL_USE_GCM_ASSEMBLY |
| 27 | SSLASM+= modes ghash-x86 | 29 | SSLASM+= modes ghash-x86 |
| 30 | SRCS += gcm128_i386.c | ||
| 31 | |||
| 28 | # rc4 | 32 | # rc4 |
| 33 | CFLAGS+= -DLIBRESSL_USE_RC4_ASSEMBLY | ||
| 29 | SSLASM+= rc4 rc4-586 | 34 | SSLASM+= rc4 rc4-586 |
| 35 | |||
| 30 | # sha | 36 | # sha |
| 37 | CFLAGS+= -DLIBRESSL_USE_SHA_ASSEMBLY | ||
| 31 | SSLASM+= sha sha1-586 | 38 | SSLASM+= sha sha1-586 |
| 32 | SSLASM+= sha sha256-586 | 39 | SSLASM+= sha sha256-586 |
| 33 | SSLASM+= sha sha512-586 | 40 | SSLASM+= sha sha512-586 |
diff --git a/src/lib/libcrypto/arch/i386/crypto_arch.h b/src/lib/libcrypto/arch/i386/crypto_arch.h index 3df3963d0b..dc3c591b0d 100644 --- a/src/lib/libcrypto/arch/i386/crypto_arch.h +++ b/src/lib/libcrypto/arch/i386/crypto_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_arch.h,v 1.4 2025/02/14 12:01:58 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_arch.h,v 1.17 2026/01/17 16:18:32 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -15,31 +15,63 @@ | |||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include <stdint.h> | ||
| 19 | |||
| 18 | #ifndef HEADER_CRYPTO_ARCH_H | 20 | #ifndef HEADER_CRYPTO_ARCH_H |
| 19 | #define HEADER_CRYPTO_ARCH_H | 21 | #define HEADER_CRYPTO_ARCH_H |
| 20 | 22 | ||
| 21 | #define HAVE_CRYPTO_CPU_CAPS_INIT | 23 | #define HAVE_CRYPTO_CPU_CAPS_INIT |
| 22 | #define HAVE_CRYPTO_CPU_CAPS_IA32 | 24 | |
| 25 | #ifndef __ASSEMBLER__ | ||
| 26 | extern uint64_t crypto_cpu_caps_i386; | ||
| 27 | #endif | ||
| 28 | |||
| 29 | #define CRYPTO_CPU_CAPS_I386_AES (1ULL << 0) | ||
| 30 | #define CRYPTO_CPU_CAPS_I386_CLMUL (1ULL << 1) | ||
| 31 | #define CRYPTO_CPU_CAPS_I386_MMX (1ULL << 2) | ||
| 32 | #define CRYPTO_CPU_CAPS_I386_SSE (1ULL << 3) | ||
| 23 | 33 | ||
| 24 | #ifndef OPENSSL_NO_ASM | 34 | #ifndef OPENSSL_NO_ASM |
| 25 | 35 | ||
| 26 | #define HAVE_AES_CBC_ENCRYPT_INTERNAL | 36 | #ifdef LIBRESSL_USE_AES_ASSEMBLY |
| 37 | #define HAVE_AES_SET_ENCRYPT_KEY_GENERIC | ||
| 38 | #define HAVE_AES_SET_DECRYPT_KEY_GENERIC | ||
| 39 | #define HAVE_AES_ENCRYPT_GENERIC | ||
| 40 | #define HAVE_AES_DECRYPT_GENERIC | ||
| 27 | #define HAVE_AES_SET_ENCRYPT_KEY_INTERNAL | 41 | #define HAVE_AES_SET_ENCRYPT_KEY_INTERNAL |
| 28 | #define HAVE_AES_SET_DECRYPT_KEY_INTERNAL | 42 | #define HAVE_AES_SET_DECRYPT_KEY_INTERNAL |
| 29 | #define HAVE_AES_ENCRYPT_INTERNAL | 43 | #define HAVE_AES_ENCRYPT_INTERNAL |
| 30 | #define HAVE_AES_DECRYPT_INTERNAL | 44 | #define HAVE_AES_DECRYPT_INTERNAL |
| 45 | #define HAVE_AES_CBC_ENCRYPT_INTERNAL | ||
| 46 | #define HAVE_AES_CCM64_ENCRYPT_INTERNAL | ||
| 47 | #define HAVE_AES_CTR32_ENCRYPT_INTERNAL | ||
| 48 | #define HAVE_AES_ECB_ENCRYPT_INTERNAL | ||
| 49 | #define HAVE_AES_XTS_ENCRYPT_INTERNAL | ||
| 50 | #endif | ||
| 31 | 51 | ||
| 52 | #ifdef LIBRESSL_USE_GCM_ASSEMBLY | ||
| 53 | #define HAVE_GCM128_INIT | ||
| 54 | #define HAVE_GCM_GHASH_4BIT | ||
| 55 | #define HAVE_GCM_GMULT_4BIT | ||
| 56 | #endif | ||
| 57 | |||
| 58 | #ifdef LIBRESSL_USE_MD5_ASSEMBLY | ||
| 59 | #define HAVE_MD5_BLOCK_DATA_ORDER | ||
| 60 | #endif | ||
| 61 | |||
| 62 | #ifdef LIBRESSL_USE_RC4_ASSEMBLY | ||
| 32 | #define HAVE_RC4_INTERNAL | 63 | #define HAVE_RC4_INTERNAL |
| 33 | #define HAVE_RC4_SET_KEY_INTERNAL | 64 | #define HAVE_RC4_SET_KEY_INTERNAL |
| 65 | #endif | ||
| 34 | 66 | ||
| 67 | #ifdef LIBRESSL_USE_SHA_ASSEMBLY | ||
| 35 | #define HAVE_SHA1_BLOCK_DATA_ORDER | 68 | #define HAVE_SHA1_BLOCK_DATA_ORDER |
| 36 | #define HAVE_SHA1_BLOCK_GENERIC | 69 | #define HAVE_SHA1_BLOCK_GENERIC |
| 37 | |||
| 38 | #define HAVE_SHA256_BLOCK_DATA_ORDER | 70 | #define HAVE_SHA256_BLOCK_DATA_ORDER |
| 39 | #define HAVE_SHA256_BLOCK_GENERIC | 71 | #define HAVE_SHA256_BLOCK_GENERIC |
| 40 | |||
| 41 | #define HAVE_SHA512_BLOCK_DATA_ORDER | 72 | #define HAVE_SHA512_BLOCK_DATA_ORDER |
| 42 | #define HAVE_SHA512_BLOCK_GENERIC | 73 | #define HAVE_SHA512_BLOCK_GENERIC |
| 74 | #endif | ||
| 43 | 75 | ||
| 44 | #endif | 76 | #endif |
| 45 | 77 | ||
diff --git a/src/lib/libcrypto/arch/i386/crypto_cpu_caps.c b/src/lib/libcrypto/arch/i386/crypto_cpu_caps.c index 6bb77411af..b136f39478 100644 --- a/src/lib/libcrypto/arch/i386/crypto_cpu_caps.c +++ b/src/lib/libcrypto/arch/i386/crypto_cpu_caps.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_cpu_caps.c,v 1.3 2024/11/12 13:14:57 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_cpu_caps.c,v 1.7 2025/12/31 10:06:41 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -19,11 +19,15 @@ | |||
| 19 | 19 | ||
| 20 | #include <openssl/crypto.h> | 20 | #include <openssl/crypto.h> |
| 21 | 21 | ||
| 22 | #include "crypto_arch.h" | ||
| 22 | #include "x86_arch.h" | 23 | #include "x86_arch.h" |
| 23 | 24 | ||
| 24 | /* Legacy architecture specific capabilities, used by perlasm. */ | 25 | /* Legacy architecture specific capabilities, used by perlasm. */ |
| 25 | uint64_t OPENSSL_ia32cap_P; | 26 | uint64_t OPENSSL_ia32cap_P; |
| 26 | 27 | ||
| 28 | /* Machine dependent CPU capabilities. */ | ||
| 29 | uint64_t crypto_cpu_caps_i386; | ||
| 30 | |||
| 27 | /* Machine independent CPU capabilities. */ | 31 | /* Machine independent CPU capabilities. */ |
| 28 | extern uint64_t crypto_cpu_caps; | 32 | extern uint64_t crypto_cpu_caps; |
| 29 | 33 | ||
| @@ -85,17 +89,25 @@ crypto_cpu_caps_init(void) | |||
| 85 | caps |= CPUCAP_MASK_FXSR; | 89 | caps |= CPUCAP_MASK_FXSR; |
| 86 | if ((edx & IA32CAP_MASK0_HT) != 0) | 90 | if ((edx & IA32CAP_MASK0_HT) != 0) |
| 87 | caps |= CPUCAP_MASK_HT; | 91 | caps |= CPUCAP_MASK_HT; |
| 88 | if ((edx & IA32CAP_MASK0_MMX) != 0) | 92 | if ((edx & IA32CAP_MASK0_MMX) != 0) { |
| 89 | caps |= CPUCAP_MASK_MMX; | 93 | caps |= CPUCAP_MASK_MMX; |
| 90 | if ((edx & IA32CAP_MASK0_SSE) != 0) | 94 | crypto_cpu_caps_i386 |= CRYPTO_CPU_CAPS_I386_MMX; |
| 95 | } | ||
| 96 | if ((edx & IA32CAP_MASK0_SSE) != 0) { | ||
| 91 | caps |= CPUCAP_MASK_SSE; | 97 | caps |= CPUCAP_MASK_SSE; |
| 98 | crypto_cpu_caps_i386 |= CRYPTO_CPU_CAPS_I386_SSE; | ||
| 99 | } | ||
| 92 | if ((edx & IA32CAP_MASK0_SSE2) != 0) | 100 | if ((edx & IA32CAP_MASK0_SSE2) != 0) |
| 93 | caps |= CPUCAP_MASK_SSE2; | 101 | caps |= CPUCAP_MASK_SSE2; |
| 94 | 102 | ||
| 95 | if ((ecx & IA32CAP_MASK1_AESNI) != 0) | 103 | if ((ecx & IA32CAP_MASK1_AESNI) != 0) { |
| 96 | caps |= CPUCAP_MASK_AESNI; | 104 | caps |= CPUCAP_MASK_AESNI; |
| 97 | if ((ecx & IA32CAP_MASK1_PCLMUL) != 0) | 105 | crypto_cpu_caps_i386 |= CRYPTO_CPU_CAPS_I386_AES; |
| 106 | } | ||
| 107 | if ((ecx & IA32CAP_MASK1_PCLMUL) != 0) { | ||
| 98 | caps |= CPUCAP_MASK_PCLMUL; | 108 | caps |= CPUCAP_MASK_PCLMUL; |
| 109 | crypto_cpu_caps_i386 |= CRYPTO_CPU_CAPS_I386_CLMUL; | ||
| 110 | } | ||
| 99 | if ((ecx & IA32CAP_MASK1_SSSE3) != 0) | 111 | if ((ecx & IA32CAP_MASK1_SSSE3) != 0) |
| 100 | caps |= CPUCAP_MASK_SSSE3; | 112 | caps |= CPUCAP_MASK_SSSE3; |
| 101 | 113 | ||
| @@ -112,9 +124,3 @@ crypto_cpu_caps_init(void) | |||
| 112 | 124 | ||
| 113 | OPENSSL_ia32cap_P = caps; | 125 | OPENSSL_ia32cap_P = caps; |
| 114 | } | 126 | } |
| 115 | |||
| 116 | uint64_t | ||
| 117 | crypto_cpu_caps_ia32(void) | ||
| 118 | { | ||
| 119 | return OPENSSL_ia32cap_P; | ||
| 120 | } | ||
diff --git a/src/lib/libcrypto/arch/i386/opensslconf.h b/src/lib/libcrypto/arch/i386/opensslconf.h deleted file mode 100644 index 03cf31b940..0000000000 --- a/src/lib/libcrypto/arch/i386/opensslconf.h +++ /dev/null | |||
| @@ -1,154 +0,0 @@ | |||
| 1 | #include <openssl/opensslfeatures.h> | ||
| 2 | /* crypto/opensslconf.h.in */ | ||
| 3 | |||
| 4 | #if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR) | ||
| 5 | #define OPENSSLDIR "/etc/ssl" | ||
| 6 | #endif | ||
| 7 | |||
| 8 | #undef OPENSSL_EXPORT_VAR_AS_FUNCTION | ||
| 9 | |||
| 10 | #ifndef OPENSSL_FILE | ||
| 11 | #ifdef OPENSSL_NO_FILENAMES | ||
| 12 | #define OPENSSL_FILE "" | ||
| 13 | #define OPENSSL_LINE 0 | ||
| 14 | #else | ||
| 15 | #define OPENSSL_FILE __FILE__ | ||
| 16 | #define OPENSSL_LINE __LINE__ | ||
| 17 | #endif | ||
| 18 | #endif | ||
| 19 | |||
| 20 | #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) | ||
| 21 | #define IDEA_INT unsigned int | ||
| 22 | #endif | ||
| 23 | |||
| 24 | #if defined(HEADER_MD2_H) && !defined(MD2_INT) | ||
| 25 | #define MD2_INT unsigned int | ||
| 26 | #endif | ||
| 27 | |||
| 28 | #if defined(HEADER_RC2_H) && !defined(RC2_INT) | ||
| 29 | /* I need to put in a mod for the alpha - eay */ | ||
| 30 | #define RC2_INT unsigned int | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #if defined(HEADER_RC4_H) | ||
| 34 | #if !defined(RC4_INT) | ||
| 35 | /* using int types make the structure larger but make the code faster | ||
| 36 | * on most boxes I have tested - up to %20 faster. */ | ||
| 37 | /* | ||
| 38 | * I don't know what does "most" mean, but declaring "int" is a must on: | ||
| 39 | * - Intel P6 because partial register stalls are very expensive; | ||
| 40 | * - elder Alpha because it lacks byte load/store instructions; | ||
| 41 | */ | ||
| 42 | #define RC4_INT unsigned int | ||
| 43 | #endif | ||
| 44 | #if !defined(RC4_CHUNK) | ||
| 45 | /* | ||
| 46 | * This enables code handling data aligned at natural CPU word | ||
| 47 | * boundary. See crypto/rc4/rc4_enc.c for further details. | ||
| 48 | */ | ||
| 49 | #undef RC4_CHUNK | ||
| 50 | #endif | ||
| 51 | #endif | ||
| 52 | |||
| 53 | #if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) | ||
| 54 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a | ||
| 55 | * %20 speed up (longs are 8 bytes, int's are 4). */ | ||
| 56 | #ifndef DES_LONG | ||
| 57 | #define DES_LONG unsigned long | ||
| 58 | #endif | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) | ||
| 62 | #define CONFIG_HEADER_BN_H | ||
| 63 | #define BN_LLONG | ||
| 64 | |||
| 65 | /* Should we define BN_DIV2W here? */ | ||
| 66 | |||
| 67 | /* Only one for the following should be defined */ | ||
| 68 | /* The prime number generation stuff may not work when | ||
| 69 | * EIGHT_BIT but I don't care since I've only used this mode | ||
| 70 | * for debugging the bignum libraries */ | ||
| 71 | #undef SIXTY_FOUR_BIT_LONG | ||
| 72 | #undef SIXTY_FOUR_BIT | ||
| 73 | #define THIRTY_TWO_BIT | ||
| 74 | #undef SIXTEEN_BIT | ||
| 75 | #undef EIGHT_BIT | ||
| 76 | #endif | ||
| 77 | |||
| 78 | #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) | ||
| 79 | #define CONFIG_HEADER_BF_LOCL_H | ||
| 80 | #undef BF_PTR | ||
| 81 | #endif /* HEADER_BF_LOCL_H */ | ||
| 82 | |||
| 83 | #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) | ||
| 84 | #define CONFIG_HEADER_DES_LOCL_H | ||
| 85 | #ifndef DES_DEFAULT_OPTIONS | ||
| 86 | /* the following is tweaked from a config script, that is why it is a | ||
| 87 | * protected undef/define */ | ||
| 88 | #ifndef DES_PTR | ||
| 89 | #define DES_PTR | ||
| 90 | #endif | ||
| 91 | |||
| 92 | /* This helps C compiler generate the correct code for multiple functional | ||
| 93 | * units. It reduces register dependencies at the expense of 2 more | ||
| 94 | * registers */ | ||
| 95 | #ifndef DES_RISC1 | ||
| 96 | #define DES_RISC1 | ||
| 97 | #endif | ||
| 98 | |||
| 99 | #ifndef DES_RISC2 | ||
| 100 | #undef DES_RISC2 | ||
| 101 | #endif | ||
| 102 | |||
| 103 | #if defined(DES_RISC1) && defined(DES_RISC2) | ||
| 104 | YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! | ||
| 105 | #endif | ||
| 106 | |||
| 107 | /* Unroll the inner loop, this sometimes helps, sometimes hinders. | ||
| 108 | * Very much CPU dependent */ | ||
| 109 | #ifndef DES_UNROLL | ||
| 110 | #define DES_UNROLL | ||
| 111 | #endif | ||
| 112 | |||
| 113 | /* These default values were supplied by | ||
| 114 | * Peter Gutman <pgut001@cs.auckland.ac.nz> | ||
| 115 | * They are only used if nothing else has been defined */ | ||
| 116 | #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) | ||
| 117 | /* Special defines which change the way the code is built depending on the | ||
| 118 | CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find | ||
| 119 | even newer MIPS CPU's, but at the moment one size fits all for | ||
| 120 | optimization options. Older Sparc's work better with only UNROLL, but | ||
| 121 | there's no way to tell at compile time what it is you're running on */ | ||
| 122 | |||
| 123 | #if defined( sun ) /* Newer Sparc's */ | ||
| 124 | # define DES_PTR | ||
| 125 | # define DES_RISC1 | ||
| 126 | # define DES_UNROLL | ||
| 127 | #elif defined( __ultrix ) /* Older MIPS */ | ||
| 128 | # define DES_PTR | ||
| 129 | # define DES_RISC2 | ||
| 130 | # define DES_UNROLL | ||
| 131 | #elif defined( __osf1__ ) /* Alpha */ | ||
| 132 | # define DES_PTR | ||
| 133 | # define DES_RISC2 | ||
| 134 | #elif defined ( _AIX ) /* RS6000 */ | ||
| 135 | /* Unknown */ | ||
| 136 | #elif defined( __hpux ) /* HP-PA */ | ||
| 137 | /* Unknown */ | ||
| 138 | #elif defined( __aux ) /* 68K */ | ||
| 139 | /* Unknown */ | ||
| 140 | #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ | ||
| 141 | # define DES_UNROLL | ||
| 142 | #elif defined( __sgi ) /* Newer MIPS */ | ||
| 143 | # define DES_PTR | ||
| 144 | # define DES_RISC2 | ||
| 145 | # define DES_UNROLL | ||
| 146 | #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ | ||
| 147 | # define DES_PTR | ||
| 148 | # define DES_RISC1 | ||
| 149 | # define DES_UNROLL | ||
| 150 | #endif /* Systems-specific speed defines */ | ||
| 151 | #endif | ||
| 152 | |||
| 153 | #endif /* DES_DEFAULT_OPTIONS */ | ||
| 154 | #endif /* HEADER_DES_LOCL_H */ | ||
diff --git a/src/lib/libcrypto/arch/m88k/opensslconf.h b/src/lib/libcrypto/arch/m88k/opensslconf.h deleted file mode 100644 index a5d26b6fdc..0000000000 --- a/src/lib/libcrypto/arch/m88k/opensslconf.h +++ /dev/null | |||
| @@ -1,154 +0,0 @@ | |||
| 1 | #include <openssl/opensslfeatures.h> | ||
| 2 | /* crypto/opensslconf.h.in */ | ||
| 3 | |||
| 4 | #if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR) | ||
| 5 | #define OPENSSLDIR "/etc/ssl" | ||
| 6 | #endif | ||
| 7 | |||
| 8 | #undef OPENSSL_EXPORT_VAR_AS_FUNCTION | ||
| 9 | |||
| 10 | #ifndef OPENSSL_FILE | ||
| 11 | #ifdef OPENSSL_NO_FILENAMES | ||
| 12 | #define OPENSSL_FILE "" | ||
| 13 | #define OPENSSL_LINE 0 | ||
| 14 | #else | ||
| 15 | #define OPENSSL_FILE __FILE__ | ||
| 16 | #define OPENSSL_LINE __LINE__ | ||
| 17 | #endif | ||
| 18 | #endif | ||
| 19 | |||
| 20 | #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) | ||
| 21 | #define IDEA_INT unsigned int | ||
| 22 | #endif | ||
| 23 | |||
| 24 | #if defined(HEADER_MD2_H) && !defined(MD2_INT) | ||
| 25 | #define MD2_INT unsigned int | ||
| 26 | #endif | ||
| 27 | |||
| 28 | #if defined(HEADER_RC2_H) && !defined(RC2_INT) | ||
| 29 | /* I need to put in a mod for the alpha - eay */ | ||
| 30 | #define RC2_INT unsigned int | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #if defined(HEADER_RC4_H) | ||
| 34 | #if !defined(RC4_INT) | ||
| 35 | /* using int types make the structure larger but make the code faster | ||
| 36 | * on most boxes I have tested - up to %20 faster. */ | ||
| 37 | /* | ||
| 38 | * I don't know what does "most" mean, but declaring "int" is a must on: | ||
| 39 | * - Intel P6 because partial register stalls are very expensive; | ||
| 40 | * - elder Alpha because it lacks byte load/store instructions; | ||
| 41 | */ | ||
| 42 | #define RC4_INT unsigned int | ||
| 43 | #endif | ||
| 44 | #if !defined(RC4_CHUNK) | ||
| 45 | /* | ||
| 46 | * This enables code handling data aligned at natural CPU word | ||
| 47 | * boundary. See crypto/rc4/rc4_enc.c for further details. | ||
| 48 | */ | ||
| 49 | #undef RC4_CHUNK | ||
| 50 | #endif | ||
| 51 | #endif | ||
| 52 | |||
| 53 | #if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) | ||
| 54 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a | ||
| 55 | * %20 speed up (longs are 8 bytes, int's are 4). */ | ||
| 56 | #ifndef DES_LONG | ||
| 57 | #define DES_LONG unsigned int | ||
| 58 | #endif | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) | ||
| 62 | #define CONFIG_HEADER_BN_H | ||
| 63 | #define BN_LLONG | ||
| 64 | |||
| 65 | /* Should we define BN_DIV2W here? */ | ||
| 66 | |||
| 67 | /* Only one for the following should be defined */ | ||
| 68 | /* The prime number generation stuff may not work when | ||
| 69 | * EIGHT_BIT but I don't care since I've only used this mode | ||
| 70 | * for debugging the bignum libraries */ | ||
| 71 | #undef SIXTY_FOUR_BIT_LONG | ||
| 72 | #undef SIXTY_FOUR_BIT | ||
| 73 | #define THIRTY_TWO_BIT | ||
| 74 | #undef SIXTEEN_BIT | ||
| 75 | #undef EIGHT_BIT | ||
| 76 | #endif | ||
| 77 | |||
| 78 | #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) | ||
| 79 | #define CONFIG_HEADER_BF_LOCL_H | ||
| 80 | #undef BF_PTR | ||
| 81 | #endif /* HEADER_BF_LOCL_H */ | ||
| 82 | |||
| 83 | #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) | ||
| 84 | #define CONFIG_HEADER_DES_LOCL_H | ||
| 85 | #ifndef DES_DEFAULT_OPTIONS | ||
| 86 | /* the following is tweaked from a config script, that is why it is a | ||
| 87 | * protected undef/define */ | ||
| 88 | #ifndef DES_PTR | ||
| 89 | #undef DES_PTR | ||
| 90 | #endif | ||
| 91 | |||
| 92 | /* This helps C compiler generate the correct code for multiple functional | ||
| 93 | * units. It reduces register dependencies at the expense of 2 more | ||
| 94 | * registers */ | ||
| 95 | #ifndef DES_RISC1 | ||
| 96 | #undef DES_RISC1 | ||
| 97 | #endif | ||
| 98 | |||
| 99 | #ifndef DES_RISC2 | ||
| 100 | #undef DES_RISC2 | ||
| 101 | #endif | ||
| 102 | |||
| 103 | #if defined(DES_RISC1) && defined(DES_RISC2) | ||
| 104 | YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! | ||
| 105 | #endif | ||
| 106 | |||
| 107 | /* Unroll the inner loop, this sometimes helps, sometimes hinders. | ||
| 108 | * Very much CPU dependent */ | ||
| 109 | #ifndef DES_UNROLL | ||
| 110 | #define DES_UNROLL | ||
| 111 | #endif | ||
| 112 | |||
| 113 | /* These default values were supplied by | ||
| 114 | * Peter Gutman <pgut001@cs.auckland.ac.nz> | ||
| 115 | * They are only used if nothing else has been defined */ | ||
| 116 | #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) | ||
| 117 | /* Special defines which change the way the code is built depending on the | ||
| 118 | CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find | ||
| 119 | even newer MIPS CPU's, but at the moment one size fits all for | ||
| 120 | optimization options. Older Sparc's work better with only UNROLL, but | ||
| 121 | there's no way to tell at compile time what it is you're running on */ | ||
| 122 | |||
| 123 | #if defined( sun ) /* Newer Sparc's */ | ||
| 124 | # define DES_PTR | ||
| 125 | # define DES_RISC1 | ||
| 126 | # define DES_UNROLL | ||
| 127 | #elif defined( __ultrix ) /* Older MIPS */ | ||
| 128 | # define DES_PTR | ||
| 129 | # define DES_RISC2 | ||
| 130 | # define DES_UNROLL | ||
| 131 | #elif defined( __osf1__ ) /* Alpha */ | ||
| 132 | # define DES_PTR | ||
| 133 | # define DES_RISC2 | ||
| 134 | #elif defined ( _AIX ) /* RS6000 */ | ||
| 135 | /* Unknown */ | ||
| 136 | #elif defined( __hpux ) /* HP-PA */ | ||
| 137 | /* Unknown */ | ||
| 138 | #elif defined( __aux ) /* 68K */ | ||
| 139 | /* Unknown */ | ||
| 140 | #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ | ||
| 141 | # define DES_UNROLL | ||
| 142 | #elif defined( __sgi ) /* Newer MIPS */ | ||
| 143 | # define DES_PTR | ||
| 144 | # define DES_RISC2 | ||
| 145 | # define DES_UNROLL | ||
| 146 | #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ | ||
| 147 | # define DES_PTR | ||
| 148 | # define DES_RISC1 | ||
| 149 | # define DES_UNROLL | ||
| 150 | #endif /* Systems-specific speed defines */ | ||
| 151 | #endif | ||
| 152 | |||
| 153 | #endif /* DES_DEFAULT_OPTIONS */ | ||
| 154 | #endif /* HEADER_DES_LOCL_H */ | ||
diff --git a/src/lib/libcrypto/arch/mips64/Makefile.inc b/src/lib/libcrypto/arch/mips64/Makefile.inc index 64e806289d..f82d0dc59a 100644 --- a/src/lib/libcrypto/arch/mips64/Makefile.inc +++ b/src/lib/libcrypto/arch/mips64/Makefile.inc | |||
| @@ -1,15 +1,19 @@ | |||
| 1 | # $OpenBSD: Makefile.inc,v 1.19 2025/02/14 12:01:58 jsing Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.21 2026/01/17 16:18:32 jsing Exp $ |
| 2 | 2 | ||
| 3 | # mips64-specific libcrypto build rules | 3 | # mips64-specific libcrypto build rules |
| 4 | 4 | ||
| 5 | # aes | 5 | # aes |
| 6 | CFLAGS+= -DAES_ASM | 6 | CFLAGS+= -DLIBRESSL_USE_AES_ASSEMBLY |
| 7 | SSLASM+= aes aes-mips aes-mips | 7 | SSLASM+= aes aes-mips aes-mips |
| 8 | |||
| 8 | # bn | 9 | # bn |
| 10 | CFLAGS+= -DLIBRESSL_USE_BN_ASSEMBLY | ||
| 9 | SSLASM+= bn mips bn-mips | 11 | SSLASM+= bn mips bn-mips |
| 10 | SSLASM+= bn mips-mont mips-mont | 12 | SSLASM+= bn mips-mont mips-mont |
| 11 | CFLAGS+= -DOPENSSL_BN_ASM_MONT | 13 | CFLAGS+= -DOPENSSL_BN_ASM_MONT |
| 14 | |||
| 12 | # sha | 15 | # sha |
| 16 | CFLAGS+= -DLIBRESSL_USE_SHA_ASSEMBLY | ||
| 13 | SSLASM+= sha sha1-mips sha1-mips | 17 | SSLASM+= sha sha1-mips sha1-mips |
| 14 | SSLASM+= sha sha512-mips sha256-mips | 18 | SSLASM+= sha sha512-mips sha256-mips |
| 15 | SSLASM+= sha sha512-mips sha512-mips | 19 | SSLASM+= sha sha512-mips sha512-mips |
diff --git a/src/lib/libcrypto/arch/mips64/crypto_arch.h b/src/lib/libcrypto/arch/mips64/crypto_arch.h index 07d7829fe3..156311837f 100644 --- a/src/lib/libcrypto/arch/mips64/crypto_arch.h +++ b/src/lib/libcrypto/arch/mips64/crypto_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_arch.h,v 1.2 2025/02/14 12:01:58 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_arch.h,v 1.3 2026/01/17 16:18:32 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -20,19 +20,21 @@ | |||
| 20 | 20 | ||
| 21 | #ifndef OPENSSL_NO_ASM | 21 | #ifndef OPENSSL_NO_ASM |
| 22 | 22 | ||
| 23 | #ifdef LIBRESSL_USE_AES_ASSEMBLY | ||
| 23 | #define HAVE_AES_SET_ENCRYPT_KEY_INTERNAL | 24 | #define HAVE_AES_SET_ENCRYPT_KEY_INTERNAL |
| 24 | #define HAVE_AES_SET_DECRYPT_KEY_INTERNAL | 25 | #define HAVE_AES_SET_DECRYPT_KEY_INTERNAL |
| 25 | #define HAVE_AES_ENCRYPT_INTERNAL | 26 | #define HAVE_AES_ENCRYPT_INTERNAL |
| 26 | #define HAVE_AES_DECRYPT_INTERNAL | 27 | #define HAVE_AES_DECRYPT_INTERNAL |
| 28 | #endif | ||
| 27 | 29 | ||
| 30 | #ifdef LIBRESSL_USE_SHA_ASSEMBLY | ||
| 28 | #define HAVE_SHA1_BLOCK_DATA_ORDER | 31 | #define HAVE_SHA1_BLOCK_DATA_ORDER |
| 29 | #define HAVE_SHA1_BLOCK_GENERIC | 32 | #define HAVE_SHA1_BLOCK_GENERIC |
| 30 | |||
| 31 | #define HAVE_SHA256_BLOCK_DATA_ORDER | 33 | #define HAVE_SHA256_BLOCK_DATA_ORDER |
| 32 | #define HAVE_SHA256_BLOCK_GENERIC | 34 | #define HAVE_SHA256_BLOCK_GENERIC |
| 33 | |||
| 34 | #define HAVE_SHA512_BLOCK_DATA_ORDER | 35 | #define HAVE_SHA512_BLOCK_DATA_ORDER |
| 35 | #define HAVE_SHA512_BLOCK_GENERIC | 36 | #define HAVE_SHA512_BLOCK_GENERIC |
| 37 | #endif | ||
| 36 | 38 | ||
| 37 | #endif | 39 | #endif |
| 38 | 40 | ||
diff --git a/src/lib/libcrypto/arch/mips64/opensslconf.h b/src/lib/libcrypto/arch/mips64/opensslconf.h deleted file mode 100644 index 36cdd2840b..0000000000 --- a/src/lib/libcrypto/arch/mips64/opensslconf.h +++ /dev/null | |||
| @@ -1,154 +0,0 @@ | |||
| 1 | #include <openssl/opensslfeatures.h> | ||
| 2 | /* crypto/opensslconf.h.in */ | ||
| 3 | |||
| 4 | #if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR) | ||
| 5 | #define OPENSSLDIR "/etc/ssl" | ||
| 6 | #endif | ||
| 7 | |||
| 8 | #undef OPENSSL_EXPORT_VAR_AS_FUNCTION | ||
| 9 | |||
| 10 | #ifndef OPENSSL_FILE | ||
| 11 | #ifdef OPENSSL_NO_FILENAMES | ||
| 12 | #define OPENSSL_FILE "" | ||
| 13 | #define OPENSSL_LINE 0 | ||
| 14 | #else | ||
| 15 | #define OPENSSL_FILE __FILE__ | ||
| 16 | #define OPENSSL_LINE __LINE__ | ||
| 17 | #endif | ||
| 18 | #endif | ||
| 19 | |||
| 20 | #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) | ||
| 21 | #define IDEA_INT unsigned int | ||
| 22 | #endif | ||
| 23 | |||
| 24 | #if defined(HEADER_MD2_H) && !defined(MD2_INT) | ||
| 25 | #define MD2_INT unsigned int | ||
| 26 | #endif | ||
| 27 | |||
| 28 | #if defined(HEADER_RC2_H) && !defined(RC2_INT) | ||
| 29 | /* I need to put in a mod for the alpha - eay */ | ||
| 30 | #define RC2_INT unsigned int | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #if defined(HEADER_RC4_H) | ||
| 34 | #if !defined(RC4_INT) | ||
| 35 | /* using int types make the structure larger but make the code faster | ||
| 36 | * on most boxes I have tested - up to %20 faster. */ | ||
| 37 | /* | ||
| 38 | * I don't know what does "most" mean, but declaring "int" is a must on: | ||
| 39 | * - Intel P6 because partial register stalls are very expensive; | ||
| 40 | * - elder Alpha because it lacks byte load/store instructions; | ||
| 41 | */ | ||
| 42 | #define RC4_INT unsigned int | ||
| 43 | #endif | ||
| 44 | #if !defined(RC4_CHUNK) | ||
| 45 | /* | ||
| 46 | * This enables code handling data aligned at natural CPU word | ||
| 47 | * boundary. See crypto/rc4/rc4_enc.c for further details. | ||
| 48 | */ | ||
| 49 | #define RC4_CHUNK unsigned long | ||
| 50 | #endif | ||
| 51 | #endif | ||
| 52 | |||
| 53 | #if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) | ||
| 54 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a | ||
| 55 | * %20 speed up (longs are 8 bytes, int's are 4). */ | ||
| 56 | #ifndef DES_LONG | ||
| 57 | #define DES_LONG unsigned int | ||
| 58 | #endif | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) | ||
| 62 | #define CONFIG_HEADER_BN_H | ||
| 63 | #undef BN_LLONG | ||
| 64 | |||
| 65 | /* Should we define BN_DIV2W here? */ | ||
| 66 | |||
| 67 | /* Only one for the following should be defined */ | ||
| 68 | /* The prime number generation stuff may not work when | ||
| 69 | * EIGHT_BIT but I don't care since I've only used this mode | ||
| 70 | * for debugging the bignum libraries */ | ||
| 71 | #define SIXTY_FOUR_BIT_LONG | ||
| 72 | #undef SIXTY_FOUR_BIT | ||
| 73 | #undef THIRTY_TWO_BIT | ||
| 74 | #undef SIXTEEN_BIT | ||
| 75 | #undef EIGHT_BIT | ||
| 76 | #endif | ||
| 77 | |||
| 78 | #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) | ||
| 79 | #define CONFIG_HEADER_BF_LOCL_H | ||
| 80 | #define BF_PTR | ||
| 81 | #endif /* HEADER_BF_LOCL_H */ | ||
| 82 | |||
| 83 | #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) | ||
| 84 | #define CONFIG_HEADER_DES_LOCL_H | ||
| 85 | #ifndef DES_DEFAULT_OPTIONS | ||
| 86 | /* the following is tweaked from a config script, that is why it is a | ||
| 87 | * protected undef/define */ | ||
| 88 | #ifndef DES_PTR | ||
| 89 | #define DES_PTR | ||
| 90 | #endif | ||
| 91 | |||
| 92 | /* This helps C compiler generate the correct code for multiple functional | ||
| 93 | * units. It reduces register dependencies at the expense of 2 more | ||
| 94 | * registers */ | ||
| 95 | #ifndef DES_RISC1 | ||
| 96 | #undef DES_RISC1 | ||
| 97 | #endif | ||
| 98 | |||
| 99 | #ifndef DES_RISC2 | ||
| 100 | #define DES_RISC2 | ||
| 101 | #endif | ||
| 102 | |||
| 103 | #if defined(DES_RISC1) && defined(DES_RISC2) | ||
| 104 | YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! | ||
| 105 | #endif | ||
| 106 | |||
| 107 | /* Unroll the inner loop, this sometimes helps, sometimes hinders. | ||
| 108 | * Very much CPU dependent */ | ||
| 109 | #ifndef DES_UNROLL | ||
| 110 | #undef DES_UNROLL | ||
| 111 | #endif | ||
| 112 | |||
| 113 | /* These default values were supplied by | ||
| 114 | * Peter Gutman <pgut001@cs.auckland.ac.nz> | ||
| 115 | * They are only used if nothing else has been defined */ | ||
| 116 | #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) | ||
| 117 | /* Special defines which change the way the code is built depending on the | ||
| 118 | CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find | ||
| 119 | even newer MIPS CPU's, but at the moment one size fits all for | ||
| 120 | optimization options. Older Sparc's work better with only UNROLL, but | ||
| 121 | there's no way to tell at compile time what it is you're running on */ | ||
| 122 | |||
| 123 | #if defined( sun ) /* Newer Sparc's */ | ||
| 124 | # define DES_PTR | ||
| 125 | # define DES_RISC1 | ||
| 126 | # define DES_UNROLL | ||
| 127 | #elif defined( __ultrix ) /* Older MIPS */ | ||
| 128 | # define DES_PTR | ||
| 129 | # define DES_RISC2 | ||
| 130 | # define DES_UNROLL | ||
| 131 | #elif defined( __osf1__ ) /* Alpha */ | ||
| 132 | # define DES_PTR | ||
| 133 | # define DES_RISC2 | ||
| 134 | #elif defined ( _AIX ) /* RS6000 */ | ||
| 135 | /* Unknown */ | ||
| 136 | #elif defined( __hpux ) /* HP-PA */ | ||
| 137 | /* Unknown */ | ||
| 138 | #elif defined( __aux ) /* 68K */ | ||
| 139 | /* Unknown */ | ||
| 140 | #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ | ||
| 141 | # define DES_UNROLL | ||
| 142 | #elif defined( __sgi ) /* Newer MIPS */ | ||
| 143 | # define DES_PTR | ||
| 144 | # define DES_RISC2 | ||
| 145 | # define DES_UNROLL | ||
| 146 | #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ | ||
| 147 | # define DES_PTR | ||
| 148 | # define DES_RISC1 | ||
| 149 | # define DES_UNROLL | ||
| 150 | #endif /* Systems-specific speed defines */ | ||
| 151 | #endif | ||
| 152 | |||
| 153 | #endif /* DES_DEFAULT_OPTIONS */ | ||
| 154 | #endif /* HEADER_DES_LOCL_H */ | ||
diff --git a/src/lib/libcrypto/arch/powerpc/Makefile.inc b/src/lib/libcrypto/arch/powerpc/Makefile.inc index c5218e53f4..c62c90f753 100644 --- a/src/lib/libcrypto/arch/powerpc/Makefile.inc +++ b/src/lib/libcrypto/arch/powerpc/Makefile.inc | |||
| @@ -1,15 +1,19 @@ | |||
| 1 | # $OpenBSD: Makefile.inc,v 1.14 2025/02/14 12:01:58 jsing Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.16 2026/01/17 16:18:32 jsing Exp $ |
| 2 | 2 | ||
| 3 | # powerpc-specific libcrypto build rules | 3 | # powerpc-specific libcrypto build rules |
| 4 | 4 | ||
| 5 | # aes | ||
| 5 | # slower than C code | 6 | # slower than C code |
| 6 | #CFLAGS+= -DAES_ASM | ||
| 7 | #SSLASM+= aes aes-ppc aes-ppc | 7 | #SSLASM+= aes aes-ppc aes-ppc |
| 8 | |||
| 8 | # bn | 9 | # bn |
| 10 | CFLAGS+= -DLIBRESSL_USE_BN_ASSEMBLY | ||
| 9 | SSLASM+= bn ppc bn-ppc | 11 | SSLASM+= bn ppc bn-ppc |
| 10 | SSLASM+= bn ppc-mont ppc-mont | 12 | SSLASM+= bn ppc-mont ppc-mont |
| 11 | CFLAGS+= -DOPENSSL_BN_ASM_MONT | 13 | CFLAGS+= -DOPENSSL_BN_ASM_MONT |
| 14 | |||
| 12 | # sha | 15 | # sha |
| 16 | CFLAGS+= -DLIBRESSL_USE_SHA_ASSEMBLY | ||
| 13 | SSLASM+= sha sha1-ppc sha1-ppc | 17 | SSLASM+= sha sha1-ppc sha1-ppc |
| 14 | SSLASM+= sha sha512-ppc sha256-ppc | 18 | SSLASM+= sha sha512-ppc sha256-ppc |
| 15 | 19 | ||
diff --git a/src/lib/libcrypto/arch/powerpc/crypto_arch.h b/src/lib/libcrypto/arch/powerpc/crypto_arch.h index d2730af0fb..63aa840ae8 100644 --- a/src/lib/libcrypto/arch/powerpc/crypto_arch.h +++ b/src/lib/libcrypto/arch/powerpc/crypto_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_arch.h,v 1.2 2025/02/14 12:01:58 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_arch.h,v 1.3 2026/01/17 16:18:32 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -20,11 +20,12 @@ | |||
| 20 | 20 | ||
| 21 | #ifndef OPENSSL_NO_ASM | 21 | #ifndef OPENSSL_NO_ASM |
| 22 | 22 | ||
| 23 | #ifdef LIBRESSL_USE_SHA_ASSEMBLY | ||
| 23 | #define HAVE_SHA1_BLOCK_DATA_ORDER | 24 | #define HAVE_SHA1_BLOCK_DATA_ORDER |
| 24 | #define HAVE_SHA1_BLOCK_GENERIC | 25 | #define HAVE_SHA1_BLOCK_GENERIC |
| 25 | |||
| 26 | #define HAVE_SHA256_BLOCK_DATA_ORDER | 26 | #define HAVE_SHA256_BLOCK_DATA_ORDER |
| 27 | #define HAVE_SHA256_BLOCK_GENERIC | 27 | #define HAVE_SHA256_BLOCK_GENERIC |
| 28 | #endif | ||
| 28 | 29 | ||
| 29 | #endif | 30 | #endif |
| 30 | 31 | ||
diff --git a/src/lib/libcrypto/arch/powerpc/opensslconf.h b/src/lib/libcrypto/arch/powerpc/opensslconf.h deleted file mode 100644 index a5d26b6fdc..0000000000 --- a/src/lib/libcrypto/arch/powerpc/opensslconf.h +++ /dev/null | |||
| @@ -1,154 +0,0 @@ | |||
| 1 | #include <openssl/opensslfeatures.h> | ||
| 2 | /* crypto/opensslconf.h.in */ | ||
| 3 | |||
| 4 | #if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR) | ||
| 5 | #define OPENSSLDIR "/etc/ssl" | ||
| 6 | #endif | ||
| 7 | |||
| 8 | #undef OPENSSL_EXPORT_VAR_AS_FUNCTION | ||
| 9 | |||
| 10 | #ifndef OPENSSL_FILE | ||
| 11 | #ifdef OPENSSL_NO_FILENAMES | ||
| 12 | #define OPENSSL_FILE "" | ||
| 13 | #define OPENSSL_LINE 0 | ||
| 14 | #else | ||
| 15 | #define OPENSSL_FILE __FILE__ | ||
| 16 | #define OPENSSL_LINE __LINE__ | ||
| 17 | #endif | ||
| 18 | #endif | ||
| 19 | |||
| 20 | #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) | ||
| 21 | #define IDEA_INT unsigned int | ||
| 22 | #endif | ||
| 23 | |||
| 24 | #if defined(HEADER_MD2_H) && !defined(MD2_INT) | ||
| 25 | #define MD2_INT unsigned int | ||
| 26 | #endif | ||
| 27 | |||
| 28 | #if defined(HEADER_RC2_H) && !defined(RC2_INT) | ||
| 29 | /* I need to put in a mod for the alpha - eay */ | ||
| 30 | #define RC2_INT unsigned int | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #if defined(HEADER_RC4_H) | ||
| 34 | #if !defined(RC4_INT) | ||
| 35 | /* using int types make the structure larger but make the code faster | ||
| 36 | * on most boxes I have tested - up to %20 faster. */ | ||
| 37 | /* | ||
| 38 | * I don't know what does "most" mean, but declaring "int" is a must on: | ||
| 39 | * - Intel P6 because partial register stalls are very expensive; | ||
| 40 | * - elder Alpha because it lacks byte load/store instructions; | ||
| 41 | */ | ||
| 42 | #define RC4_INT unsigned int | ||
| 43 | #endif | ||
| 44 | #if !defined(RC4_CHUNK) | ||
| 45 | /* | ||
| 46 | * This enables code handling data aligned at natural CPU word | ||
| 47 | * boundary. See crypto/rc4/rc4_enc.c for further details. | ||
| 48 | */ | ||
| 49 | #undef RC4_CHUNK | ||
| 50 | #endif | ||
| 51 | #endif | ||
| 52 | |||
| 53 | #if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) | ||
| 54 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a | ||
| 55 | * %20 speed up (longs are 8 bytes, int's are 4). */ | ||
| 56 | #ifndef DES_LONG | ||
| 57 | #define DES_LONG unsigned int | ||
| 58 | #endif | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) | ||
| 62 | #define CONFIG_HEADER_BN_H | ||
| 63 | #define BN_LLONG | ||
| 64 | |||
| 65 | /* Should we define BN_DIV2W here? */ | ||
| 66 | |||
| 67 | /* Only one for the following should be defined */ | ||
| 68 | /* The prime number generation stuff may not work when | ||
| 69 | * EIGHT_BIT but I don't care since I've only used this mode | ||
| 70 | * for debugging the bignum libraries */ | ||
| 71 | #undef SIXTY_FOUR_BIT_LONG | ||
| 72 | #undef SIXTY_FOUR_BIT | ||
| 73 | #define THIRTY_TWO_BIT | ||
| 74 | #undef SIXTEEN_BIT | ||
| 75 | #undef EIGHT_BIT | ||
| 76 | #endif | ||
| 77 | |||
| 78 | #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) | ||
| 79 | #define CONFIG_HEADER_BF_LOCL_H | ||
| 80 | #undef BF_PTR | ||
| 81 | #endif /* HEADER_BF_LOCL_H */ | ||
| 82 | |||
| 83 | #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) | ||
| 84 | #define CONFIG_HEADER_DES_LOCL_H | ||
| 85 | #ifndef DES_DEFAULT_OPTIONS | ||
| 86 | /* the following is tweaked from a config script, that is why it is a | ||
| 87 | * protected undef/define */ | ||
| 88 | #ifndef DES_PTR | ||
| 89 | #undef DES_PTR | ||
| 90 | #endif | ||
| 91 | |||
| 92 | /* This helps C compiler generate the correct code for multiple functional | ||
| 93 | * units. It reduces register dependencies at the expense of 2 more | ||
| 94 | * registers */ | ||
| 95 | #ifndef DES_RISC1 | ||
| 96 | #undef DES_RISC1 | ||
| 97 | #endif | ||
| 98 | |||
| 99 | #ifndef DES_RISC2 | ||
| 100 | #undef DES_RISC2 | ||
| 101 | #endif | ||
| 102 | |||
| 103 | #if defined(DES_RISC1) && defined(DES_RISC2) | ||
| 104 | YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! | ||
| 105 | #endif | ||
| 106 | |||
| 107 | /* Unroll the inner loop, this sometimes helps, sometimes hinders. | ||
| 108 | * Very much CPU dependent */ | ||
| 109 | #ifndef DES_UNROLL | ||
| 110 | #define DES_UNROLL | ||
| 111 | #endif | ||
| 112 | |||
| 113 | /* These default values were supplied by | ||
| 114 | * Peter Gutman <pgut001@cs.auckland.ac.nz> | ||
| 115 | * They are only used if nothing else has been defined */ | ||
| 116 | #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) | ||
| 117 | /* Special defines which change the way the code is built depending on the | ||
| 118 | CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find | ||
| 119 | even newer MIPS CPU's, but at the moment one size fits all for | ||
| 120 | optimization options. Older Sparc's work better with only UNROLL, but | ||
| 121 | there's no way to tell at compile time what it is you're running on */ | ||
| 122 | |||
| 123 | #if defined( sun ) /* Newer Sparc's */ | ||
| 124 | # define DES_PTR | ||
| 125 | # define DES_RISC1 | ||
| 126 | # define DES_UNROLL | ||
| 127 | #elif defined( __ultrix ) /* Older MIPS */ | ||
| 128 | # define DES_PTR | ||
| 129 | # define DES_RISC2 | ||
| 130 | # define DES_UNROLL | ||
| 131 | #elif defined( __osf1__ ) /* Alpha */ | ||
| 132 | # define DES_PTR | ||
| 133 | # define DES_RISC2 | ||
| 134 | #elif defined ( _AIX ) /* RS6000 */ | ||
| 135 | /* Unknown */ | ||
| 136 | #elif defined( __hpux ) /* HP-PA */ | ||
| 137 | /* Unknown */ | ||
| 138 | #elif defined( __aux ) /* 68K */ | ||
| 139 | /* Unknown */ | ||
| 140 | #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ | ||
| 141 | # define DES_UNROLL | ||
| 142 | #elif defined( __sgi ) /* Newer MIPS */ | ||
| 143 | # define DES_PTR | ||
| 144 | # define DES_RISC2 | ||
| 145 | # define DES_UNROLL | ||
| 146 | #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ | ||
| 147 | # define DES_PTR | ||
| 148 | # define DES_RISC1 | ||
| 149 | # define DES_UNROLL | ||
| 150 | #endif /* Systems-specific speed defines */ | ||
| 151 | #endif | ||
| 152 | |||
| 153 | #endif /* DES_DEFAULT_OPTIONS */ | ||
| 154 | #endif /* HEADER_DES_LOCL_H */ | ||
diff --git a/src/lib/libcrypto/arch/powerpc64/Makefile.inc b/src/lib/libcrypto/arch/powerpc64/Makefile.inc index c309ab8b40..4a72726eab 100644 --- a/src/lib/libcrypto/arch/powerpc64/Makefile.inc +++ b/src/lib/libcrypto/arch/powerpc64/Makefile.inc | |||
| @@ -1,14 +1,16 @@ | |||
| 1 | # $OpenBSD: Makefile.inc,v 1.16 2025/02/14 12:01:58 jsing Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.18 2026/01/17 16:18:32 jsing Exp $ |
| 2 | 2 | ||
| 3 | # powerpc-specific libcrypto build rules | 3 | # powerpc-specific libcrypto build rules |
| 4 | 4 | ||
| 5 | # aes | ||
| 5 | # slower than C code | 6 | # slower than C code |
| 6 | #CFLAGS+= -DAES_ASM | ||
| 7 | #SSLASM+= aes aes-ppc aes-ppc | 7 | #SSLASM+= aes aes-ppc aes-ppc |
| 8 | |||
| 8 | # bn | 9 | # bn |
| 9 | #SSLASM+= bn ppc bn-ppc | 10 | #SSLASM+= bn ppc bn-ppc |
| 10 | #SSLASM+= bn ppc-mont ppc-mont | 11 | #SSLASM+= bn ppc-mont ppc-mont |
| 11 | #CFLAGS+= -DOPENSSL_BN_ASM_MONT | 12 | #CFLAGS+= -DOPENSSL_BN_ASM_MONT |
| 13 | |||
| 12 | # sha | 14 | # sha |
| 13 | #SSLASM+= sha sha1-ppc sha1-ppc | 15 | #SSLASM+= sha sha1-ppc sha1-ppc |
| 14 | #SSLASM+= sha sha512-ppc sha256-ppc | 16 | #SSLASM+= sha sha512-ppc sha256-ppc |
diff --git a/src/lib/libcrypto/arch/powerpc64/opensslconf.h b/src/lib/libcrypto/arch/powerpc64/opensslconf.h deleted file mode 100644 index cc193762f1..0000000000 --- a/src/lib/libcrypto/arch/powerpc64/opensslconf.h +++ /dev/null | |||
| @@ -1,149 +0,0 @@ | |||
| 1 | #include <openssl/opensslfeatures.h> | ||
| 2 | /* crypto/opensslconf.h.in */ | ||
| 3 | |||
| 4 | #if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR) | ||
| 5 | #define OPENSSLDIR "/etc/ssl" | ||
| 6 | #endif | ||
| 7 | |||
| 8 | #undef OPENSSL_EXPORT_VAR_AS_FUNCTION | ||
| 9 | |||
| 10 | #ifndef OPENSSL_FILE | ||
| 11 | #ifdef OPENSSL_NO_FILENAMES | ||
| 12 | #define OPENSSL_FILE "" | ||
| 13 | #define OPENSSL_LINE 0 | ||
| 14 | #else | ||
| 15 | #define OPENSSL_FILE __FILE__ | ||
| 16 | #define OPENSSL_LINE __LINE__ | ||
| 17 | #endif | ||
| 18 | #endif | ||
| 19 | |||
| 20 | #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) | ||
| 21 | #define IDEA_INT unsigned int | ||
| 22 | #endif | ||
| 23 | |||
| 24 | #if defined(HEADER_MD2_H) && !defined(MD2_INT) | ||
| 25 | #define MD2_INT unsigned int | ||
| 26 | #endif | ||
| 27 | |||
| 28 | #if defined(HEADER_RC2_H) && !defined(RC2_INT) | ||
| 29 | /* I need to put in a mod for the alpha - eay */ | ||
| 30 | #define RC2_INT unsigned int | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #if defined(HEADER_RC4_H) | ||
| 34 | #if !defined(RC4_INT) | ||
| 35 | /* using int types make the structure larger but make the code faster | ||
| 36 | * on most boxes I have tested - up to %20 faster. */ | ||
| 37 | /* | ||
| 38 | * I don't know what does "most" mean, but declaring "int" is a must on: | ||
| 39 | * - Intel P6 because partial register stalls are very expensive; | ||
| 40 | * - elder Alpha because it lacks byte load/store instructions; | ||
| 41 | */ | ||
| 42 | #define RC4_INT unsigned int | ||
| 43 | #endif | ||
| 44 | #if !defined(RC4_CHUNK) | ||
| 45 | /* | ||
| 46 | * This enables code handling data aligned at natural CPU word | ||
| 47 | * boundary. See crypto/rc4/rc4_enc.c for further details. | ||
| 48 | */ | ||
| 49 | #define RC4_CHUNK unsigned long | ||
| 50 | #endif | ||
| 51 | #endif | ||
| 52 | |||
| 53 | #if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) | ||
| 54 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a | ||
| 55 | * %20 speed up (longs are 8 bytes, int's are 4). */ | ||
| 56 | #ifndef DES_LONG | ||
| 57 | #define DES_LONG unsigned int | ||
| 58 | #endif | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) | ||
| 62 | #define CONFIG_HEADER_BN_H | ||
| 63 | #undef BN_LLONG | ||
| 64 | |||
| 65 | /* Should we define BN_DIV2W here? */ | ||
| 66 | |||
| 67 | /* Only one for the following should be defined */ | ||
| 68 | #define SIXTY_FOUR_BIT_LONG | ||
| 69 | #undef SIXTY_FOUR_BIT | ||
| 70 | #undef THIRTY_TWO_BIT | ||
| 71 | #endif | ||
| 72 | |||
| 73 | #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) | ||
| 74 | #define CONFIG_HEADER_BF_LOCL_H | ||
| 75 | #undef BF_PTR | ||
| 76 | #endif /* HEADER_BF_LOCL_H */ | ||
| 77 | |||
| 78 | #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) | ||
| 79 | #define CONFIG_HEADER_DES_LOCL_H | ||
| 80 | #ifndef DES_DEFAULT_OPTIONS | ||
| 81 | /* the following is tweaked from a config script, that is why it is a | ||
| 82 | * protected undef/define */ | ||
| 83 | #ifndef DES_PTR | ||
| 84 | #undef DES_PTR | ||
| 85 | #endif | ||
| 86 | |||
| 87 | /* This helps C compiler generate the correct code for multiple functional | ||
| 88 | * units. It reduces register dependencies at the expense of 2 more | ||
| 89 | * registers */ | ||
| 90 | #ifndef DES_RISC1 | ||
| 91 | #undef DES_RISC1 | ||
| 92 | #endif | ||
| 93 | |||
| 94 | #ifndef DES_RISC2 | ||
| 95 | #undef DES_RISC2 | ||
| 96 | #endif | ||
| 97 | |||
| 98 | #if defined(DES_RISC1) && defined(DES_RISC2) | ||
| 99 | YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! | ||
| 100 | #endif | ||
| 101 | |||
| 102 | /* Unroll the inner loop, this sometimes helps, sometimes hinders. | ||
| 103 | * Very much CPU dependent */ | ||
| 104 | #ifndef DES_UNROLL | ||
| 105 | #define DES_UNROLL | ||
| 106 | #endif | ||
| 107 | |||
| 108 | /* These default values were supplied by | ||
| 109 | * Peter Gutman <pgut001@cs.auckland.ac.nz> | ||
| 110 | * They are only used if nothing else has been defined */ | ||
| 111 | #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) | ||
| 112 | /* Special defines which change the way the code is built depending on the | ||
| 113 | CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find | ||
| 114 | even newer MIPS CPU's, but at the moment one size fits all for | ||
| 115 | optimization options. Older Sparc's work better with only UNROLL, but | ||
| 116 | there's no way to tell at compile time what it is you're running on */ | ||
| 117 | |||
| 118 | #if defined( sun ) /* Newer Sparc's */ | ||
| 119 | # define DES_PTR | ||
| 120 | # define DES_RISC1 | ||
| 121 | # define DES_UNROLL | ||
| 122 | #elif defined( __ultrix ) /* Older MIPS */ | ||
| 123 | # define DES_PTR | ||
| 124 | # define DES_RISC2 | ||
| 125 | # define DES_UNROLL | ||
| 126 | #elif defined( __osf1__ ) /* Alpha */ | ||
| 127 | # define DES_PTR | ||
| 128 | # define DES_RISC2 | ||
| 129 | #elif defined ( _AIX ) /* RS6000 */ | ||
| 130 | /* Unknown */ | ||
| 131 | #elif defined( __hpux ) /* HP-PA */ | ||
| 132 | /* Unknown */ | ||
| 133 | #elif defined( __aux ) /* 68K */ | ||
| 134 | /* Unknown */ | ||
| 135 | #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ | ||
| 136 | # define DES_UNROLL | ||
| 137 | #elif defined( __sgi ) /* Newer MIPS */ | ||
| 138 | # define DES_PTR | ||
| 139 | # define DES_RISC2 | ||
| 140 | # define DES_UNROLL | ||
| 141 | #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ | ||
| 142 | # define DES_PTR | ||
| 143 | # define DES_RISC1 | ||
| 144 | # define DES_UNROLL | ||
| 145 | #endif /* Systems-specific speed defines */ | ||
| 146 | #endif | ||
| 147 | |||
| 148 | #endif /* DES_DEFAULT_OPTIONS */ | ||
| 149 | #endif /* HEADER_DES_LOCL_H */ | ||
diff --git a/src/lib/libcrypto/arch/riscv64/opensslconf.h b/src/lib/libcrypto/arch/riscv64/opensslconf.h deleted file mode 100644 index 731b06aecc..0000000000 --- a/src/lib/libcrypto/arch/riscv64/opensslconf.h +++ /dev/null | |||
| @@ -1,154 +0,0 @@ | |||
| 1 | #include <openssl/opensslfeatures.h> | ||
| 2 | /* crypto/opensslconf.h.in */ | ||
| 3 | |||
| 4 | #if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR) | ||
| 5 | #define OPENSSLDIR "/etc/ssl" | ||
| 6 | #endif | ||
| 7 | |||
| 8 | #undef OPENSSL_EXPORT_VAR_AS_FUNCTION | ||
| 9 | |||
| 10 | #ifndef OPENSSL_FILE | ||
| 11 | #ifdef OPENSSL_NO_FILENAMES | ||
| 12 | #define OPENSSL_FILE "" | ||
| 13 | #define OPENSSL_LINE 0 | ||
| 14 | #else | ||
| 15 | #define OPENSSL_FILE __FILE__ | ||
| 16 | #define OPENSSL_LINE __LINE__ | ||
| 17 | #endif | ||
| 18 | #endif | ||
| 19 | |||
| 20 | #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) | ||
| 21 | #define IDEA_INT unsigned int | ||
| 22 | #endif | ||
| 23 | |||
| 24 | #if defined(HEADER_MD2_H) && !defined(MD2_INT) | ||
| 25 | #define MD2_INT unsigned int | ||
| 26 | #endif | ||
| 27 | |||
| 28 | #if defined(HEADER_RC2_H) && !defined(RC2_INT) | ||
| 29 | /* I need to put in a mod for the alpha - eay */ | ||
| 30 | #define RC2_INT unsigned int | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #if defined(HEADER_RC4_H) | ||
| 34 | #if !defined(RC4_INT) | ||
| 35 | /* using int types make the structure larger but make the code faster | ||
| 36 | * on most boxes I have tested - up to %20 faster. */ | ||
| 37 | /* | ||
| 38 | * I don't know what does "most" mean, but declaring "int" is a must on: | ||
| 39 | * - Intel P6 because partial register stalls are very expensive; | ||
| 40 | * - elder Alpha because it lacks byte load/store instructions; | ||
| 41 | */ | ||
| 42 | #define RC4_INT unsigned int | ||
| 43 | #endif | ||
| 44 | #if !defined(RC4_CHUNK) | ||
| 45 | /* | ||
| 46 | * This enables code handling data aligned at natural CPU word | ||
| 47 | * boundary. See crypto/rc4/rc4_enc.c for further details. | ||
| 48 | */ | ||
| 49 | #define RC4_CHUNK unsigned long | ||
| 50 | #endif | ||
| 51 | #endif | ||
| 52 | |||
| 53 | #if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) | ||
| 54 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a | ||
| 55 | * %20 speed up (longs are 8 bytes, int's are 4). */ | ||
| 56 | #ifndef DES_LONG | ||
| 57 | #define DES_LONG unsigned int | ||
| 58 | #endif | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) | ||
| 62 | #define CONFIG_HEADER_BN_H | ||
| 63 | #undef BN_LLONG | ||
| 64 | |||
| 65 | /* Should we define BN_DIV2W here? */ | ||
| 66 | |||
| 67 | /* Only one for the following should be defined */ | ||
| 68 | /* The prime number generation stuff may not work when | ||
| 69 | * EIGHT_BIT but I don't care since I've only used this mode | ||
| 70 | * for debugging the bignum libraries */ | ||
| 71 | #define SIXTY_FOUR_BIT_LONG | ||
| 72 | #undef SIXTY_FOUR_BIT | ||
| 73 | #undef THIRTY_TWO_BIT | ||
| 74 | #undef SIXTEEN_BIT | ||
| 75 | #undef EIGHT_BIT | ||
| 76 | #endif | ||
| 77 | |||
| 78 | #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) | ||
| 79 | #define CONFIG_HEADER_BF_LOCL_H | ||
| 80 | #undef BF_PTR | ||
| 81 | #endif /* HEADER_BF_LOCL_H */ | ||
| 82 | |||
| 83 | #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) | ||
| 84 | #define CONFIG_HEADER_DES_LOCL_H | ||
| 85 | #ifndef DES_DEFAULT_OPTIONS | ||
| 86 | /* the following is tweaked from a config script, that is why it is a | ||
| 87 | * protected undef/define */ | ||
| 88 | #ifndef DES_PTR | ||
| 89 | #undef DES_PTR | ||
| 90 | #endif | ||
| 91 | |||
| 92 | /* This helps C compiler generate the correct code for multiple functional | ||
| 93 | * units. It reduces register dependencies at the expense of 2 more | ||
| 94 | * registers */ | ||
| 95 | #ifndef DES_RISC1 | ||
| 96 | #undef DES_RISC1 | ||
| 97 | #endif | ||
| 98 | |||
| 99 | #ifndef DES_RISC2 | ||
| 100 | #undef DES_RISC2 | ||
| 101 | #endif | ||
| 102 | |||
| 103 | #if defined(DES_RISC1) && defined(DES_RISC2) | ||
| 104 | YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! | ||
| 105 | #endif | ||
| 106 | |||
| 107 | /* Unroll the inner loop, this sometimes helps, sometimes hinders. | ||
| 108 | * Very much CPU dependent */ | ||
| 109 | #ifndef DES_UNROLL | ||
| 110 | #define DES_UNROLL | ||
| 111 | #endif | ||
| 112 | |||
| 113 | /* These default values were supplied by | ||
| 114 | * Peter Gutman <pgut001@cs.auckland.ac.nz> | ||
| 115 | * They are only used if nothing else has been defined */ | ||
| 116 | #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) | ||
| 117 | /* Special defines which change the way the code is built depending on the | ||
| 118 | CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find | ||
| 119 | even newer MIPS CPU's, but at the moment one size fits all for | ||
| 120 | optimization options. Older Sparc's work better with only UNROLL, but | ||
| 121 | there's no way to tell at compile time what it is you're running on */ | ||
| 122 | |||
| 123 | #if defined( sun ) /* Newer Sparc's */ | ||
| 124 | # define DES_PTR | ||
| 125 | # define DES_RISC1 | ||
| 126 | # define DES_UNROLL | ||
| 127 | #elif defined( __ultrix ) /* Older MIPS */ | ||
| 128 | # define DES_PTR | ||
| 129 | # define DES_RISC2 | ||
| 130 | # define DES_UNROLL | ||
| 131 | #elif defined( __osf1__ ) /* Alpha */ | ||
| 132 | # define DES_PTR | ||
| 133 | # define DES_RISC2 | ||
| 134 | #elif defined ( _AIX ) /* RS6000 */ | ||
| 135 | /* Unknown */ | ||
| 136 | #elif defined( __hpux ) /* HP-PA */ | ||
| 137 | /* Unknown */ | ||
| 138 | #elif defined( __aux ) /* 68K */ | ||
| 139 | /* Unknown */ | ||
| 140 | #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ | ||
| 141 | # define DES_UNROLL | ||
| 142 | #elif defined( __sgi ) /* Newer MIPS */ | ||
| 143 | # define DES_PTR | ||
| 144 | # define DES_RISC2 | ||
| 145 | # define DES_UNROLL | ||
| 146 | #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ | ||
| 147 | # define DES_PTR | ||
| 148 | # define DES_RISC1 | ||
| 149 | # define DES_UNROLL | ||
| 150 | #endif /* Systems-specific speed defines */ | ||
| 151 | #endif | ||
| 152 | |||
| 153 | #endif /* DES_DEFAULT_OPTIONS */ | ||
| 154 | #endif /* HEADER_DES_LOCL_H */ | ||
diff --git a/src/lib/libcrypto/arch/sh/opensslconf.h b/src/lib/libcrypto/arch/sh/opensslconf.h deleted file mode 100644 index a5d26b6fdc..0000000000 --- a/src/lib/libcrypto/arch/sh/opensslconf.h +++ /dev/null | |||
| @@ -1,154 +0,0 @@ | |||
| 1 | #include <openssl/opensslfeatures.h> | ||
| 2 | /* crypto/opensslconf.h.in */ | ||
| 3 | |||
| 4 | #if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR) | ||
| 5 | #define OPENSSLDIR "/etc/ssl" | ||
| 6 | #endif | ||
| 7 | |||
| 8 | #undef OPENSSL_EXPORT_VAR_AS_FUNCTION | ||
| 9 | |||
| 10 | #ifndef OPENSSL_FILE | ||
| 11 | #ifdef OPENSSL_NO_FILENAMES | ||
| 12 | #define OPENSSL_FILE "" | ||
| 13 | #define OPENSSL_LINE 0 | ||
| 14 | #else | ||
| 15 | #define OPENSSL_FILE __FILE__ | ||
| 16 | #define OPENSSL_LINE __LINE__ | ||
| 17 | #endif | ||
| 18 | #endif | ||
| 19 | |||
| 20 | #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) | ||
| 21 | #define IDEA_INT unsigned int | ||
| 22 | #endif | ||
| 23 | |||
| 24 | #if defined(HEADER_MD2_H) && !defined(MD2_INT) | ||
| 25 | #define MD2_INT unsigned int | ||
| 26 | #endif | ||
| 27 | |||
| 28 | #if defined(HEADER_RC2_H) && !defined(RC2_INT) | ||
| 29 | /* I need to put in a mod for the alpha - eay */ | ||
| 30 | #define RC2_INT unsigned int | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #if defined(HEADER_RC4_H) | ||
| 34 | #if !defined(RC4_INT) | ||
| 35 | /* using int types make the structure larger but make the code faster | ||
| 36 | * on most boxes I have tested - up to %20 faster. */ | ||
| 37 | /* | ||
| 38 | * I don't know what does "most" mean, but declaring "int" is a must on: | ||
| 39 | * - Intel P6 because partial register stalls are very expensive; | ||
| 40 | * - elder Alpha because it lacks byte load/store instructions; | ||
| 41 | */ | ||
| 42 | #define RC4_INT unsigned int | ||
| 43 | #endif | ||
| 44 | #if !defined(RC4_CHUNK) | ||
| 45 | /* | ||
| 46 | * This enables code handling data aligned at natural CPU word | ||
| 47 | * boundary. See crypto/rc4/rc4_enc.c for further details. | ||
| 48 | */ | ||
| 49 | #undef RC4_CHUNK | ||
| 50 | #endif | ||
| 51 | #endif | ||
| 52 | |||
| 53 | #if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) | ||
| 54 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a | ||
| 55 | * %20 speed up (longs are 8 bytes, int's are 4). */ | ||
| 56 | #ifndef DES_LONG | ||
| 57 | #define DES_LONG unsigned int | ||
| 58 | #endif | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) | ||
| 62 | #define CONFIG_HEADER_BN_H | ||
| 63 | #define BN_LLONG | ||
| 64 | |||
| 65 | /* Should we define BN_DIV2W here? */ | ||
| 66 | |||
| 67 | /* Only one for the following should be defined */ | ||
| 68 | /* The prime number generation stuff may not work when | ||
| 69 | * EIGHT_BIT but I don't care since I've only used this mode | ||
| 70 | * for debugging the bignum libraries */ | ||
| 71 | #undef SIXTY_FOUR_BIT_LONG | ||
| 72 | #undef SIXTY_FOUR_BIT | ||
| 73 | #define THIRTY_TWO_BIT | ||
| 74 | #undef SIXTEEN_BIT | ||
| 75 | #undef EIGHT_BIT | ||
| 76 | #endif | ||
| 77 | |||
| 78 | #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) | ||
| 79 | #define CONFIG_HEADER_BF_LOCL_H | ||
| 80 | #undef BF_PTR | ||
| 81 | #endif /* HEADER_BF_LOCL_H */ | ||
| 82 | |||
| 83 | #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) | ||
| 84 | #define CONFIG_HEADER_DES_LOCL_H | ||
| 85 | #ifndef DES_DEFAULT_OPTIONS | ||
| 86 | /* the following is tweaked from a config script, that is why it is a | ||
| 87 | * protected undef/define */ | ||
| 88 | #ifndef DES_PTR | ||
| 89 | #undef DES_PTR | ||
| 90 | #endif | ||
| 91 | |||
| 92 | /* This helps C compiler generate the correct code for multiple functional | ||
| 93 | * units. It reduces register dependencies at the expense of 2 more | ||
| 94 | * registers */ | ||
| 95 | #ifndef DES_RISC1 | ||
| 96 | #undef DES_RISC1 | ||
| 97 | #endif | ||
| 98 | |||
| 99 | #ifndef DES_RISC2 | ||
| 100 | #undef DES_RISC2 | ||
| 101 | #endif | ||
| 102 | |||
| 103 | #if defined(DES_RISC1) && defined(DES_RISC2) | ||
| 104 | YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! | ||
| 105 | #endif | ||
| 106 | |||
| 107 | /* Unroll the inner loop, this sometimes helps, sometimes hinders. | ||
| 108 | * Very much CPU dependent */ | ||
| 109 | #ifndef DES_UNROLL | ||
| 110 | #define DES_UNROLL | ||
| 111 | #endif | ||
| 112 | |||
| 113 | /* These default values were supplied by | ||
| 114 | * Peter Gutman <pgut001@cs.auckland.ac.nz> | ||
| 115 | * They are only used if nothing else has been defined */ | ||
| 116 | #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) | ||
| 117 | /* Special defines which change the way the code is built depending on the | ||
| 118 | CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find | ||
| 119 | even newer MIPS CPU's, but at the moment one size fits all for | ||
| 120 | optimization options. Older Sparc's work better with only UNROLL, but | ||
| 121 | there's no way to tell at compile time what it is you're running on */ | ||
| 122 | |||
| 123 | #if defined( sun ) /* Newer Sparc's */ | ||
| 124 | # define DES_PTR | ||
| 125 | # define DES_RISC1 | ||
| 126 | # define DES_UNROLL | ||
| 127 | #elif defined( __ultrix ) /* Older MIPS */ | ||
| 128 | # define DES_PTR | ||
| 129 | # define DES_RISC2 | ||
| 130 | # define DES_UNROLL | ||
| 131 | #elif defined( __osf1__ ) /* Alpha */ | ||
| 132 | # define DES_PTR | ||
| 133 | # define DES_RISC2 | ||
| 134 | #elif defined ( _AIX ) /* RS6000 */ | ||
| 135 | /* Unknown */ | ||
| 136 | #elif defined( __hpux ) /* HP-PA */ | ||
| 137 | /* Unknown */ | ||
| 138 | #elif defined( __aux ) /* 68K */ | ||
| 139 | /* Unknown */ | ||
| 140 | #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ | ||
| 141 | # define DES_UNROLL | ||
| 142 | #elif defined( __sgi ) /* Newer MIPS */ | ||
| 143 | # define DES_PTR | ||
| 144 | # define DES_RISC2 | ||
| 145 | # define DES_UNROLL | ||
| 146 | #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ | ||
| 147 | # define DES_PTR | ||
| 148 | # define DES_RISC1 | ||
| 149 | # define DES_UNROLL | ||
| 150 | #endif /* Systems-specific speed defines */ | ||
| 151 | #endif | ||
| 152 | |||
| 153 | #endif /* DES_DEFAULT_OPTIONS */ | ||
| 154 | #endif /* HEADER_DES_LOCL_H */ | ||
diff --git a/src/lib/libcrypto/arch/sparc64/Makefile.inc b/src/lib/libcrypto/arch/sparc64/Makefile.inc index cbf63e033e..3a83ac6282 100644 --- a/src/lib/libcrypto/arch/sparc64/Makefile.inc +++ b/src/lib/libcrypto/arch/sparc64/Makefile.inc | |||
| @@ -1,15 +1,17 @@ | |||
| 1 | # $OpenBSD: Makefile.inc,v 1.21 2025/02/14 12:01:58 jsing Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.24 2026/01/17 16:18:32 jsing Exp $ |
| 2 | 2 | ||
| 3 | # sparc64-specific libcrypto build rules | 3 | # sparc64-specific libcrypto build rules |
| 4 | 4 | ||
| 5 | # aes | 5 | # aes |
| 6 | CFLAGS+= -DAES_ASM | 6 | CFLAGS+= -DLIBRESSL_USE_AES_ASSEMBLY |
| 7 | SSLASM+= aes aes-sparcv9 aes-sparcv9 | 7 | SSLASM+= aes aes-sparcv9 aes-sparcv9 |
| 8 | # bn | 8 | |
| 9 | # modes | 9 | # modes |
| 10 | CFLAGS+= -DGHASH_ASM | 10 | CFLAGS+= -DLIBRESSL_USE_GCM_ASSEMBLY |
| 11 | SSLASM+= modes ghash-sparcv9 ghash-sparcv9 | 11 | SSLASM+= modes ghash-sparcv9 ghash-sparcv9 |
| 12 | |||
| 12 | # sha | 13 | # sha |
| 14 | CFLAGS+= -DLIBRESSL_USE_SHA_ASSEMBLY | ||
| 13 | SSLASM+= sha sha1-sparcv9 sha1-sparcv9 | 15 | SSLASM+= sha sha1-sparcv9 sha1-sparcv9 |
| 14 | SSLASM+= sha sha512-sparcv9 sha256-sparcv9 | 16 | SSLASM+= sha sha512-sparcv9 sha256-sparcv9 |
| 15 | SSLASM+= sha sha512-sparcv9 sha512-sparcv9 | 17 | SSLASM+= sha sha512-sparcv9 sha512-sparcv9 |
diff --git a/src/lib/libcrypto/arch/sparc64/crypto_arch.h b/src/lib/libcrypto/arch/sparc64/crypto_arch.h index 251957a5bc..1f160b625c 100644 --- a/src/lib/libcrypto/arch/sparc64/crypto_arch.h +++ b/src/lib/libcrypto/arch/sparc64/crypto_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_arch.h,v 1.2 2025/02/14 12:01:58 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_arch.h,v 1.4 2026/01/17 16:18:32 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -20,17 +20,24 @@ | |||
| 20 | 20 | ||
| 21 | #ifndef OPENSSL_NO_ASM | 21 | #ifndef OPENSSL_NO_ASM |
| 22 | 22 | ||
| 23 | #ifdef LIBRESSL_USE_AES_ASSEMBLY | ||
| 23 | #define HAVE_AES_ENCRYPT_INTERNAL | 24 | #define HAVE_AES_ENCRYPT_INTERNAL |
| 24 | #define HAVE_AES_DECRYPT_INTERNAL | 25 | #define HAVE_AES_DECRYPT_INTERNAL |
| 26 | #endif | ||
| 27 | |||
| 28 | #ifdef LIBRESSL_USE_GCM_ASSEMBLY | ||
| 29 | #define HAVE_GCM_GHASH_4BIT | ||
| 30 | #define HAVE_GCM_GMULT_4BIT | ||
| 31 | #endif | ||
| 25 | 32 | ||
| 33 | #ifdef LIBRESSL_USE_SHA_ASSEMBLY | ||
| 26 | #define HAVE_SHA1_BLOCK_DATA_ORDER | 34 | #define HAVE_SHA1_BLOCK_DATA_ORDER |
| 27 | #define HAVE_SHA1_BLOCK_GENERIC | 35 | #define HAVE_SHA1_BLOCK_GENERIC |
| 28 | |||
| 29 | #define HAVE_SHA256_BLOCK_DATA_ORDER | 36 | #define HAVE_SHA256_BLOCK_DATA_ORDER |
| 30 | #define HAVE_SHA256_BLOCK_GENERIC | 37 | #define HAVE_SHA256_BLOCK_GENERIC |
| 31 | |||
| 32 | #define HAVE_SHA512_BLOCK_DATA_ORDER | 38 | #define HAVE_SHA512_BLOCK_DATA_ORDER |
| 33 | #define HAVE_SHA512_BLOCK_GENERIC | 39 | #define HAVE_SHA512_BLOCK_GENERIC |
| 40 | #endif | ||
| 34 | 41 | ||
| 35 | #endif | 42 | #endif |
| 36 | 43 | ||
diff --git a/src/lib/libcrypto/arch/sparc64/opensslconf.h b/src/lib/libcrypto/arch/sparc64/opensslconf.h deleted file mode 100644 index 36cdd2840b..0000000000 --- a/src/lib/libcrypto/arch/sparc64/opensslconf.h +++ /dev/null | |||
| @@ -1,154 +0,0 @@ | |||
| 1 | #include <openssl/opensslfeatures.h> | ||
| 2 | /* crypto/opensslconf.h.in */ | ||
| 3 | |||
| 4 | #if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR) | ||
| 5 | #define OPENSSLDIR "/etc/ssl" | ||
| 6 | #endif | ||
| 7 | |||
| 8 | #undef OPENSSL_EXPORT_VAR_AS_FUNCTION | ||
| 9 | |||
| 10 | #ifndef OPENSSL_FILE | ||
| 11 | #ifdef OPENSSL_NO_FILENAMES | ||
| 12 | #define OPENSSL_FILE "" | ||
| 13 | #define OPENSSL_LINE 0 | ||
| 14 | #else | ||
| 15 | #define OPENSSL_FILE __FILE__ | ||
| 16 | #define OPENSSL_LINE __LINE__ | ||
| 17 | #endif | ||
| 18 | #endif | ||
| 19 | |||
| 20 | #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) | ||
| 21 | #define IDEA_INT unsigned int | ||
| 22 | #endif | ||
| 23 | |||
| 24 | #if defined(HEADER_MD2_H) && !defined(MD2_INT) | ||
| 25 | #define MD2_INT unsigned int | ||
| 26 | #endif | ||
| 27 | |||
| 28 | #if defined(HEADER_RC2_H) && !defined(RC2_INT) | ||
| 29 | /* I need to put in a mod for the alpha - eay */ | ||
| 30 | #define RC2_INT unsigned int | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #if defined(HEADER_RC4_H) | ||
| 34 | #if !defined(RC4_INT) | ||
| 35 | /* using int types make the structure larger but make the code faster | ||
| 36 | * on most boxes I have tested - up to %20 faster. */ | ||
| 37 | /* | ||
| 38 | * I don't know what does "most" mean, but declaring "int" is a must on: | ||
| 39 | * - Intel P6 because partial register stalls are very expensive; | ||
| 40 | * - elder Alpha because it lacks byte load/store instructions; | ||
| 41 | */ | ||
| 42 | #define RC4_INT unsigned int | ||
| 43 | #endif | ||
| 44 | #if !defined(RC4_CHUNK) | ||
| 45 | /* | ||
| 46 | * This enables code handling data aligned at natural CPU word | ||
| 47 | * boundary. See crypto/rc4/rc4_enc.c for further details. | ||
| 48 | */ | ||
| 49 | #define RC4_CHUNK unsigned long | ||
| 50 | #endif | ||
| 51 | #endif | ||
| 52 | |||
| 53 | #if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) | ||
| 54 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a | ||
| 55 | * %20 speed up (longs are 8 bytes, int's are 4). */ | ||
| 56 | #ifndef DES_LONG | ||
| 57 | #define DES_LONG unsigned int | ||
| 58 | #endif | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) | ||
| 62 | #define CONFIG_HEADER_BN_H | ||
| 63 | #undef BN_LLONG | ||
| 64 | |||
| 65 | /* Should we define BN_DIV2W here? */ | ||
| 66 | |||
| 67 | /* Only one for the following should be defined */ | ||
| 68 | /* The prime number generation stuff may not work when | ||
| 69 | * EIGHT_BIT but I don't care since I've only used this mode | ||
| 70 | * for debugging the bignum libraries */ | ||
| 71 | #define SIXTY_FOUR_BIT_LONG | ||
| 72 | #undef SIXTY_FOUR_BIT | ||
| 73 | #undef THIRTY_TWO_BIT | ||
| 74 | #undef SIXTEEN_BIT | ||
| 75 | #undef EIGHT_BIT | ||
| 76 | #endif | ||
| 77 | |||
| 78 | #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) | ||
| 79 | #define CONFIG_HEADER_BF_LOCL_H | ||
| 80 | #define BF_PTR | ||
| 81 | #endif /* HEADER_BF_LOCL_H */ | ||
| 82 | |||
| 83 | #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) | ||
| 84 | #define CONFIG_HEADER_DES_LOCL_H | ||
| 85 | #ifndef DES_DEFAULT_OPTIONS | ||
| 86 | /* the following is tweaked from a config script, that is why it is a | ||
| 87 | * protected undef/define */ | ||
| 88 | #ifndef DES_PTR | ||
| 89 | #define DES_PTR | ||
| 90 | #endif | ||
| 91 | |||
| 92 | /* This helps C compiler generate the correct code for multiple functional | ||
| 93 | * units. It reduces register dependencies at the expense of 2 more | ||
| 94 | * registers */ | ||
| 95 | #ifndef DES_RISC1 | ||
| 96 | #undef DES_RISC1 | ||
| 97 | #endif | ||
| 98 | |||
| 99 | #ifndef DES_RISC2 | ||
| 100 | #define DES_RISC2 | ||
| 101 | #endif | ||
| 102 | |||
| 103 | #if defined(DES_RISC1) && defined(DES_RISC2) | ||
| 104 | YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! | ||
| 105 | #endif | ||
| 106 | |||
| 107 | /* Unroll the inner loop, this sometimes helps, sometimes hinders. | ||
| 108 | * Very much CPU dependent */ | ||
| 109 | #ifndef DES_UNROLL | ||
| 110 | #undef DES_UNROLL | ||
| 111 | #endif | ||
| 112 | |||
| 113 | /* These default values were supplied by | ||
| 114 | * Peter Gutman <pgut001@cs.auckland.ac.nz> | ||
| 115 | * They are only used if nothing else has been defined */ | ||
| 116 | #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) | ||
| 117 | /* Special defines which change the way the code is built depending on the | ||
| 118 | CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find | ||
| 119 | even newer MIPS CPU's, but at the moment one size fits all for | ||
| 120 | optimization options. Older Sparc's work better with only UNROLL, but | ||
| 121 | there's no way to tell at compile time what it is you're running on */ | ||
| 122 | |||
| 123 | #if defined( sun ) /* Newer Sparc's */ | ||
| 124 | # define DES_PTR | ||
| 125 | # define DES_RISC1 | ||
| 126 | # define DES_UNROLL | ||
| 127 | #elif defined( __ultrix ) /* Older MIPS */ | ||
| 128 | # define DES_PTR | ||
| 129 | # define DES_RISC2 | ||
| 130 | # define DES_UNROLL | ||
| 131 | #elif defined( __osf1__ ) /* Alpha */ | ||
| 132 | # define DES_PTR | ||
| 133 | # define DES_RISC2 | ||
| 134 | #elif defined ( _AIX ) /* RS6000 */ | ||
| 135 | /* Unknown */ | ||
| 136 | #elif defined( __hpux ) /* HP-PA */ | ||
| 137 | /* Unknown */ | ||
| 138 | #elif defined( __aux ) /* 68K */ | ||
| 139 | /* Unknown */ | ||
| 140 | #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ | ||
| 141 | # define DES_UNROLL | ||
| 142 | #elif defined( __sgi ) /* Newer MIPS */ | ||
| 143 | # define DES_PTR | ||
| 144 | # define DES_RISC2 | ||
| 145 | # define DES_UNROLL | ||
| 146 | #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ | ||
| 147 | # define DES_PTR | ||
| 148 | # define DES_RISC1 | ||
| 149 | # define DES_UNROLL | ||
| 150 | #endif /* Systems-specific speed defines */ | ||
| 151 | #endif | ||
| 152 | |||
| 153 | #endif /* DES_DEFAULT_OPTIONS */ | ||
| 154 | #endif /* HEADER_DES_LOCL_H */ | ||
diff --git a/src/lib/libcrypto/asn1/a_bitstr.c b/src/lib/libcrypto/asn1/a_bitstr.c index d5d00c4d44..e656c43f0c 100644 --- a/src/lib/libcrypto/asn1/a_bitstr.c +++ b/src/lib/libcrypto/asn1/a_bitstr.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: a_bitstr.c,v 1.43 2024/07/08 14:52:31 beck Exp $ */ | 1 | /* $OpenBSD: a_bitstr.c,v 1.48 2026/01/04 09:54:23 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -63,10 +63,10 @@ | |||
| 63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
| 64 | #include <openssl/asn1t.h> | 64 | #include <openssl/asn1t.h> |
| 65 | #include <openssl/conf.h> | 65 | #include <openssl/conf.h> |
| 66 | #include <openssl/err.h> | ||
| 67 | #include <openssl/x509v3.h> | 66 | #include <openssl/x509v3.h> |
| 68 | 67 | ||
| 69 | #include "bytestring.h" | 68 | #include "bytestring.h" |
| 69 | #include "err_local.h" | ||
| 70 | 70 | ||
| 71 | const ASN1_ITEM ASN1_BIT_STRING_it = { | 71 | const ASN1_ITEM ASN1_BIT_STRING_it = { |
| 72 | .itype = ASN1_ITYPE_PRIMITIVE, | 72 | .itype = ASN1_ITYPE_PRIMITIVE, |
| @@ -182,18 +182,9 @@ i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp) | |||
| 182 | unsigned char *p, *d; | 182 | unsigned char *p, *d; |
| 183 | 183 | ||
| 184 | if (a == NULL) | 184 | if (a == NULL) |
| 185 | return (0); | 185 | return 0; |
| 186 | |||
| 187 | if (a->length == INT_MAX) | ||
| 188 | return (0); | ||
| 189 | |||
| 190 | ret = a->length + 1; | ||
| 191 | |||
| 192 | if (pp == NULL) | ||
| 193 | return (ret); | ||
| 194 | 186 | ||
| 195 | len = a->length; | 187 | len = a->length; |
| 196 | |||
| 197 | if (len > 0) { | 188 | if (len > 0) { |
| 198 | if (a->flags & ASN1_STRING_FLAG_BITS_LEFT) { | 189 | if (a->flags & ASN1_STRING_FLAG_BITS_LEFT) { |
| 199 | bits = (int)a->flags & 0x07; | 190 | bits = (int)a->flags & 0x07; |
| @@ -222,12 +213,20 @@ i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp) | |||
| 222 | else if (j & 0x80) | 213 | else if (j & 0x80) |
| 223 | bits = 7; | 214 | bits = 7; |
| 224 | else | 215 | else |
| 225 | bits = 0; /* should not happen */ | 216 | bits = 0; |
| 226 | } | 217 | } |
| 227 | } else | 218 | } else |
| 228 | bits = 0; | 219 | bits = 0; |
| 229 | 220 | ||
| 230 | p= *pp; | 221 | if (len > INT_MAX - 1) |
| 222 | return 0; | ||
| 223 | |||
| 224 | ret = len + 1; | ||
| 225 | |||
| 226 | if (pp == NULL) | ||
| 227 | return ret; | ||
| 228 | |||
| 229 | p = *pp; | ||
| 231 | 230 | ||
| 232 | *(p++) = (unsigned char)bits; | 231 | *(p++) = (unsigned char)bits; |
| 233 | d = a->data; | 232 | d = a->data; |
| @@ -237,7 +236,7 @@ i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp) | |||
| 237 | p[-1] &= 0xff << bits; | 236 | p[-1] &= 0xff << bits; |
| 238 | } | 237 | } |
| 239 | *pp = p; | 238 | *pp = p; |
| 240 | return (ret); | 239 | return ret; |
| 241 | } | 240 | } |
| 242 | 241 | ||
| 243 | int | 242 | int |
diff --git a/src/lib/libcrypto/asn1/a_enum.c b/src/lib/libcrypto/asn1/a_enum.c index 5d3a3dd0c7..ac5033ea8a 100644 --- a/src/lib/libcrypto/asn1/a_enum.c +++ b/src/lib/libcrypto/asn1/a_enum.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: a_enum.c,v 1.30 2024/07/08 14:52:31 beck Exp $ */ | 1 | /* $OpenBSD: a_enum.c,v 1.31 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -63,10 +63,10 @@ | |||
| 63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
| 64 | #include <openssl/bn.h> | 64 | #include <openssl/bn.h> |
| 65 | #include <openssl/buffer.h> | 65 | #include <openssl/buffer.h> |
| 66 | #include <openssl/err.h> | ||
| 67 | 66 | ||
| 68 | #include "asn1_local.h" | 67 | #include "asn1_local.h" |
| 69 | #include "bytestring.h" | 68 | #include "bytestring.h" |
| 69 | #include "err_local.h" | ||
| 70 | 70 | ||
| 71 | /* | 71 | /* |
| 72 | * Code for ENUMERATED type: identical to INTEGER apart from a different tag. | 72 | * Code for ENUMERATED type: identical to INTEGER apart from a different tag. |
diff --git a/src/lib/libcrypto/asn1/a_int.c b/src/lib/libcrypto/asn1/a_int.c index 0d9b6577d7..f171e330f6 100644 --- a/src/lib/libcrypto/asn1/a_int.c +++ b/src/lib/libcrypto/asn1/a_int.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: a_int.c,v 1.48 2024/07/08 14:52:31 beck Exp $ */ | 1 | /* $OpenBSD: a_int.c,v 1.49 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -64,9 +64,9 @@ | |||
| 64 | #include <openssl/asn1t.h> | 64 | #include <openssl/asn1t.h> |
| 65 | #include <openssl/bn.h> | 65 | #include <openssl/bn.h> |
| 66 | #include <openssl/buffer.h> | 66 | #include <openssl/buffer.h> |
| 67 | #include <openssl/err.h> | ||
| 68 | 67 | ||
| 69 | #include "bytestring.h" | 68 | #include "bytestring.h" |
| 69 | #include "err_local.h" | ||
| 70 | 70 | ||
| 71 | const ASN1_ITEM ASN1_INTEGER_it = { | 71 | const ASN1_ITEM ASN1_INTEGER_it = { |
| 72 | .itype = ASN1_ITYPE_PRIMITIVE, | 72 | .itype = ASN1_ITYPE_PRIMITIVE, |
diff --git a/src/lib/libcrypto/asn1/a_mbstr.c b/src/lib/libcrypto/asn1/a_mbstr.c index f050f97539..38398ad1d1 100644 --- a/src/lib/libcrypto/asn1/a_mbstr.c +++ b/src/lib/libcrypto/asn1/a_mbstr.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: a_mbstr.c,v 1.27 2023/07/05 21:23:36 beck Exp $ */ | 1 | /* $OpenBSD: a_mbstr.c,v 1.28 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -61,9 +61,9 @@ | |||
| 61 | #include <string.h> | 61 | #include <string.h> |
| 62 | 62 | ||
| 63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | 64 | ||
| 66 | #include "asn1_local.h" | 65 | #include "asn1_local.h" |
| 66 | #include "err_local.h" | ||
| 67 | 67 | ||
| 68 | static int traverse_string(const unsigned char *p, int len, int inform, | 68 | static int traverse_string(const unsigned char *p, int len, int inform, |
| 69 | int (*rfunc)(unsigned long value, void *in), void *arg); | 69 | int (*rfunc)(unsigned long value, void *in), void *arg); |
diff --git a/src/lib/libcrypto/asn1/a_object.c b/src/lib/libcrypto/asn1/a_object.c index 2f3ca1398f..333ac60348 100644 --- a/src/lib/libcrypto/asn1/a_object.c +++ b/src/lib/libcrypto/asn1/a_object.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: a_object.c,v 1.55 2024/07/08 14:52:31 beck Exp $ */ | 1 | /* $OpenBSD: a_object.c,v 1.56 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -62,11 +62,11 @@ | |||
| 62 | 62 | ||
| 63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
| 64 | #include <openssl/asn1t.h> | 64 | #include <openssl/asn1t.h> |
| 65 | #include <openssl/err.h> | ||
| 66 | #include <openssl/buffer.h> | 65 | #include <openssl/buffer.h> |
| 67 | #include <openssl/objects.h> | 66 | #include <openssl/objects.h> |
| 68 | 67 | ||
| 69 | #include "asn1_local.h" | 68 | #include "asn1_local.h" |
| 69 | #include "err_local.h" | ||
| 70 | 70 | ||
| 71 | const ASN1_ITEM ASN1_OBJECT_it = { | 71 | const ASN1_ITEM ASN1_OBJECT_it = { |
| 72 | .itype = ASN1_ITYPE_PRIMITIVE, | 72 | .itype = ASN1_ITYPE_PRIMITIVE, |
diff --git a/src/lib/libcrypto/asn1/a_pkey.c b/src/lib/libcrypto/asn1/a_pkey.c index a730728076..636b602377 100644 --- a/src/lib/libcrypto/asn1/a_pkey.c +++ b/src/lib/libcrypto/asn1/a_pkey.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: a_pkey.c,v 1.8 2024/04/09 13:52:41 beck Exp $ */ | 1 | /* $OpenBSD: a_pkey.c,v 1.9 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -62,12 +62,12 @@ | |||
| 62 | 62 | ||
| 63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
| 64 | #include <openssl/bn.h> | 64 | #include <openssl/bn.h> |
| 65 | #include <openssl/err.h> | ||
| 66 | #include <openssl/evp.h> | 65 | #include <openssl/evp.h> |
| 67 | #include <openssl/objects.h> | 66 | #include <openssl/objects.h> |
| 68 | #include <openssl/x509.h> | 67 | #include <openssl/x509.h> |
| 69 | 68 | ||
| 70 | #include "asn1_local.h" | 69 | #include "asn1_local.h" |
| 70 | #include "err_local.h" | ||
| 71 | #include "evp_local.h" | 71 | #include "evp_local.h" |
| 72 | 72 | ||
| 73 | EVP_PKEY * | 73 | EVP_PKEY * |
diff --git a/src/lib/libcrypto/asn1/a_pubkey.c b/src/lib/libcrypto/asn1/a_pubkey.c index 544f3d2cf0..f846b6cda5 100644 --- a/src/lib/libcrypto/asn1/a_pubkey.c +++ b/src/lib/libcrypto/asn1/a_pubkey.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: a_pubkey.c,v 1.7 2024/04/09 13:52:41 beck Exp $ */ | 1 | /* $OpenBSD: a_pubkey.c,v 1.8 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -62,7 +62,6 @@ | |||
| 62 | 62 | ||
| 63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
| 64 | #include <openssl/bn.h> | 64 | #include <openssl/bn.h> |
| 65 | #include <openssl/err.h> | ||
| 66 | #include <openssl/evp.h> | 65 | #include <openssl/evp.h> |
| 67 | #include <openssl/objects.h> | 66 | #include <openssl/objects.h> |
| 68 | 67 | ||
| @@ -76,6 +75,7 @@ | |||
| 76 | #include <openssl/rsa.h> | 75 | #include <openssl/rsa.h> |
| 77 | #endif | 76 | #endif |
| 78 | 77 | ||
| 78 | #include "err_local.h" | ||
| 79 | #include "evp_local.h" | 79 | #include "evp_local.h" |
| 80 | 80 | ||
| 81 | EVP_PKEY * | 81 | EVP_PKEY * |
diff --git a/src/lib/libcrypto/asn1/a_string.c b/src/lib/libcrypto/asn1/a_string.c index ec492e71f0..70e9c95f22 100644 --- a/src/lib/libcrypto/asn1/a_string.c +++ b/src/lib/libcrypto/asn1/a_string.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: a_string.c,v 1.17 2023/08/15 18:05:15 tb Exp $ */ | 1 | /* $OpenBSD: a_string.c,v 1.18 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -61,9 +61,9 @@ | |||
| 61 | #include <string.h> | 61 | #include <string.h> |
| 62 | 62 | ||
| 63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | 64 | ||
| 66 | #include "asn1_local.h" | 65 | #include "asn1_local.h" |
| 66 | #include "err_local.h" | ||
| 67 | 67 | ||
| 68 | ASN1_STRING * | 68 | ASN1_STRING * |
| 69 | ASN1_STRING_new(void) | 69 | ASN1_STRING_new(void) |
diff --git a/src/lib/libcrypto/asn1/a_strnid.c b/src/lib/libcrypto/asn1/a_strnid.c index 5fa60b9ce7..3519d6725d 100644 --- a/src/lib/libcrypto/asn1/a_strnid.c +++ b/src/lib/libcrypto/asn1/a_strnid.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: a_strnid.c,v 1.31 2024/03/02 08:54:02 tb Exp $ */ | 1 | /* $OpenBSD: a_strnid.c,v 1.32 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -62,7 +62,6 @@ | |||
| 62 | #include <string.h> | 62 | #include <string.h> |
| 63 | 63 | ||
| 64 | #include <openssl/asn1.h> | 64 | #include <openssl/asn1.h> |
| 65 | #include <openssl/err.h> | ||
| 66 | #include <openssl/objects.h> | 65 | #include <openssl/objects.h> |
| 67 | 66 | ||
| 68 | /* | 67 | /* |
diff --git a/src/lib/libcrypto/asn1/a_time.c b/src/lib/libcrypto/asn1/a_time.c index 15ac1af5c4..3deff56eda 100644 --- a/src/lib/libcrypto/asn1/a_time.c +++ b/src/lib/libcrypto/asn1/a_time.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: a_time.c,v 1.38 2024/07/08 14:52:31 beck Exp $ */ | 1 | /* $OpenBSD: a_time.c,v 1.39 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -65,7 +65,6 @@ | |||
| 65 | #include <time.h> | 65 | #include <time.h> |
| 66 | 66 | ||
| 67 | #include <openssl/asn1t.h> | 67 | #include <openssl/asn1t.h> |
| 68 | #include <openssl/err.h> | ||
| 69 | 68 | ||
| 70 | #include "asn1_local.h" | 69 | #include "asn1_local.h" |
| 71 | 70 | ||
diff --git a/src/lib/libcrypto/asn1/a_time_tm.c b/src/lib/libcrypto/asn1/a_time_tm.c index a1f329be96..dd2893167f 100644 --- a/src/lib/libcrypto/asn1/a_time_tm.c +++ b/src/lib/libcrypto/asn1/a_time_tm.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: a_time_tm.c,v 1.42 2024/05/03 18:33:27 tb Exp $ */ | 1 | /* $OpenBSD: a_time_tm.c,v 1.43 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2015 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2015 Bob Beck <beck@openbsd.org> |
| 4 | * | 4 | * |
| @@ -22,10 +22,10 @@ | |||
| 22 | #include <time.h> | 22 | #include <time.h> |
| 23 | 23 | ||
| 24 | #include <openssl/asn1t.h> | 24 | #include <openssl/asn1t.h> |
| 25 | #include <openssl/err.h> | ||
| 26 | 25 | ||
| 27 | #include "bytestring.h" | ||
| 28 | #include "asn1_local.h" | 26 | #include "asn1_local.h" |
| 27 | #include "bytestring.h" | ||
| 28 | #include "err_local.h" | ||
| 29 | 29 | ||
| 30 | #define RFC5280 0 | 30 | #define RFC5280 0 |
| 31 | #define GENTIME_LENGTH 15 | 31 | #define GENTIME_LENGTH 15 |
diff --git a/src/lib/libcrypto/asn1/a_type.c b/src/lib/libcrypto/asn1/a_type.c index ef0a76e810..0615de1ccb 100644 --- a/src/lib/libcrypto/asn1/a_type.c +++ b/src/lib/libcrypto/asn1/a_type.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: a_type.c,v 1.27 2023/07/28 10:00:10 tb Exp $ */ | 1 | /* $OpenBSD: a_type.c,v 1.29 2025/12/05 14:19:27 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -59,10 +59,10 @@ | |||
| 59 | #include <string.h> | 59 | #include <string.h> |
| 60 | 60 | ||
| 61 | #include <openssl/asn1t.h> | 61 | #include <openssl/asn1t.h> |
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/objects.h> | 62 | #include <openssl/objects.h> |
| 64 | 63 | ||
| 65 | #include "asn1_local.h" | 64 | #include "asn1_local.h" |
| 65 | #include "err_local.h" | ||
| 66 | 66 | ||
| 67 | typedef struct { | 67 | typedef struct { |
| 68 | ASN1_INTEGER *num; | 68 | ASN1_INTEGER *num; |
| @@ -227,14 +227,14 @@ int | |||
| 227 | ASN1_TYPE_get_octetstring(const ASN1_TYPE *a, unsigned char *data, int max_len) | 227 | ASN1_TYPE_get_octetstring(const ASN1_TYPE *a, unsigned char *data, int max_len) |
| 228 | { | 228 | { |
| 229 | int ret, num; | 229 | int ret, num; |
| 230 | unsigned char *p; | 230 | const unsigned char *p; |
| 231 | 231 | ||
| 232 | if ((a->type != V_ASN1_OCTET_STRING) || | 232 | if ((a->type != V_ASN1_OCTET_STRING) || |
| 233 | (a->value.octet_string == NULL)) { | 233 | (a->value.octet_string == NULL)) { |
| 234 | ASN1error(ASN1_R_DATA_IS_WRONG); | 234 | ASN1error(ASN1_R_DATA_IS_WRONG); |
| 235 | return (-1); | 235 | return (-1); |
| 236 | } | 236 | } |
| 237 | p = ASN1_STRING_data(a->value.octet_string); | 237 | p = ASN1_STRING_get0_data(a->value.octet_string); |
| 238 | ret = ASN1_STRING_length(a->value.octet_string); | 238 | ret = ASN1_STRING_length(a->value.octet_string); |
| 239 | if (ret < max_len) | 239 | if (ret < max_len) |
| 240 | num = ret; | 240 | num = ret; |
| @@ -298,7 +298,7 @@ ASN1_TYPE_get_int_octetstring(const ASN1_TYPE *at, long *num, unsigned char *dat | |||
| 298 | len = ASN1_STRING_length(ios->value); | 298 | len = ASN1_STRING_length(ios->value); |
| 299 | if (len > max_len) | 299 | if (len > max_len) |
| 300 | len = max_len; | 300 | len = max_len; |
| 301 | memcpy(data, ASN1_STRING_data(ios->value), len); | 301 | memcpy(data, ASN1_STRING_get0_data(ios->value), len); |
| 302 | } | 302 | } |
| 303 | 303 | ||
| 304 | ret = ASN1_STRING_length(ios->value); | 304 | ret = ASN1_STRING_length(ios->value); |
diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h index aeabbc0a28..2b19f58717 100644 --- a/src/lib/libcrypto/asn1/asn1.h +++ b/src/lib/libcrypto/asn1/asn1.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: asn1.h,v 1.92 2024/04/10 14:55:12 beck Exp $ */ | 1 | /* $OpenBSD: asn1.h,v 1.95 2026/01/02 08:03:02 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -85,7 +85,6 @@ extern "C" { | |||
| 85 | #define V_ASN1_PRIMITIVE_TAG 0x1f | 85 | #define V_ASN1_PRIMITIVE_TAG 0x1f |
| 86 | #define V_ASN1_PRIMATIVE_TAG 0x1f | 86 | #define V_ASN1_PRIMATIVE_TAG 0x1f |
| 87 | 87 | ||
| 88 | #define V_ASN1_APP_CHOOSE -2 /* let the recipient choose */ | ||
| 89 | #define V_ASN1_OTHER -3 /* used in ASN1_TYPE */ | 88 | #define V_ASN1_OTHER -3 /* used in ASN1_TYPE */ |
| 90 | #define V_ASN1_ANY -4 /* used in ASN1 template code */ | 89 | #define V_ASN1_ANY -4 /* used in ASN1 template code */ |
| 91 | 90 | ||
| @@ -200,11 +199,9 @@ typedef struct ASN1_ENCODING_st { | |||
| 200 | int modified; /* set to 1 if 'enc' is invalid */ | 199 | int modified; /* set to 1 if 'enc' is invalid */ |
| 201 | } ASN1_ENCODING; | 200 | } ASN1_ENCODING; |
| 202 | 201 | ||
| 203 | /* Used with ASN1 LONG type: if a long is set to this it is omitted */ | 202 | /* Used by security/xca */ |
| 204 | #define ASN1_LONG_UNDEF 0x7fffffffL | ||
| 205 | |||
| 206 | #define STABLE_FLAGS_MALLOC 0x01 | ||
| 207 | #define STABLE_NO_MASK 0x02 | 203 | #define STABLE_NO_MASK 0x02 |
| 204 | |||
| 208 | #define DIRSTRING_TYPE \ | 205 | #define DIRSTRING_TYPE \ |
| 209 | (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING) | 206 | (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING) |
| 210 | #define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING) | 207 | #define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING) |
diff --git a/src/lib/libcrypto/asn1/asn1_gen.c b/src/lib/libcrypto/asn1/asn1_gen.c index edd6743993..b409e83c7d 100644 --- a/src/lib/libcrypto/asn1/asn1_gen.c +++ b/src/lib/libcrypto/asn1/asn1_gen.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: asn1_gen.c,v 1.27 2025/03/06 07:25:01 tb Exp $ */ | 1 | /* $OpenBSD: asn1_gen.c,v 1.28 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2002. | 3 | * project 2002. |
| 4 | */ | 4 | */ |
| @@ -59,11 +59,11 @@ | |||
| 59 | #include <string.h> | 59 | #include <string.h> |
| 60 | 60 | ||
| 61 | #include <openssl/asn1.h> | 61 | #include <openssl/asn1.h> |
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/x509v3.h> | 62 | #include <openssl/x509v3.h> |
| 64 | 63 | ||
| 65 | #include "asn1_local.h" | 64 | #include "asn1_local.h" |
| 66 | #include "conf_local.h" | 65 | #include "conf_local.h" |
| 66 | #include "err_local.h" | ||
| 67 | #include "x509_local.h" | 67 | #include "x509_local.h" |
| 68 | 68 | ||
| 69 | #define ASN1_GEN_FLAG 0x10000 | 69 | #define ASN1_GEN_FLAG 0x10000 |
diff --git a/src/lib/libcrypto/asn1/asn1_item.c b/src/lib/libcrypto/asn1/asn1_item.c index 86c800e3ad..621d65711b 100644 --- a/src/lib/libcrypto/asn1/asn1_item.c +++ b/src/lib/libcrypto/asn1/asn1_item.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: asn1_item.c,v 1.21 2024/04/09 13:55:02 beck Exp $ */ | 1 | /* $OpenBSD: asn1_item.c,v 1.22 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -112,11 +112,11 @@ | |||
| 112 | #include <limits.h> | 112 | #include <limits.h> |
| 113 | 113 | ||
| 114 | #include <openssl/buffer.h> | 114 | #include <openssl/buffer.h> |
| 115 | #include <openssl/err.h> | ||
| 116 | #include <openssl/evp.h> | 115 | #include <openssl/evp.h> |
| 117 | #include <openssl/x509.h> | 116 | #include <openssl/x509.h> |
| 118 | 117 | ||
| 119 | #include "asn1_local.h" | 118 | #include "asn1_local.h" |
| 119 | #include "err_local.h" | ||
| 120 | #include "evp_local.h" | 120 | #include "evp_local.h" |
| 121 | #include "x509_local.h" | 121 | #include "x509_local.h" |
| 122 | 122 | ||
diff --git a/src/lib/libcrypto/asn1/asn1_local.h b/src/lib/libcrypto/asn1/asn1_local.h index 19de978772..d61cfaa7b9 100644 --- a/src/lib/libcrypto/asn1/asn1_local.h +++ b/src/lib/libcrypto/asn1/asn1_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: asn1_local.h,v 1.10 2024/03/02 09:10:42 tb Exp $ */ | 1 | /* $OpenBSD: asn1_local.h,v 1.11 2025/11/26 10:19:57 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -56,6 +56,9 @@ | |||
| 56 | * | 56 | * |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #ifndef HEADER_ASN1_LOCAL_H | ||
| 60 | #define HEADER_ASN1_LOCAL_H | ||
| 61 | |||
| 59 | #include "bytestring.h" | 62 | #include "bytestring.h" |
| 60 | 63 | ||
| 61 | __BEGIN_HIDDEN_DECLS | 64 | __BEGIN_HIDDEN_DECLS |
| @@ -191,3 +194,5 @@ int ASN1_time_parse(const char *_bytes, size_t _len, struct tm *_tm, int _mode); | |||
| 191 | int ASN1_time_tm_cmp(struct tm *_tm1, struct tm *_tm2); | 194 | int ASN1_time_tm_cmp(struct tm *_tm1, struct tm *_tm2); |
| 192 | 195 | ||
| 193 | __END_HIDDEN_DECLS | 196 | __END_HIDDEN_DECLS |
| 197 | |||
| 198 | #endif /* HEADER_ASN1_LOCAL_H */ | ||
diff --git a/src/lib/libcrypto/asn1/asn1_old.c b/src/lib/libcrypto/asn1/asn1_old.c index 7992fccdef..c47ea8e74a 100644 --- a/src/lib/libcrypto/asn1/asn1_old.c +++ b/src/lib/libcrypto/asn1/asn1_old.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: asn1_old.c,v 1.6 2024/04/10 14:55:12 beck Exp $ */ | 1 | /* $OpenBSD: asn1_old.c,v 1.7 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -61,9 +61,9 @@ | |||
| 61 | 61 | ||
| 62 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
| 63 | #include <openssl/buffer.h> | 63 | #include <openssl/buffer.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | 64 | ||
| 66 | #include "asn1_local.h" | 65 | #include "asn1_local.h" |
| 66 | #include "err_local.h" | ||
| 67 | 67 | ||
| 68 | #ifndef NO_OLD_ASN1 | 68 | #ifndef NO_OLD_ASN1 |
| 69 | 69 | ||
diff --git a/src/lib/libcrypto/asn1/asn1_old_lib.c b/src/lib/libcrypto/asn1/asn1_old_lib.c index 80362ae689..541ac7b615 100644 --- a/src/lib/libcrypto/asn1/asn1_old_lib.c +++ b/src/lib/libcrypto/asn1/asn1_old_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: asn1_old_lib.c,v 1.6 2023/07/05 21:23:36 beck Exp $ */ | 1 | /* $OpenBSD: asn1_old_lib.c,v 1.7 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -61,9 +61,9 @@ | |||
| 61 | #include <string.h> | 61 | #include <string.h> |
| 62 | 62 | ||
| 63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | 64 | ||
| 66 | #include "asn1_local.h" | 65 | #include "asn1_local.h" |
| 66 | #include "err_local.h" | ||
| 67 | 67 | ||
| 68 | static void asn1_put_length(unsigned char **pp, int length); | 68 | static void asn1_put_length(unsigned char **pp, int length); |
| 69 | 69 | ||
diff --git a/src/lib/libcrypto/asn1/asn1t.h b/src/lib/libcrypto/asn1/asn1t.h index 22cde48669..b3fb1cf838 100644 --- a/src/lib/libcrypto/asn1/asn1t.h +++ b/src/lib/libcrypto/asn1/asn1t.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: asn1t.h,v 1.24 2024/07/08 16:24:22 beck Exp $ */ | 1 | /* $OpenBSD: asn1t.h,v 1.31 2026/01/16 09:25:15 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -78,44 +78,43 @@ extern "C" { | |||
| 78 | 78 | ||
| 79 | /* Macros for start and end of ASN1_ITEM definition */ | 79 | /* Macros for start and end of ASN1_ITEM definition */ |
| 80 | 80 | ||
| 81 | #define ASN1_ITEM_start(itname) \ | 81 | #define ASN1_ITEM_start(itname) \ |
| 82 | const ASN1_ITEM itname##_it = { | 82 | const ASN1_ITEM itname##_it = { |
| 83 | 83 | ||
| 84 | #define static_ASN1_ITEM_start(itname) \ | 84 | #define static_ASN1_ITEM_start(itname) \ |
| 85 | static const ASN1_ITEM itname##_it = { | 85 | static const ASN1_ITEM itname##_it = { |
| 86 | 86 | ||
| 87 | #define ASN1_ITEM_end(itname) \ | 87 | #define ASN1_ITEM_end(itname) \ |
| 88 | }; | 88 | }; |
| 89 | |||
| 90 | 89 | ||
| 91 | 90 | ||
| 92 | /* Macros to aid ASN1 template writing */ | 91 | /* Macros to aid ASN1 template writing */ |
| 93 | 92 | ||
| 94 | #define ASN1_ITEM_TEMPLATE(tname) \ | 93 | #define ASN1_ITEM_TEMPLATE(tname) \ |
| 95 | static const ASN1_TEMPLATE tname##_item_tt | 94 | static const ASN1_TEMPLATE tname##_item_tt |
| 96 | 95 | ||
| 97 | #define ASN1_ITEM_TEMPLATE_END(tname) \ | 96 | #define ASN1_ITEM_TEMPLATE_END(tname) \ |
| 98 | ;\ | 97 | ; \ |
| 99 | ASN1_ITEM_start(tname) \ | 98 | ASN1_ITEM_start(tname) \ |
| 100 | ASN1_ITYPE_PRIMITIVE,\ | 99 | .itype = ASN1_ITYPE_PRIMITIVE, \ |
| 101 | -1,\ | 100 | .utype = -1, \ |
| 102 | &tname##_item_tt,\ | 101 | .templates = &tname##_item_tt, \ |
| 103 | 0,\ | 102 | .tcount = 0, \ |
| 104 | NULL,\ | 103 | .funcs = NULL, \ |
| 105 | 0,\ | 104 | .size = 0, \ |
| 106 | #tname \ | 105 | .sname = #tname, \ |
| 107 | ASN1_ITEM_end(tname) | 106 | ASN1_ITEM_end(tname) |
| 108 | 107 | ||
| 109 | #define static_ASN1_ITEM_TEMPLATE_END(tname) \ | 108 | #define static_ASN1_ITEM_TEMPLATE_END(tname) \ |
| 110 | ;\ | 109 | ; \ |
| 111 | static_ASN1_ITEM_start(tname) \ | 110 | static_ASN1_ITEM_start(tname) \ |
| 112 | ASN1_ITYPE_PRIMITIVE,\ | 111 | .itype = ASN1_ITYPE_PRIMITIVE, \ |
| 113 | -1,\ | 112 | .utype = -1, \ |
| 114 | &tname##_item_tt,\ | 113 | .templates = &tname##_item_tt, \ |
| 115 | 0,\ | 114 | .tcount = 0, \ |
| 116 | NULL,\ | 115 | .funcs = NULL, \ |
| 117 | 0,\ | 116 | .size = 0, \ |
| 118 | #tname \ | 117 | .sname = #tname, \ |
| 119 | ASN1_ITEM_end(tname) | 118 | ASN1_ITEM_end(tname) |
| 120 | 119 | ||
| 121 | 120 | ||
| @@ -142,119 +141,145 @@ extern "C" { | |||
| 142 | * a structure called stname. | 141 | * a structure called stname. |
| 143 | */ | 142 | */ |
| 144 | 143 | ||
| 145 | #define ASN1_SEQUENCE(tname) \ | 144 | #define ASN1_SEQUENCE(tname) \ |
| 146 | static const ASN1_TEMPLATE tname##_seq_tt[] | 145 | static const ASN1_TEMPLATE tname##_seq_tt[] |
| 147 | 146 | ||
| 148 | #define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname) | 147 | #define ASN1_SEQUENCE_END(stname) \ |
| 149 | 148 | ASN1_SEQUENCE_END_name(stname, stname) | |
| 150 | #define static_ASN1_SEQUENCE_END(stname) static_ASN1_SEQUENCE_END_name(stname, stname) | 149 | |
| 151 | 150 | #define static_ASN1_SEQUENCE_END(stname) \ | |
| 152 | #define ASN1_SEQUENCE_END_name(stname, tname) \ | 151 | static_ASN1_SEQUENCE_END_name(stname, stname) |
| 153 | ;\ | 152 | |
| 154 | ASN1_ITEM_start(tname) \ | 153 | #define ASN1_SEQUENCE_END_name(stname, tname) \ |
| 155 | ASN1_ITYPE_SEQUENCE,\ | 154 | ; \ |
| 156 | V_ASN1_SEQUENCE,\ | 155 | ASN1_ITEM_start(tname) \ |
| 157 | tname##_seq_tt,\ | 156 | .itype = ASN1_ITYPE_SEQUENCE, \ |
| 158 | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ | 157 | .utype = V_ASN1_SEQUENCE, \ |
| 159 | NULL,\ | 158 | .templates = tname##_seq_tt, \ |
| 160 | sizeof(stname),\ | 159 | .tcount = sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ |
| 161 | #stname \ | 160 | .funcs = NULL, \ |
| 161 | .size = sizeof(stname), \ | ||
| 162 | .sname = #stname, \ | ||
| 162 | ASN1_ITEM_end(tname) | 163 | ASN1_ITEM_end(tname) |
| 163 | 164 | ||
| 164 | #define static_ASN1_SEQUENCE_END_name(stname, tname) \ | 165 | #define static_ASN1_SEQUENCE_END_name(stname, tname) \ |
| 165 | ;\ | 166 | ; \ |
| 166 | static_ASN1_ITEM_start(tname) \ | 167 | static_ASN1_ITEM_start(tname) \ |
| 167 | ASN1_ITYPE_SEQUENCE,\ | 168 | .itype = ASN1_ITYPE_SEQUENCE, \ |
| 168 | V_ASN1_SEQUENCE,\ | 169 | .utype = V_ASN1_SEQUENCE, \ |
| 169 | tname##_seq_tt,\ | 170 | .templates = tname##_seq_tt, \ |
| 170 | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ | 171 | .tcount = sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ |
| 171 | NULL,\ | 172 | .funcs = NULL, \ |
| 172 | sizeof(stname),\ | 173 | .size = sizeof(stname), \ |
| 173 | #stname \ | 174 | .sname = #stname, \ |
| 174 | ASN1_ITEM_end(tname) | 175 | ASN1_ITEM_end(tname) |
| 175 | 176 | ||
| 176 | #define ASN1_NDEF_SEQUENCE(tname) \ | 177 | #define ASN1_NDEF_SEQUENCE(tname) \ |
| 177 | ASN1_SEQUENCE(tname) | 178 | ASN1_SEQUENCE(tname) |
| 178 | 179 | ||
| 179 | #define ASN1_NDEF_SEQUENCE_cb(tname, cb) \ | 180 | #define ASN1_NDEF_SEQUENCE_cb(tname, cb) \ |
| 180 | ASN1_SEQUENCE_cb(tname, cb) | 181 | ASN1_SEQUENCE_cb(tname, cb) |
| 181 | 182 | ||
| 182 | #define ASN1_SEQUENCE_cb(tname, cb) \ | 183 | #define ASN1_SEQUENCE_cb(tname, cb) \ |
| 183 | static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ | 184 | static const ASN1_AUX tname##_aux = { \ |
| 185 | .app_data = NULL, \ | ||
| 186 | .flags = 0, \ | ||
| 187 | .ref_offset = 0, \ | ||
| 188 | .ref_lock = 0, \ | ||
| 189 | .asn1_cb = cb, \ | ||
| 190 | .enc_offset = 0, \ | ||
| 191 | }; \ | ||
| 184 | ASN1_SEQUENCE(tname) | 192 | ASN1_SEQUENCE(tname) |
| 185 | 193 | ||
| 186 | #define ASN1_SEQUENCE_ref(tname, cb, lck) \ | 194 | #define ASN1_SEQUENCE_ref(tname, cb, lck) \ |
| 187 | static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), lck, cb, 0}; \ | 195 | static const ASN1_AUX tname##_aux = { \ |
| 196 | .app_data = NULL, \ | ||
| 197 | .flags = ASN1_AFLG_REFCOUNT, \ | ||
| 198 | .ref_offset = offsetof(tname, references), \ | ||
| 199 | .ref_lock = lck, \ | ||
| 200 | .asn1_cb = cb, \ | ||
| 201 | .enc_offset = 0, \ | ||
| 202 | }; \ | ||
| 188 | ASN1_SEQUENCE(tname) | 203 | ASN1_SEQUENCE(tname) |
| 189 | 204 | ||
| 190 | #define ASN1_SEQUENCE_enc(tname, enc, cb) \ | 205 | #define ASN1_SEQUENCE_enc(tname, enc, cb) \ |
| 191 | static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \ | 206 | static const ASN1_AUX tname##_aux = { \ |
| 207 | .app_data = NULL, \ | ||
| 208 | .flags = ASN1_AFLG_ENCODING, \ | ||
| 209 | .ref_offset = 0, \ | ||
| 210 | .ref_lock = 0, \ | ||
| 211 | .asn1_cb = cb, \ | ||
| 212 | .enc_offset = offsetof(tname, enc), \ | ||
| 213 | }; \ | ||
| 192 | ASN1_SEQUENCE(tname) | 214 | ASN1_SEQUENCE(tname) |
| 193 | 215 | ||
| 194 | #define ASN1_NDEF_SEQUENCE_END(tname) \ | 216 | #define ASN1_NDEF_SEQUENCE_END(tname) \ |
| 195 | ;\ | 217 | ; \ |
| 196 | ASN1_ITEM_start(tname) \ | 218 | ASN1_ITEM_start(tname) \ |
| 197 | ASN1_ITYPE_NDEF_SEQUENCE,\ | 219 | .itype = ASN1_ITYPE_NDEF_SEQUENCE, \ |
| 198 | V_ASN1_SEQUENCE,\ | 220 | .utype = V_ASN1_SEQUENCE, \ |
| 199 | tname##_seq_tt,\ | 221 | .templates = tname##_seq_tt, \ |
| 200 | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ | 222 | .tcount = sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ |
| 201 | NULL,\ | 223 | .funcs = NULL, \ |
| 202 | sizeof(tname),\ | 224 | .size = sizeof(tname), \ |
| 203 | #tname \ | 225 | .sname = #tname, \ |
| 204 | ASN1_ITEM_end(tname) | 226 | ASN1_ITEM_end(tname) |
| 205 | 227 | ||
| 206 | #define static_ASN1_NDEF_SEQUENCE_END(tname) \ | 228 | #define static_ASN1_NDEF_SEQUENCE_END(tname) \ |
| 207 | ;\ | 229 | ; \ |
| 208 | static_ASN1_ITEM_start(tname) \ | 230 | static_ASN1_ITEM_start(tname) \ |
| 209 | ASN1_ITYPE_NDEF_SEQUENCE,\ | 231 | .itype = ASN1_ITYPE_NDEF_SEQUENCE, \ |
| 210 | V_ASN1_SEQUENCE,\ | 232 | .utype = V_ASN1_SEQUENCE, \ |
| 211 | tname##_seq_tt,\ | 233 | .templates = tname##_seq_tt, \ |
| 212 | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ | 234 | .tcount = sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ |
| 213 | NULL,\ | 235 | .funcs = NULL, \ |
| 214 | sizeof(tname),\ | 236 | .size = sizeof(tname), \ |
| 215 | #tname \ | 237 | .sname = #tname, \ |
| 216 | ASN1_ITEM_end(tname) | 238 | ASN1_ITEM_end(tname) |
| 217 | 239 | ||
| 218 | #define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) | 240 | #define ASN1_SEQUENCE_END_enc(stname, tname) \ |
| 219 | 241 | ASN1_SEQUENCE_END_ref(stname, tname) | |
| 220 | #define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) | 242 | |
| 221 | 243 | #define ASN1_SEQUENCE_END_cb(stname, tname) \ | |
| 222 | #define static_ASN1_SEQUENCE_END_cb(stname, tname) static_ASN1_SEQUENCE_END_ref(stname, tname) | 244 | ASN1_SEQUENCE_END_ref(stname, tname) |
| 223 | 245 | ||
| 224 | #define ASN1_SEQUENCE_END_ref(stname, tname) \ | 246 | #define static_ASN1_SEQUENCE_END_cb(stname, tname) \ |
| 225 | ;\ | 247 | static_ASN1_SEQUENCE_END_ref(stname, tname) |
| 226 | ASN1_ITEM_start(tname) \ | 248 | |
| 227 | ASN1_ITYPE_SEQUENCE,\ | 249 | #define ASN1_SEQUENCE_END_ref(stname, tname) \ |
| 228 | V_ASN1_SEQUENCE,\ | 250 | ; \ |
| 229 | tname##_seq_tt,\ | 251 | ASN1_ITEM_start(tname) \ |
| 230 | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ | 252 | .itype = ASN1_ITYPE_SEQUENCE, \ |
| 231 | &tname##_aux,\ | 253 | .utype = V_ASN1_SEQUENCE, \ |
| 232 | sizeof(stname),\ | 254 | .templates = tname##_seq_tt, \ |
| 233 | #stname \ | 255 | .tcount = sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ |
| 256 | .funcs = &tname##_aux, \ | ||
| 257 | .size = sizeof(stname), \ | ||
| 258 | .sname = #stname, \ | ||
| 234 | ASN1_ITEM_end(tname) | 259 | ASN1_ITEM_end(tname) |
| 235 | 260 | ||
| 236 | #define static_ASN1_SEQUENCE_END_ref(stname, tname) \ | 261 | #define static_ASN1_SEQUENCE_END_ref(stname, tname) \ |
| 237 | ;\ | 262 | ; \ |
| 238 | static_ASN1_ITEM_start(tname) \ | 263 | static_ASN1_ITEM_start(tname) \ |
| 239 | ASN1_ITYPE_SEQUENCE,\ | 264 | .itype = ASN1_ITYPE_SEQUENCE, \ |
| 240 | V_ASN1_SEQUENCE,\ | 265 | .utype = V_ASN1_SEQUENCE, \ |
| 241 | tname##_seq_tt,\ | 266 | .templates = tname##_seq_tt, \ |
| 242 | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ | 267 | .tcount = sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ |
| 243 | &tname##_aux,\ | 268 | .funcs = &tname##_aux, \ |
| 244 | sizeof(stname),\ | 269 | .size = sizeof(stname), \ |
| 245 | #stname \ | 270 | .sname = #stname, \ |
| 246 | ASN1_ITEM_end(tname) | 271 | ASN1_ITEM_end(tname) |
| 247 | 272 | ||
| 248 | #define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \ | 273 | #define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \ |
| 249 | ;\ | 274 | ; \ |
| 250 | ASN1_ITEM_start(tname) \ | 275 | ASN1_ITEM_start(tname) \ |
| 251 | ASN1_ITYPE_NDEF_SEQUENCE,\ | 276 | .itype = ASN1_ITYPE_NDEF_SEQUENCE, \ |
| 252 | V_ASN1_SEQUENCE,\ | 277 | .utype = V_ASN1_SEQUENCE, \ |
| 253 | tname##_seq_tt,\ | 278 | .templates = tname##_seq_tt, \ |
| 254 | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ | 279 | .tcount = sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ |
| 255 | &tname##_aux,\ | 280 | .funcs = &tname##_aux, \ |
| 256 | sizeof(stname),\ | 281 | .size = sizeof(stname), \ |
| 257 | #stname \ | 282 | .sname = #stname, \ |
| 258 | ASN1_ITEM_end(tname) | 283 | ASN1_ITEM_end(tname) |
| 259 | 284 | ||
| 260 | 285 | ||
| @@ -281,170 +306,214 @@ extern "C" { | |||
| 281 | * ASN1_CHOICE_END_selector() version. | 306 | * ASN1_CHOICE_END_selector() version. |
| 282 | */ | 307 | */ |
| 283 | 308 | ||
| 284 | #define ASN1_CHOICE(tname) \ | 309 | #define ASN1_CHOICE(tname) \ |
| 285 | static const ASN1_TEMPLATE tname##_ch_tt[] | 310 | static const ASN1_TEMPLATE tname##_ch_tt[] |
| 286 | 311 | ||
| 287 | #define ASN1_CHOICE_cb(tname, cb) \ | 312 | #define ASN1_CHOICE_cb(tname, cb) \ |
| 288 | static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ | 313 | static const ASN1_AUX tname##_aux = { \ |
| 314 | .app_data = NULL, \ | ||
| 315 | .flags = 0, \ | ||
| 316 | .ref_offset = 0, \ | ||
| 317 | .ref_lock = 0, \ | ||
| 318 | .asn1_cb = cb, \ | ||
| 319 | .enc_offset = 0, \ | ||
| 320 | }; \ | ||
| 289 | ASN1_CHOICE(tname) | 321 | ASN1_CHOICE(tname) |
| 290 | 322 | ||
| 291 | #define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname) | 323 | #define ASN1_CHOICE_END(stname) \ |
| 324 | ASN1_CHOICE_END_name(stname, stname) | ||
| 292 | 325 | ||
| 293 | #define static_ASN1_CHOICE_END(stname) static_ASN1_CHOICE_END_name(stname, stname) | 326 | #define static_ASN1_CHOICE_END(stname) \ |
| 327 | static_ASN1_CHOICE_END_name(stname, stname) | ||
| 294 | 328 | ||
| 295 | #define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type) | 329 | #define ASN1_CHOICE_END_name(stname, tname) \ |
| 330 | ASN1_CHOICE_END_selector(stname, tname, type) | ||
| 296 | 331 | ||
| 297 | #define static_ASN1_CHOICE_END_name(stname, tname) static_ASN1_CHOICE_END_selector(stname, tname, type) | 332 | #define static_ASN1_CHOICE_END_name(stname, tname) \ |
| 333 | static_ASN1_CHOICE_END_selector(stname, tname, type) | ||
| 298 | 334 | ||
| 299 | #define ASN1_CHOICE_END_selector(stname, tname, selname) \ | 335 | #define ASN1_CHOICE_END_selector(stname, tname, selname) \ |
| 300 | ;\ | 336 | ; \ |
| 301 | ASN1_ITEM_start(tname) \ | 337 | ASN1_ITEM_start(tname) \ |
| 302 | ASN1_ITYPE_CHOICE,\ | 338 | .itype = ASN1_ITYPE_CHOICE, \ |
| 303 | offsetof(stname,selname) ,\ | 339 | .utype = offsetof(stname, selname), \ |
| 304 | tname##_ch_tt,\ | 340 | .templates = tname##_ch_tt, \ |
| 305 | sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ | 341 | .tcount = sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ |
| 306 | NULL,\ | 342 | .funcs = NULL, \ |
| 307 | sizeof(stname),\ | 343 | .size = sizeof(stname), \ |
| 308 | #stname \ | 344 | .sname = #stname, \ |
| 309 | ASN1_ITEM_end(tname) | 345 | ASN1_ITEM_end(tname) |
| 310 | 346 | ||
| 311 | #define static_ASN1_CHOICE_END_selector(stname, tname, selname) \ | 347 | #define static_ASN1_CHOICE_END_selector(stname, tname, selname) \ |
| 312 | ;\ | 348 | ; \ |
| 313 | static_ASN1_ITEM_start(tname) \ | 349 | static_ASN1_ITEM_start(tname) \ |
| 314 | ASN1_ITYPE_CHOICE,\ | 350 | .itype = ASN1_ITYPE_CHOICE, \ |
| 315 | offsetof(stname,selname) ,\ | 351 | .utype = offsetof(stname, selname), \ |
| 316 | tname##_ch_tt,\ | 352 | .templates = tname##_ch_tt, \ |
| 317 | sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ | 353 | .tcount = sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ |
| 318 | NULL,\ | 354 | .funcs = NULL, \ |
| 319 | sizeof(stname),\ | 355 | .size = sizeof(stname), \ |
| 320 | #stname \ | 356 | .sname = #stname, \ |
| 321 | ASN1_ITEM_end(tname) | 357 | ASN1_ITEM_end(tname) |
| 322 | 358 | ||
| 323 | #define ASN1_CHOICE_END_cb(stname, tname, selname) \ | 359 | #define ASN1_CHOICE_END_cb(stname, tname, selname) \ |
| 324 | ;\ | 360 | ; \ |
| 325 | ASN1_ITEM_start(tname) \ | 361 | ASN1_ITEM_start(tname) \ |
| 326 | ASN1_ITYPE_CHOICE,\ | 362 | .itype = ASN1_ITYPE_CHOICE, \ |
| 327 | offsetof(stname,selname) ,\ | 363 | .utype = offsetof(stname, selname), \ |
| 328 | tname##_ch_tt,\ | 364 | .templates = tname##_ch_tt, \ |
| 329 | sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ | 365 | .tcount = sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ |
| 330 | &tname##_aux,\ | 366 | .funcs = &tname##_aux, \ |
| 331 | sizeof(stname),\ | 367 | .size = sizeof(stname), \ |
| 332 | #stname \ | 368 | .sname = #stname, \ |
| 333 | ASN1_ITEM_end(tname) | 369 | ASN1_ITEM_end(tname) |
| 334 | 370 | ||
| 335 | /* This helps with the template wrapper form of ASN1_ITEM */ | 371 | /* This helps with the template wrapper form of ASN1_ITEM */ |
| 336 | 372 | ||
| 337 | #define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \ | 373 | #define ASN1_EX_TEMPLATE_TYPE(flagsval, tagval, name, type) \ |
| 338 | (flags), (tag), 0,\ | 374 | { \ |
| 339 | #name, ASN1_ITEM_ref(type) } | 375 | .flags = (flagsval), \ |
| 376 | .tag = (tagval), \ | ||
| 377 | .offset = 0, \ | ||
| 378 | .field_name = #name, \ | ||
| 379 | .item = ASN1_ITEM_ref(type), \ | ||
| 380 | } | ||
| 340 | 381 | ||
| 341 | /* These help with SEQUENCE or CHOICE components */ | 382 | /* These help with SEQUENCE or CHOICE components */ |
| 342 | 383 | ||
| 343 | /* used to declare other types */ | 384 | /* used to declare other types */ |
| 344 | 385 | ||
| 345 | #define ASN1_EX_TYPE(flags, tag, stname, field, type) { \ | 386 | #define ASN1_EX_TYPE(flagsval, tagval, stname, field, type) \ |
| 346 | (flags), (tag), offsetof(stname, field),\ | 387 | { \ |
| 347 | #field, ASN1_ITEM_ref(type) } | 388 | .flags = (flagsval), \ |
| 389 | .tag = (tagval), \ | ||
| 390 | .offset = offsetof(stname, field), \ | ||
| 391 | .field_name = #field, \ | ||
| 392 | .item = ASN1_ITEM_ref(type), \ | ||
| 393 | } | ||
| 348 | 394 | ||
| 349 | /* implicit and explicit helper macros */ | 395 | /* implicit and explicit helper macros */ |
| 350 | 396 | ||
| 351 | #define ASN1_IMP_EX(stname, field, type, tag, ex) \ | 397 | #define ASN1_IMP_EX(stname, field, type, tag, ex) \ |
| 352 | ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | ex, tag, stname, field, type) | 398 | ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | ex, tag, stname, field, type) |
| 353 | 399 | ||
| 354 | #define ASN1_EXP_EX(stname, field, type, tag, ex) \ | 400 | #define ASN1_EXP_EX(stname, field, type, tag, ex) \ |
| 355 | ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | ex, tag, stname, field, type) | 401 | ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | ex, tag, stname, field, type) |
| 356 | 402 | ||
| 357 | /* Any defined by macros: the field used is in the table itself */ | 403 | /* Any defined by macros: the field used is in the table itself */ |
| 358 | 404 | ||
| 359 | #define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } | 405 | #define ASN1_ADB_OBJECT(tblname) \ |
| 360 | #define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } | 406 | { \ |
| 407 | .flags = ASN1_TFLG_ADB_OID, \ | ||
| 408 | .tag = -1, \ | ||
| 409 | .offset = 0, \ | ||
| 410 | .field_name = #tblname, \ | ||
| 411 | .item = (const ASN1_ITEM *)&(tblname##_adb), \ | ||
| 412 | } | ||
| 413 | #define ASN1_ADB_INTEGER(tblname) \ | ||
| 414 | { \ | ||
| 415 | .flags = ASN1_TFLG_ADB_INT, \ | ||
| 416 | .tag = -1, \ | ||
| 417 | .offset = 0, \ | ||
| 418 | .field_name = #tblname, \ | ||
| 419 | .item = (const ASN1_ITEM *)&(tblname##_adb), \ | ||
| 420 | } | ||
| 421 | |||
| 361 | /* Plain simple type */ | 422 | /* Plain simple type */ |
| 362 | #define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type) | 423 | #define ASN1_SIMPLE(stname, field, type) \ |
| 424 | ASN1_EX_TYPE(0, 0, stname, field, type) | ||
| 363 | 425 | ||
| 364 | /* OPTIONAL simple type */ | 426 | /* OPTIONAL simple type */ |
| 365 | #define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type) | 427 | #define ASN1_OPT(stname, field, type) \ |
| 428 | ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type) | ||
| 366 | 429 | ||
| 367 | /* IMPLICIT tagged simple type */ | 430 | /* IMPLICIT tagged simple type */ |
| 368 | #define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0) | 431 | #define ASN1_IMP(stname, field, type, tag) \ |
| 432 | ASN1_IMP_EX(stname, field, type, tag, 0) | ||
| 369 | 433 | ||
| 370 | /* IMPLICIT tagged OPTIONAL simple type */ | 434 | /* IMPLICIT tagged OPTIONAL simple type */ |
| 371 | #define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) | 435 | #define ASN1_IMP_OPT(stname, field, type, tag) \ |
| 436 | ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) | ||
| 372 | 437 | ||
| 373 | /* Same as above but EXPLICIT */ | 438 | /* Same as above but EXPLICIT */ |
| 374 | 439 | ||
| 375 | #define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0) | 440 | #define ASN1_EXP(stname, field, type, tag) \ |
| 376 | #define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) | 441 | ASN1_EXP_EX(stname, field, type, tag, 0) |
| 442 | #define ASN1_EXP_OPT(stname, field, type, tag) \ | ||
| 443 | ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) | ||
| 377 | 444 | ||
| 378 | /* SEQUENCE OF type */ | 445 | /* SEQUENCE OF type */ |
| 379 | #define ASN1_SEQUENCE_OF(stname, field, type) \ | 446 | #define ASN1_SEQUENCE_OF(stname, field, type) \ |
| 380 | ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type) | 447 | ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type) |
| 381 | 448 | ||
| 382 | /* OPTIONAL SEQUENCE OF */ | 449 | /* OPTIONAL SEQUENCE OF */ |
| 383 | #define ASN1_SEQUENCE_OF_OPT(stname, field, type) \ | 450 | #define ASN1_SEQUENCE_OF_OPT(stname, field, type) \ |
| 384 | ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) | 451 | ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) |
| 385 | 452 | ||
| 386 | /* Same as above but for SET OF */ | 453 | /* Same as above but for SET OF */ |
| 387 | 454 | ||
| 388 | #define ASN1_SET_OF(stname, field, type) \ | 455 | #define ASN1_SET_OF(stname, field, type) \ |
| 389 | ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type) | 456 | ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type) |
| 390 | 457 | ||
| 391 | #define ASN1_SET_OF_OPT(stname, field, type) \ | 458 | #define ASN1_SET_OF_OPT(stname, field, type) \ |
| 392 | ASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) | 459 | ASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) |
| 393 | 460 | ||
| 394 | /* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */ | 461 | /* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */ |
| 395 | 462 | ||
| 396 | #define ASN1_IMP_SET_OF(stname, field, type, tag) \ | 463 | #define ASN1_IMP_SET_OF(stname, field, type, tag) \ |
| 397 | ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) | 464 | ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) |
| 398 | 465 | ||
| 399 | #define ASN1_EXP_SET_OF(stname, field, type, tag) \ | 466 | #define ASN1_EXP_SET_OF(stname, field, type, tag) \ |
| 400 | ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) | 467 | ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) |
| 401 | 468 | ||
| 402 | #define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \ | 469 | #define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \ |
| 403 | ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) | 470 | ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) |
| 404 | 471 | ||
| 405 | #define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \ | 472 | #define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \ |
| 406 | ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) | 473 | ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) |
| 407 | 474 | ||
| 408 | #define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \ | 475 | #define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \ |
| 409 | ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) | 476 | ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) |
| 410 | 477 | ||
| 411 | #define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \ | 478 | #define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \ |
| 412 | ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) | 479 | ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) |
| 413 | 480 | ||
| 414 | #define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \ | 481 | #define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \ |
| 415 | ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) | 482 | ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) |
| 416 | 483 | ||
| 417 | #define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \ | 484 | #define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \ |
| 418 | ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) | 485 | ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) |
| 419 | 486 | ||
| 420 | /* EXPLICIT using indefinite length constructed form */ | 487 | /* EXPLICIT using indefinite length constructed form */ |
| 421 | #define ASN1_NDEF_EXP(stname, field, type, tag) \ | 488 | #define ASN1_NDEF_EXP(stname, field, type, tag) \ |
| 422 | ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF) | 489 | ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF) |
| 423 | 490 | ||
| 424 | /* EXPLICIT OPTIONAL using indefinite length constructed form */ | 491 | /* EXPLICIT OPTIONAL using indefinite length constructed form */ |
| 425 | #define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \ | 492 | #define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \ |
| 426 | ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF) | 493 | ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF) |
| 427 | 494 | ||
| 428 | /* Macros for the ASN1_ADB structure */ | 495 | /* Macros for the ASN1_ADB structure */ |
| 429 | 496 | ||
| 430 | #define ASN1_ADB(name) \ | 497 | #define ASN1_ADB(name) \ |
| 431 | static const ASN1_ADB_TABLE name##_adbtbl[] | 498 | static const ASN1_ADB_TABLE name##_adbtbl[] |
| 432 | 499 | ||
| 433 | 500 | /* In 5b70372d OpenSSL added adb_cb. Ignore this until someone complains. */ | |
| 434 | #define ASN1_ADB_END(name, flags, field, app_table, def, none) \ | 501 | #define ASN1_ADB_END(name, flagsval, field, adb_cb, def, none) \ |
| 435 | ;\ | 502 | ; \ |
| 436 | static const ASN1_ADB name##_adb = {\ | 503 | static const ASN1_ADB name##_adb = { \ |
| 437 | flags,\ | 504 | .flags = flagsval, \ |
| 438 | offsetof(name, field),\ | 505 | .offset = offsetof(name, field), \ |
| 439 | app_table,\ | 506 | .tbl = name##_adbtbl, \ |
| 440 | name##_adbtbl,\ | 507 | .tblcount = sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ |
| 441 | sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ | 508 | .default_tt = def, \ |
| 442 | def,\ | 509 | .null_tt = none, \ |
| 443 | none\ | ||
| 444 | } | 510 | } |
| 445 | 511 | ||
| 446 | 512 | #define ADB_ENTRY(val, template) \ | |
| 447 | #define ADB_ENTRY(val, template) {val, template} | 513 | { \ |
| 514 | .value = val, \ | ||
| 515 | .tt = template, \ | ||
| 516 | } | ||
| 448 | 517 | ||
| 449 | #define ASN1_ADB_TEMPLATE(name) \ | 518 | #define ASN1_ADB_TEMPLATE(name) \ |
| 450 | static const ASN1_TEMPLATE name##_tt | 519 | static const ASN1_TEMPLATE name##_tt |
| @@ -474,16 +543,16 @@ typedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE; | |||
| 474 | typedef struct ASN1_ADB_st ASN1_ADB; | 543 | typedef struct ASN1_ADB_st ASN1_ADB; |
| 475 | 544 | ||
| 476 | struct ASN1_ADB_st { | 545 | struct ASN1_ADB_st { |
| 477 | unsigned long flags; /* Various flags */ | 546 | unsigned long flags; /* Various flags */ |
| 478 | unsigned long offset; /* Offset of selector field */ | 547 | unsigned long offset; /* Offset of selector field */ |
| 479 | const ASN1_ADB_TABLE *tbl; /* Table of possible types */ | 548 | const ASN1_ADB_TABLE *tbl; /* Table of possible types */ |
| 480 | long tblcount; /* Number of entries in tbl */ | 549 | long tblcount; /* Number of entries in tbl */ |
| 481 | const ASN1_TEMPLATE *default_tt; /* Type to use if no match */ | 550 | const ASN1_TEMPLATE *default_tt; /* Type to use if no match */ |
| 482 | const ASN1_TEMPLATE *null_tt; /* Type to use if selector is NULL */ | 551 | const ASN1_TEMPLATE *null_tt; /* Type to use if selector is NULL */ |
| 483 | }; | 552 | }; |
| 484 | 553 | ||
| 485 | struct ASN1_ADB_TABLE_st { | 554 | struct ASN1_ADB_TABLE_st { |
| 486 | long value; /* NID for an object or value for an int */ | 555 | long value; /* NID for an object or value for an int */ |
| 487 | const ASN1_TEMPLATE tt; /* item for this value */ | 556 | const ASN1_TEMPLATE tt; /* item for this value */ |
| 488 | }; | 557 | }; |
| 489 | 558 | ||
| @@ -498,9 +567,9 @@ struct ASN1_ADB_TABLE_st { | |||
| 498 | /* Field is a SEQUENCE OF */ | 567 | /* Field is a SEQUENCE OF */ |
| 499 | #define ASN1_TFLG_SEQUENCE_OF (0x2 << 1) | 568 | #define ASN1_TFLG_SEQUENCE_OF (0x2 << 1) |
| 500 | 569 | ||
| 501 | /* Special case: this refers to a SET OF that | 570 | /* |
| 502 | * will be sorted into DER order when encoded *and* | 571 | * Special case: this refers to a SET OF that will be sorted into DER order |
| 503 | * the corresponding STACK will be modified to match | 572 | * when encoded *and* the corresponding STACK will be modified to match |
| 504 | * the new order. | 573 | * the new order. |
| 505 | */ | 574 | */ |
| 506 | #define ASN1_TFLG_SET_ORDER (0x3 << 1) | 575 | #define ASN1_TFLG_SET_ORDER (0x3 << 1) |
| @@ -508,9 +577,9 @@ struct ASN1_ADB_TABLE_st { | |||
| 508 | /* Mask for SET OF or SEQUENCE OF */ | 577 | /* Mask for SET OF or SEQUENCE OF */ |
| 509 | #define ASN1_TFLG_SK_MASK (0x3 << 1) | 578 | #define ASN1_TFLG_SK_MASK (0x3 << 1) |
| 510 | 579 | ||
| 511 | /* These flags mean the tag should be taken from the | 580 | /* |
| 512 | * tag field. If EXPLICIT then the underlying type | 581 | * These flags mean the tag should be taken from the tag field. If EXPLICIT |
| 513 | * is used for the inner tag. | 582 | * then the underlying type is used for the inner tag. |
| 514 | */ | 583 | */ |
| 515 | 584 | ||
| 516 | /* IMPLICIT tagging */ | 585 | /* IMPLICIT tagging */ |
| @@ -529,7 +598,7 @@ struct ASN1_ADB_TABLE_st { | |||
| 529 | #define ASN1_TFLG_EXPLICIT ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT | 598 | #define ASN1_TFLG_EXPLICIT ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT |
| 530 | 599 | ||
| 531 | /* | 600 | /* |
| 532 | * If tagging is in force these determine the type of tag to use. Otherwiser | 601 | * If tagging is in force these determine the type of tag to use. Otherwise |
| 533 | * the tag is determined by the underlying type. These values reflect the | 602 | * the tag is determined by the underlying type. These values reflect the |
| 534 | * actual octet format. | 603 | * actual octet format. |
| 535 | */ | 604 | */ |
| @@ -546,10 +615,9 @@ struct ASN1_ADB_TABLE_st { | |||
| 546 | #define ASN1_TFLG_TAG_CLASS (0x3<<6) | 615 | #define ASN1_TFLG_TAG_CLASS (0x3<<6) |
| 547 | 616 | ||
| 548 | /* | 617 | /* |
| 549 | * These are for ANY DEFINED BY type. In this case | 618 | * These are for ANY DEFINED BY type. In this case the 'item' field points |
| 550 | * the 'item' field points to an ASN1_ADB structure | 619 | * to an ASN1_ADB structure which contains a table of values to decode the |
| 551 | * which contains a table of values to decode the | 620 | * relevant type. |
| 552 | * relevant type | ||
| 553 | */ | 621 | */ |
| 554 | 622 | ||
| 555 | #define ASN1_TFLG_ADB_MASK (0x3<<8) | 623 | #define ASN1_TFLG_ADB_MASK (0x3<<8) |
| @@ -559,9 +627,8 @@ struct ASN1_ADB_TABLE_st { | |||
| 559 | #define ASN1_TFLG_ADB_INT (0x1<<9) | 627 | #define ASN1_TFLG_ADB_INT (0x1<<9) |
| 560 | 628 | ||
| 561 | /* | 629 | /* |
| 562 | * This flag when present in a SEQUENCE OF, SET OF | 630 | * This flag when present in a SEQUENCE OF, SET OF or EXPLICIT causes |
| 563 | * or EXPLICIT causes indefinite length constructed | 631 | * indefinite length constructed encoding to be used if required. |
| 564 | * encoding to be used if required. | ||
| 565 | */ | 632 | */ |
| 566 | 633 | ||
| 567 | #define ASN1_TFLG_NDEF (0x1<<11) | 634 | #define ASN1_TFLG_NDEF (0x1<<11) |
| @@ -569,52 +636,43 @@ struct ASN1_ADB_TABLE_st { | |||
| 569 | /* This is the actual ASN1 item itself */ | 636 | /* This is the actual ASN1 item itself */ |
| 570 | 637 | ||
| 571 | struct ASN1_ITEM_st { | 638 | struct ASN1_ITEM_st { |
| 572 | char itype; /* The item type, primitive, SEQUENCE, CHOICE or extern */ | 639 | char itype; /* The item type, primitive, SEQUENCE, CHOICE or extern */ |
| 573 | long utype; /* underlying type */ | 640 | long utype; /* underlying type */ |
| 574 | const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains the contents */ | 641 | const ASN1_TEMPLATE *templates; /* contents for SEQUENCE or CHOICE */ |
| 575 | long tcount; /* Number of templates if SEQUENCE or CHOICE */ | 642 | long tcount; /* Number of templates if SEQUENCE or CHOICE */ |
| 576 | const void *funcs; /* functions that handle this type */ | 643 | const void *funcs; /* functions that handle this type */ |
| 577 | long size; /* Structure size (usually)*/ | 644 | long size; /* Structure size (usually) */ |
| 578 | const char *sname; /* Structure name */ | 645 | const char *sname; /* Structure name */ |
| 579 | }; | 646 | }; |
| 580 | 647 | ||
| 581 | /* These are values for the itype field and | 648 | /* |
| 582 | * determine how the type is interpreted. | 649 | * These are values for the itype field and determine how the type is |
| 650 | * interpreted. | ||
| 583 | * | 651 | * |
| 584 | * For PRIMITIVE types the underlying type | 652 | * For PRIMITIVE types the underlying type determines the behaviour if |
| 585 | * determines the behaviour if items is NULL. | 653 | * items is NULL. |
| 586 | * | 654 | * |
| 587 | * Otherwise templates must contain a single | 655 | * Otherwise templates must contain a single template and the type is |
| 588 | * template and the type is treated in the | 656 | * treated in the same way as the type specified in the template. |
| 589 | * same way as the type specified in the template. | ||
| 590 | * | 657 | * |
| 591 | * For SEQUENCE types the templates field points | 658 | * For SEQUENCE types the templates field points to the members, the |
| 592 | * to the members, the size field is the | 659 | * size field is the structure size. |
| 593 | * structure size. | ||
| 594 | * | 660 | * |
| 595 | * For CHOICE types the templates field points | 661 | * For CHOICE types the templates field points to each possible member |
| 596 | * to each possible member (typically a union) | 662 | * (typically a union) and the 'size' field is the offset of the selector. |
| 597 | * and the 'size' field is the offset of the | ||
| 598 | * selector. | ||
| 599 | * | 663 | * |
| 600 | * The 'funcs' field is used for application | 664 | * The 'funcs' field is used for application specific functions. |
| 601 | * specific functions. | ||
| 602 | * | 665 | * |
| 603 | * The EXTERN type uses a new style d2i/i2d. | 666 | * The EXTERN type uses a new style d2i/i2d. The new style should be used |
| 604 | * The new style should be used where possible | 667 | * where possible because it avoids things like the d2i IMPLICIT hack. |
| 605 | * because it avoids things like the d2i IMPLICIT | ||
| 606 | * hack. | ||
| 607 | * | 668 | * |
| 608 | * MSTRING is a multiple string type, it is used | 669 | * MSTRING is a multiple string type, it is used for a CHOICE of character |
| 609 | * for a CHOICE of character strings where the | 670 | * strings where the actual strings all occupy an ASN1_STRING structure. |
| 610 | * actual strings all occupy an ASN1_STRING | 671 | * In this case the 'utype' field has a special meaning, it is used as a |
| 611 | * structure. In this case the 'utype' field | 672 | * mask of acceptable types using the B_ASN1 constants. |
| 612 | * has a special meaning, it is used as a mask | ||
| 613 | * of acceptable types using the B_ASN1 constants. | ||
| 614 | * | 673 | * |
| 615 | * NDEF_SEQUENCE is the same as SEQUENCE except | 674 | * NDEF_SEQUENCE is the same as SEQUENCE except that it will use |
| 616 | * that it will use indefinite length constructed | 675 | * indefinite length constructed encoding if requested. |
| 617 | * encoding if requested. | ||
| 618 | * | 676 | * |
| 619 | */ | 677 | */ |
| 620 | 678 | ||
| @@ -648,23 +706,27 @@ struct ASN1_TLC_st { | |||
| 648 | 706 | ||
| 649 | typedef ASN1_VALUE * ASN1_new_func(void); | 707 | typedef ASN1_VALUE * ASN1_new_func(void); |
| 650 | typedef void ASN1_free_func(ASN1_VALUE *a); | 708 | typedef void ASN1_free_func(ASN1_VALUE *a); |
| 651 | typedef ASN1_VALUE * ASN1_d2i_func(ASN1_VALUE **a, const unsigned char ** in, long length); | 709 | typedef ASN1_VALUE * ASN1_d2i_func(ASN1_VALUE **a, const unsigned char ** in, |
| 710 | long length); | ||
| 652 | typedef int ASN1_i2d_func(ASN1_VALUE * a, unsigned char **in); | 711 | typedef int ASN1_i2d_func(ASN1_VALUE * a, unsigned char **in); |
| 653 | 712 | ||
| 654 | typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it, | 713 | typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, |
| 655 | int tag, int aclass, char opt, ASN1_TLC *ctx); | 714 | const ASN1_ITEM *it, int tag, int aclass, char opt, ASN1_TLC *ctx); |
| 656 | 715 | ||
| 657 | typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass); | 716 | typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, |
| 717 | const ASN1_ITEM *it, int tag, int aclass); | ||
| 658 | typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it); | 718 | typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it); |
| 659 | typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it); | 719 | typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it); |
| 660 | 720 | ||
| 661 | typedef int ASN1_ex_print_func(BIO *out, ASN1_VALUE **pval, | 721 | typedef int ASN1_ex_print_func(BIO *out, ASN1_VALUE **pval, int indent, |
| 662 | int indent, const char *fname, | 722 | const char *fname, const ASN1_PCTX *pctx); |
| 663 | const ASN1_PCTX *pctx); | ||
| 664 | 723 | ||
| 665 | typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); | 724 | typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, |
| 666 | typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it); | 725 | int *putype, const ASN1_ITEM *it); |
| 667 | typedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, int indent, const ASN1_PCTX *pctx); | 726 | typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, |
| 727 | int len, int utype, char *free_cont, const ASN1_ITEM *it); | ||
| 728 | typedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval, | ||
| 729 | const ASN1_ITEM *it, int indent, const ASN1_PCTX *pctx); | ||
| 668 | 730 | ||
| 669 | typedef struct ASN1_EXTERN_FUNCS_st { | 731 | typedef struct ASN1_EXTERN_FUNCS_st { |
| 670 | void *app_data; | 732 | void *app_data; |
| @@ -687,25 +749,25 @@ typedef struct ASN1_PRIMITIVE_FUNCS_st { | |||
| 687 | ASN1_primitive_print *prim_print; | 749 | ASN1_primitive_print *prim_print; |
| 688 | } ASN1_PRIMITIVE_FUNCS; | 750 | } ASN1_PRIMITIVE_FUNCS; |
| 689 | 751 | ||
| 690 | /* This is the ASN1_AUX structure: it handles various | 752 | /* |
| 691 | * miscellaneous requirements. For example the use of | 753 | * This is the ASN1_AUX structure: it handles various miscellaneous |
| 692 | * reference counts and an informational callback. | 754 | * requirements. For example the use of reference counts and an |
| 755 | * informational callback. | ||
| 693 | * | 756 | * |
| 694 | * The "informational callback" is called at various | 757 | * The "informational callback" is called at various points during |
| 695 | * points during the ASN1 encoding and decoding. It can | 758 | * the ASN1 encoding and decoding. It can be used to provide minor |
| 696 | * be used to provide minor customisation of the structures | 759 | * customisation of the structures used. This is most useful where |
| 697 | * used. This is most useful where the supplied routines | 760 | * the supplied routines *almost* do the right thing but need some |
| 698 | * *almost* do the right thing but need some extra help | 761 | * extra help at a few points. If the callback returns zero then it |
| 699 | * at a few points. If the callback returns zero then | 762 | * is assumed a fatal error has occurred and the main operation |
| 700 | * it is assumed a fatal error has occurred and the | 763 | * should be abandoned. |
| 701 | * main operation should be abandoned. | ||
| 702 | * | 764 | * |
| 703 | * If major changes in the default behaviour are required | 765 | * If major changes in the default behaviour are required then an |
| 704 | * then an external type is more appropriate. | 766 | * external type is more appropriate. |
| 705 | */ | 767 | */ |
| 706 | 768 | ||
| 707 | typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it, | 769 | typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it, |
| 708 | void *exarg); | 770 | void *exarg); |
| 709 | 771 | ||
| 710 | typedef struct ASN1_AUX_st { | 772 | typedef struct ASN1_AUX_st { |
| 711 | void *app_data; | 773 | void *app_data; |
| @@ -761,116 +823,146 @@ typedef struct ASN1_STREAM_ARG_st { | |||
| 761 | 823 | ||
| 762 | /* Macro to implement a primitive type */ | 824 | /* Macro to implement a primitive type */ |
| 763 | #define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) | 825 | #define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) |
| 764 | #define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \ | 826 | #define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \ |
| 765 | ASN1_ITEM_start(itname) \ | 827 | ASN1_ITEM_start(itname) \ |
| 766 | ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \ | 828 | .itype = ASN1_ITYPE_PRIMITIVE, \ |
| 767 | ASN1_ITEM_end(itname) | 829 | .utype = V_##vname, \ |
| 830 | .templates = NULL, \ | ||
| 831 | .tcount = 0, \ | ||
| 832 | .funcs = NULL, \ | ||
| 833 | .size = ex, \ | ||
| 834 | .sname = #itname, \ | ||
| 835 | ASN1_ITEM_end(itname) | ||
| 768 | 836 | ||
| 769 | /* Macro to implement a multi string type */ | 837 | /* Macro to implement a multi string type */ |
| 770 | #define IMPLEMENT_ASN1_MSTRING(itname, mask) \ | 838 | #define IMPLEMENT_ASN1_MSTRING(itname, mask) \ |
| 771 | ASN1_ITEM_start(itname) \ | 839 | ASN1_ITEM_start(itname) \ |
| 772 | ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \ | 840 | .itype = ASN1_ITYPE_MSTRING, \ |
| 773 | ASN1_ITEM_end(itname) | 841 | .utype = mask, \ |
| 774 | #define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \ | 842 | .templates = NULL, \ |
| 775 | ASN1_ITEM_start(sname) \ | 843 | .tcount = 0, \ |
| 776 | ASN1_ITYPE_EXTERN, \ | 844 | .funcs = NULL, \ |
| 777 | tag, \ | 845 | .size = sizeof(ASN1_STRING), \ |
| 778 | NULL, \ | 846 | .sname = #itname, \ |
| 779 | 0, \ | 847 | ASN1_ITEM_end(itname) |
| 780 | &fptrs, \ | 848 | #define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \ |
| 781 | 0, \ | 849 | ASN1_ITEM_start(sname) \ |
| 782 | #sname \ | 850 | .itype = ASN1_ITYPE_EXTERN, \ |
| 851 | .utype = tag, \ | ||
| 852 | .templates = NULL, \ | ||
| 853 | .tcount = 0, \ | ||
| 854 | .funcs = &fptrs, \ | ||
| 855 | .size = 0, \ | ||
| 856 | .sname = #sname, \ | ||
| 783 | ASN1_ITEM_end(sname) | 857 | ASN1_ITEM_end(sname) |
| 784 | 858 | ||
| 785 | /* Macro to implement standard functions in terms of ASN1_ITEM structures */ | 859 | /* Macro to implement standard functions in terms of ASN1_ITEM structures */ |
| 786 | 860 | ||
| 787 | #define IMPLEMENT_ASN1_FUNCTIONS(stname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname) | 861 | #define IMPLEMENT_ASN1_FUNCTIONS(stname) \ |
| 862 | IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname) | ||
| 788 | 863 | ||
| 789 | #define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname) | 864 | #define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) \ |
| 865 | IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname) | ||
| 790 | 866 | ||
| 791 | #define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ | 867 | #define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ |
| 792 | IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) | 868 | IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) |
| 793 | 869 | ||
| 794 | #define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \ | 870 | #define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \ |
| 795 | IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname) | 871 | IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname) |
| 796 | 872 | ||
| 797 | #define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \ | 873 | #define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \ |
| 798 | IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname) | 874 | IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname) |
| 799 | 875 | ||
| 800 | #define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \ | 876 | #define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \ |
| 801 | pre stname *fname##_new(void) \ | 877 | pre stname * \ |
| 802 | { \ | 878 | fname##_new(void) \ |
| 803 | return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ | 879 | { \ |
| 804 | } \ | 880 | return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ |
| 805 | pre void fname##_free(stname *a) \ | 881 | } \ |
| 806 | { \ | 882 | pre void \ |
| 883 | fname##_free(stname *a) \ | ||
| 884 | { \ | ||
| 807 | ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ | 885 | ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ |
| 808 | } | 886 | } |
| 809 | 887 | ||
| 810 | #define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ | 888 | #define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ |
| 811 | stname *fname##_new(void) \ | 889 | stname * \ |
| 812 | { \ | 890 | fname##_new(void) \ |
| 813 | return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ | 891 | { \ |
| 814 | } \ | 892 | return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ |
| 815 | void fname##_free(stname *a) \ | 893 | } \ |
| 816 | { \ | 894 | void \ |
| 895 | fname##_free(stname *a) \ | ||
| 896 | { \ | ||
| 817 | ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ | 897 | ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ |
| 818 | } | 898 | } |
| 819 | 899 | ||
| 820 | #define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \ | 900 | #define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \ |
| 821 | IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ | 901 | IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ |
| 822 | IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) | 902 | IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) |
| 823 | 903 | ||
| 824 | #define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ | 904 | #define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ |
| 825 | stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ | 905 | stname * \ |
| 826 | { \ | 906 | d2i_##fname(stname **a, const unsigned char **in, long len) \ |
| 827 | return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ | 907 | { \ |
| 828 | } \ | 908 | return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, \ |
| 829 | int i2d_##fname(stname *a, unsigned char **out) \ | 909 | len, ASN1_ITEM_rptr(itname)); \ |
| 830 | { \ | 910 | } \ |
| 831 | return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ | 911 | int \ |
| 912 | i2d_##fname(stname *a, unsigned char **out) \ | ||
| 913 | { \ | ||
| 914 | return ASN1_item_i2d((ASN1_VALUE *)a, out, \ | ||
| 915 | ASN1_ITEM_rptr(itname)); \ | ||
| 832 | } | 916 | } |
| 833 | 917 | ||
| 834 | #define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \ | 918 | #define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \ |
| 835 | int i2d_##stname##_NDEF(stname *a, unsigned char **out) \ | 919 | int \ |
| 836 | { \ | 920 | i2d_##stname##_NDEF(stname *a, unsigned char **out) \ |
| 837 | return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\ | 921 | { \ |
| 922 | return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, \ | ||
| 923 | ASN1_ITEM_rptr(stname)); \ | ||
| 838 | } | 924 | } |
| 839 | 925 | ||
| 840 | /* This includes evil casts to remove const: they will go away when full | 926 | /* This includes evil casts to remove const: they will go away when full |
| 841 | * ASN1 constification is done. | 927 | * ASN1 constification is done. |
| 842 | */ | 928 | */ |
| 843 | #define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ | 929 | #define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ |
| 844 | stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ | 930 | stname * \ |
| 845 | { \ | 931 | d2i_##fname(stname **a, const unsigned char **in, long len) \ |
| 846 | return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ | 932 | { \ |
| 847 | } \ | 933 | return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, \ |
| 848 | int i2d_##fname(const stname *a, unsigned char **out) \ | 934 | len, ASN1_ITEM_rptr(itname)); \ |
| 849 | { \ | 935 | } \ |
| 850 | return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ | 936 | int \ |
| 937 | i2d_##fname(const stname *a, unsigned char **out) \ | ||
| 938 | { \ | ||
| 939 | return ASN1_item_i2d((ASN1_VALUE *)a, out, \ | ||
| 940 | ASN1_ITEM_rptr(itname)); \ | ||
| 851 | } | 941 | } |
| 852 | 942 | ||
| 853 | #define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \ | 943 | #define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \ |
| 854 | stname * stname##_dup(stname *x) \ | 944 | stname * \ |
| 855 | { \ | 945 | stname##_dup(stname *x) \ |
| 856 | return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \ | 946 | { \ |
| 857 | } | 947 | return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \ |
| 948 | } | ||
| 858 | 949 | ||
| 859 | #define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \ | 950 | #define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \ |
| 860 | IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname) | 951 | IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname) |
| 861 | 952 | ||
| 862 | #define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \ | 953 | #define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \ |
| 863 | int fname##_print_ctx(BIO *out, stname *x, int indent, \ | 954 | int \ |
| 864 | const ASN1_PCTX *pctx) \ | 955 | fname##_print_ctx(BIO *out, stname *x, int indent, \ |
| 865 | { \ | 956 | const ASN1_PCTX *pctx) \ |
| 866 | return ASN1_item_print(out, (ASN1_VALUE *)x, indent, \ | 957 | { \ |
| 867 | ASN1_ITEM_rptr(itname), pctx); \ | 958 | return ASN1_item_print(out, (ASN1_VALUE *)x, indent, \ |
| 959 | ASN1_ITEM_rptr(itname), pctx); \ | ||
| 868 | } | 960 | } |
| 869 | 961 | ||
| 870 | #define IMPLEMENT_ASN1_FUNCTIONS_const(name) \ | 962 | #define IMPLEMENT_ASN1_FUNCTIONS_const(name) \ |
| 871 | IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name) | 963 | IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name) |
| 872 | 964 | ||
| 873 | #define IMPLEMENT_ASN1_FUNCTIONS_const_fname(stname, itname, fname) \ | 965 | #define IMPLEMENT_ASN1_FUNCTIONS_const_fname(stname, itname, fname) \ |
| 874 | IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ | 966 | IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ |
| 875 | IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) | 967 | IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) |
| 876 | 968 | ||
| @@ -893,10 +985,10 @@ DECLARE_STACK_OF(ASN1_VALUE) | |||
| 893 | 985 | ||
| 894 | int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it); | 986 | int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it); |
| 895 | void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it); | 987 | void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it); |
| 896 | int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it, | 988 | int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, |
| 897 | int tag, int aclass, char opt, ASN1_TLC *ctx); | 989 | const ASN1_ITEM *it, int tag, int aclass, char opt, ASN1_TLC *ctx); |
| 898 | 990 | int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, | |
| 899 | int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass); | 991 | const ASN1_ITEM *it, int tag, int aclass); |
| 900 | 992 | ||
| 901 | #ifdef __cplusplus | 993 | #ifdef __cplusplus |
| 902 | } | 994 | } |
diff --git a/src/lib/libcrypto/asn1/asn_mime.c b/src/lib/libcrypto/asn1/asn_mime.c index 3995fc547c..d42dd8663e 100644 --- a/src/lib/libcrypto/asn1/asn_mime.c +++ b/src/lib/libcrypto/asn1/asn_mime.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: asn_mime.c,v 1.35 2025/01/17 05:02:18 tb Exp $ */ | 1 | /* $OpenBSD: asn_mime.c,v 1.37 2025/06/02 12:18:21 jsg Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project. | 3 | * project. |
| 4 | */ | 4 | */ |
| @@ -59,10 +59,10 @@ | |||
| 59 | 59 | ||
| 60 | #include <openssl/asn1.h> | 60 | #include <openssl/asn1.h> |
| 61 | #include <openssl/asn1t.h> | 61 | #include <openssl/asn1t.h> |
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/x509.h> | 62 | #include <openssl/x509.h> |
| 64 | 63 | ||
| 65 | #include "asn1_local.h" | 64 | #include "asn1_local.h" |
| 65 | #include "err_local.h" | ||
| 66 | #include "evp_local.h" | 66 | #include "evp_local.h" |
| 67 | 67 | ||
| 68 | /* Generalised MIME like utilities for streaming ASN1. Although many | 68 | /* Generalised MIME like utilities for streaming ASN1. Although many |
| @@ -507,8 +507,9 @@ SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it) | |||
| 507 | *bcont = sk_BIO_value(parts, 0); | 507 | *bcont = sk_BIO_value(parts, 0); |
| 508 | BIO_free(asnin); | 508 | BIO_free(asnin); |
| 509 | sk_BIO_free(parts); | 509 | sk_BIO_free(parts); |
| 510 | } else sk_BIO_pop_free(parts, BIO_vfree); | 510 | } else |
| 511 | return val; | 511 | sk_BIO_pop_free(parts, BIO_vfree); |
| 512 | return val; | ||
| 512 | } | 513 | } |
| 513 | 514 | ||
| 514 | /* OK, if not multipart/signed try opaque signature */ | 515 | /* OK, if not multipart/signed try opaque signature */ |
diff --git a/src/lib/libcrypto/asn1/asn_moid.c b/src/lib/libcrypto/asn1/asn_moid.c index e3c7d09446..a9a752cc38 100644 --- a/src/lib/libcrypto/asn1/asn_moid.c +++ b/src/lib/libcrypto/asn1/asn_moid.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: asn_moid.c,v 1.18 2024/08/31 09:26:18 tb Exp $ */ | 1 | /* $OpenBSD: asn_moid.c,v 1.20 2025/05/10 11:51:01 tb Exp $ */ |
| 2 | /* Written by Stephen Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Stephen Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2001. | 3 | * project 2001. |
| 4 | */ | 4 | */ |
| @@ -60,13 +60,13 @@ | |||
| 60 | #include <stdio.h> | 60 | #include <stdio.h> |
| 61 | #include <string.h> | 61 | #include <string.h> |
| 62 | 62 | ||
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/conf.h> | 63 | #include <openssl/conf.h> |
| 65 | #include <openssl/crypto.h> | 64 | #include <openssl/crypto.h> |
| 66 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
| 67 | 66 | ||
| 68 | #include "asn1_local.h" | 67 | #include "asn1_local.h" |
| 69 | #include "conf_local.h" | 68 | #include "conf_local.h" |
| 69 | #include "err_local.h" | ||
| 70 | 70 | ||
| 71 | /* Simple ASN1 OID module: add all objects in a given section */ | 71 | /* Simple ASN1 OID module: add all objects in a given section */ |
| 72 | 72 | ||
diff --git a/src/lib/libcrypto/asn1/bio_ndef.c b/src/lib/libcrypto/asn1/bio_ndef.c index 98bb1cd197..d001ffb0ae 100644 --- a/src/lib/libcrypto/asn1/bio_ndef.c +++ b/src/lib/libcrypto/asn1/bio_ndef.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bio_ndef.c,v 1.24 2023/07/28 09:58:30 tb Exp $ */ | 1 | /* $OpenBSD: bio_ndef.c,v 1.25 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project. | 3 | * project. |
| 4 | */ | 4 | */ |
| @@ -57,9 +57,9 @@ | |||
| 57 | #include <openssl/asn1.h> | 57 | #include <openssl/asn1.h> |
| 58 | #include <openssl/asn1t.h> | 58 | #include <openssl/asn1t.h> |
| 59 | #include <openssl/bio.h> | 59 | #include <openssl/bio.h> |
| 60 | #include <openssl/err.h> | ||
| 61 | 60 | ||
| 62 | #include "asn1_local.h" | 61 | #include "asn1_local.h" |
| 62 | #include "err_local.h" | ||
| 63 | 63 | ||
| 64 | int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, asn1_ps_func *prefix_free); | 64 | int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, asn1_ps_func *prefix_free); |
| 65 | int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, asn1_ps_func *suffix_free); | 65 | int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, asn1_ps_func *suffix_free); |
diff --git a/src/lib/libcrypto/asn1/p5_pbe.c b/src/lib/libcrypto/asn1/p5_pbe.c index 582d2d9a9b..feccf8af58 100644 --- a/src/lib/libcrypto/asn1/p5_pbe.c +++ b/src/lib/libcrypto/asn1/p5_pbe.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: p5_pbe.c,v 1.28 2024/07/08 14:48:49 beck Exp $ */ | 1 | /* $OpenBSD: p5_pbe.c,v 1.31 2025/12/07 09:27:02 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -61,11 +61,14 @@ | |||
| 61 | #include <string.h> | 61 | #include <string.h> |
| 62 | 62 | ||
| 63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
| 66 | 65 | ||
| 66 | #include "err_local.h" | ||
| 67 | #include "x509_local.h" | 67 | #include "x509_local.h" |
| 68 | 68 | ||
| 69 | /* RFC 8018, section 6.1 specifies an eight-octet salt for PBES1. */ | ||
| 70 | #define PKCS5_PBE1_SALT_LEN 8 | ||
| 71 | |||
| 69 | /* PKCS#5 password based encryption structure */ | 72 | /* PKCS#5 password based encryption structure */ |
| 70 | 73 | ||
| 71 | static const ASN1_TEMPLATE PBEPARAM_seq_tt[] = { | 74 | static const ASN1_TEMPLATE PBEPARAM_seq_tt[] = { |
| @@ -126,7 +129,6 @@ PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter, | |||
| 126 | { | 129 | { |
| 127 | PBEPARAM *pbe = NULL; | 130 | PBEPARAM *pbe = NULL; |
| 128 | ASN1_STRING *pbe_str = NULL; | 131 | ASN1_STRING *pbe_str = NULL; |
| 129 | unsigned char *sstr; | ||
| 130 | 132 | ||
| 131 | if ((pbe = PBEPARAM_new()) == NULL) { | 133 | if ((pbe = PBEPARAM_new()) == NULL) { |
| 132 | ASN1error(ERR_R_MALLOC_FAILURE); | 134 | ASN1error(ERR_R_MALLOC_FAILURE); |
| @@ -138,17 +140,24 @@ PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter, | |||
| 138 | ASN1error(ERR_R_MALLOC_FAILURE); | 140 | ASN1error(ERR_R_MALLOC_FAILURE); |
| 139 | goto err; | 141 | goto err; |
| 140 | } | 142 | } |
| 141 | if (!saltlen) | 143 | if (saltlen < 0) |
| 142 | saltlen = PKCS5_SALT_LEN; | ||
| 143 | if (!ASN1_STRING_set(pbe->salt, NULL, saltlen)) { | ||
| 144 | ASN1error(ERR_R_MALLOC_FAILURE); | ||
| 145 | goto err; | 144 | goto err; |
| 146 | } | 145 | if (saltlen == 0) |
| 147 | sstr = ASN1_STRING_data(pbe->salt); | 146 | saltlen = PKCS5_PBE1_SALT_LEN; |
| 148 | if (salt) | 147 | if (salt != NULL) { |
| 149 | memcpy(sstr, salt, saltlen); | 148 | if (!ASN1_STRING_set(pbe->salt, salt, saltlen)) |
| 150 | else | 149 | goto err; |
| 150 | } else { | ||
| 151 | unsigned char *sstr = NULL; | ||
| 152 | |||
| 153 | if ((sstr = malloc(saltlen)) == NULL) { | ||
| 154 | ASN1error(ERR_R_MALLOC_FAILURE); | ||
| 155 | goto err; | ||
| 156 | } | ||
| 151 | arc4random_buf(sstr, saltlen); | 157 | arc4random_buf(sstr, saltlen); |
| 158 | ASN1_STRING_set0(pbe->salt, sstr, saltlen); | ||
| 159 | sstr = NULL; | ||
| 160 | } | ||
| 152 | 161 | ||
| 153 | if (!ASN1_item_pack(pbe, &PBEPARAM_it, &pbe_str)) { | 162 | if (!ASN1_item_pack(pbe, &PBEPARAM_it, &pbe_str)) { |
| 154 | ASN1error(ERR_R_MALLOC_FAILURE); | 163 | ASN1error(ERR_R_MALLOC_FAILURE); |
| @@ -162,9 +171,9 @@ PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter, | |||
| 162 | return 1; | 171 | return 1; |
| 163 | 172 | ||
| 164 | err: | 173 | err: |
| 165 | if (pbe != NULL) | 174 | PBEPARAM_free(pbe); |
| 166 | PBEPARAM_free(pbe); | ||
| 167 | ASN1_STRING_free(pbe_str); | 175 | ASN1_STRING_free(pbe_str); |
| 176 | |||
| 168 | return 0; | 177 | return 0; |
| 169 | } | 178 | } |
| 170 | 179 | ||
diff --git a/src/lib/libcrypto/asn1/p5_pbev2.c b/src/lib/libcrypto/asn1/p5_pbev2.c index 76872a8dec..64924d9b38 100644 --- a/src/lib/libcrypto/asn1/p5_pbev2.c +++ b/src/lib/libcrypto/asn1/p5_pbev2.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: p5_pbev2.c,v 1.35 2024/03/26 07:03:10 tb Exp $ */ | 1 | /* $OpenBSD: p5_pbev2.c,v 1.38 2025/05/24 02:57:14 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999-2004. | 3 | * project 1999-2004. |
| 4 | */ | 4 | */ |
| @@ -61,12 +61,18 @@ | |||
| 61 | #include <string.h> | 61 | #include <string.h> |
| 62 | 62 | ||
| 63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
| 66 | 65 | ||
| 66 | #include "err_local.h" | ||
| 67 | #include "evp_local.h" | 67 | #include "evp_local.h" |
| 68 | #include "x509_local.h" | 68 | #include "x509_local.h" |
| 69 | 69 | ||
| 70 | /* | ||
| 71 | * RFC 8018, sections 6.2 and 4 specify at least 64 bits for PBES2, apparently | ||
| 72 | * FIPS will require at least 128 bits in the future, OpenSSL does that. | ||
| 73 | */ | ||
| 74 | #define PKCS5_PBE2_SALT_LEN 16 | ||
| 75 | |||
| 70 | /* PKCS#5 v2.0 password based encryption structures */ | 76 | /* PKCS#5 v2.0 password based encryption structures */ |
| 71 | 77 | ||
| 72 | static const ASN1_TEMPLATE PBE2PARAM_seq_tt[] = { | 78 | static const ASN1_TEMPLATE PBE2PARAM_seq_tt[] = { |
| @@ -187,7 +193,7 @@ PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, unsigned char *salt, | |||
| 187 | int saltlen) | 193 | int saltlen) |
| 188 | { | 194 | { |
| 189 | X509_ALGOR *scheme = NULL, *kalg = NULL, *ret = NULL; | 195 | X509_ALGOR *scheme = NULL, *kalg = NULL, *ret = NULL; |
| 190 | int prf_nid = NID_hmacWithSHA1; | 196 | int prf_nid = NID_hmacWithSHA256; |
| 191 | int alg_nid, keylen; | 197 | int alg_nid, keylen; |
| 192 | EVP_CIPHER_CTX ctx; | 198 | EVP_CIPHER_CTX ctx; |
| 193 | unsigned char iv[EVP_MAX_IV_LENGTH]; | 199 | unsigned char iv[EVP_MAX_IV_LENGTH]; |
| @@ -292,7 +298,7 @@ PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen, int prf_nid, | |||
| 292 | kdf->salt->type = V_ASN1_OCTET_STRING; | 298 | kdf->salt->type = V_ASN1_OCTET_STRING; |
| 293 | 299 | ||
| 294 | if (!saltlen) | 300 | if (!saltlen) |
| 295 | saltlen = PKCS5_SALT_LEN; | 301 | saltlen = PKCS5_PBE2_SALT_LEN; |
| 296 | if (!(osalt->data = malloc (saltlen))) | 302 | if (!(osalt->data = malloc (saltlen))) |
| 297 | goto merr; | 303 | goto merr; |
| 298 | 304 | ||
diff --git a/src/lib/libcrypto/asn1/p8_pkey.c b/src/lib/libcrypto/asn1/p8_pkey.c index bdb0c39ad5..a5e82ef7ff 100644 --- a/src/lib/libcrypto/asn1/p8_pkey.c +++ b/src/lib/libcrypto/asn1/p8_pkey.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: p8_pkey.c,v 1.25 2024/07/08 14:48:49 beck Exp $ */ | 1 | /* $OpenBSD: p8_pkey.c,v 1.26 2025/12/05 14:19:27 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -168,7 +168,7 @@ PKCS8_pkey_get0(const ASN1_OBJECT **ppkalg, const unsigned char **pk, | |||
| 168 | if (ppkalg != NULL) | 168 | if (ppkalg != NULL) |
| 169 | *ppkalg = p8->pkeyalg->algorithm; | 169 | *ppkalg = p8->pkeyalg->algorithm; |
| 170 | if (pk != NULL) { | 170 | if (pk != NULL) { |
| 171 | *pk = ASN1_STRING_data(p8->pkey); | 171 | *pk = ASN1_STRING_get0_data(p8->pkey); |
| 172 | *ppklen = ASN1_STRING_length(p8->pkey); | 172 | *ppklen = ASN1_STRING_length(p8->pkey); |
| 173 | } | 173 | } |
| 174 | if (pa != NULL) | 174 | if (pa != NULL) |
diff --git a/src/lib/libcrypto/asn1/t_crl.c b/src/lib/libcrypto/asn1/t_crl.c index 6449e7f199..295ab6c050 100644 --- a/src/lib/libcrypto/asn1/t_crl.c +++ b/src/lib/libcrypto/asn1/t_crl.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_crl.c,v 1.26 2024/05/03 02:52:00 tb Exp $ */ | 1 | /* $OpenBSD: t_crl.c,v 1.27 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -61,11 +61,11 @@ | |||
| 61 | 61 | ||
| 62 | #include <openssl/bn.h> | 62 | #include <openssl/bn.h> |
| 63 | #include <openssl/buffer.h> | 63 | #include <openssl/buffer.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
| 66 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
| 67 | #include <openssl/x509v3.h> | 66 | #include <openssl/x509v3.h> |
| 68 | 67 | ||
| 68 | #include "err_local.h" | ||
| 69 | #include "x509_local.h" | 69 | #include "x509_local.h" |
| 70 | 70 | ||
| 71 | int | 71 | int |
diff --git a/src/lib/libcrypto/asn1/t_req.c b/src/lib/libcrypto/asn1/t_req.c index 1d4be9865d..51e4b4f651 100644 --- a/src/lib/libcrypto/asn1/t_req.c +++ b/src/lib/libcrypto/asn1/t_req.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_req.c,v 1.28 2024/05/03 02:52:00 tb Exp $ */ | 1 | /* $OpenBSD: t_req.c,v 1.29 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -62,7 +62,6 @@ | |||
| 62 | 62 | ||
| 63 | #include <openssl/bn.h> | 63 | #include <openssl/bn.h> |
| 64 | #include <openssl/buffer.h> | 64 | #include <openssl/buffer.h> |
| 65 | #include <openssl/err.h> | ||
| 66 | #include <openssl/objects.h> | 65 | #include <openssl/objects.h> |
| 67 | #include <openssl/x509.h> | 66 | #include <openssl/x509.h> |
| 68 | #include <openssl/x509v3.h> | 67 | #include <openssl/x509v3.h> |
| @@ -74,6 +73,7 @@ | |||
| 74 | #include <openssl/rsa.h> | 73 | #include <openssl/rsa.h> |
| 75 | #endif | 74 | #endif |
| 76 | 75 | ||
| 76 | #include "err_local.h" | ||
| 77 | #include "x509_local.h" | 77 | #include "x509_local.h" |
| 78 | 78 | ||
| 79 | int | 79 | int |
diff --git a/src/lib/libcrypto/asn1/t_x509.c b/src/lib/libcrypto/asn1/t_x509.c index 7cf4557314..71f97a8214 100644 --- a/src/lib/libcrypto/asn1/t_x509.c +++ b/src/lib/libcrypto/asn1/t_x509.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_x509.c,v 1.51 2025/02/08 03:41:36 tb Exp $ */ | 1 | /* $OpenBSD: t_x509.c,v 1.54 2025/07/01 06:46:39 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -65,13 +65,13 @@ | |||
| 65 | 65 | ||
| 66 | #include <openssl/asn1.h> | 66 | #include <openssl/asn1.h> |
| 67 | #include <openssl/bio.h> | 67 | #include <openssl/bio.h> |
| 68 | #include <openssl/err.h> | ||
| 69 | #include <openssl/evp.h> | 68 | #include <openssl/evp.h> |
| 70 | #include <openssl/objects.h> | 69 | #include <openssl/objects.h> |
| 71 | #include <openssl/sha.h> | 70 | #include <openssl/sha.h> |
| 72 | #include <openssl/x509.h> | 71 | #include <openssl/x509.h> |
| 73 | #include <openssl/x509v3.h> | 72 | #include <openssl/x509v3.h> |
| 74 | 73 | ||
| 74 | #include "err_local.h" | ||
| 75 | #include "evp_local.h" | 75 | #include "evp_local.h" |
| 76 | #include "x509_local.h" | 76 | #include "x509_local.h" |
| 77 | 77 | ||
| @@ -106,6 +106,28 @@ X509_print(BIO *bp, X509 *x) | |||
| 106 | } | 106 | } |
| 107 | LCRYPTO_ALIAS(X509_print); | 107 | LCRYPTO_ALIAS(X509_print); |
| 108 | 108 | ||
| 109 | static int | ||
| 110 | x509_print_uids(BIO *bp, const X509 *x, int indent) | ||
| 111 | { | ||
| 112 | const ASN1_BIT_STRING *issuerUID = NULL, *subjectUID = NULL; | ||
| 113 | |||
| 114 | X509_get0_uids(x, &issuerUID, &subjectUID); | ||
| 115 | if (issuerUID != NULL) { | ||
| 116 | if (BIO_printf(bp, "%*sIssuer Unique ID: ", indent, "") <= 0) | ||
| 117 | return 0; | ||
| 118 | if (!X509_signature_dump(bp, issuerUID, indent + 4)) | ||
| 119 | return 0; | ||
| 120 | } | ||
| 121 | if (subjectUID != NULL) { | ||
| 122 | if (BIO_printf(bp, "%*sSubject Unique ID: ", indent, "") <= 0) | ||
| 123 | return 0; | ||
| 124 | if (!X509_signature_dump(bp, subjectUID, indent + 4)) | ||
| 125 | return 0; | ||
| 126 | } | ||
| 127 | |||
| 128 | return 1; | ||
| 129 | } | ||
| 130 | |||
| 109 | int | 131 | int |
| 110 | X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) | 132 | X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) |
| 111 | { | 133 | { |
| @@ -127,9 +149,9 @@ X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) | |||
| 127 | 149 | ||
| 128 | ci = x->cert_info; | 150 | ci = x->cert_info; |
| 129 | if (!(cflag & X509_FLAG_NO_HEADER)) { | 151 | if (!(cflag & X509_FLAG_NO_HEADER)) { |
| 130 | if (BIO_write(bp, "Certificate:\n", 13) <= 0) | 152 | if (BIO_printf(bp, "Certificate:\n") <= 0) |
| 131 | goto err; | 153 | goto err; |
| 132 | if (BIO_write(bp, " Data:\n", 10) <= 0) | 154 | if (BIO_printf(bp, " Data:\n") <= 0) |
| 133 | goto err; | 155 | goto err; |
| 134 | } | 156 | } |
| 135 | if (!(cflag & X509_FLAG_NO_VERSION)) { | 157 | if (!(cflag & X509_FLAG_NO_VERSION)) { |
| @@ -145,7 +167,7 @@ X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) | |||
| 145 | } | 167 | } |
| 146 | } | 168 | } |
| 147 | if (!(cflag & X509_FLAG_NO_SERIAL)) { | 169 | if (!(cflag & X509_FLAG_NO_SERIAL)) { |
| 148 | if (BIO_write(bp, " Serial Number:", 22) <= 0) | 170 | if (BIO_printf(bp, " Serial Number:") <= 0) |
| 149 | goto err; | 171 | goto err; |
| 150 | 172 | ||
| 151 | bs = X509_get_serialNumber(x); | 173 | bs = X509_get_serialNumber(x); |
| @@ -196,21 +218,21 @@ X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) | |||
| 196 | if (X509_NAME_print_ex(bp, X509_get_issuer_name(x), | 218 | if (X509_NAME_print_ex(bp, X509_get_issuer_name(x), |
| 197 | nmindent, nmflags) < (nmflags == X509_FLAG_COMPAT ? 1 : 0)) | 219 | nmindent, nmflags) < (nmflags == X509_FLAG_COMPAT ? 1 : 0)) |
| 198 | goto err; | 220 | goto err; |
| 199 | if (BIO_write(bp, "\n", 1) <= 0) | 221 | if (BIO_printf(bp, "\n") <= 0) |
| 200 | goto err; | 222 | goto err; |
| 201 | } | 223 | } |
| 202 | if (!(cflag & X509_FLAG_NO_VALIDITY)) { | 224 | if (!(cflag & X509_FLAG_NO_VALIDITY)) { |
| 203 | if (BIO_write(bp, " Validity\n", 17) <= 0) | 225 | if (BIO_printf(bp, " Validity\n") <= 0) |
| 204 | goto err; | 226 | goto err; |
| 205 | if (BIO_write(bp, " Not Before: ", 24) <= 0) | 227 | if (BIO_printf(bp, " Not Before: ") <= 0) |
| 206 | goto err; | 228 | goto err; |
| 207 | if (!ASN1_TIME_print(bp, X509_get_notBefore(x))) | 229 | if (!ASN1_TIME_print(bp, X509_get_notBefore(x))) |
| 208 | goto err; | 230 | goto err; |
| 209 | if (BIO_write(bp, "\n Not After : ", 25) <= 0) | 231 | if (BIO_printf(bp, "\n Not After : ") <= 0) |
| 210 | goto err; | 232 | goto err; |
| 211 | if (!ASN1_TIME_print(bp, X509_get_notAfter(x))) | 233 | if (!ASN1_TIME_print(bp, X509_get_notAfter(x))) |
| 212 | goto err; | 234 | goto err; |
| 213 | if (BIO_write(bp, "\n", 1) <= 0) | 235 | if (BIO_printf(bp, "\n") <= 0) |
| 214 | goto err; | 236 | goto err; |
| 215 | } | 237 | } |
| 216 | if (!(cflag & X509_FLAG_NO_SUBJECT)) { | 238 | if (!(cflag & X509_FLAG_NO_SUBJECT)) { |
| @@ -219,12 +241,11 @@ X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) | |||
| 219 | if (X509_NAME_print_ex(bp, X509_get_subject_name(x), | 241 | if (X509_NAME_print_ex(bp, X509_get_subject_name(x), |
| 220 | nmindent, nmflags) < (nmflags == X509_FLAG_COMPAT ? 1 : 0)) | 242 | nmindent, nmflags) < (nmflags == X509_FLAG_COMPAT ? 1 : 0)) |
| 221 | goto err; | 243 | goto err; |
| 222 | if (BIO_write(bp, "\n", 1) <= 0) | 244 | if (BIO_printf(bp, "\n") <= 0) |
| 223 | goto err; | 245 | goto err; |
| 224 | } | 246 | } |
| 225 | if (!(cflag & X509_FLAG_NO_PUBKEY)) { | 247 | if (!(cflag & X509_FLAG_NO_PUBKEY)) { |
| 226 | if (BIO_write(bp, " Subject Public Key Info:\n", | 248 | if (BIO_printf(bp, " Subject Public Key Info:\n") <= 0) |
| 227 | 33) <= 0) | ||
| 228 | goto err; | 249 | goto err; |
| 229 | if (BIO_printf(bp, "%12sPublic Key Algorithm: ", "") <= 0) | 250 | if (BIO_printf(bp, "%12sPublic Key Algorithm: ", "") <= 0) |
| 230 | goto err; | 251 | goto err; |
| @@ -243,6 +264,11 @@ X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) | |||
| 243 | } | 264 | } |
| 244 | } | 265 | } |
| 245 | 266 | ||
| 267 | if (!(cflag & X509_FLAG_NO_IDS)) { | ||
| 268 | if (!x509_print_uids(bp, x, 8)) | ||
| 269 | goto err; | ||
| 270 | } | ||
| 271 | |||
| 246 | if (!(cflag & X509_FLAG_NO_EXTENSIONS)) | 272 | if (!(cflag & X509_FLAG_NO_EXTENSIONS)) |
| 247 | X509V3_extensions_print(bp, "X509v3 extensions", | 273 | X509V3_extensions_print(bp, "X509v3 extensions", |
| 248 | ci->extensions, cflag, 8); | 274 | ci->extensions, cflag, 8); |
| @@ -325,7 +351,7 @@ X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent) | |||
| 325 | s = sig->data; | 351 | s = sig->data; |
| 326 | for (i = 0; i < n; i++) { | 352 | for (i = 0; i < n; i++) { |
| 327 | if ((i % 18) == 0) { | 353 | if ((i % 18) == 0) { |
| 328 | if (BIO_write(bp, "\n", 1) <= 0) | 354 | if (BIO_printf(bp, "\n") <= 0) |
| 329 | return 0; | 355 | return 0; |
| 330 | if (BIO_indent(bp, indent, indent) <= 0) | 356 | if (BIO_indent(bp, indent, indent) <= 0) |
| 331 | return 0; | 357 | return 0; |
| @@ -334,7 +360,7 @@ X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent) | |||
| 334 | ((i + 1) == n) ? "" : ":") <= 0) | 360 | ((i + 1) == n) ? "" : ":") <= 0) |
| 335 | return 0; | 361 | return 0; |
| 336 | } | 362 | } |
| 337 | if (BIO_write(bp, "\n", 1) != 1) | 363 | if (BIO_printf(bp, "\n") != 1) |
| 338 | return 0; | 364 | return 0; |
| 339 | 365 | ||
| 340 | return 1; | 366 | return 1; |
| @@ -375,7 +401,7 @@ ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm) | |||
| 375 | return ASN1_UTCTIME_print(bp, tm); | 401 | return ASN1_UTCTIME_print(bp, tm); |
| 376 | if (tm->type == V_ASN1_GENERALIZEDTIME) | 402 | if (tm->type == V_ASN1_GENERALIZEDTIME) |
| 377 | return ASN1_GENERALIZEDTIME_print(bp, tm); | 403 | return ASN1_GENERALIZEDTIME_print(bp, tm); |
| 378 | BIO_write(bp, "Bad time value", 14); | 404 | BIO_printf(bp, "Bad time value"); |
| 379 | return (0); | 405 | return (0); |
| 380 | } | 406 | } |
| 381 | LCRYPTO_ALIAS(ASN1_TIME_print); | 407 | LCRYPTO_ALIAS(ASN1_TIME_print); |
| @@ -435,7 +461,7 @@ ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) | |||
| 435 | return (1); | 461 | return (1); |
| 436 | 462 | ||
| 437 | err: | 463 | err: |
| 438 | BIO_write(bp, "Bad time value", 14); | 464 | BIO_printf(bp, "Bad time value"); |
| 439 | return (0); | 465 | return (0); |
| 440 | } | 466 | } |
| 441 | LCRYPTO_ALIAS(ASN1_GENERALIZEDTIME_print); | 467 | LCRYPTO_ALIAS(ASN1_GENERALIZEDTIME_print); |
| @@ -479,7 +505,7 @@ ASN1_UTCTIME_print(BIO *bp, const ASN1_UTCTIME *tm) | |||
| 479 | return (1); | 505 | return (1); |
| 480 | 506 | ||
| 481 | err: | 507 | err: |
| 482 | BIO_write(bp, "Bad time value", 14); | 508 | BIO_printf(bp, "Bad time value"); |
| 483 | return (0); | 509 | return (0); |
| 484 | } | 510 | } |
| 485 | LCRYPTO_ALIAS(ASN1_UTCTIME_print); | 511 | LCRYPTO_ALIAS(ASN1_UTCTIME_print); |
diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c index 31b9efee54..1bffae8a94 100644 --- a/src/lib/libcrypto/asn1/tasn_dec.c +++ b/src/lib/libcrypto/asn1/tasn_dec.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tasn_dec.c,v 1.88 2023/07/28 10:00:10 tb Exp $ */ | 1 | /* $OpenBSD: tasn_dec.c,v 1.89 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -63,11 +63,11 @@ | |||
| 63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
| 64 | #include <openssl/asn1t.h> | 64 | #include <openssl/asn1t.h> |
| 65 | #include <openssl/buffer.h> | 65 | #include <openssl/buffer.h> |
| 66 | #include <openssl/err.h> | ||
| 67 | #include <openssl/objects.h> | 66 | #include <openssl/objects.h> |
| 68 | 67 | ||
| 69 | #include "asn1_local.h" | 68 | #include "asn1_local.h" |
| 70 | #include "bytestring.h" | 69 | #include "bytestring.h" |
| 70 | #include "err_local.h" | ||
| 71 | 71 | ||
| 72 | /* | 72 | /* |
| 73 | * Constructed types with a recursive definition (such as can be found in PKCS7) | 73 | * Constructed types with a recursive definition (such as can be found in PKCS7) |
diff --git a/src/lib/libcrypto/asn1/tasn_enc.c b/src/lib/libcrypto/asn1/tasn_enc.c index b71993a139..a65fb5b7e7 100644 --- a/src/lib/libcrypto/asn1/tasn_enc.c +++ b/src/lib/libcrypto/asn1/tasn_enc.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tasn_enc.c,v 1.33 2023/07/28 10:00:10 tb Exp $ */ | 1 | /* $OpenBSD: tasn_enc.c,v 1.34 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -61,10 +61,10 @@ | |||
| 61 | 61 | ||
| 62 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
| 63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
| 66 | 65 | ||
| 67 | #include "asn1_local.h" | 66 | #include "asn1_local.h" |
| 67 | #include "err_local.h" | ||
| 68 | 68 | ||
| 69 | static int asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out, | 69 | static int asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out, |
| 70 | const ASN1_ITEM *it, int tag, int aclass); | 70 | const ASN1_ITEM *it, int tag, int aclass); |
diff --git a/src/lib/libcrypto/asn1/tasn_fre.c b/src/lib/libcrypto/asn1/tasn_fre.c index 0e259a13ab..c3de668483 100644 --- a/src/lib/libcrypto/asn1/tasn_fre.c +++ b/src/lib/libcrypto/asn1/tasn_fre.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tasn_fre.c,v 1.24 2024/12/11 11:22:06 tb Exp $ */ | 1 | /* $OpenBSD: tasn_fre.c,v 1.25 2025/08/14 19:02:17 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -147,8 +147,9 @@ asn1_item_free(ASN1_VALUE **pval, const ASN1_ITEM *it) | |||
| 147 | return; | 147 | return; |
| 148 | } | 148 | } |
| 149 | asn1_enc_cleanup(pval, it); | 149 | asn1_enc_cleanup(pval, it); |
| 150 | /* If we free up as normal we will invalidate any | 150 | /* |
| 151 | * ANY DEFINED BY field and we wont be able to | 151 | * If we free up as normal, we will invalidate any |
| 152 | * ANY DEFINED BY field and we won't be able to | ||
| 152 | * determine the type of the field it defines. So | 153 | * determine the type of the field it defines. So |
| 153 | * free up in reverse order. | 154 | * free up in reverse order. |
| 154 | */ | 155 | */ |
diff --git a/src/lib/libcrypto/asn1/tasn_new.c b/src/lib/libcrypto/asn1/tasn_new.c index 10c1137dbf..e17810b832 100644 --- a/src/lib/libcrypto/asn1/tasn_new.c +++ b/src/lib/libcrypto/asn1/tasn_new.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tasn_new.c,v 1.25 2023/07/28 10:00:10 tb Exp $ */ | 1 | /* $OpenBSD: tasn_new.c,v 1.26 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -60,11 +60,11 @@ | |||
| 60 | #include <stddef.h> | 60 | #include <stddef.h> |
| 61 | #include <openssl/asn1.h> | 61 | #include <openssl/asn1.h> |
| 62 | #include <openssl/objects.h> | 62 | #include <openssl/objects.h> |
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
| 65 | #include <string.h> | 64 | #include <string.h> |
| 66 | 65 | ||
| 67 | #include "asn1_local.h" | 66 | #include "asn1_local.h" |
| 67 | #include "err_local.h" | ||
| 68 | 68 | ||
| 69 | static int asn1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it); | 69 | static int asn1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it); |
| 70 | static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it); | 70 | static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it); |
diff --git a/src/lib/libcrypto/asn1/tasn_prn.c b/src/lib/libcrypto/asn1/tasn_prn.c index 07764fc091..4db6d61111 100644 --- a/src/lib/libcrypto/asn1/tasn_prn.c +++ b/src/lib/libcrypto/asn1/tasn_prn.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tasn_prn.c,v 1.27 2024/03/02 09:04:07 tb Exp $ */ | 1 | /* $OpenBSD: tasn_prn.c,v 1.29 2025/06/07 09:28:00 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -61,7 +61,6 @@ | |||
| 61 | #include <openssl/asn1.h> | 61 | #include <openssl/asn1.h> |
| 62 | #include <openssl/asn1t.h> | 62 | #include <openssl/asn1t.h> |
| 63 | #include <openssl/buffer.h> | 63 | #include <openssl/buffer.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
| 66 | #include <openssl/x509v3.h> | 65 | #include <openssl/x509v3.h> |
| 67 | 66 | ||
| @@ -411,7 +410,7 @@ asn1_primitive_print(BIO *out, ASN1_VALUE **fld, const ASN1_ITEM *it, | |||
| 411 | if (!asn1_print_fsname(out, indent, fname, sname, pctx)) | 410 | if (!asn1_print_fsname(out, indent, fname, sname, pctx)) |
| 412 | return 0; | 411 | return 0; |
| 413 | 412 | ||
| 414 | if (it != NULL && it->funcs != NULL) { | 413 | if (it->funcs != NULL) { |
| 415 | const ASN1_PRIMITIVE_FUNCS *pf = it->funcs; | 414 | const ASN1_PRIMITIVE_FUNCS *pf = it->funcs; |
| 416 | 415 | ||
| 417 | if (pf->prim_print == NULL) | 416 | if (pf->prim_print == NULL) |
diff --git a/src/lib/libcrypto/asn1/tasn_typ.c b/src/lib/libcrypto/asn1/tasn_typ.c index 0f7fcb0e03..64faad7240 100644 --- a/src/lib/libcrypto/asn1/tasn_typ.c +++ b/src/lib/libcrypto/asn1/tasn_typ.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tasn_typ.c,v 1.20 2024/07/08 16:24:22 beck Exp $ */ | 1 | /* $OpenBSD: tasn_typ.c,v 1.21 2025/08/22 14:07:34 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -623,6 +623,7 @@ const ASN1_ITEM ASN1_BOOLEAN_it = { | |||
| 623 | .size = -1, | 623 | .size = -1, |
| 624 | .sname = "ASN1_BOOLEAN", | 624 | .sname = "ASN1_BOOLEAN", |
| 625 | }; | 625 | }; |
| 626 | LCRYPTO_ALIAS(ASN1_BOOLEAN_it); | ||
| 626 | 627 | ||
| 627 | int | 628 | int |
| 628 | i2d_ASN1_BOOLEAN(int a, unsigned char **out) | 629 | i2d_ASN1_BOOLEAN(int a, unsigned char **out) |
| @@ -652,6 +653,7 @@ const ASN1_ITEM ASN1_TBOOLEAN_it = { | |||
| 652 | .size = 1, | 653 | .size = 1, |
| 653 | .sname = "ASN1_TBOOLEAN", | 654 | .sname = "ASN1_TBOOLEAN", |
| 654 | }; | 655 | }; |
| 656 | LCRYPTO_ALIAS(ASN1_TBOOLEAN_it); | ||
| 655 | 657 | ||
| 656 | const ASN1_ITEM ASN1_FBOOLEAN_it = { | 658 | const ASN1_ITEM ASN1_FBOOLEAN_it = { |
| 657 | .itype = ASN1_ITYPE_PRIMITIVE, | 659 | .itype = ASN1_ITYPE_PRIMITIVE, |
| @@ -659,6 +661,7 @@ const ASN1_ITEM ASN1_FBOOLEAN_it = { | |||
| 659 | .size = 0, | 661 | .size = 0, |
| 660 | .sname = "ASN1_FBOOLEAN", | 662 | .sname = "ASN1_FBOOLEAN", |
| 661 | }; | 663 | }; |
| 664 | LCRYPTO_ALIAS(ASN1_FBOOLEAN_it); | ||
| 662 | 665 | ||
| 663 | /* Special, OCTET STRING with indefinite length constructed support */ | 666 | /* Special, OCTET STRING with indefinite length constructed support */ |
| 664 | 667 | ||
diff --git a/src/lib/libcrypto/asn1/tasn_utl.c b/src/lib/libcrypto/asn1/tasn_utl.c index ae546edd4b..178a364c89 100644 --- a/src/lib/libcrypto/asn1/tasn_utl.c +++ b/src/lib/libcrypto/asn1/tasn_utl.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tasn_utl.c,v 1.18 2022/12/26 07:18:51 jmc Exp $ */ | 1 | /* $OpenBSD: tasn_utl.c,v 1.19 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -63,9 +63,9 @@ | |||
| 63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
| 64 | #include <openssl/asn1t.h> | 64 | #include <openssl/asn1t.h> |
| 65 | #include <openssl/objects.h> | 65 | #include <openssl/objects.h> |
| 66 | #include <openssl/err.h> | ||
| 67 | 66 | ||
| 68 | #include "bytestring.h" | 67 | #include "bytestring.h" |
| 68 | #include "err_local.h" | ||
| 69 | 69 | ||
| 70 | /* Utility functions for manipulating fields and offsets */ | 70 | /* Utility functions for manipulating fields and offsets */ |
| 71 | 71 | ||
diff --git a/src/lib/libcrypto/asn1/x_crl.c b/src/lib/libcrypto/asn1/x_crl.c index 7ad8350f3d..59f867bc12 100644 --- a/src/lib/libcrypto/asn1/x_crl.c +++ b/src/lib/libcrypto/asn1/x_crl.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x_crl.c,v 1.48 2025/02/27 20:13:41 tb Exp $ */ | 1 | /* $OpenBSD: x_crl.c,v 1.51 2025/08/19 21:54:11 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -61,11 +61,11 @@ | |||
| 61 | #include <openssl/opensslconf.h> | 61 | #include <openssl/opensslconf.h> |
| 62 | 62 | ||
| 63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
| 66 | #include <openssl/x509v3.h> | 65 | #include <openssl/x509v3.h> |
| 67 | 66 | ||
| 68 | #include "asn1_local.h" | 67 | #include "asn1_local.h" |
| 68 | #include "err_local.h" | ||
| 69 | #include "x509_local.h" | 69 | #include "x509_local.h" |
| 70 | 70 | ||
| 71 | static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp); | 71 | static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp); |
| @@ -105,8 +105,9 @@ X509_REVOKED_cmp(const X509_REVOKED * const *a, const X509_REVOKED * const *b) | |||
| 105 | return ASN1_INTEGER_cmp((*a)->serialNumber, (*b)->serialNumber); | 105 | return ASN1_INTEGER_cmp((*a)->serialNumber, (*b)->serialNumber); |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | /* The X509_CRL_INFO structure needs a bit of customisation. | 108 | /* |
| 109 | * Since we cache the original encoding the signature wont be affected by | 109 | * The X509_CRL_INFO structure needs a bit of customisation. |
| 110 | * Since we cache the original encoding, the signature won't be affected by | ||
| 110 | * reordering of the revoked field. | 111 | * reordering of the revoked field. |
| 111 | */ | 112 | */ |
| 112 | static int | 113 | static int |
| @@ -540,6 +541,12 @@ LCRYPTO_ALIAS(X509_CRL_add0_revoked); | |||
| 540 | int | 541 | int |
| 541 | X509_CRL_verify(X509_CRL *crl, EVP_PKEY *pkey) | 542 | X509_CRL_verify(X509_CRL *crl, EVP_PKEY *pkey) |
| 542 | { | 543 | { |
| 544 | /* | ||
| 545 | * The CertificateList's signature AlgorithmIdentifier must match | ||
| 546 | * the one inside the TBSCertList, see RFC 5280, 5.1.1.2, 5.1.2.2. | ||
| 547 | */ | ||
| 548 | if (X509_ALGOR_cmp(crl->sig_alg, crl->crl->sig_alg) != 0) | ||
| 549 | return 0; | ||
| 543 | return ASN1_item_verify(&X509_CRL_INFO_it, crl->sig_alg, crl->signature, | 550 | return ASN1_item_verify(&X509_CRL_INFO_it, crl->sig_alg, crl->signature, |
| 544 | crl->crl, pkey); | 551 | crl->crl, pkey); |
| 545 | } | 552 | } |
diff --git a/src/lib/libcrypto/asn1/x_info.c b/src/lib/libcrypto/asn1/x_info.c deleted file mode 100644 index d2c4bcfe7a..0000000000 --- a/src/lib/libcrypto/asn1/x_info.c +++ /dev/null | |||
| @@ -1,96 +0,0 @@ | |||
| 1 | /* $OpenBSD: x_info.c,v 1.22 2024/12/11 10:28:03 tb Exp $ */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | |||
| 61 | #include <openssl/asn1.h> | ||
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/x509.h> | ||
| 64 | |||
| 65 | X509_INFO * | ||
| 66 | X509_INFO_new(void) | ||
| 67 | { | ||
| 68 | X509_INFO *ret; | ||
| 69 | |||
| 70 | if ((ret = calloc(1, sizeof(X509_INFO))) == NULL) { | ||
| 71 | ASN1error(ERR_R_MALLOC_FAILURE); | ||
| 72 | return NULL; | ||
| 73 | } | ||
| 74 | ret->references = 1; | ||
| 75 | |||
| 76 | return ret; | ||
| 77 | } | ||
| 78 | LCRYPTO_ALIAS(X509_INFO_new); | ||
| 79 | |||
| 80 | void | ||
| 81 | X509_INFO_free(X509_INFO *x) | ||
| 82 | { | ||
| 83 | if (x == NULL) | ||
| 84 | return; | ||
| 85 | |||
| 86 | if (CRYPTO_add(&x->references, -1, CRYPTO_LOCK_X509_INFO) > 0) | ||
| 87 | return; | ||
| 88 | |||
| 89 | X509_free(x->x509); | ||
| 90 | X509_CRL_free(x->crl); | ||
| 91 | X509_PKEY_free(x->x_pkey); | ||
| 92 | free(x->enc_data); | ||
| 93 | |||
| 94 | free(x); | ||
| 95 | } | ||
| 96 | LCRYPTO_ALIAS(X509_INFO_free); | ||
diff --git a/src/lib/libcrypto/asn1/x_long.c b/src/lib/libcrypto/asn1/x_long.c index 5e673f4521..ed463bf7c5 100644 --- a/src/lib/libcrypto/asn1/x_long.c +++ b/src/lib/libcrypto/asn1/x_long.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x_long.c,v 1.21 2024/07/08 16:24:22 beck Exp $ */ | 1 | /* $OpenBSD: x_long.c,v 1.23 2026/01/02 08:03:02 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -61,15 +61,18 @@ | |||
| 61 | 61 | ||
| 62 | #include <openssl/asn1t.h> | 62 | #include <openssl/asn1t.h> |
| 63 | #include <openssl/bn.h> | 63 | #include <openssl/bn.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | 64 | ||
| 66 | #include "asn1_local.h" | 65 | #include "asn1_local.h" |
| 66 | #include "err_local.h" | ||
| 67 | 67 | ||
| 68 | /* | 68 | /* |
| 69 | * Custom primitive type for long handling. This converts between an | 69 | * Custom primitive type for long handling. This converts between an |
| 70 | * ASN1_INTEGER and a long directly. | 70 | * ASN1_INTEGER and a long directly. |
| 71 | */ | 71 | */ |
| 72 | 72 | ||
| 73 | /* Used with ASN1 LONG type: if a long is set to this it is omitted */ | ||
| 74 | #define ASN1_LONG_UNDEF 0x7fffffffL | ||
| 75 | |||
| 73 | static int long_new(ASN1_VALUE **pval, const ASN1_ITEM *it); | 76 | static int long_new(ASN1_VALUE **pval, const ASN1_ITEM *it); |
| 74 | static void long_free(ASN1_VALUE **pval, const ASN1_ITEM *it); | 77 | static void long_free(ASN1_VALUE **pval, const ASN1_ITEM *it); |
| 75 | static void long_clear(ASN1_VALUE **pval, const ASN1_ITEM *it); | 78 | static void long_clear(ASN1_VALUE **pval, const ASN1_ITEM *it); |
| @@ -159,8 +162,9 @@ long_i2c(ASN1_VALUE **pval, unsigned char *content, int *putype, | |||
| 159 | long_get(pval, &val); | 162 | long_get(pval, &val); |
| 160 | 163 | ||
| 161 | /* | 164 | /* |
| 162 | * The zero value for this type (stored in the overloaded it->size | 165 | * Omit this field if it has the zero value for this type (stored |
| 163 | * field) is considered to be invalid. | 166 | * in the overloaded it->size field) - asn1_i2d_ex_primitive() |
| 167 | * specifically checks for a -1 return value. | ||
| 164 | */ | 168 | */ |
| 165 | if (val == it->size) | 169 | if (val == it->size) |
| 166 | return -1; | 170 | return -1; |
diff --git a/src/lib/libcrypto/asn1/x_name.c b/src/lib/libcrypto/asn1/x_name.c index c60714b74f..eab14ad503 100644 --- a/src/lib/libcrypto/asn1/x_name.c +++ b/src/lib/libcrypto/asn1/x_name.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x_name.c,v 1.45 2025/03/20 09:41:47 tb Exp $ */ | 1 | /* $OpenBSD: x_name.c,v 1.47 2026/01/05 05:22:09 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -61,10 +61,10 @@ | |||
| 61 | #include <string.h> | 61 | #include <string.h> |
| 62 | 62 | ||
| 63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
| 66 | 65 | ||
| 67 | #include "asn1_local.h" | 66 | #include "asn1_local.h" |
| 67 | #include "err_local.h" | ||
| 68 | #include "x509_local.h" | 68 | #include "x509_local.h" |
| 69 | 69 | ||
| 70 | typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; | 70 | typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; |
| @@ -194,7 +194,7 @@ static const ASN1_ITEM X509_NAME_INTERNAL_it = { | |||
| 194 | * to the external form. | 194 | * to the external form. |
| 195 | */ | 195 | */ |
| 196 | 196 | ||
| 197 | const ASN1_EXTERN_FUNCS x509_name_ff = { | 197 | static const ASN1_EXTERN_FUNCS x509_name_ff = { |
| 198 | .app_data = NULL, | 198 | .app_data = NULL, |
| 199 | .asn1_ex_new = x509_name_ex_new, | 199 | .asn1_ex_new = x509_name_ex_new, |
| 200 | .asn1_ex_free = x509_name_ex_free, | 200 | .asn1_ex_free = x509_name_ex_free, |
diff --git a/src/lib/libcrypto/asn1/x_pkey.c b/src/lib/libcrypto/asn1/x_pkey.c deleted file mode 100644 index 5c96c13ab9..0000000000 --- a/src/lib/libcrypto/asn1/x_pkey.c +++ /dev/null | |||
| @@ -1,123 +0,0 @@ | |||
| 1 | /* $OpenBSD: x_pkey.c,v 1.24 2024/04/09 13:55:02 beck Exp $ */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <string.h> | ||
| 61 | |||
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/evp.h> | ||
| 64 | #include <openssl/objects.h> | ||
| 65 | #include <openssl/x509.h> | ||
| 66 | |||
| 67 | X509_PKEY * | ||
| 68 | X509_PKEY_new(void) | ||
| 69 | { | ||
| 70 | X509_PKEY *ret = NULL; | ||
| 71 | |||
| 72 | if ((ret = malloc(sizeof(X509_PKEY))) == NULL) { | ||
| 73 | ASN1error(ERR_R_MALLOC_FAILURE); | ||
| 74 | goto err; | ||
| 75 | } | ||
| 76 | ret->version = 0; | ||
| 77 | if ((ret->enc_algor = X509_ALGOR_new()) == NULL) { | ||
| 78 | ASN1error(ERR_R_MALLOC_FAILURE); | ||
| 79 | goto err; | ||
| 80 | } | ||
| 81 | if ((ret->enc_pkey = ASN1_OCTET_STRING_new()) == NULL) { | ||
| 82 | ASN1error(ERR_R_MALLOC_FAILURE); | ||
| 83 | goto err; | ||
| 84 | } | ||
| 85 | ret->dec_pkey = NULL; | ||
| 86 | ret->key_length = 0; | ||
| 87 | ret->key_data = NULL; | ||
| 88 | ret->key_free = 0; | ||
| 89 | ret->cipher.cipher = NULL; | ||
| 90 | memset(ret->cipher.iv, 0, EVP_MAX_IV_LENGTH); | ||
| 91 | ret->references = 1; | ||
| 92 | return (ret); | ||
| 93 | |||
| 94 | err: | ||
| 95 | if (ret) { | ||
| 96 | X509_ALGOR_free(ret->enc_algor); | ||
| 97 | free(ret); | ||
| 98 | } | ||
| 99 | return NULL; | ||
| 100 | } | ||
| 101 | LCRYPTO_ALIAS(X509_PKEY_new); | ||
| 102 | |||
| 103 | void | ||
| 104 | X509_PKEY_free(X509_PKEY *x) | ||
| 105 | { | ||
| 106 | int i; | ||
| 107 | |||
| 108 | if (x == NULL) | ||
| 109 | return; | ||
| 110 | |||
| 111 | i = CRYPTO_add(&x->references, -1, CRYPTO_LOCK_X509_PKEY); | ||
| 112 | if (i > 0) | ||
| 113 | return; | ||
| 114 | |||
| 115 | if (x->enc_algor != NULL) | ||
| 116 | X509_ALGOR_free(x->enc_algor); | ||
| 117 | ASN1_OCTET_STRING_free(x->enc_pkey); | ||
| 118 | EVP_PKEY_free(x->dec_pkey); | ||
| 119 | if ((x->key_data != NULL) && (x->key_free)) | ||
| 120 | free(x->key_data); | ||
| 121 | free(x); | ||
| 122 | } | ||
| 123 | LCRYPTO_ALIAS(X509_PKEY_free); | ||
diff --git a/src/lib/libcrypto/asn1/x_pubkey.c b/src/lib/libcrypto/asn1/x_pubkey.c index 1e772a3458..895b4da4d0 100644 --- a/src/lib/libcrypto/asn1/x_pubkey.c +++ b/src/lib/libcrypto/asn1/x_pubkey.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x_pubkey.c,v 1.37 2024/07/08 14:48:49 beck Exp $ */ | 1 | /* $OpenBSD: x_pubkey.c,v 1.40 2026/01/05 05:23:56 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -61,7 +61,6 @@ | |||
| 61 | #include <openssl/opensslconf.h> | 61 | #include <openssl/opensslconf.h> |
| 62 | 62 | ||
| 63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
| 66 | 65 | ||
| 67 | #ifndef OPENSSL_NO_DSA | 66 | #ifndef OPENSSL_NO_DSA |
| @@ -72,6 +71,7 @@ | |||
| 72 | #endif | 71 | #endif |
| 73 | 72 | ||
| 74 | #include "asn1_local.h" | 73 | #include "asn1_local.h" |
| 74 | #include "err_local.h" | ||
| 75 | #include "evp_local.h" | 75 | #include "evp_local.h" |
| 76 | #include "x509_local.h" | 76 | #include "x509_local.h" |
| 77 | 77 | ||
| @@ -385,7 +385,7 @@ pkey_pubkey_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, | |||
| 385 | return pubkey_ex_i2d(EVP_PKEY_NONE, pval, out, it); | 385 | return pubkey_ex_i2d(EVP_PKEY_NONE, pval, out, it); |
| 386 | } | 386 | } |
| 387 | 387 | ||
| 388 | const ASN1_EXTERN_FUNCS pkey_pubkey_asn1_ff = { | 388 | static const ASN1_EXTERN_FUNCS pkey_pubkey_asn1_ff = { |
| 389 | .app_data = NULL, | 389 | .app_data = NULL, |
| 390 | .asn1_ex_new = pkey_pubkey_ex_new, | 390 | .asn1_ex_new = pkey_pubkey_ex_new, |
| 391 | .asn1_ex_free = pkey_pubkey_ex_free, | 391 | .asn1_ex_free = pkey_pubkey_ex_free, |
| @@ -395,7 +395,7 @@ const ASN1_EXTERN_FUNCS pkey_pubkey_asn1_ff = { | |||
| 395 | .asn1_ex_print = NULL, | 395 | .asn1_ex_print = NULL, |
| 396 | }; | 396 | }; |
| 397 | 397 | ||
| 398 | const ASN1_ITEM EVP_PKEY_PUBKEY_it = { | 398 | static const ASN1_ITEM EVP_PKEY_PUBKEY_it = { |
| 399 | .itype = ASN1_ITYPE_EXTERN, | 399 | .itype = ASN1_ITYPE_EXTERN, |
| 400 | .utype = 0, | 400 | .utype = 0, |
| 401 | .templates = NULL, | 401 | .templates = NULL, |
| @@ -485,7 +485,7 @@ rsa_pubkey_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, | |||
| 485 | return pubkey_ex_i2d(EVP_PKEY_RSA, pval, out, it); | 485 | return pubkey_ex_i2d(EVP_PKEY_RSA, pval, out, it); |
| 486 | } | 486 | } |
| 487 | 487 | ||
| 488 | const ASN1_EXTERN_FUNCS rsa_pubkey_asn1_ff = { | 488 | static const ASN1_EXTERN_FUNCS rsa_pubkey_asn1_ff = { |
| 489 | .app_data = NULL, | 489 | .app_data = NULL, |
| 490 | .asn1_ex_new = rsa_pubkey_ex_new, | 490 | .asn1_ex_new = rsa_pubkey_ex_new, |
| 491 | .asn1_ex_free = rsa_pubkey_ex_free, | 491 | .asn1_ex_free = rsa_pubkey_ex_free, |
| @@ -495,7 +495,7 @@ const ASN1_EXTERN_FUNCS rsa_pubkey_asn1_ff = { | |||
| 495 | .asn1_ex_print = NULL, | 495 | .asn1_ex_print = NULL, |
| 496 | }; | 496 | }; |
| 497 | 497 | ||
| 498 | const ASN1_ITEM RSA_PUBKEY_it = { | 498 | static const ASN1_ITEM RSA_PUBKEY_it = { |
| 499 | .itype = ASN1_ITYPE_EXTERN, | 499 | .itype = ASN1_ITYPE_EXTERN, |
| 500 | .utype = 0, | 500 | .utype = 0, |
| 501 | .templates = NULL, | 501 | .templates = NULL, |
| @@ -581,7 +581,7 @@ dsa_pubkey_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, | |||
| 581 | return pubkey_ex_i2d(EVP_PKEY_DSA, pval, out, it); | 581 | return pubkey_ex_i2d(EVP_PKEY_DSA, pval, out, it); |
| 582 | } | 582 | } |
| 583 | 583 | ||
| 584 | const ASN1_EXTERN_FUNCS dsa_pubkey_asn1_ff = { | 584 | static const ASN1_EXTERN_FUNCS dsa_pubkey_asn1_ff = { |
| 585 | .app_data = NULL, | 585 | .app_data = NULL, |
| 586 | .asn1_ex_new = dsa_pubkey_ex_new, | 586 | .asn1_ex_new = dsa_pubkey_ex_new, |
| 587 | .asn1_ex_free = dsa_pubkey_ex_free, | 587 | .asn1_ex_free = dsa_pubkey_ex_free, |
| @@ -591,7 +591,7 @@ const ASN1_EXTERN_FUNCS dsa_pubkey_asn1_ff = { | |||
| 591 | .asn1_ex_print = NULL, | 591 | .asn1_ex_print = NULL, |
| 592 | }; | 592 | }; |
| 593 | 593 | ||
| 594 | const ASN1_ITEM DSA_PUBKEY_it = { | 594 | static const ASN1_ITEM DSA_PUBKEY_it = { |
| 595 | .itype = ASN1_ITYPE_EXTERN, | 595 | .itype = ASN1_ITYPE_EXTERN, |
| 596 | .utype = 0, | 596 | .utype = 0, |
| 597 | .templates = NULL, | 597 | .templates = NULL, |
| @@ -678,7 +678,7 @@ ec_pubkey_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, | |||
| 678 | return pubkey_ex_i2d(EVP_PKEY_EC, pval, out, it); | 678 | return pubkey_ex_i2d(EVP_PKEY_EC, pval, out, it); |
| 679 | } | 679 | } |
| 680 | 680 | ||
| 681 | const ASN1_EXTERN_FUNCS ec_pubkey_asn1_ff = { | 681 | static const ASN1_EXTERN_FUNCS ec_pubkey_asn1_ff = { |
| 682 | .app_data = NULL, | 682 | .app_data = NULL, |
| 683 | .asn1_ex_new = ec_pubkey_ex_new, | 683 | .asn1_ex_new = ec_pubkey_ex_new, |
| 684 | .asn1_ex_free = ec_pubkey_ex_free, | 684 | .asn1_ex_free = ec_pubkey_ex_free, |
| @@ -688,7 +688,7 @@ const ASN1_EXTERN_FUNCS ec_pubkey_asn1_ff = { | |||
| 688 | .asn1_ex_print = NULL, | 688 | .asn1_ex_print = NULL, |
| 689 | }; | 689 | }; |
| 690 | 690 | ||
| 691 | const ASN1_ITEM EC_PUBKEY_it = { | 691 | static const ASN1_ITEM EC_PUBKEY_it = { |
| 692 | .itype = ASN1_ITYPE_EXTERN, | 692 | .itype = ASN1_ITYPE_EXTERN, |
| 693 | .utype = 0, | 693 | .utype = 0, |
| 694 | .templates = NULL, | 694 | .templates = NULL, |
diff --git a/src/lib/libcrypto/bf/bf_local.h b/src/lib/libcrypto/bf/bf_local.h index 8fc5a5dbd8..2fe65eb85c 100644 --- a/src/lib/libcrypto/bf/bf_local.h +++ b/src/lib/libcrypto/bf/bf_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bf_local.h,v 1.3 2024/03/27 11:54:29 jsing Exp $ */ | 1 | /* $OpenBSD: bf_local.h,v 1.4 2025/06/11 04:08:16 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -56,11 +56,11 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <openssl/opensslconf.h> /* BF_PTR */ | ||
| 60 | |||
| 61 | #ifndef HEADER_BF_LOCL_H | 59 | #ifndef HEADER_BF_LOCL_H |
| 62 | #define HEADER_BF_LOCL_H | 60 | #define HEADER_BF_LOCL_H |
| 63 | 61 | ||
| 62 | #include <openssl/opensslconf.h> | ||
| 63 | |||
| 64 | /* NOTE - c is not incremented as per n2l */ | 64 | /* NOTE - c is not incremented as per n2l */ |
| 65 | #define n2ln(c,l1,l2,n) { \ | 65 | #define n2ln(c,l1,l2,n) { \ |
| 66 | c+=n; \ | 66 | c+=n; \ |
| @@ -104,46 +104,6 @@ | |||
| 104 | *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ | 104 | *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ |
| 105 | *((c)++)=(unsigned char)(((l) )&0xff)) | 105 | *((c)++)=(unsigned char)(((l) )&0xff)) |
| 106 | 106 | ||
| 107 | /* This is actually a big endian algorithm, the most significant byte | ||
| 108 | * is used to lookup array 0 */ | ||
| 109 | |||
| 110 | #if defined(BF_PTR) | ||
| 111 | |||
| 112 | #ifndef BF_LONG_LOG2 | ||
| 113 | #define BF_LONG_LOG2 2 /* default to BF_LONG being 32 bits */ | ||
| 114 | #endif | ||
| 115 | #define BF_M (0xFF<<BF_LONG_LOG2) | ||
| 116 | #define BF_0 (24-BF_LONG_LOG2) | ||
| 117 | #define BF_1 (16-BF_LONG_LOG2) | ||
| 118 | #define BF_2 ( 8-BF_LONG_LOG2) | ||
| 119 | #define BF_3 BF_LONG_LOG2 /* left shift */ | ||
| 120 | |||
| 121 | /* | ||
| 122 | * This is normally very good on RISC platforms where normally you | ||
| 123 | * have to explicitly "multiply" array index by sizeof(BF_LONG) | ||
| 124 | * in order to calculate the effective address. This implementation | ||
| 125 | * excuses CPU from this extra work. Power[PC] uses should have most | ||
| 126 | * fun as (R>>BF_i)&BF_M gets folded into a single instruction, namely | ||
| 127 | * rlwinm. So let'em double-check if their compiler does it. | ||
| 128 | */ | ||
| 129 | |||
| 130 | #define BF_ENC(LL,R,S,P) ( \ | ||
| 131 | LL^=P, \ | ||
| 132 | LL^= (((*(BF_LONG *)((unsigned char *)&(S[ 0])+((R>>BF_0)&BF_M))+ \ | ||
| 133 | *(BF_LONG *)((unsigned char *)&(S[256])+((R>>BF_1)&BF_M)))^ \ | ||
| 134 | *(BF_LONG *)((unsigned char *)&(S[512])+((R>>BF_2)&BF_M)))+ \ | ||
| 135 | *(BF_LONG *)((unsigned char *)&(S[768])+((R<<BF_3)&BF_M))) \ | ||
| 136 | ) | ||
| 137 | #else | ||
| 138 | |||
| 139 | /* | ||
| 140 | * This is a *generic* version. Seem to perform best on platforms that | ||
| 141 | * offer explicit support for extraction of 8-bit nibbles preferably | ||
| 142 | * complemented with "multiplying" of array index by sizeof(BF_LONG). | ||
| 143 | * For the moment of this writing the list comprises Alpha CPU featuring | ||
| 144 | * extbl and s[48]addq instructions. | ||
| 145 | */ | ||
| 146 | |||
| 147 | #define BF_ENC(LL,R,S,P) ( \ | 107 | #define BF_ENC(LL,R,S,P) ( \ |
| 148 | LL^=P, \ | 108 | LL^=P, \ |
| 149 | LL^=((( S[ ((int)(R>>24)&0xff)] + \ | 109 | LL^=((( S[ ((int)(R>>24)&0xff)] + \ |
| @@ -151,6 +111,5 @@ | |||
| 151 | S[0x0200+((int)(R>> 8)&0xff)])+ \ | 111 | S[0x0200+((int)(R>> 8)&0xff)])+ \ |
| 152 | S[0x0300+((int)(R )&0xff)])&0xffffffffL \ | 112 | S[0x0300+((int)(R )&0xff)])&0xffffffffL \ |
| 153 | ) | 113 | ) |
| 154 | #endif | ||
| 155 | 114 | ||
| 156 | #endif | 115 | #endif |
diff --git a/src/lib/libcrypto/bio/b_dump.c b/src/lib/libcrypto/bio/b_dump.c index 4dcf710bbe..3f673205c1 100644 --- a/src/lib/libcrypto/bio/b_dump.c +++ b/src/lib/libcrypto/bio/b_dump.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: b_dump.c,v 1.30 2024/03/02 09:21:24 tb Exp $ */ | 1 | /* $OpenBSD: b_dump.c,v 1.31 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -62,7 +62,6 @@ | |||
| 62 | #include <string.h> | 62 | #include <string.h> |
| 63 | 63 | ||
| 64 | #include <openssl/bio.h> | 64 | #include <openssl/bio.h> |
| 65 | #include <openssl/err.h> | ||
| 66 | 65 | ||
| 67 | #include "bytestring.h" | 66 | #include "bytestring.h" |
| 68 | 67 | ||
diff --git a/src/lib/libcrypto/bio/b_sock.c b/src/lib/libcrypto/bio/b_sock.c index 00bbe9c37e..9ef9953b95 100644 --- a/src/lib/libcrypto/bio/b_sock.c +++ b/src/lib/libcrypto/bio/b_sock.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: b_sock.c,v 1.71 2023/07/05 21:23:37 beck Exp $ */ | 1 | /* $OpenBSD: b_sock.c,v 1.72 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2017 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2017 Bob Beck <beck@openbsd.org> |
| 4 | * | 4 | * |
| @@ -32,7 +32,8 @@ | |||
| 32 | 32 | ||
| 33 | #include <openssl/bio.h> | 33 | #include <openssl/bio.h> |
| 34 | #include <openssl/buffer.h> | 34 | #include <openssl/buffer.h> |
| 35 | #include <openssl/err.h> | 35 | |
| 36 | #include "err_local.h" | ||
| 36 | 37 | ||
| 37 | int | 38 | int |
| 38 | BIO_get_host_ip(const char *str, unsigned char *ip) | 39 | BIO_get_host_ip(const char *str, unsigned char *ip) |
diff --git a/src/lib/libcrypto/bio/bf_buff.c b/src/lib/libcrypto/bio/bf_buff.c index 226c16835a..36b6fabde3 100644 --- a/src/lib/libcrypto/bio/bf_buff.c +++ b/src/lib/libcrypto/bio/bf_buff.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bf_buff.c,v 1.28 2023/07/05 21:23:37 beck Exp $ */ | 1 | /* $OpenBSD: bf_buff.c,v 1.29 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -61,9 +61,9 @@ | |||
| 61 | #include <string.h> | 61 | #include <string.h> |
| 62 | 62 | ||
| 63 | #include <openssl/bio.h> | 63 | #include <openssl/bio.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | 64 | ||
| 66 | #include "bio_local.h" | 65 | #include "bio_local.h" |
| 66 | #include "err_local.h" | ||
| 67 | 67 | ||
| 68 | static int buffer_write(BIO *h, const char *buf, int num); | 68 | static int buffer_write(BIO *h, const char *buf, int num); |
| 69 | static int buffer_read(BIO *h, char *buf, int size); | 69 | static int buffer_read(BIO *h, char *buf, int size); |
diff --git a/src/lib/libcrypto/bio/bio.h b/src/lib/libcrypto/bio/bio.h index 8327ffc071..a8108054e7 100644 --- a/src/lib/libcrypto/bio/bio.h +++ b/src/lib/libcrypto/bio/bio.h | |||
| @@ -1,25 +1,25 @@ | |||
| 1 | /* $OpenBSD: bio.h,v 1.64 2024/05/19 07:12:50 jsg Exp $ */ | 1 | /* $OpenBSD: bio.h,v 1.65 2025/07/16 18:12:54 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| 5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
| 6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
| 7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
| 8 | * | 8 | * |
| 9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
| 10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | 11 | * apply to all code found in this distribution, be it the RC4, RSA, |
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation |
| 13 | * included with this distribution is covered by the same copyright terms | 13 | * included with this distribution is covered by the same copyright terms |
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
| 15 | * | 15 | * |
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
| 17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
| 18 | * If this package is used in a product, Eric Young should be given attribution | 18 | * If this package is used in a product, Eric Young should be given attribution |
| 19 | * as the author of the parts of the library used. | 19 | * as the author of the parts of the library used. |
| 20 | * This can be in the form of a textual message at program startup or | 20 | * This can be in the form of a textual message at program startup or |
| 21 | * in documentation (online or textual) provided with the package. | 21 | * in documentation (online or textual) provided with the package. |
| 22 | * | 22 | * |
| 23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
| 24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
| 25 | * are met: | 25 | * are met: |
| @@ -34,10 +34,10 @@ | |||
| 34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
| 36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 37 | * 4. If you include any Windows specific code (or a derivative thereof) from |
| 38 | * the apps directory (application code) you must include an acknowledgement: | 38 | * the apps directory (application code) you must include an acknowledgement: |
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
| 40 | * | 40 | * |
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| @@ -49,7 +49,7 @@ | |||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
| 52 | * | 52 | * |
| 53 | * The licence and distribution terms for any publically available version or | 53 | * The licence and distribution terms for any publically available version or |
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
| 55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
| @@ -96,8 +96,8 @@ extern "C" { | |||
| 96 | #define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */ | 96 | #define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */ |
| 97 | #define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */ | 97 | #define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */ |
| 98 | #define BIO_TYPE_DGRAM (21|0x0400|0x0100) | 98 | #define BIO_TYPE_DGRAM (21|0x0400|0x0100) |
| 99 | #define BIO_TYPE_ASN1 (22|0x0200) /* filter */ | 99 | #define BIO_TYPE_ASN1 (22|0x0200) /* filter */ |
| 100 | #define BIO_TYPE_COMP (23|0x0200) /* filter */ | 100 | #define BIO_TYPE_COMP (23|0x0200) /* filter */ |
| 101 | 101 | ||
| 102 | #define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ | 102 | #define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ |
| 103 | #define BIO_TYPE_FILTER 0x0200 | 103 | #define BIO_TYPE_FILTER 0x0200 |
| @@ -139,14 +139,14 @@ extern "C" { | |||
| 139 | #define BIO_CTRL_DGRAM_CONNECT 31 /* BIO dgram special */ | 139 | #define BIO_CTRL_DGRAM_CONNECT 31 /* BIO dgram special */ |
| 140 | #define BIO_CTRL_DGRAM_SET_CONNECTED 32 /* allow for an externally | 140 | #define BIO_CTRL_DGRAM_SET_CONNECTED 32 /* allow for an externally |
| 141 | * connected socket to be | 141 | * connected socket to be |
| 142 | * passed in */ | 142 | * passed in */ |
| 143 | #define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33 /* setsockopt, essentially */ | 143 | #define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33 /* setsockopt, essentially */ |
| 144 | #define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34 /* getsockopt, essentially */ | 144 | #define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34 /* getsockopt, essentially */ |
| 145 | #define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35 /* setsockopt, essentially */ | 145 | #define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35 /* setsockopt, essentially */ |
| 146 | #define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36 /* getsockopt, essentially */ | 146 | #define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36 /* getsockopt, essentially */ |
| 147 | 147 | ||
| 148 | #define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37 /* flag whether the last */ | 148 | #define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37 /* flag whether the last */ |
| 149 | #define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38 /* I/O operation tiemd out */ | 149 | #define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38 /* I/O operation timed out */ |
| 150 | 150 | ||
| 151 | /* #ifdef IP_MTU_DISCOVER */ | 151 | /* #ifdef IP_MTU_DISCOVER */ |
| 152 | #define BIO_CTRL_DGRAM_MTU_DISCOVER 39 /* set DF bit on egress packets */ | 152 | #define BIO_CTRL_DGRAM_MTU_DISCOVER 39 /* set DF bit on egress packets */ |
| @@ -232,7 +232,7 @@ void BIO_clear_flags(BIO *b, int flags); | |||
| 232 | 232 | ||
| 233 | /* The next three are used in conjunction with the | 233 | /* The next three are used in conjunction with the |
| 234 | * BIO_should_io_special() condition. After this returns true, | 234 | * BIO_should_io_special() condition. After this returns true, |
| 235 | * BIO *BIO_get_retry_BIO(BIO *bio, int *reason); will walk the BIO | 235 | * BIO *BIO_get_retry_BIO(BIO *bio, int *reason); will walk the BIO |
| 236 | * stack and return the 'reason' for the special and the offending BIO. | 236 | * stack and return the 'reason' for the special and the offending BIO. |
| 237 | * Given a BIO, BIO_get_retry_reason(bio) will return the code. */ | 237 | * Given a BIO, BIO_get_retry_reason(bio) will return the code. */ |
| 238 | /* Returned from the SSL bio when the certificate retrieval code had an error */ | 238 | /* Returned from the SSL bio when the certificate retrieval code had an error */ |
| @@ -380,7 +380,7 @@ int BIO_meth_set_callback_ctrl(BIO_METHOD *biom, | |||
| 380 | #define BIO_set_conn_int_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,3,(char *)port) | 380 | #define BIO_set_conn_int_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,3,(char *)port) |
| 381 | #define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0) | 381 | #define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0) |
| 382 | #define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1) | 382 | #define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1) |
| 383 | #define BIO_get_conn_ip(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2) | 383 | #define BIO_get_conn_ip(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2) |
| 384 | #define BIO_get_conn_int_port(b) BIO_int_ctrl(b,BIO_C_GET_CONNECT,3,0) | 384 | #define BIO_get_conn_int_port(b) BIO_int_ctrl(b,BIO_C_GET_CONNECT,3,0) |
| 385 | 385 | ||
| 386 | 386 | ||
| @@ -571,7 +571,6 @@ const BIO_METHOD *BIO_s_socket(void); | |||
| 571 | const BIO_METHOD *BIO_s_connect(void); | 571 | const BIO_METHOD *BIO_s_connect(void); |
| 572 | const BIO_METHOD *BIO_s_accept(void); | 572 | const BIO_METHOD *BIO_s_accept(void); |
| 573 | const BIO_METHOD *BIO_s_fd(void); | 573 | const BIO_METHOD *BIO_s_fd(void); |
| 574 | const BIO_METHOD *BIO_s_log(void); | ||
| 575 | const BIO_METHOD *BIO_s_bio(void); | 574 | const BIO_METHOD *BIO_s_bio(void); |
| 576 | const BIO_METHOD *BIO_s_null(void); | 575 | const BIO_METHOD *BIO_s_null(void); |
| 577 | const BIO_METHOD *BIO_f_null(void); | 576 | const BIO_METHOD *BIO_f_null(void); |
diff --git a/src/lib/libcrypto/bio/bio_cb.c b/src/lib/libcrypto/bio/bio_cb.c index 18e9be8d68..990cb20708 100644 --- a/src/lib/libcrypto/bio/bio_cb.c +++ b/src/lib/libcrypto/bio/bio_cb.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bio_cb.c,v 1.19 2023/07/05 21:23:37 beck Exp $ */ | 1 | /* $OpenBSD: bio_cb.c,v 1.20 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -60,7 +60,6 @@ | |||
| 60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
| 61 | #include <string.h> | 61 | #include <string.h> |
| 62 | 62 | ||
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/bio.h> | 63 | #include <openssl/bio.h> |
| 65 | 64 | ||
| 66 | #include "bio_local.h" | 65 | #include "bio_local.h" |
diff --git a/src/lib/libcrypto/bio/bio_lib.c b/src/lib/libcrypto/bio/bio_lib.c index 463d2ad23a..04e8f4c295 100644 --- a/src/lib/libcrypto/bio/bio_lib.c +++ b/src/lib/libcrypto/bio/bio_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bio_lib.c,v 1.54 2024/07/09 06:14:59 beck Exp $ */ | 1 | /* $OpenBSD: bio_lib.c,v 1.55 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -62,10 +62,10 @@ | |||
| 62 | 62 | ||
| 63 | #include <openssl/bio.h> | 63 | #include <openssl/bio.h> |
| 64 | #include <openssl/crypto.h> | 64 | #include <openssl/crypto.h> |
| 65 | #include <openssl/err.h> | ||
| 66 | #include <openssl/stack.h> | 65 | #include <openssl/stack.h> |
| 67 | 66 | ||
| 68 | #include "bio_local.h" | 67 | #include "bio_local.h" |
| 68 | #include "err_local.h" | ||
| 69 | 69 | ||
| 70 | /* | 70 | /* |
| 71 | * Helper function to work out whether to call the new style callback or the old | 71 | * Helper function to work out whether to call the new style callback or the old |
diff --git a/src/lib/libcrypto/bio/bss_acpt.c b/src/lib/libcrypto/bio/bss_acpt.c index d74c710a7f..60e61100b1 100644 --- a/src/lib/libcrypto/bio/bss_acpt.c +++ b/src/lib/libcrypto/bio/bss_acpt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bss_acpt.c,v 1.31 2023/07/05 21:23:37 beck Exp $ */ | 1 | /* $OpenBSD: bss_acpt.c,v 1.33 2025/06/02 12:18:21 jsg Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -65,9 +65,9 @@ | |||
| 65 | 65 | ||
| 66 | #include <openssl/bio.h> | 66 | #include <openssl/bio.h> |
| 67 | #include <openssl/buffer.h> | 67 | #include <openssl/buffer.h> |
| 68 | #include <openssl/err.h> | ||
| 69 | 68 | ||
| 70 | #include "bio_local.h" | 69 | #include "bio_local.h" |
| 70 | #include "err_local.h" | ||
| 71 | 71 | ||
| 72 | #define SOCKET_PROTOCOL IPPROTO_TCP | 72 | #define SOCKET_PROTOCOL IPPROTO_TCP |
| 73 | 73 | ||
| @@ -261,11 +261,12 @@ again: | |||
| 261 | if (c->bio_chain != NULL) { | 261 | if (c->bio_chain != NULL) { |
| 262 | if ((dbio = BIO_dup_chain(c->bio_chain)) == NULL) | 262 | if ((dbio = BIO_dup_chain(c->bio_chain)) == NULL) |
| 263 | goto err; | 263 | goto err; |
| 264 | if (!BIO_push(dbio, bio)) goto err; | 264 | if (!BIO_push(dbio, bio)) |
| 265 | bio = dbio; | 265 | goto err; |
| 266 | bio = dbio; | ||
| 266 | } | 267 | } |
| 267 | if (BIO_push(b, bio) | 268 | if (BIO_push(b, bio) == NULL) |
| 268 | == NULL) goto err; | 269 | goto err; |
| 269 | 270 | ||
| 270 | c->state = ACPT_S_OK; | 271 | c->state = ACPT_S_OK; |
| 271 | return (1); | 272 | return (1); |
diff --git a/src/lib/libcrypto/bio/bss_bio.c b/src/lib/libcrypto/bio/bss_bio.c index 39d8d1e46c..f1d1bbeecd 100644 --- a/src/lib/libcrypto/bio/bss_bio.c +++ b/src/lib/libcrypto/bio/bss_bio.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bss_bio.c,v 1.29 2024/07/09 06:14:59 beck Exp $ */ | 1 | /* $OpenBSD: bss_bio.c,v 1.30 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -81,10 +81,10 @@ | |||
| 81 | #include <sys/types.h> | 81 | #include <sys/types.h> |
| 82 | 82 | ||
| 83 | #include <openssl/bio.h> | 83 | #include <openssl/bio.h> |
| 84 | #include <openssl/err.h> | ||
| 85 | #include <openssl/crypto.h> | 84 | #include <openssl/crypto.h> |
| 86 | 85 | ||
| 87 | #include "bio_local.h" | 86 | #include "bio_local.h" |
| 87 | #include "err_local.h" | ||
| 88 | 88 | ||
| 89 | static int bio_new(BIO *bio); | 89 | static int bio_new(BIO *bio); |
| 90 | static int bio_free(BIO *bio); | 90 | static int bio_free(BIO *bio); |
diff --git a/src/lib/libcrypto/bio/bss_conn.c b/src/lib/libcrypto/bio/bss_conn.c index 3b0e3d3bdd..14f410f59d 100644 --- a/src/lib/libcrypto/bio/bss_conn.c +++ b/src/lib/libcrypto/bio/bss_conn.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bss_conn.c,v 1.41 2024/04/19 09:54:36 tb Exp $ */ | 1 | /* $OpenBSD: bss_conn.c,v 1.43 2025/06/02 12:18:21 jsg Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -68,9 +68,9 @@ | |||
| 68 | 68 | ||
| 69 | #include <openssl/bio.h> | 69 | #include <openssl/bio.h> |
| 70 | #include <openssl/buffer.h> | 70 | #include <openssl/buffer.h> |
| 71 | #include <openssl/err.h> | ||
| 72 | 71 | ||
| 73 | #include "bio_local.h" | 72 | #include "bio_local.h" |
| 73 | #include "err_local.h" | ||
| 74 | 74 | ||
| 75 | #define SOCKET_PROTOCOL IPPROTO_TCP | 75 | #define SOCKET_PROTOCOL IPPROTO_TCP |
| 76 | 76 | ||
| @@ -141,7 +141,7 @@ conn_state(BIO *b, BIO_CONNECT *c) | |||
| 141 | } | 141 | } |
| 142 | for (; *p != '\0'; p++) { | 142 | for (; *p != '\0'; p++) { |
| 143 | if ((*p == ':') || (*p == '/')) | 143 | if ((*p == ':') || (*p == '/')) |
| 144 | break; | 144 | break; |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | i= *p; | 147 | i= *p; |
diff --git a/src/lib/libcrypto/bio/bss_file.c b/src/lib/libcrypto/bio/bss_file.c index 9b6ca2bdd8..21f71718bb 100644 --- a/src/lib/libcrypto/bio/bss_file.c +++ b/src/lib/libcrypto/bio/bss_file.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bss_file.c,v 1.35 2023/07/05 21:23:37 beck Exp $ */ | 1 | /* $OpenBSD: bss_file.c,v 1.36 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -88,9 +88,9 @@ | |||
| 88 | #include <string.h> | 88 | #include <string.h> |
| 89 | 89 | ||
| 90 | #include <openssl/bio.h> | 90 | #include <openssl/bio.h> |
| 91 | #include <openssl/err.h> | ||
| 92 | 91 | ||
| 93 | #include "bio_local.h" | 92 | #include "bio_local.h" |
| 93 | #include "err_local.h" | ||
| 94 | 94 | ||
| 95 | static int file_write(BIO *h, const char *buf, int num); | 95 | static int file_write(BIO *h, const char *buf, int num); |
| 96 | static int file_read(BIO *h, char *buf, int size); | 96 | static int file_read(BIO *h, char *buf, int size); |
diff --git a/src/lib/libcrypto/bio/bss_log.c b/src/lib/libcrypto/bio/bss_log.c deleted file mode 100644 index 9e2e882646..0000000000 --- a/src/lib/libcrypto/bio/bss_log.c +++ /dev/null | |||
| @@ -1,216 +0,0 @@ | |||
| 1 | /* $OpenBSD: bss_log.c,v 1.24 2023/07/05 21:23:37 beck Exp $ */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * licensing@OpenSSL.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | * ==================================================================== | ||
| 49 | * | ||
| 50 | * This product includes cryptographic software written by Eric Young | ||
| 51 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 52 | * Hudson (tjh@cryptsoft.com). | ||
| 53 | * | ||
| 54 | */ | ||
| 55 | |||
| 56 | /* | ||
| 57 | Why BIO_s_log? | ||
| 58 | |||
| 59 | BIO_s_log is useful for system daemons (or services under NT). | ||
| 60 | It is one-way BIO, it sends all stuff to syslogd (on system that | ||
| 61 | commonly use that), or event log (on NT), or OPCOM (on OpenVMS). | ||
| 62 | |||
| 63 | */ | ||
| 64 | |||
| 65 | #include <errno.h> | ||
| 66 | #include <stdio.h> | ||
| 67 | #include <string.h> | ||
| 68 | #include <syslog.h> | ||
| 69 | |||
| 70 | #include <openssl/buffer.h> | ||
| 71 | #include <openssl/err.h> | ||
| 72 | |||
| 73 | #include "bio_local.h" | ||
| 74 | |||
| 75 | #ifndef NO_SYSLOG | ||
| 76 | |||
| 77 | static int slg_write(BIO *h, const char *buf, int num); | ||
| 78 | static int slg_puts(BIO *h, const char *str); | ||
| 79 | static long slg_ctrl(BIO *h, int cmd, long arg1, void *arg2); | ||
| 80 | static int slg_new(BIO *h); | ||
| 81 | static int slg_free(BIO *data); | ||
| 82 | static void xopenlog(BIO* bp, char* name, int level); | ||
| 83 | static void xsyslog(BIO* bp, int priority, const char* string); | ||
| 84 | static void xcloselog(BIO* bp); | ||
| 85 | |||
| 86 | static const BIO_METHOD methods_slg = { | ||
| 87 | .type = BIO_TYPE_MEM, | ||
| 88 | .name = "syslog", | ||
| 89 | .bwrite = slg_write, | ||
| 90 | .bputs = slg_puts, | ||
| 91 | .ctrl = slg_ctrl, | ||
| 92 | .create = slg_new, | ||
| 93 | .destroy = slg_free | ||
| 94 | }; | ||
| 95 | |||
| 96 | const BIO_METHOD * | ||
| 97 | BIO_s_log(void) | ||
| 98 | { | ||
| 99 | return (&methods_slg); | ||
| 100 | } | ||
| 101 | LCRYPTO_ALIAS(BIO_s_log); | ||
| 102 | |||
| 103 | static int | ||
| 104 | slg_new(BIO *bi) | ||
| 105 | { | ||
| 106 | bi->init = 1; | ||
| 107 | bi->num = 0; | ||
| 108 | bi->ptr = NULL; | ||
| 109 | xopenlog(bi, "application", LOG_DAEMON); | ||
| 110 | return (1); | ||
| 111 | } | ||
| 112 | |||
| 113 | static int | ||
| 114 | slg_free(BIO *a) | ||
| 115 | { | ||
| 116 | if (a == NULL) | ||
| 117 | return (0); | ||
| 118 | xcloselog(a); | ||
| 119 | return (1); | ||
| 120 | } | ||
| 121 | |||
| 122 | static int | ||
| 123 | slg_write(BIO *b, const char *in, int inl) | ||
| 124 | { | ||
| 125 | int ret = inl; | ||
| 126 | char* buf; | ||
| 127 | char* pp; | ||
| 128 | int priority, i; | ||
| 129 | static const struct { | ||
| 130 | int strl; | ||
| 131 | char str[10]; | ||
| 132 | int log_level; | ||
| 133 | } | ||
| 134 | mapping[] = { | ||
| 135 | { 6, "PANIC ", LOG_EMERG }, | ||
| 136 | { 6, "EMERG ", LOG_EMERG }, | ||
| 137 | { 4, "EMR ", LOG_EMERG }, | ||
| 138 | { 6, "ALERT ", LOG_ALERT }, | ||
| 139 | { 4, "ALR ", LOG_ALERT }, | ||
| 140 | { 5, "CRIT ", LOG_CRIT }, | ||
| 141 | { 4, "CRI ", LOG_CRIT }, | ||
| 142 | { 6, "ERROR ", LOG_ERR }, | ||
| 143 | { 4, "ERR ", LOG_ERR }, | ||
| 144 | { 8, "WARNING ", LOG_WARNING }, | ||
| 145 | { 5, "WARN ", LOG_WARNING }, | ||
| 146 | { 4, "WAR ", LOG_WARNING }, | ||
| 147 | { 7, "NOTICE ", LOG_NOTICE }, | ||
| 148 | { 5, "NOTE ", LOG_NOTICE }, | ||
| 149 | { 4, "NOT ", LOG_NOTICE }, | ||
| 150 | { 5, "INFO ", LOG_INFO }, | ||
| 151 | { 4, "INF ", LOG_INFO }, | ||
| 152 | { 6, "DEBUG ", LOG_DEBUG }, | ||
| 153 | { 4, "DBG ", LOG_DEBUG }, | ||
| 154 | { 0, "", LOG_ERR } /* The default */ | ||
| 155 | }; | ||
| 156 | |||
| 157 | if ((buf = malloc(inl + 1)) == NULL) { | ||
| 158 | return (0); | ||
| 159 | } | ||
| 160 | strlcpy(buf, in, inl + 1); | ||
| 161 | i = 0; | ||
| 162 | while (strncmp(buf, mapping[i].str, mapping[i].strl) != 0) | ||
| 163 | i++; | ||
| 164 | priority = mapping[i].log_level; | ||
| 165 | pp = buf + mapping[i].strl; | ||
| 166 | |||
| 167 | xsyslog(b, priority, pp); | ||
| 168 | |||
| 169 | free(buf); | ||
| 170 | return (ret); | ||
| 171 | } | ||
| 172 | |||
| 173 | static long | ||
| 174 | slg_ctrl(BIO *b, int cmd, long num, void *ptr) | ||
| 175 | { | ||
| 176 | switch (cmd) { | ||
| 177 | case BIO_CTRL_SET: | ||
| 178 | xcloselog(b); | ||
| 179 | xopenlog(b, ptr, num); | ||
| 180 | break; | ||
| 181 | default: | ||
| 182 | break; | ||
| 183 | } | ||
| 184 | return (0); | ||
| 185 | } | ||
| 186 | |||
| 187 | static int | ||
| 188 | slg_puts(BIO *bp, const char *str) | ||
| 189 | { | ||
| 190 | int n, ret; | ||
| 191 | |||
| 192 | n = strlen(str); | ||
| 193 | ret = slg_write(bp, str, n); | ||
| 194 | return (ret); | ||
| 195 | } | ||
| 196 | |||
| 197 | |||
| 198 | static void | ||
| 199 | xopenlog(BIO* bp, char* name, int level) | ||
| 200 | { | ||
| 201 | openlog(name, LOG_PID|LOG_CONS, level); | ||
| 202 | } | ||
| 203 | |||
| 204 | static void | ||
| 205 | xsyslog(BIO *bp, int priority, const char *string) | ||
| 206 | { | ||
| 207 | syslog(priority, "%s", string); | ||
| 208 | } | ||
| 209 | |||
| 210 | static void | ||
| 211 | xcloselog(BIO* bp) | ||
| 212 | { | ||
| 213 | closelog(); | ||
| 214 | } | ||
| 215 | |||
| 216 | #endif /* NO_SYSLOG */ | ||
diff --git a/src/lib/libcrypto/bio/bss_mem.c b/src/lib/libcrypto/bio/bss_mem.c index 6d0d54db84..0fa6317a2b 100644 --- a/src/lib/libcrypto/bio/bss_mem.c +++ b/src/lib/libcrypto/bio/bss_mem.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bss_mem.c,v 1.22 2023/07/05 21:23:37 beck Exp $ */ | 1 | /* $OpenBSD: bss_mem.c,v 1.27 2025/05/31 11:31:16 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -62,10 +62,10 @@ | |||
| 62 | #include <string.h> | 62 | #include <string.h> |
| 63 | 63 | ||
| 64 | #include <openssl/bio.h> | 64 | #include <openssl/bio.h> |
| 65 | #include <openssl/err.h> | ||
| 66 | #include <openssl/buffer.h> | 65 | #include <openssl/buffer.h> |
| 67 | 66 | ||
| 68 | #include "bio_local.h" | 67 | #include "bio_local.h" |
| 68 | #include "err_local.h" | ||
| 69 | 69 | ||
| 70 | struct bio_mem { | 70 | struct bio_mem { |
| 71 | BUF_MEM *buf; | 71 | BUF_MEM *buf; |
| @@ -140,6 +140,7 @@ BIO_new_mem_buf(const void *buf, int buf_len) | |||
| 140 | return NULL; | 140 | return NULL; |
| 141 | 141 | ||
| 142 | bm = bio->ptr; | 142 | bm = bio->ptr; |
| 143 | free(bm->buf->data); | ||
| 143 | bm->buf->data = (void *)buf; /* Trust in the BIO_FLAGS_MEM_RDONLY flag. */ | 144 | bm->buf->data = (void *)buf; /* Trust in the BIO_FLAGS_MEM_RDONLY flag. */ |
| 144 | bm->buf->length = buf_len; | 145 | bm->buf->length = buf_len; |
| 145 | bm->buf->max = buf_len; | 146 | bm->buf->max = buf_len; |
| @@ -162,6 +163,12 @@ mem_new(BIO *bio) | |||
| 162 | free(bm); | 163 | free(bm); |
| 163 | return 0; | 164 | return 0; |
| 164 | } | 165 | } |
| 166 | if (BUF_MEM_grow_clean(bm->buf, 64) != 64) { | ||
| 167 | BUF_MEM_free(bm->buf); | ||
| 168 | free(bm); | ||
| 169 | return 0; | ||
| 170 | } | ||
| 171 | bm->buf->length = 0; | ||
| 165 | 172 | ||
| 166 | bio->shutdown = 1; | 173 | bio->shutdown = 1; |
| 167 | bio->init = 1; | 174 | bio->init = 1; |
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_add.S b/src/lib/libcrypto/bn/arch/amd64/bignum_add.S index 5fe4aae7a1..1d4e6d08ef 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bignum_add.S +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_add.S | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | // $OpenBSD: bignum_add.S,v 1.7 2025/08/11 14:13:56 jsing Exp $ | ||
| 2 | // | ||
| 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | // | 4 | // |
| 3 | // Permission to use, copy, modify, and/or distribute this software for any | 5 | // Permission to use, copy, modify, and/or distribute this software for any |
| @@ -16,9 +18,8 @@ | |||
| 16 | // Add, z := x + y | 18 | // Add, z := x + y |
| 17 | // Inputs x[m], y[n]; outputs function return (carry-out) and z[p] | 19 | // Inputs x[m], y[n]; outputs function return (carry-out) and z[p] |
| 18 | // | 20 | // |
| 19 | // extern uint64_t bignum_add | 21 | // extern uint64_t bignum_add(uint64_t p, uint64_t *z, uint64_t m, |
| 20 | // (uint64_t p, uint64_t *z, | 22 | // const uint64_t *x, uint64_t n, const uint64_t *y); |
| 21 | // uint64_t m, uint64_t *x, uint64_t n, uint64_t *y); | ||
| 22 | // | 23 | // |
| 23 | // Does the z := x + y operation, truncating modulo p words in general and | 24 | // Does the z := x + y operation, truncating modulo p words in general and |
| 24 | // returning a top carry (0 or 1) in the p'th place, only adding the input | 25 | // returning a top carry (0 or 1) in the p'th place, only adding the input |
| @@ -49,7 +50,7 @@ | |||
| 49 | 50 | ||
| 50 | 51 | ||
| 51 | S2N_BN_SYMBOL(bignum_add): | 52 | S2N_BN_SYMBOL(bignum_add): |
| 52 | _CET_ENDBR | 53 | _CET_ENDBR |
| 53 | 54 | ||
| 54 | #if WINDOWS_ABI | 55 | #if WINDOWS_ABI |
| 55 | push rdi | 56 | push rdi |
| @@ -75,7 +76,7 @@ S2N_BN_SYMBOL(bignum_add): | |||
| 75 | cmp p, n | 76 | cmp p, n |
| 76 | cmovc n, p | 77 | cmovc n, p |
| 77 | cmp m, n | 78 | cmp m, n |
| 78 | jc ylonger | 79 | jc bignum_add_ylonger |
| 79 | 80 | ||
| 80 | // The case where x is longer or of the same size (p >= m >= n) | 81 | // The case where x is longer or of the same size (p >= m >= n) |
| 81 | 82 | ||
| @@ -83,27 +84,27 @@ S2N_BN_SYMBOL(bignum_add): | |||
| 83 | sub m, n | 84 | sub m, n |
| 84 | inc m | 85 | inc m |
| 85 | test n, n | 86 | test n, n |
| 86 | jz xtest | 87 | jz bignum_add_xtest |
| 87 | xmainloop: | 88 | bignum_add_xmainloop: |
| 88 | mov a, [x+8*i] | 89 | mov a, [x+8*i] |
| 89 | adc a, [y+8*i] | 90 | adc a, [y+8*i] |
| 90 | mov [z+8*i],a | 91 | mov [z+8*i],a |
| 91 | inc i | 92 | inc i |
| 92 | dec n | 93 | dec n |
| 93 | jnz xmainloop | 94 | jnz bignum_add_xmainloop |
| 94 | jmp xtest | 95 | jmp bignum_add_xtest |
| 95 | xtoploop: | 96 | bignum_add_xtoploop: |
| 96 | mov a, [x+8*i] | 97 | mov a, [x+8*i] |
| 97 | adc a, 0 | 98 | adc a, 0 |
| 98 | mov [z+8*i],a | 99 | mov [z+8*i],a |
| 99 | inc i | 100 | inc i |
| 100 | xtest: | 101 | bignum_add_xtest: |
| 101 | dec m | 102 | dec m |
| 102 | jnz xtoploop | 103 | jnz bignum_add_xtoploop |
| 103 | mov ashort, 0 | 104 | mov ashort, 0 |
| 104 | adc a, 0 | 105 | adc a, 0 |
| 105 | test p, p | 106 | test p, p |
| 106 | jnz tails | 107 | jnz bignum_add_tails |
| 107 | #if WINDOWS_ABI | 108 | #if WINDOWS_ABI |
| 108 | pop rsi | 109 | pop rsi |
| 109 | pop rdi | 110 | pop rdi |
| @@ -112,30 +113,30 @@ xtest: | |||
| 112 | 113 | ||
| 113 | // The case where y is longer (p >= n > m) | 114 | // The case where y is longer (p >= n > m) |
| 114 | 115 | ||
| 115 | ylonger: | 116 | bignum_add_ylonger: |
| 116 | 117 | ||
| 117 | sub p, n | 118 | sub p, n |
| 118 | sub n, m | 119 | sub n, m |
| 119 | test m, m | 120 | test m, m |
| 120 | jz ytoploop | 121 | jz bignum_add_ytoploop |
| 121 | ymainloop: | 122 | bignum_add_ymainloop: |
| 122 | mov a, [x+8*i] | 123 | mov a, [x+8*i] |
| 123 | adc a, [y+8*i] | 124 | adc a, [y+8*i] |
| 124 | mov [z+8*i],a | 125 | mov [z+8*i],a |
| 125 | inc i | 126 | inc i |
| 126 | dec m | 127 | dec m |
| 127 | jnz ymainloop | 128 | jnz bignum_add_ymainloop |
| 128 | ytoploop: | 129 | bignum_add_ytoploop: |
| 129 | mov a, [y+8*i] | 130 | mov a, [y+8*i] |
| 130 | adc a, 0 | 131 | adc a, 0 |
| 131 | mov [z+8*i],a | 132 | mov [z+8*i],a |
| 132 | inc i | 133 | inc i |
| 133 | dec n | 134 | dec n |
| 134 | jnz ytoploop | 135 | jnz bignum_add_ytoploop |
| 135 | mov ashort, 0 | 136 | mov ashort, 0 |
| 136 | adc a, 0 | 137 | adc a, 0 |
| 137 | test p, p | 138 | test p, p |
| 138 | jnz tails | 139 | jnz bignum_add_tails |
| 139 | #if WINDOWS_ABI | 140 | #if WINDOWS_ABI |
| 140 | pop rsi | 141 | pop rsi |
| 141 | pop rdi | 142 | pop rdi |
| @@ -144,16 +145,16 @@ ytoploop: | |||
| 144 | 145 | ||
| 145 | // Adding a non-trivial tail, when p > max(m,n) | 146 | // Adding a non-trivial tail, when p > max(m,n) |
| 146 | 147 | ||
| 147 | tails: | 148 | bignum_add_tails: |
| 148 | mov [z+8*i],a | 149 | mov [z+8*i],a |
| 149 | xor a, a | 150 | xor a, a |
| 150 | jmp tail | 151 | jmp bignum_add_tail |
| 151 | tailloop: | 152 | bignum_add_tailloop: |
| 152 | mov [z+8*i],a | 153 | mov [z+8*i],a |
| 153 | tail: | 154 | bignum_add_tail: |
| 154 | inc i | 155 | inc i |
| 155 | dec p | 156 | dec p |
| 156 | jnz tailloop | 157 | jnz bignum_add_tailloop |
| 157 | #if WINDOWS_ABI | 158 | #if WINDOWS_ABI |
| 158 | pop rsi | 159 | pop rsi |
| 159 | pop rdi | 160 | pop rdi |
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S b/src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S index 25ba17bce2..a611919603 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | // $OpenBSD: bignum_cmadd.S,v 1.7 2025/08/11 14:13:56 jsing Exp $ | ||
| 2 | // | ||
| 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | // | 4 | // |
| 3 | // Permission to use, copy, modify, and/or distribute this software for any | 5 | // Permission to use, copy, modify, and/or distribute this software for any |
| @@ -16,8 +18,8 @@ | |||
| 16 | // Multiply-add with single-word multiplier, z := z + c * y | 18 | // Multiply-add with single-word multiplier, z := z + c * y |
| 17 | // Inputs c, y[n]; outputs function return (carry-out) and z[k] | 19 | // Inputs c, y[n]; outputs function return (carry-out) and z[k] |
| 18 | // | 20 | // |
| 19 | // extern uint64_t bignum_cmadd | 21 | // extern uint64_t bignum_cmadd(uint64_t k, uint64_t *z, uint64_t c, uint64_t n, |
| 20 | // (uint64_t k, uint64_t *z, uint64_t c, uint64_t n, uint64_t *y); | 22 | // const uint64_t *y); |
| 21 | // | 23 | // |
| 22 | // Does the "z := z + c * y" operation where y is n digits, result z is p. | 24 | // Does the "z := z + c * y" operation where y is n digits, result z is p. |
| 23 | // Truncates the result in general. | 25 | // Truncates the result in general. |
| @@ -54,7 +56,7 @@ | |||
| 54 | 56 | ||
| 55 | 57 | ||
| 56 | S2N_BN_SYMBOL(bignum_cmadd): | 58 | S2N_BN_SYMBOL(bignum_cmadd): |
| 57 | _CET_ENDBR | 59 | _CET_ENDBR |
| 58 | 60 | ||
| 59 | #if WINDOWS_ABI | 61 | #if WINDOWS_ABI |
| 60 | push rdi | 62 | push rdi |
| @@ -82,7 +84,7 @@ S2N_BN_SYMBOL(bignum_cmadd): | |||
| 82 | 84 | ||
| 83 | xor h, h | 85 | xor h, h |
| 84 | test n, n | 86 | test n, n |
| 85 | jz end | 87 | jz bignum_cmadd_end |
| 86 | 88 | ||
| 87 | // Move c into a safer register as multiplies overwrite rdx | 89 | // Move c into a safer register as multiplies overwrite rdx |
| 88 | 90 | ||
| @@ -96,11 +98,11 @@ S2N_BN_SYMBOL(bignum_cmadd): | |||
| 96 | mov h, rdx | 98 | mov h, rdx |
| 97 | mov ishort, 1 | 99 | mov ishort, 1 |
| 98 | dec n | 100 | dec n |
| 99 | jz hightail | 101 | jz bignum_cmadd_hightail |
| 100 | 102 | ||
| 101 | // Main loop, where we always have CF + previous high part h to add in | 103 | // Main loop, where we always have CF + previous high part h to add in |
| 102 | 104 | ||
| 103 | loop: | 105 | bignum_cmadd_loop: |
| 104 | adc h, [z+8*i] | 106 | adc h, [z+8*i] |
| 105 | sbb r, r | 107 | sbb r, r |
| 106 | mov rax, [x+8*i] | 108 | mov rax, [x+8*i] |
| @@ -111,36 +113,36 @@ loop: | |||
| 111 | mov h, rdx | 113 | mov h, rdx |
| 112 | inc i | 114 | inc i |
| 113 | dec n | 115 | dec n |
| 114 | jnz loop | 116 | jnz bignum_cmadd_loop |
| 115 | 117 | ||
| 116 | hightail: | 118 | bignum_cmadd_hightail: |
| 117 | adc h, 0 | 119 | adc h, 0 |
| 118 | 120 | ||
| 119 | // Propagate the carry all the way to the end with h as extra carry word | 121 | // Propagate the carry all the way to the end with h as extra carry word |
| 120 | 122 | ||
| 121 | tail: | 123 | bignum_cmadd_tail: |
| 122 | test p, p | 124 | test p, p |
| 123 | jz end | 125 | jz bignum_cmadd_end |
| 124 | 126 | ||
| 125 | add [z+8*i], h | 127 | add [z+8*i], h |
| 126 | mov hshort, 0 | 128 | mov hshort, 0 |
| 127 | inc i | 129 | inc i |
| 128 | dec p | 130 | dec p |
| 129 | jz highend | 131 | jz bignum_cmadd_highend |
| 130 | 132 | ||
| 131 | tloop: | 133 | bignum_cmadd_tloop: |
| 132 | adc [z+8*i], h | 134 | adc [z+8*i], h |
| 133 | inc i | 135 | inc i |
| 134 | dec p | 136 | dec p |
| 135 | jnz tloop | 137 | jnz bignum_cmadd_tloop |
| 136 | 138 | ||
| 137 | highend: | 139 | bignum_cmadd_highend: |
| 138 | 140 | ||
| 139 | adc h, 0 | 141 | adc h, 0 |
| 140 | 142 | ||
| 141 | // Return the high/carry word | 143 | // Return the high/carry word |
| 142 | 144 | ||
| 143 | end: | 145 | bignum_cmadd_end: |
| 144 | mov rax, h | 146 | mov rax, h |
| 145 | 147 | ||
| 146 | pop rbx | 148 | pop rbx |
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S b/src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S index 12f785d63a..eb71d9da44 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | // $OpenBSD: bignum_cmul.S,v 1.7 2025/08/11 14:13:56 jsing Exp $ | ||
| 2 | // | ||
| 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | // | 4 | // |
| 3 | // Permission to use, copy, modify, and/or distribute this software for any | 5 | // Permission to use, copy, modify, and/or distribute this software for any |
| @@ -16,8 +18,8 @@ | |||
| 16 | // Multiply by a single word, z := c * y | 18 | // Multiply by a single word, z := c * y |
| 17 | // Inputs c, y[n]; outputs function return (carry-out) and z[k] | 19 | // Inputs c, y[n]; outputs function return (carry-out) and z[k] |
| 18 | // | 20 | // |
| 19 | // extern uint64_t bignum_cmul | 21 | // extern uint64_t bignum_cmul(uint64_t k, uint64_t *z, uint64_t c, uint64_t n, |
| 20 | // (uint64_t k, uint64_t *z, uint64_t c, uint64_t n, uint64_t *y); | 22 | // const uint64_t *y); |
| 21 | // | 23 | // |
| 22 | // Does the "z := c * y" operation where y is n digits, result z is p. | 24 | // Does the "z := c * y" operation where y is n digits, result z is p. |
| 23 | // Truncates the result in general unless p >= n + 1. | 25 | // Truncates the result in general unless p >= n + 1. |
| @@ -51,7 +53,7 @@ | |||
| 51 | 53 | ||
| 52 | 54 | ||
| 53 | S2N_BN_SYMBOL(bignum_cmul): | 55 | S2N_BN_SYMBOL(bignum_cmul): |
| 54 | _CET_ENDBR | 56 | _CET_ENDBR |
| 55 | 57 | ||
| 56 | #if WINDOWS_ABI | 58 | #if WINDOWS_ABI |
| 57 | push rdi | 59 | push rdi |
| @@ -76,7 +78,7 @@ S2N_BN_SYMBOL(bignum_cmul): | |||
| 76 | xor h, h | 78 | xor h, h |
| 77 | xor i, i | 79 | xor i, i |
| 78 | test n, n | 80 | test n, n |
| 79 | jz tail | 81 | jz bignum_cmul_tail |
| 80 | 82 | ||
| 81 | // Move c into a safer register as multiplies overwrite rdx | 83 | // Move c into a safer register as multiplies overwrite rdx |
| 82 | 84 | ||
| @@ -90,11 +92,11 @@ S2N_BN_SYMBOL(bignum_cmul): | |||
| 90 | mov h, rdx | 92 | mov h, rdx |
| 91 | inc i | 93 | inc i |
| 92 | cmp i, n | 94 | cmp i, n |
| 93 | jz tail | 95 | jz bignum_cmul_tail |
| 94 | 96 | ||
| 95 | // Main loop doing the multiplications | 97 | // Main loop doing the multiplications |
| 96 | 98 | ||
| 97 | loop: | 99 | bignum_cmul_loop: |
| 98 | mov rax, [x+8*i] | 100 | mov rax, [x+8*i] |
| 99 | mul c | 101 | mul c |
| 100 | add rax, h | 102 | add rax, h |
| @@ -103,28 +105,28 @@ loop: | |||
| 103 | mov h, rdx | 105 | mov h, rdx |
| 104 | inc i | 106 | inc i |
| 105 | cmp i, n | 107 | cmp i, n |
| 106 | jc loop | 108 | jc bignum_cmul_loop |
| 107 | 109 | ||
| 108 | // Add a tail when the destination is longer | 110 | // Add a tail when the destination is longer |
| 109 | 111 | ||
| 110 | tail: | 112 | bignum_cmul_tail: |
| 111 | cmp i, p | 113 | cmp i, p |
| 112 | jnc end | 114 | jnc bignum_cmul_end |
| 113 | mov [z+8*i], h | 115 | mov [z+8*i], h |
| 114 | xor h, h | 116 | xor h, h |
| 115 | inc i | 117 | inc i |
| 116 | cmp i, p | 118 | cmp i, p |
| 117 | jnc end | 119 | jnc bignum_cmul_end |
| 118 | 120 | ||
| 119 | tloop: | 121 | bignum_cmul_tloop: |
| 120 | mov [z+8*i], h | 122 | mov [z+8*i], h |
| 121 | inc i | 123 | inc i |
| 122 | cmp i, p | 124 | cmp i, p |
| 123 | jc tloop | 125 | jc bignum_cmul_tloop |
| 124 | 126 | ||
| 125 | // Return the high/carry word | 127 | // Return the high/carry word |
| 126 | 128 | ||
| 127 | end: | 129 | bignum_cmul_end: |
| 128 | mov rax, h | 130 | mov rax, h |
| 129 | 131 | ||
| 130 | #if WINDOWS_ABI | 132 | #if WINDOWS_ABI |
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_modadd.S b/src/lib/libcrypto/bn/arch/amd64/bignum_modadd.S new file mode 100644 index 0000000000..baf27fdc7f --- /dev/null +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_modadd.S | |||
| @@ -0,0 +1,112 @@ | |||
| 1 | // $OpenBSD: bignum_modadd.S,v 1.4 2025/08/12 10:23:40 jsing Exp $ | ||
| 2 | // | ||
| 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| 4 | // | ||
| 5 | // Permission to use, copy, modify, and/or distribute this software for any | ||
| 6 | // purpose with or without fee is hereby granted, provided that the above | ||
| 7 | // copyright notice and this permission notice appear in all copies. | ||
| 8 | // | ||
| 9 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | |||
| 17 | // ---------------------------------------------------------------------------- | ||
| 18 | // Add modulo m, z := (x + y) mod m, assuming x and y reduced | ||
| 19 | // Inputs x[k], y[k], m[k]; output z[k] | ||
| 20 | // | ||
| 21 | // extern void bignum_modadd(uint64_t k, uint64_t *z, const uint64_t *x, | ||
| 22 | // const uint64_t *y, const uint64_t *m); | ||
| 23 | // | ||
| 24 | // Standard x86-64 ABI: RDI = k, RSI = z, RDX = x, RCX = y, R8 = m | ||
| 25 | // Microsoft x64 ABI: RCX = k, RDX = z, R8 = x, R9 = y, [RSP+40] = m | ||
| 26 | // ---------------------------------------------------------------------------- | ||
| 27 | |||
| 28 | #include "s2n_bignum_internal.h" | ||
| 29 | |||
| 30 | .intel_syntax noprefix | ||
| 31 | S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_modadd) | ||
| 32 | S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_modadd) | ||
| 33 | .text | ||
| 34 | |||
| 35 | #define k rdi | ||
| 36 | #define z rsi | ||
| 37 | #define x rdx | ||
| 38 | #define y rcx | ||
| 39 | #define m r8 | ||
| 40 | #define i r9 | ||
| 41 | #define j r10 | ||
| 42 | #define a rax | ||
| 43 | #define c r11 | ||
| 44 | |||
| 45 | S2N_BN_SYMBOL(bignum_modadd): | ||
| 46 | _CET_ENDBR | ||
| 47 | |||
| 48 | #if WINDOWS_ABI | ||
| 49 | push rdi | ||
| 50 | push rsi | ||
| 51 | mov rdi, rcx | ||
| 52 | mov rsi, rdx | ||
| 53 | mov rdx, r8 | ||
| 54 | mov rcx, r9 | ||
| 55 | mov r8, [rsp+56] | ||
| 56 | #endif | ||
| 57 | |||
| 58 | // If k = 0 do nothing | ||
| 59 | |||
| 60 | test k, k | ||
| 61 | jz bignum_modadd_end | ||
| 62 | |||
| 63 | // First just add (c::z) := x + y | ||
| 64 | |||
| 65 | xor c, c | ||
| 66 | mov j, k | ||
| 67 | xor i, i | ||
| 68 | bignum_modadd_addloop: | ||
| 69 | mov a, [x+8*i] | ||
| 70 | adc a, [y+8*i] | ||
| 71 | mov [z+8*i], a | ||
| 72 | inc i | ||
| 73 | dec j | ||
| 74 | jnz bignum_modadd_addloop | ||
| 75 | adc c, 0 | ||
| 76 | |||
| 77 | // Now do a comparison subtraction (c::z) - m, recording mask for (c::z) >= m | ||
| 78 | |||
| 79 | mov j, k | ||
| 80 | xor i, i | ||
| 81 | bignum_modadd_cmploop: | ||
| 82 | mov a, [z+8*i] | ||
| 83 | sbb a, [m+8*i] | ||
| 84 | inc i | ||
| 85 | dec j | ||
| 86 | jnz bignum_modadd_cmploop | ||
| 87 | sbb c, 0 | ||
| 88 | not c | ||
| 89 | |||
| 90 | // Now do a masked subtraction z := z - [c] * m | ||
| 91 | |||
| 92 | xor i, i | ||
| 93 | bignum_modadd_subloop: | ||
| 94 | mov a, [m+8*i] | ||
| 95 | and a, c | ||
| 96 | neg j | ||
| 97 | sbb [z+8*i], a | ||
| 98 | sbb j, j | ||
| 99 | inc i | ||
| 100 | cmp i, k | ||
| 101 | jc bignum_modadd_subloop | ||
| 102 | |||
| 103 | bignum_modadd_end: | ||
| 104 | #if WINDOWS_ABI | ||
| 105 | pop rsi | ||
| 106 | pop rdi | ||
| 107 | #endif | ||
| 108 | ret | ||
| 109 | |||
| 110 | #if defined(__linux__) && defined(__ELF__) | ||
| 111 | .section .note.GNU-stack,"",%progbits | ||
| 112 | #endif | ||
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_modsub.S b/src/lib/libcrypto/bn/arch/amd64/bignum_modsub.S new file mode 100644 index 0000000000..63b3230e35 --- /dev/null +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_modsub.S | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | // $OpenBSD: bignum_modsub.S,v 1.4 2025/08/12 10:23:40 jsing Exp $ | ||
| 2 | // | ||
| 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| 4 | // | ||
| 5 | // Permission to use, copy, modify, and/or distribute this software for any | ||
| 6 | // purpose with or without fee is hereby granted, provided that the above | ||
| 7 | // copyright notice and this permission notice appear in all copies. | ||
| 8 | // | ||
| 9 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | |||
| 17 | // ---------------------------------------------------------------------------- | ||
| 18 | // Subtract modulo m, z := (x - y) mod m, assuming x and y reduced | ||
| 19 | // Inputs x[k], y[k], m[k]; output z[k] | ||
| 20 | // | ||
| 21 | // extern void bignum_modsub(uint64_t k, uint64_t *z, const uint64_t *x, | ||
| 22 | // const uint64_t *y, const uint64_t *m); | ||
| 23 | // | ||
| 24 | // Standard x86-64 ABI: RDI = k, RSI = z, RDX = x, RCX = y, R8 = m | ||
| 25 | // Microsoft x64 ABI: RCX = k, RDX = z, R8 = x, R9 = y, [RSP+40] = m | ||
| 26 | // ---------------------------------------------------------------------------- | ||
| 27 | |||
| 28 | #include "s2n_bignum_internal.h" | ||
| 29 | |||
| 30 | .intel_syntax noprefix | ||
| 31 | S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_modsub) | ||
| 32 | S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_modsub) | ||
| 33 | .text | ||
| 34 | |||
| 35 | #define k rdi | ||
| 36 | #define z rsi | ||
| 37 | #define x rdx | ||
| 38 | #define y rcx | ||
| 39 | #define m r8 | ||
| 40 | #define i r9 | ||
| 41 | #define j r10 | ||
| 42 | #define a rax | ||
| 43 | #define c r11 | ||
| 44 | |||
| 45 | S2N_BN_SYMBOL(bignum_modsub): | ||
| 46 | _CET_ENDBR | ||
| 47 | |||
| 48 | #if WINDOWS_ABI | ||
| 49 | push rdi | ||
| 50 | push rsi | ||
| 51 | mov rdi, rcx | ||
| 52 | mov rsi, rdx | ||
| 53 | mov rdx, r8 | ||
| 54 | mov rcx, r9 | ||
| 55 | mov r8, [rsp+56] | ||
| 56 | #endif | ||
| 57 | |||
| 58 | // If k = 0 do nothing | ||
| 59 | |||
| 60 | test k, k | ||
| 61 | jz bignum_modsub_end | ||
| 62 | |||
| 63 | // Subtract z := x - y and record a mask for the carry x - y < 0 | ||
| 64 | |||
| 65 | xor c, c | ||
| 66 | mov j, k | ||
| 67 | xor i, i | ||
| 68 | bignum_modsub_subloop: | ||
| 69 | mov a, [x+8*i] | ||
| 70 | sbb a, [y+8*i] | ||
| 71 | mov [z+8*i], a | ||
| 72 | inc i | ||
| 73 | dec j | ||
| 74 | jnz bignum_modsub_subloop | ||
| 75 | sbb c, c | ||
| 76 | |||
| 77 | // Now do a masked addition z := z + [c] * m | ||
| 78 | |||
| 79 | xor i, i | ||
| 80 | bignum_modsub_addloop: | ||
| 81 | mov a, [m+8*i] | ||
| 82 | and a, c | ||
| 83 | neg j | ||
| 84 | adc [z+8*i], a | ||
| 85 | sbb j, j | ||
| 86 | inc i | ||
| 87 | cmp i, k | ||
| 88 | jc bignum_modsub_addloop | ||
| 89 | |||
| 90 | bignum_modsub_end: | ||
| 91 | #if WINDOWS_ABI | ||
| 92 | pop rsi | ||
| 93 | pop rdi | ||
| 94 | #endif | ||
| 95 | ret | ||
| 96 | |||
| 97 | #if defined(__linux__) && defined(__ELF__) | ||
| 98 | .section .note.GNU-stack,"",%progbits | ||
| 99 | #endif | ||
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_mul.S b/src/lib/libcrypto/bn/arch/amd64/bignum_mul.S index a3552679a2..538cce9af7 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bignum_mul.S +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_mul.S | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | // $OpenBSD: bignum_mul.S,v 1.7 2025/08/11 14:13:56 jsing Exp $ | ||
| 2 | // | ||
| 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | // | 4 | // |
| 3 | // Permission to use, copy, modify, and/or distribute this software for any | 5 | // Permission to use, copy, modify, and/or distribute this software for any |
| @@ -16,9 +18,8 @@ | |||
| 16 | // Multiply z := x * y | 18 | // Multiply z := x * y |
| 17 | // Inputs x[m], y[n]; output z[k] | 19 | // Inputs x[m], y[n]; output z[k] |
| 18 | // | 20 | // |
| 19 | // extern void bignum_mul | 21 | // extern void bignum_mul(uint64_t k, uint64_t *z, uint64_t m, const uint64_t *x, |
| 20 | // (uint64_t k, uint64_t *z, | 22 | // uint64_t n, const uint64_t *y); |
| 21 | // uint64_t m, uint64_t *x, uint64_t n, uint64_t *y); | ||
| 22 | // | 23 | // |
| 23 | // Does the "z := x * y" operation where x is m digits, y is n, result z is k. | 24 | // Does the "z := x * y" operation where x is m digits, y is n, result z is k. |
| 24 | // Truncates the result in general unless k >= m + n | 25 | // Truncates the result in general unless k >= m + n |
| @@ -59,7 +60,7 @@ | |||
| 59 | 60 | ||
| 60 | 61 | ||
| 61 | S2N_BN_SYMBOL(bignum_mul): | 62 | S2N_BN_SYMBOL(bignum_mul): |
| 62 | _CET_ENDBR | 63 | _CET_ENDBR |
| 63 | 64 | ||
| 64 | #if WINDOWS_ABI | 65 | #if WINDOWS_ABI |
| 65 | push rdi | 66 | push rdi |
| @@ -88,7 +89,7 @@ S2N_BN_SYMBOL(bignum_mul): | |||
| 88 | // If we did a multiply-add variant, however, then we could | 89 | // If we did a multiply-add variant, however, then we could |
| 89 | 90 | ||
| 90 | test p, p | 91 | test p, p |
| 91 | jz end | 92 | jz bignum_mul_end |
| 92 | 93 | ||
| 93 | // Set initial 2-part sum to zero (we zero c inside the body) | 94 | // Set initial 2-part sum to zero (we zero c inside the body) |
| 94 | 95 | ||
| @@ -99,7 +100,7 @@ S2N_BN_SYMBOL(bignum_mul): | |||
| 99 | 100 | ||
| 100 | xor k, k | 101 | xor k, k |
| 101 | 102 | ||
| 102 | outerloop: | 103 | bignum_mul_outerloop: |
| 103 | 104 | ||
| 104 | // Zero our carry term first; we eventually want it and a zero is useful now | 105 | // Zero our carry term first; we eventually want it and a zero is useful now |
| 105 | // Set a = max 0 (k + 1 - n), i = min (k + 1) m | 106 | // Set a = max 0 (k + 1 - n), i = min (k + 1) m |
| @@ -125,11 +126,11 @@ outerloop: | |||
| 125 | mov d, k | 126 | mov d, k |
| 126 | sub d, i | 127 | sub d, i |
| 127 | sub i, a | 128 | sub i, a |
| 128 | jbe innerend | 129 | jbe bignum_mul_innerend |
| 129 | lea x,[rcx+8*a] | 130 | lea x,[rcx+8*a] |
| 130 | lea y,[r9+8*d-8] | 131 | lea y,[r9+8*d-8] |
| 131 | 132 | ||
| 132 | innerloop: | 133 | bignum_mul_innerloop: |
| 133 | mov rax, [y+8*i] | 134 | mov rax, [y+8*i] |
| 134 | mul QWORD PTR [x] | 135 | mul QWORD PTR [x] |
| 135 | add x, 8 | 136 | add x, 8 |
| @@ -137,9 +138,9 @@ innerloop: | |||
| 137 | adc h, rdx | 138 | adc h, rdx |
| 138 | adc c, 0 | 139 | adc c, 0 |
| 139 | dec i | 140 | dec i |
| 140 | jnz innerloop | 141 | jnz bignum_mul_innerloop |
| 141 | 142 | ||
| 142 | innerend: | 143 | bignum_mul_innerend: |
| 143 | 144 | ||
| 144 | mov [z], l | 145 | mov [z], l |
| 145 | mov l, h | 146 | mov l, h |
| @@ -147,9 +148,9 @@ innerend: | |||
| 147 | add z, 8 | 148 | add z, 8 |
| 148 | 149 | ||
| 149 | cmp k, p | 150 | cmp k, p |
| 150 | jc outerloop | 151 | jc bignum_mul_outerloop |
| 151 | 152 | ||
| 152 | end: | 153 | bignum_mul_end: |
| 153 | pop r15 | 154 | pop r15 |
| 154 | pop r14 | 155 | pop r14 |
| 155 | pop r13 | 156 | pop r13 |
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_mul_4_8.S b/src/lib/libcrypto/bn/arch/amd64/bignum_mul_4_8.S new file mode 100644 index 0000000000..d6ad514020 --- /dev/null +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_mul_4_8.S | |||
| @@ -0,0 +1,187 @@ | |||
| 1 | // $OpenBSD: bignum_mul_4_8.S,v 1.4 2025/08/12 10:23:40 jsing Exp $ | ||
| 2 | // | ||
| 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| 4 | // | ||
| 5 | // Permission to use, copy, modify, and/or distribute this software for any | ||
| 6 | // purpose with or without fee is hereby granted, provided that the above | ||
| 7 | // copyright notice and this permission notice appear in all copies. | ||
| 8 | // | ||
| 9 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | |||
| 17 | // ---------------------------------------------------------------------------- | ||
| 18 | // Multiply z := x * y | ||
| 19 | // Inputs x[4], y[4]; output z[8] | ||
| 20 | // | ||
| 21 | // extern void bignum_mul_4_8(uint64_t z[static 8], const uint64_t x[static 4], | ||
| 22 | // const uint64_t y[static 4]); | ||
| 23 | // | ||
| 24 | // Standard x86-64 ABI: RDI = z, RSI = x, RDX = y | ||
| 25 | // Microsoft x64 ABI: RCX = z, RDX = x, R8 = y | ||
| 26 | // ---------------------------------------------------------------------------- | ||
| 27 | |||
| 28 | #include "s2n_bignum_internal.h" | ||
| 29 | |||
| 30 | .intel_syntax noprefix | ||
| 31 | S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_mul_4_8) | ||
| 32 | S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_mul_4_8) | ||
| 33 | .text | ||
| 34 | |||
| 35 | // These are actually right | ||
| 36 | |||
| 37 | #define z rdi | ||
| 38 | #define x rsi | ||
| 39 | |||
| 40 | // Copied in or set up | ||
| 41 | |||
| 42 | #define y rcx | ||
| 43 | |||
| 44 | // A zero register | ||
| 45 | |||
| 46 | #define zero rbp | ||
| 47 | #define zeroe ebp | ||
| 48 | |||
| 49 | // Add in x[i] * rdx to the (i,i+1) position with the register window | ||
| 50 | // Would be nice to have conditional expressions reg[i], reg[i+1] ... | ||
| 51 | |||
| 52 | .macro mulpadd arg1,arg2 | ||
| 53 | mulx rbx, rax, [x+8*\arg2] | ||
| 54 | .if ((\arg1 + \arg2) % 4 == 0) | ||
| 55 | adcx r8, rax | ||
| 56 | adox r9, rbx | ||
| 57 | .elseif ((\arg1 + \arg2) % 4 == 1) | ||
| 58 | adcx r9, rax | ||
| 59 | adox r10, rbx | ||
| 60 | .elseif ((\arg1 + \arg2) % 4 == 2) | ||
| 61 | adcx r10, rax | ||
| 62 | adox r11, rbx | ||
| 63 | .elseif ((\arg1 + \arg2) % 4 == 3) | ||
| 64 | adcx r11, rax | ||
| 65 | adox r8, rbx | ||
| 66 | .endif | ||
| 67 | |||
| 68 | .endm | ||
| 69 | |||
| 70 | |||
| 71 | // Add in the whole j'th row | ||
| 72 | |||
| 73 | .macro addrow arg1 | ||
| 74 | mov rdx, [y+8*\arg1] | ||
| 75 | xor zeroe, zeroe | ||
| 76 | |||
| 77 | mulpadd \arg1, 0 | ||
| 78 | |||
| 79 | .if (\arg1 % 4 == 0) | ||
| 80 | mov [z+8*\arg1],r8 | ||
| 81 | .elseif (\arg1 % 4 == 1) | ||
| 82 | mov [z+8*\arg1],r9 | ||
| 83 | .elseif (\arg1 % 4 == 2) | ||
| 84 | mov [z+8*\arg1],r10 | ||
| 85 | .elseif (\arg1 % 4 == 3) | ||
| 86 | mov [z+8*\arg1],r11 | ||
| 87 | .endif | ||
| 88 | |||
| 89 | mulpadd \arg1, 1 | ||
| 90 | mulpadd \arg1, 2 | ||
| 91 | |||
| 92 | .if (\arg1 % 4 == 0) | ||
| 93 | mulx r8, rax, [x+24] | ||
| 94 | adcx r11, rax | ||
| 95 | adox r8, zero | ||
| 96 | adcx r8, zero | ||
| 97 | .elseif (\arg1 % 4 == 1) | ||
| 98 | mulx r9, rax, [x+24] | ||
| 99 | adcx r8, rax | ||
| 100 | adox r9, zero | ||
| 101 | adcx r9, zero | ||
| 102 | .elseif (\arg1 % 4 == 2) | ||
| 103 | mulx r10, rax, [x+24] | ||
| 104 | adcx r9, rax | ||
| 105 | adox r10, zero | ||
| 106 | adcx r10, zero | ||
| 107 | .elseif (\arg1 % 4 == 3) | ||
| 108 | mulx r11, rax, [x+24] | ||
| 109 | adcx r10, rax | ||
| 110 | adox r11, zero | ||
| 111 | adcx r11, zero | ||
| 112 | .endif | ||
| 113 | |||
| 114 | .endm | ||
| 115 | |||
| 116 | |||
| 117 | |||
| 118 | S2N_BN_SYMBOL(bignum_mul_4_8): | ||
| 119 | _CET_ENDBR | ||
| 120 | |||
| 121 | #if WINDOWS_ABI | ||
| 122 | push rdi | ||
| 123 | push rsi | ||
| 124 | mov rdi, rcx | ||
| 125 | mov rsi, rdx | ||
| 126 | mov rdx, r8 | ||
| 127 | #endif | ||
| 128 | |||
| 129 | // Save more registers to play with | ||
| 130 | |||
| 131 | push rbp | ||
| 132 | push rbx | ||
| 133 | |||
| 134 | // Copy y into a safe register to start with | ||
| 135 | |||
| 136 | mov y, rdx | ||
| 137 | |||
| 138 | // Zero a register, which also makes sure we don't get a fake carry-in | ||
| 139 | |||
| 140 | xor zeroe, zeroe | ||
| 141 | |||
| 142 | // Do the zeroth row, which is a bit different | ||
| 143 | // Write back the zero-zero product and then accumulate | ||
| 144 | // r8,r11,r10,r9 as y[0] * x from 1..4 | ||
| 145 | |||
| 146 | mov rdx, [y] | ||
| 147 | |||
| 148 | mulx r9, r8, [x] | ||
| 149 | mov [z], r8 | ||
| 150 | |||
| 151 | mulx r10, rbx, [x+8] | ||
| 152 | adcx r9, rbx | ||
| 153 | |||
| 154 | mulx r11, rbx, [x+16] | ||
| 155 | adcx r10, rbx | ||
| 156 | |||
| 157 | mulx r8, rbx, [x+24] | ||
| 158 | adcx r11, rbx | ||
| 159 | adcx r8, zero | ||
| 160 | |||
| 161 | // Now all the other rows in a uniform pattern | ||
| 162 | |||
| 163 | addrow 1 | ||
| 164 | addrow 2 | ||
| 165 | addrow 3 | ||
| 166 | |||
| 167 | // Now write back the additional columns | ||
| 168 | |||
| 169 | mov [z+32], r8 | ||
| 170 | mov [z+40], r9 | ||
| 171 | mov [z+48], r10 | ||
| 172 | mov [z+56], r11 | ||
| 173 | |||
| 174 | // Restore registers and return | ||
| 175 | |||
| 176 | pop rbx | ||
| 177 | pop rbp | ||
| 178 | |||
| 179 | #if WINDOWS_ABI | ||
| 180 | pop rsi | ||
| 181 | pop rdi | ||
| 182 | #endif | ||
| 183 | ret | ||
| 184 | |||
| 185 | #if defined(__linux__) && defined(__ELF__) | ||
| 186 | .section .note.GNU-stack,"",%progbits | ||
| 187 | #endif | ||
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_mul_4_8_alt.S b/src/lib/libcrypto/bn/arch/amd64/bignum_mul_4_8_alt.S index 70ff69e372..2592d1d658 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bignum_mul_4_8_alt.S +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_mul_4_8_alt.S | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | // $OpenBSD: bignum_mul_4_8_alt.S,v 1.7 2025/08/11 14:13:56 jsing Exp $ | ||
| 2 | // | ||
| 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | // | 4 | // |
| 3 | // Permission to use, copy, modify, and/or distribute this software for any | 5 | // Permission to use, copy, modify, and/or distribute this software for any |
| @@ -16,8 +18,8 @@ | |||
| 16 | // Multiply z := x * y | 18 | // Multiply z := x * y |
| 17 | // Inputs x[4], y[4]; output z[8] | 19 | // Inputs x[4], y[4]; output z[8] |
| 18 | // | 20 | // |
| 19 | // extern void bignum_mul_4_8_alt | 21 | // extern void bignum_mul_4_8_alt(uint64_t z[static 8], const uint64_t x[static 4], |
| 20 | // (uint64_t z[static 8], uint64_t x[static 4], uint64_t y[static 4]); | 22 | // const uint64_t y[static 4]); |
| 21 | // | 23 | // |
| 22 | // Standard x86-64 ABI: RDI = z, RSI = x, RDX = y | 24 | // Standard x86-64 ABI: RDI = z, RSI = x, RDX = y |
| 23 | // Microsoft x64 ABI: RCX = z, RDX = x, R8 = y | 25 | // Microsoft x64 ABI: RCX = z, RDX = x, R8 = y |
| @@ -72,7 +74,7 @@ | |||
| 72 | adc h, rdx | 74 | adc h, rdx |
| 73 | 75 | ||
| 74 | S2N_BN_SYMBOL(bignum_mul_4_8_alt): | 76 | S2N_BN_SYMBOL(bignum_mul_4_8_alt): |
| 75 | _CET_ENDBR | 77 | _CET_ENDBR |
| 76 | 78 | ||
| 77 | #if WINDOWS_ABI | 79 | #if WINDOWS_ABI |
| 78 | push rdi | 80 | push rdi |
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_mul_6_12.S b/src/lib/libcrypto/bn/arch/amd64/bignum_mul_6_12.S new file mode 100644 index 0000000000..56cbdf06e0 --- /dev/null +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_mul_6_12.S | |||
| @@ -0,0 +1,223 @@ | |||
| 1 | // $OpenBSD: bignum_mul_6_12.S,v 1.4 2025/08/12 10:23:40 jsing Exp $ | ||
| 2 | // | ||
| 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| 4 | // | ||
| 5 | // Permission to use, copy, modify, and/or distribute this software for any | ||
| 6 | // purpose with or without fee is hereby granted, provided that the above | ||
| 7 | // copyright notice and this permission notice appear in all copies. | ||
| 8 | // | ||
| 9 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | |||
| 17 | // ---------------------------------------------------------------------------- | ||
| 18 | // Multiply z := x * y | ||
| 19 | // Inputs x[6], y[6]; output z[12] | ||
| 20 | // | ||
| 21 | // extern void bignum_mul_6_12(uint64_t z[static 12], const uint64_t x[static 6], | ||
| 22 | // const uint64_t y[static 6]); | ||
| 23 | // | ||
| 24 | // Standard x86-64 ABI: RDI = z, RSI = x, RDX = y | ||
| 25 | // Microsoft x64 ABI: RCX = z, RDX = x, R8 = y | ||
| 26 | // ---------------------------------------------------------------------------- | ||
| 27 | |||
| 28 | #include "s2n_bignum_internal.h" | ||
| 29 | |||
| 30 | .intel_syntax noprefix | ||
| 31 | S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_mul_6_12) | ||
| 32 | S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_mul_6_12) | ||
| 33 | .text | ||
| 34 | |||
| 35 | // These are actually right | ||
| 36 | |||
| 37 | #define z rdi | ||
| 38 | #define x rsi | ||
| 39 | |||
| 40 | // Copied in or set up | ||
| 41 | |||
| 42 | #define y rcx | ||
| 43 | |||
| 44 | // A zero register | ||
| 45 | |||
| 46 | #define zero rbp | ||
| 47 | #define zeroe ebp | ||
| 48 | |||
| 49 | // Add in x[i] * rdx to the (i,i+1) position with the register window | ||
| 50 | // Would be nice to have conditional expressions reg[i], reg[i+1] ... | ||
| 51 | |||
| 52 | .macro mulpadd arg1,arg2 | ||
| 53 | mulx rbx, rax, [x+8*\arg2] | ||
| 54 | .if ((\arg1 + \arg2) % 6 == 0) | ||
| 55 | adcx r8, rax | ||
| 56 | adox r9, rbx | ||
| 57 | .elseif ((\arg1 + \arg2) % 6 == 1) | ||
| 58 | adcx r9, rax | ||
| 59 | adox r10, rbx | ||
| 60 | .elseif ((\arg1 + \arg2) % 6 == 2) | ||
| 61 | adcx r10, rax | ||
| 62 | adox r11, rbx | ||
| 63 | .elseif ((\arg1 + \arg2) % 6 == 3) | ||
| 64 | adcx r11, rax | ||
| 65 | adox r12, rbx | ||
| 66 | .elseif ((\arg1 + \arg2) % 6 == 4) | ||
| 67 | adcx r12, rax | ||
| 68 | adox r13, rbx | ||
| 69 | .elseif ((\arg1 + \arg2) % 6 == 5) | ||
| 70 | adcx r13, rax | ||
| 71 | adox r8, rbx | ||
| 72 | .endif | ||
| 73 | |||
| 74 | .endm | ||
| 75 | |||
| 76 | |||
| 77 | // Add in the whole j'th row | ||
| 78 | |||
| 79 | .macro addrow arg1 | ||
| 80 | mov rdx, [y+8*\arg1] | ||
| 81 | xor zeroe, zeroe | ||
| 82 | |||
| 83 | mulpadd \arg1, 0 | ||
| 84 | |||
| 85 | .if (\arg1 % 6 == 0) | ||
| 86 | mov [z+8*\arg1],r8 | ||
| 87 | .elseif (\arg1 % 6 == 1) | ||
| 88 | mov [z+8*\arg1],r9 | ||
| 89 | .elseif (\arg1 % 6 == 2) | ||
| 90 | mov [z+8*\arg1],r10 | ||
| 91 | .elseif (\arg1 % 6 == 3) | ||
| 92 | mov [z+8*\arg1],r11 | ||
| 93 | .elseif (\arg1 % 6 == 4) | ||
| 94 | mov [z+8*\arg1],r12 | ||
| 95 | .elseif (\arg1 % 6 == 5) | ||
| 96 | mov [z+8*\arg1],r13 | ||
| 97 | .endif | ||
| 98 | |||
| 99 | mulpadd \arg1, 1 | ||
| 100 | mulpadd \arg1, 2 | ||
| 101 | mulpadd \arg1, 3 | ||
| 102 | mulpadd \arg1, 4 | ||
| 103 | |||
| 104 | .if (\arg1 % 6 == 0) | ||
| 105 | mulx r8, rax, [x+40] | ||
| 106 | adcx r13, rax | ||
| 107 | adox r8, zero | ||
| 108 | adcx r8, zero | ||
| 109 | .elseif (\arg1 % 6 == 1) | ||
| 110 | mulx r9, rax, [x+40] | ||
| 111 | adcx r8, rax | ||
| 112 | adox r9, zero | ||
| 113 | adcx r9, zero | ||
| 114 | .elseif (\arg1 % 6 == 2) | ||
| 115 | mulx r10, rax, [x+40] | ||
| 116 | adcx r9, rax | ||
| 117 | adox r10, zero | ||
| 118 | adcx r10, zero | ||
| 119 | .elseif (\arg1 % 6 == 3) | ||
| 120 | mulx r11, rax, [x+40] | ||
| 121 | adcx r10, rax | ||
| 122 | adox r11, zero | ||
| 123 | adcx r11, zero | ||
| 124 | .elseif (\arg1 % 6 == 4) | ||
| 125 | mulx r12, rax, [x+40] | ||
| 126 | adcx r11, rax | ||
| 127 | adox r12, zero | ||
| 128 | adcx r12, zero | ||
| 129 | .elseif (\arg1 % 6 == 5) | ||
| 130 | mulx r13, rax, [x+40] | ||
| 131 | adcx r12, rax | ||
| 132 | adox r13, zero | ||
| 133 | adcx r13, zero | ||
| 134 | .endif | ||
| 135 | |||
| 136 | .endm | ||
| 137 | |||
| 138 | |||
| 139 | |||
| 140 | S2N_BN_SYMBOL(bignum_mul_6_12): | ||
| 141 | _CET_ENDBR | ||
| 142 | |||
| 143 | #if WINDOWS_ABI | ||
| 144 | push rdi | ||
| 145 | push rsi | ||
| 146 | mov rdi, rcx | ||
| 147 | mov rsi, rdx | ||
| 148 | mov rdx, r8 | ||
| 149 | #endif | ||
| 150 | |||
| 151 | // Save more registers to play with | ||
| 152 | |||
| 153 | push rbp | ||
| 154 | push rbx | ||
| 155 | push r12 | ||
| 156 | push r13 | ||
| 157 | |||
| 158 | // Copy y into a safe register to start with | ||
| 159 | |||
| 160 | mov y, rdx | ||
| 161 | |||
| 162 | // Zero a register, which also makes sure we don't get a fake carry-in | ||
| 163 | |||
| 164 | xor zeroe, zeroe | ||
| 165 | |||
| 166 | // Do the zeroth row, which is a bit different | ||
| 167 | // Write back the zero-zero product and then accumulate | ||
| 168 | // r8,r13,r12,r11,r10,r9 as y[0] * x from 1..6 | ||
| 169 | |||
| 170 | mov rdx, [y] | ||
| 171 | |||
| 172 | mulx r9, r8, [x] | ||
| 173 | mov [z], r8 | ||
| 174 | |||
| 175 | mulx r10, rbx, [x+8] | ||
| 176 | adcx r9, rbx | ||
| 177 | |||
| 178 | mulx r11, rbx, [x+16] | ||
| 179 | adcx r10, rbx | ||
| 180 | |||
| 181 | mulx r12, rbx, [x+24] | ||
| 182 | adcx r11, rbx | ||
| 183 | |||
| 184 | mulx r13, rbx, [x+32] | ||
| 185 | adcx r12, rbx | ||
| 186 | |||
| 187 | mulx r8, rbx, [x+40] | ||
| 188 | adcx r13, rbx | ||
| 189 | adcx r8, zero | ||
| 190 | |||
| 191 | // Now all the other rows in a uniform pattern | ||
| 192 | |||
| 193 | addrow 1 | ||
| 194 | addrow 2 | ||
| 195 | addrow 3 | ||
| 196 | addrow 4 | ||
| 197 | addrow 5 | ||
| 198 | |||
| 199 | // Now write back the additional columns | ||
| 200 | |||
| 201 | mov [z+48], r8 | ||
| 202 | mov [z+56], r9 | ||
| 203 | mov [z+64], r10 | ||
| 204 | mov [z+72], r11 | ||
| 205 | mov [z+80], r12 | ||
| 206 | mov [z+88], r13 | ||
| 207 | |||
| 208 | // Restore registers and return | ||
| 209 | |||
| 210 | pop r13 | ||
| 211 | pop r12 | ||
| 212 | pop rbx | ||
| 213 | pop rbp | ||
| 214 | |||
| 215 | #if WINDOWS_ABI | ||
| 216 | pop rsi | ||
| 217 | pop rdi | ||
| 218 | #endif | ||
| 219 | ret | ||
| 220 | |||
| 221 | #if defined(__linux__) && defined(__ELF__) | ||
| 222 | .section .note.GNU-stack,"",%progbits | ||
| 223 | #endif | ||
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_mul_6_12_alt.S b/src/lib/libcrypto/bn/arch/amd64/bignum_mul_6_12_alt.S new file mode 100644 index 0000000000..077c52b38e --- /dev/null +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_mul_6_12_alt.S | |||
| @@ -0,0 +1,199 @@ | |||
| 1 | // $OpenBSD: bignum_mul_6_12_alt.S,v 1.4 2025/08/12 10:23:40 jsing Exp $ | ||
| 2 | // | ||
| 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| 4 | // | ||
| 5 | // Permission to use, copy, modify, and/or distribute this software for any | ||
| 6 | // purpose with or without fee is hereby granted, provided that the above | ||
| 7 | // copyright notice and this permission notice appear in all copies. | ||
| 8 | // | ||
| 9 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | |||
| 17 | // ---------------------------------------------------------------------------- | ||
| 18 | // Multiply z := x * y | ||
| 19 | // Inputs x[6], y[6]; output z[12] | ||
| 20 | // | ||
| 21 | // extern void bignum_mul_6_12_alt(uint64_t z[static 12], | ||
| 22 | // const uint64_t x[static 6], | ||
| 23 | // const uint64_t y[static 6]); | ||
| 24 | // | ||
| 25 | // Standard x86-64 ABI: RDI = z, RSI = x, RDX = y | ||
| 26 | // Microsoft x64 ABI: RCX = z, RDX = x, R8 = y | ||
| 27 | // ---------------------------------------------------------------------------- | ||
| 28 | |||
| 29 | #include "s2n_bignum_internal.h" | ||
| 30 | |||
| 31 | .intel_syntax noprefix | ||
| 32 | S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_mul_6_12_alt) | ||
| 33 | S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_mul_6_12_alt) | ||
| 34 | .text | ||
| 35 | |||
| 36 | // These are actually right | ||
| 37 | |||
| 38 | #define z rdi | ||
| 39 | #define x rsi | ||
| 40 | |||
| 41 | // This is moved from rdx to free it for muls | ||
| 42 | |||
| 43 | #define y rcx | ||
| 44 | |||
| 45 | // Other variables used as a rotating 3-word window to add terms to | ||
| 46 | |||
| 47 | #define t0 r8 | ||
| 48 | #define t1 r9 | ||
| 49 | #define t2 r10 | ||
| 50 | |||
| 51 | // Macro for the key "multiply and add to (c,h,l)" step | ||
| 52 | |||
| 53 | #define combadd(c,h,l,numa,numb) \ | ||
| 54 | mov rax, numa; \ | ||
| 55 | mul QWORD PTR numb; \ | ||
| 56 | add l, rax; \ | ||
| 57 | adc h, rdx; \ | ||
| 58 | adc c, 0 | ||
| 59 | |||
| 60 | // A minutely shorter form for when c = 0 initially | ||
| 61 | |||
| 62 | #define combadz(c,h,l,numa,numb) \ | ||
| 63 | mov rax, numa; \ | ||
| 64 | mul QWORD PTR numb; \ | ||
| 65 | add l, rax; \ | ||
| 66 | adc h, rdx; \ | ||
| 67 | adc c, c | ||
| 68 | |||
| 69 | // A short form where we don't expect a top carry | ||
| 70 | |||
| 71 | #define combads(h,l,numa,numb) \ | ||
| 72 | mov rax, numa; \ | ||
| 73 | mul QWORD PTR numb; \ | ||
| 74 | add l, rax; \ | ||
| 75 | adc h, rdx | ||
| 76 | |||
| 77 | S2N_BN_SYMBOL(bignum_mul_6_12_alt): | ||
| 78 | _CET_ENDBR | ||
| 79 | |||
| 80 | #if WINDOWS_ABI | ||
| 81 | push rdi | ||
| 82 | push rsi | ||
| 83 | mov rdi, rcx | ||
| 84 | mov rsi, rdx | ||
| 85 | mov rdx, r8 | ||
| 86 | #endif | ||
| 87 | |||
| 88 | // Copy y into a safe register to start with | ||
| 89 | |||
| 90 | mov y, rdx | ||
| 91 | |||
| 92 | // Result term 0 | ||
| 93 | |||
| 94 | mov rax, [x] | ||
| 95 | mul QWORD PTR [y] | ||
| 96 | |||
| 97 | mov [z], rax | ||
| 98 | mov t0, rdx | ||
| 99 | xor t1, t1 | ||
| 100 | |||
| 101 | // Result term 1 | ||
| 102 | |||
| 103 | xor t2, t2 | ||
| 104 | combads(t1,t0,[x],[y+8]) | ||
| 105 | combadz(t2,t1,t0,[x+8],[y]) | ||
| 106 | mov [z+8], t0 | ||
| 107 | |||
| 108 | // Result term 2 | ||
| 109 | |||
| 110 | xor t0, t0 | ||
| 111 | combadz(t0,t2,t1,[x],[y+16]) | ||
| 112 | combadd(t0,t2,t1,[x+8],[y+8]) | ||
| 113 | combadd(t0,t2,t1,[x+16],[y]) | ||
| 114 | mov [z+16], t1 | ||
| 115 | |||
| 116 | // Result term 3 | ||
| 117 | |||
| 118 | xor t1, t1 | ||
| 119 | combadz(t1,t0,t2,[x],[y+24]) | ||
| 120 | combadd(t1,t0,t2,[x+8],[y+16]) | ||
| 121 | combadd(t1,t0,t2,[x+16],[y+8]) | ||
| 122 | combadd(t1,t0,t2,[x+24],[y]) | ||
| 123 | mov [z+24], t2 | ||
| 124 | |||
| 125 | // Result term 4 | ||
| 126 | |||
| 127 | xor t2, t2 | ||
| 128 | combadz(t2,t1,t0,[x],[y+32]) | ||
| 129 | combadd(t2,t1,t0,[x+8],[y+24]) | ||
| 130 | combadd(t2,t1,t0,[x+16],[y+16]) | ||
| 131 | combadd(t2,t1,t0,[x+24],[y+8]) | ||
| 132 | combadd(t2,t1,t0,[x+32],[y]) | ||
| 133 | mov [z+32], t0 | ||
| 134 | |||
| 135 | // Result term 5 | ||
| 136 | |||
| 137 | xor t0, t0 | ||
| 138 | combadz(t0,t2,t1,[x],[y+40]) | ||
| 139 | combadd(t0,t2,t1,[x+8],[y+32]) | ||
| 140 | combadd(t0,t2,t1,[x+16],[y+24]) | ||
| 141 | combadd(t0,t2,t1,[x+24],[y+16]) | ||
| 142 | combadd(t0,t2,t1,[x+32],[y+8]) | ||
| 143 | combadd(t0,t2,t1,[x+40],[y]) | ||
| 144 | mov [z+40], t1 | ||
| 145 | |||
| 146 | // Result term 6 | ||
| 147 | |||
| 148 | xor t1, t1 | ||
| 149 | combadz(t1,t0,t2,[x+8],[y+40]) | ||
| 150 | combadd(t1,t0,t2,[x+16],[y+32]) | ||
| 151 | combadd(t1,t0,t2,[x+24],[y+24]) | ||
| 152 | combadd(t1,t0,t2,[x+32],[y+16]) | ||
| 153 | combadd(t1,t0,t2,[x+40],[y+8]) | ||
| 154 | mov [z+48], t2 | ||
| 155 | |||
| 156 | // Result term 7 | ||
| 157 | |||
| 158 | xor t2, t2 | ||
| 159 | combadz(t2,t1,t0,[x+16],[y+40]) | ||
| 160 | combadd(t2,t1,t0,[x+24],[y+32]) | ||
| 161 | combadd(t2,t1,t0,[x+32],[y+24]) | ||
| 162 | combadd(t2,t1,t0,[x+40],[y+16]) | ||
| 163 | mov [z+56], t0 | ||
| 164 | |||
| 165 | // Result term 8 | ||
| 166 | |||
| 167 | xor t0, t0 | ||
| 168 | combadz(t0,t2,t1,[x+24],[y+40]) | ||
| 169 | combadd(t0,t2,t1,[x+32],[y+32]) | ||
| 170 | combadd(t0,t2,t1,[x+40],[y+24]) | ||
| 171 | mov [z+64], t1 | ||
| 172 | |||
| 173 | // Result term 9 | ||
| 174 | |||
| 175 | xor t1, t1 | ||
| 176 | combadz(t1,t0,t2,[x+32],[y+40]) | ||
| 177 | combadd(t1,t0,t2,[x+40],[y+32]) | ||
| 178 | mov [z+72], t2 | ||
| 179 | |||
| 180 | // Result term 10 | ||
| 181 | |||
| 182 | combads(t1,t0,[x+40],[y+40]) | ||
| 183 | mov [z+80], t0 | ||
| 184 | |||
| 185 | // Result term 11 | ||
| 186 | |||
| 187 | mov [z+88], t1 | ||
| 188 | |||
| 189 | // Return | ||
| 190 | |||
| 191 | #if WINDOWS_ABI | ||
| 192 | pop rsi | ||
| 193 | pop rdi | ||
| 194 | #endif | ||
| 195 | ret | ||
| 196 | |||
| 197 | #if defined(__linux__) && defined(__ELF__) | ||
| 198 | .section .note.GNU-stack,"",%progbits | ||
| 199 | #endif | ||
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_mul_8_16.S b/src/lib/libcrypto/bn/arch/amd64/bignum_mul_8_16.S new file mode 100644 index 0000000000..faa0196d8e --- /dev/null +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_mul_8_16.S | |||
| @@ -0,0 +1,273 @@ | |||
| 1 | // $OpenBSD: bignum_mul_8_16.S,v 1.4 2025/08/12 10:23:40 jsing Exp $ | ||
| 2 | // | ||
| 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| 4 | // | ||
| 5 | // Permission to use, copy, modify, and/or distribute this software for any | ||
| 6 | // purpose with or without fee is hereby granted, provided that the above | ||
| 7 | // copyright notice and this permission notice appear in all copies. | ||
| 8 | // | ||
| 9 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | |||
| 17 | // ---------------------------------------------------------------------------- | ||
| 18 | // Multiply z := x * y | ||
| 19 | // Inputs x[8], y[8]; output z[16] | ||
| 20 | // | ||
| 21 | // extern void bignum_mul_8_16(uint64_t z[static 16], const uint64_t x[static 8], | ||
| 22 | // const uint64_t y[static 8]); | ||
| 23 | // | ||
| 24 | // Standard x86-64 ABI: RDI = z, RSI = x, RDX = y | ||
| 25 | // Microsoft x64 ABI: RCX = z, RDX = x, R8 = y | ||
| 26 | // ---------------------------------------------------------------------------- | ||
| 27 | |||
| 28 | #include "s2n_bignum_internal.h" | ||
| 29 | |||
| 30 | .intel_syntax noprefix | ||
| 31 | S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_mul_8_16) | ||
| 32 | S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_mul_8_16) | ||
| 33 | .text | ||
| 34 | |||
| 35 | // These are actually right | ||
| 36 | |||
| 37 | #define z rdi | ||
| 38 | #define x rsi | ||
| 39 | |||
| 40 | // Copied in or set up | ||
| 41 | |||
| 42 | #define y rcx | ||
| 43 | |||
| 44 | // A zero register | ||
| 45 | |||
| 46 | #define zero rbp | ||
| 47 | #define zeroe ebp | ||
| 48 | |||
| 49 | // mulpadd i, j adds x[i] * rdx (now assumed = y[j]) into the window at i+j | ||
| 50 | |||
| 51 | .macro mulpadd arg1,arg2 | ||
| 52 | mulx rbx, rax, [x+8*\arg1] | ||
| 53 | .if ((\arg1 + \arg2) % 8 == 0) | ||
| 54 | adcx r8, rax | ||
| 55 | adox r9, rbx | ||
| 56 | .elseif ((\arg1 + \arg2) % 8 == 1) | ||
| 57 | adcx r9, rax | ||
| 58 | adox r10, rbx | ||
| 59 | .elseif ((\arg1 + \arg2) % 8 == 2) | ||
| 60 | adcx r10, rax | ||
| 61 | adox r11, rbx | ||
| 62 | .elseif ((\arg1 + \arg2) % 8 == 3) | ||
| 63 | adcx r11, rax | ||
| 64 | adox r12, rbx | ||
| 65 | .elseif ((\arg1 + \arg2) % 8 == 4) | ||
| 66 | adcx r12, rax | ||
| 67 | adox r13, rbx | ||
| 68 | .elseif ((\arg1 + \arg2) % 8 == 5) | ||
| 69 | adcx r13, rax | ||
| 70 | adox r14, rbx | ||
| 71 | .elseif ((\arg1 + \arg2) % 8 == 6) | ||
| 72 | adcx r14, rax | ||
| 73 | adox r15, rbx | ||
| 74 | .elseif ((\arg1 + \arg2) % 8 == 7) | ||
| 75 | adcx r15, rax | ||
| 76 | adox r8, rbx | ||
| 77 | .endif | ||
| 78 | |||
| 79 | .endm | ||
| 80 | |||
| 81 | // mulpade i, j adds x[i] * rdx (now assumed = y[j]) into the window at i+j | ||
| 82 | // but re-creates the top word assuming nothing to add there | ||
| 83 | |||
| 84 | .macro mulpade arg1,arg2 | ||
| 85 | .if ((\arg1 + \arg2) % 8 == 0) | ||
| 86 | mulx r9, rax, [x+8*\arg1] | ||
| 87 | adcx r8, rax | ||
| 88 | adox r9, zero | ||
| 89 | .elseif ((\arg1 + \arg2) % 8 == 1) | ||
| 90 | mulx r10, rax, [x+8*\arg1] | ||
| 91 | adcx r9, rax | ||
| 92 | adox r10, zero | ||
| 93 | .elseif ((\arg1 + \arg2) % 8 == 2) | ||
| 94 | mulx r11, rax, [x+8*\arg1] | ||
| 95 | adcx r10, rax | ||
| 96 | adox r11, zero | ||
| 97 | .elseif ((\arg1 + \arg2) % 8 == 3) | ||
| 98 | mulx r12, rax, [x+8*\arg1] | ||
| 99 | adcx r11, rax | ||
| 100 | adox r12, zero | ||
| 101 | .elseif ((\arg1 + \arg2) % 8 == 4) | ||
| 102 | mulx r13, rax, [x+8*\arg1] | ||
| 103 | adcx r12, rax | ||
| 104 | adox r13, zero | ||
| 105 | .elseif ((\arg1 + \arg2) % 8 == 5) | ||
| 106 | mulx r14, rax, [x+8*\arg1] | ||
| 107 | adcx r13, rax | ||
| 108 | adox r14, zero | ||
| 109 | .elseif ((\arg1 + \arg2) % 8 == 6) | ||
| 110 | mulx r15, rax, [x+8*\arg1] | ||
| 111 | adcx r14, rax | ||
| 112 | adox r15, zero | ||
| 113 | .elseif ((\arg1 + \arg2) % 8 == 7) | ||
| 114 | mulx r8, rax, [x+8*\arg1] | ||
| 115 | adcx r15, rax | ||
| 116 | adox r8, zero | ||
| 117 | .endif | ||
| 118 | |||
| 119 | .endm | ||
| 120 | |||
| 121 | // Add in the whole j'th row | ||
| 122 | |||
| 123 | .macro addrow arg1 | ||
| 124 | mov rdx, [y+8*\arg1] | ||
| 125 | xor zeroe, zeroe | ||
| 126 | |||
| 127 | mulpadd 0, \arg1 | ||
| 128 | |||
| 129 | .if (\arg1 % 8 == 0) | ||
| 130 | mov [z+8*\arg1],r8 | ||
| 131 | .elseif (\arg1 % 8 == 1) | ||
| 132 | mov [z+8*\arg1],r9 | ||
| 133 | .elseif (\arg1 % 8 == 2) | ||
| 134 | mov [z+8*\arg1],r10 | ||
| 135 | .elseif (\arg1 % 8 == 3) | ||
| 136 | mov [z+8*\arg1],r11 | ||
| 137 | .elseif (\arg1 % 8 == 4) | ||
| 138 | mov [z+8*\arg1],r12 | ||
| 139 | .elseif (\arg1 % 8 == 5) | ||
| 140 | mov [z+8*\arg1],r13 | ||
| 141 | .elseif (\arg1 % 8 == 6) | ||
| 142 | mov [z+8*\arg1],r14 | ||
| 143 | .elseif (\arg1 % 8 == 7) | ||
| 144 | mov [z+8*\arg1],r15 | ||
| 145 | .endif | ||
| 146 | |||
| 147 | mulpadd 1, \arg1 | ||
| 148 | mulpadd 2, \arg1 | ||
| 149 | mulpadd 3, \arg1 | ||
| 150 | mulpadd 4, \arg1 | ||
| 151 | mulpadd 5, \arg1 | ||
| 152 | mulpadd 6, \arg1 | ||
| 153 | mulpade 7, \arg1 | ||
| 154 | |||
| 155 | .if (\arg1 % 8 == 0) | ||
| 156 | adc r8, zero | ||
| 157 | .elseif (\arg1 % 8 == 1) | ||
| 158 | adc r9, zero | ||
| 159 | .elseif (\arg1 % 8 == 2) | ||
| 160 | adc r10, zero | ||
| 161 | .elseif (\arg1 % 8 == 3) | ||
| 162 | adc r11, zero | ||
| 163 | .elseif (\arg1 % 8 == 4) | ||
| 164 | adc r12, zero | ||
| 165 | .elseif (\arg1 % 8 == 5) | ||
| 166 | adc r13, zero | ||
| 167 | .elseif (\arg1 % 8 == 6) | ||
| 168 | adc r14, zero | ||
| 169 | .elseif (\arg1 % 8 == 7) | ||
| 170 | adc r15, zero | ||
| 171 | .endif | ||
| 172 | |||
| 173 | .endm | ||
| 174 | |||
| 175 | |||
| 176 | S2N_BN_SYMBOL(bignum_mul_8_16): | ||
| 177 | _CET_ENDBR | ||
| 178 | |||
| 179 | #if WINDOWS_ABI | ||
| 180 | push rdi | ||
| 181 | push rsi | ||
| 182 | mov rdi, rcx | ||
| 183 | mov rsi, rdx | ||
| 184 | mov rdx, r8 | ||
| 185 | #endif | ||
| 186 | |||
| 187 | // Save more registers to play with | ||
| 188 | |||
| 189 | push rbp | ||
| 190 | push rbx | ||
| 191 | push r12 | ||
| 192 | push r13 | ||
| 193 | push r14 | ||
| 194 | push r15 | ||
| 195 | |||
| 196 | // Copy y into a safe register to start with | ||
| 197 | |||
| 198 | mov y, rdx | ||
| 199 | |||
| 200 | // Zero a register, which also makes sure we don't get a fake carry-in | ||
| 201 | |||
| 202 | xor zeroe, zeroe | ||
| 203 | |||
| 204 | // Do the zeroth row, which is a bit different | ||
| 205 | // Write back the zero-zero product and then accumulate | ||
| 206 | // r8,r15,r14,r13,r12,r11,r10,r9 as y[0] * x from 1..8 | ||
| 207 | |||
| 208 | mov rdx, [y] | ||
| 209 | |||
| 210 | mulx r9, r8, [x] | ||
| 211 | mov [z], r8 | ||
| 212 | |||
| 213 | mulx r10, rbx, [x+8] | ||
| 214 | adc r9, rbx | ||
| 215 | |||
| 216 | mulx r11, rbx, [x+16] | ||
| 217 | adc r10, rbx | ||
| 218 | |||
| 219 | mulx r12, rbx, [x+24] | ||
| 220 | adc r11, rbx | ||
| 221 | |||
| 222 | mulx r13, rbx, [x+32] | ||
| 223 | adc r12, rbx | ||
| 224 | |||
| 225 | mulx r14, rbx, [x+40] | ||
| 226 | adc r13, rbx | ||
| 227 | |||
| 228 | mulx r15, rbx, [x+48] | ||
| 229 | adc r14, rbx | ||
| 230 | |||
| 231 | mulx r8, rbx, [x+56] | ||
| 232 | adc r15, rbx | ||
| 233 | adc r8, zero | ||
| 234 | |||
| 235 | // Now all the other rows in a uniform pattern | ||
| 236 | |||
| 237 | addrow 1 | ||
| 238 | addrow 2 | ||
| 239 | addrow 3 | ||
| 240 | addrow 4 | ||
| 241 | addrow 5 | ||
| 242 | addrow 6 | ||
| 243 | addrow 7 | ||
| 244 | |||
| 245 | // Now write back the additional columns | ||
| 246 | |||
| 247 | mov [z+64], r8 | ||
| 248 | mov [z+72], r9 | ||
| 249 | mov [z+80], r10 | ||
| 250 | mov [z+88], r11 | ||
| 251 | mov [z+96], r12 | ||
| 252 | mov [z+104], r13 | ||
| 253 | mov [z+112], r14 | ||
| 254 | mov [z+120], r15 | ||
| 255 | |||
| 256 | // Real epilog | ||
| 257 | |||
| 258 | pop r15 | ||
| 259 | pop r14 | ||
| 260 | pop r13 | ||
| 261 | pop r12 | ||
| 262 | pop rbx | ||
| 263 | pop rbp | ||
| 264 | |||
| 265 | #if WINDOWS_ABI | ||
| 266 | pop rsi | ||
| 267 | pop rdi | ||
| 268 | #endif | ||
| 269 | ret | ||
| 270 | |||
| 271 | #if defined(__linux__) && defined(__ELF__) | ||
| 272 | .section .note.GNU-stack,"",%progbits | ||
| 273 | #endif | ||
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_mul_8_16_alt.S b/src/lib/libcrypto/bn/arch/amd64/bignum_mul_8_16_alt.S index 066403b074..0e30b9170f 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bignum_mul_8_16_alt.S +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_mul_8_16_alt.S | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | // $OpenBSD: bignum_mul_8_16_alt.S,v 1.7 2025/08/11 14:13:56 jsing Exp $ | ||
| 2 | // | ||
| 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | // | 4 | // |
| 3 | // Permission to use, copy, modify, and/or distribute this software for any | 5 | // Permission to use, copy, modify, and/or distribute this software for any |
| @@ -16,8 +18,9 @@ | |||
| 16 | // Multiply z := x * y | 18 | // Multiply z := x * y |
| 17 | // Inputs x[8], y[8]; output z[16] | 19 | // Inputs x[8], y[8]; output z[16] |
| 18 | // | 20 | // |
| 19 | // extern void bignum_mul_8_16_alt | 21 | // extern void bignum_mul_8_16_alt(uint64_t z[static 16], |
| 20 | // (uint64_t z[static 16], uint64_t x[static 8], uint64_t y[static 8]); | 22 | // const uint64_t x[static 8], |
| 23 | // const uint64_t y[static 8]); | ||
| 21 | // | 24 | // |
| 22 | // Standard x86-64 ABI: RDI = z, RSI = x, RDX = y | 25 | // Standard x86-64 ABI: RDI = z, RSI = x, RDX = y |
| 23 | // Microsoft x64 ABI: RCX = z, RDX = x, R8 = y | 26 | // Microsoft x64 ABI: RCX = z, RDX = x, R8 = y |
| @@ -72,7 +75,7 @@ | |||
| 72 | adc h, rdx | 75 | adc h, rdx |
| 73 | 76 | ||
| 74 | S2N_BN_SYMBOL(bignum_mul_8_16_alt): | 77 | S2N_BN_SYMBOL(bignum_mul_8_16_alt): |
| 75 | _CET_ENDBR | 78 | _CET_ENDBR |
| 76 | 79 | ||
| 77 | #if WINDOWS_ABI | 80 | #if WINDOWS_ABI |
| 78 | push rdi | 81 | push rdi |
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S index 54e3f59442..86f1af2ac4 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | // $OpenBSD: bignum_sqr.S,v 1.7 2025/08/11 14:13:56 jsing Exp $ | ||
| 2 | // | ||
| 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | // | 4 | // |
| 3 | // Permission to use, copy, modify, and/or distribute this software for any | 5 | // Permission to use, copy, modify, and/or distribute this software for any |
| @@ -16,8 +18,7 @@ | |||
| 16 | // Square z := x^2 | 18 | // Square z := x^2 |
| 17 | // Input x[n]; output z[k] | 19 | // Input x[n]; output z[k] |
| 18 | // | 20 | // |
| 19 | // extern void bignum_sqr | 21 | // extern void bignum_sqr(uint64_t k, uint64_t *z, uint64_t n, const uint64_t *x); |
| 20 | // (uint64_t k, uint64_t *z, uint64_t n, uint64_t *x); | ||
| 21 | // | 22 | // |
| 22 | // Does the "z := x^2" operation where x is n digits and result z is k. | 23 | // Does the "z := x^2" operation where x is n digits and result z is k. |
| 23 | // Truncates the result in general unless k >= 2 * n | 24 | // Truncates the result in general unless k >= 2 * n |
| @@ -62,7 +63,7 @@ | |||
| 62 | #define llshort ebp | 63 | #define llshort ebp |
| 63 | 64 | ||
| 64 | S2N_BN_SYMBOL(bignum_sqr): | 65 | S2N_BN_SYMBOL(bignum_sqr): |
| 65 | _CET_ENDBR | 66 | _CET_ENDBR |
| 66 | 67 | ||
| 67 | #if WINDOWS_ABI | 68 | #if WINDOWS_ABI |
| 68 | push rdi | 69 | push rdi |
| @@ -86,7 +87,7 @@ S2N_BN_SYMBOL(bignum_sqr): | |||
| 86 | // If p = 0 the result is trivial and nothing needs doing | 87 | // If p = 0 the result is trivial and nothing needs doing |
| 87 | 88 | ||
| 88 | test p, p | 89 | test p, p |
| 89 | jz end | 90 | jz bignum_sqr_end |
| 90 | 91 | ||
| 91 | // initialize (hh,ll) = 0 | 92 | // initialize (hh,ll) = 0 |
| 92 | 93 | ||
| @@ -97,7 +98,7 @@ S2N_BN_SYMBOL(bignum_sqr): | |||
| 97 | 98 | ||
| 98 | xor k, k | 99 | xor k, k |
| 99 | 100 | ||
| 100 | outerloop: | 101 | bignum_sqr_outerloop: |
| 101 | 102 | ||
| 102 | // First let bot = MAX 0 (k + 1 - n) and top = MIN (k + 1) n | 103 | // First let bot = MAX 0 (k + 1 - n) and top = MIN (k + 1) n |
| 103 | // We want to accumulate all x[i] * x[k - i] for bot <= i < top | 104 | // We want to accumulate all x[i] * x[k - i] for bot <= i < top |
| @@ -122,7 +123,7 @@ outerloop: | |||
| 122 | // If htop <= bot then main doubled part of the sum is empty | 123 | // If htop <= bot then main doubled part of the sum is empty |
| 123 | 124 | ||
| 124 | cmp i, htop | 125 | cmp i, htop |
| 125 | jnc nosumming | 126 | jnc bignum_sqr_nosumming |
| 126 | 127 | ||
| 127 | // Use a moving pointer for [y] = x[k-i] for the cofactor | 128 | // Use a moving pointer for [y] = x[k-i] for the cofactor |
| 128 | 129 | ||
| @@ -132,7 +133,7 @@ outerloop: | |||
| 132 | 133 | ||
| 133 | // Do the main part of the sum x[i] * x[k - i] for 2 * i < k | 134 | // Do the main part of the sum x[i] * x[k - i] for 2 * i < k |
| 134 | 135 | ||
| 135 | innerloop: | 136 | bignum_sqr_innerloop: |
| 136 | mov a, [x+8*i] | 137 | mov a, [x+8*i] |
| 137 | mul QWORD PTR [y] | 138 | mul QWORD PTR [y] |
| 138 | add l, a | 139 | add l, a |
| @@ -141,7 +142,7 @@ innerloop: | |||
| 141 | sub y, 8 | 142 | sub y, 8 |
| 142 | inc i | 143 | inc i |
| 143 | cmp i, htop | 144 | cmp i, htop |
| 144 | jc innerloop | 145 | jc bignum_sqr_innerloop |
| 145 | 146 | ||
| 146 | // Now double it | 147 | // Now double it |
| 147 | 148 | ||
| @@ -151,11 +152,11 @@ innerloop: | |||
| 151 | 152 | ||
| 152 | // If k is even (which means 2 * i = k) and i < n add the extra x[i]^2 term | 153 | // If k is even (which means 2 * i = k) and i < n add the extra x[i]^2 term |
| 153 | 154 | ||
| 154 | nosumming: | 155 | bignum_sqr_nosumming: |
| 155 | test k, 1 | 156 | test k, 1 |
| 156 | jnz innerend | 157 | jnz bignum_sqr_innerend |
| 157 | cmp i, n | 158 | cmp i, n |
| 158 | jnc innerend | 159 | jnc bignum_sqr_innerend |
| 159 | 160 | ||
| 160 | mov a, [x+8*i] | 161 | mov a, [x+8*i] |
| 161 | mul a | 162 | mul a |
| @@ -165,7 +166,7 @@ nosumming: | |||
| 165 | 166 | ||
| 166 | // Now add the local sum into the global sum, store and shift | 167 | // Now add the local sum into the global sum, store and shift |
| 167 | 168 | ||
| 168 | innerend: | 169 | bignum_sqr_innerend: |
| 169 | add l, ll | 170 | add l, ll |
| 170 | mov [z+8*k], l | 171 | mov [z+8*k], l |
| 171 | adc h, hh | 172 | adc h, hh |
| @@ -175,11 +176,11 @@ innerend: | |||
| 175 | 176 | ||
| 176 | inc k | 177 | inc k |
| 177 | cmp k, p | 178 | cmp k, p |
| 178 | jc outerloop | 179 | jc bignum_sqr_outerloop |
| 179 | 180 | ||
| 180 | // Restore registers and return | 181 | // Restore registers and return |
| 181 | 182 | ||
| 182 | end: | 183 | bignum_sqr_end: |
| 183 | pop r15 | 184 | pop r15 |
| 184 | pop r14 | 185 | pop r14 |
| 185 | pop r13 | 186 | pop r13 |
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_4_8.S b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_4_8.S new file mode 100644 index 0000000000..25664782f7 --- /dev/null +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_4_8.S | |||
| @@ -0,0 +1,158 @@ | |||
| 1 | // $OpenBSD: bignum_sqr_4_8.S,v 1.4 2025/08/12 10:23:40 jsing Exp $ | ||
| 2 | // | ||
| 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| 4 | // | ||
| 5 | // Permission to use, copy, modify, and/or distribute this software for any | ||
| 6 | // purpose with or without fee is hereby granted, provided that the above | ||
| 7 | // copyright notice and this permission notice appear in all copies. | ||
| 8 | // | ||
| 9 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | |||
| 17 | // ---------------------------------------------------------------------------- | ||
| 18 | // Square, z := x^2 | ||
| 19 | // Input x[4]; output z[8] | ||
| 20 | // | ||
| 21 | // extern void bignum_sqr_4_8(uint64_t z[static 8], const uint64_t x[static 4]); | ||
| 22 | // | ||
| 23 | // Standard x86-64 ABI: RDI = z, RSI = x | ||
| 24 | // Microsoft x64 ABI: RCX = z, RDX = x | ||
| 25 | // ---------------------------------------------------------------------------- | ||
| 26 | |||
| 27 | #include "s2n_bignum_internal.h" | ||
| 28 | |||
| 29 | .intel_syntax noprefix | ||
| 30 | S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_sqr_4_8) | ||
| 31 | S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_sqr_4_8) | ||
| 32 | .text | ||
| 33 | |||
| 34 | // These are actually right | ||
| 35 | |||
| 36 | #define z rdi | ||
| 37 | #define x rsi | ||
| 38 | |||
| 39 | // A zero register | ||
| 40 | |||
| 41 | #define zero rbp | ||
| 42 | #define zeroe ebp | ||
| 43 | |||
| 44 | // Other registers | ||
| 45 | |||
| 46 | #define d1 r8 | ||
| 47 | #define d2 r9 | ||
| 48 | #define d3 r10 | ||
| 49 | #define d4 r11 | ||
| 50 | #define d5 r12 | ||
| 51 | #define d6 r13 | ||
| 52 | |||
| 53 | |||
| 54 | |||
| 55 | S2N_BN_SYMBOL(bignum_sqr_4_8): | ||
| 56 | _CET_ENDBR | ||
| 57 | |||
| 58 | #if WINDOWS_ABI | ||
| 59 | push rdi | ||
| 60 | push rsi | ||
| 61 | mov rdi, rcx | ||
| 62 | mov rsi, rdx | ||
| 63 | #endif | ||
| 64 | |||
| 65 | // Save more registers to play with | ||
| 66 | |||
| 67 | push rbp | ||
| 68 | push r12 | ||
| 69 | push r13 | ||
| 70 | |||
| 71 | // Set up an initial window [d6;...d1] = [23;03;01] | ||
| 72 | |||
| 73 | mov rdx, [x] | ||
| 74 | mulx d2, d1, [x+8] | ||
| 75 | mulx d4, d3, [x+24] | ||
| 76 | mov rdx, [x+16] | ||
| 77 | mulx d6, d5, [x+24] | ||
| 78 | |||
| 79 | // Clear our zero register, and also initialize the flags for the carry chain | ||
| 80 | |||
| 81 | xor zeroe, zeroe | ||
| 82 | |||
| 83 | // Chain in the addition of 02 + 12 + 13 to that window (no carry-out possible) | ||
| 84 | // This gives all the "heterogeneous" terms of the squaring ready to double | ||
| 85 | |||
| 86 | mulx rcx, rax, [x] | ||
| 87 | adcx d2, rax | ||
| 88 | adox d3, rcx | ||
| 89 | mulx rcx, rax, [x+8] | ||
| 90 | adcx d3, rax | ||
| 91 | adox d4, rcx | ||
| 92 | mov rdx, [x+24] | ||
| 93 | mulx rcx, rax, [x+8] | ||
| 94 | adcx d4, rax | ||
| 95 | adox d5, rcx | ||
| 96 | adcx d5, zero | ||
| 97 | adox d6, zero | ||
| 98 | adcx d6, zero | ||
| 99 | |||
| 100 | // In principle this is otiose as CF and OF carries are absorbed at this point | ||
| 101 | // However it seems helpful for the OOO engine to be told it's a fresh start | ||
| 102 | |||
| 103 | xor zeroe, zeroe | ||
| 104 | |||
| 105 | // Double and add to the 00 + 11 + 22 + 33 terms | ||
| 106 | // | ||
| 107 | // We could use shift-double but this seems tidier and in larger squarings | ||
| 108 | // it was actually more efficient. I haven't experimented with this small | ||
| 109 | // case to see how much that matters. Note: the writeback here is sprinkled | ||
| 110 | // into the sequence in such a way that things still work if z = x, i.e. if | ||
| 111 | // the output overwrites the input buffer and beyond. | ||
| 112 | |||
| 113 | mov rdx, [x] | ||
| 114 | mulx rdx, rax, rdx | ||
| 115 | mov [z], rax | ||
| 116 | adcx d1, d1 | ||
| 117 | adox d1, rdx | ||
| 118 | mov rdx, [x+8] | ||
| 119 | mov [z+8], d1 | ||
| 120 | mulx rdx, rax, rdx | ||
| 121 | adcx d2, d2 | ||
| 122 | adox d2, rax | ||
| 123 | adcx d3, d3 | ||
| 124 | adox d3, rdx | ||
| 125 | mov rdx, [x+16] | ||
| 126 | mov [z+16], d2 | ||
| 127 | mulx rdx, rax, rdx | ||
| 128 | adcx d4, d4 | ||
| 129 | adox d4, rax | ||
| 130 | adcx d5, d5 | ||
| 131 | adox d5, rdx | ||
| 132 | mov rdx, [x+24] | ||
| 133 | mov [z+24], d3 | ||
| 134 | mulx rdx, rax, rdx | ||
| 135 | mov [z+32], d4 | ||
| 136 | adcx d6, d6 | ||
| 137 | mov [z+40], d5 | ||
| 138 | adox d6, rax | ||
| 139 | mov [z+48], d6 | ||
| 140 | adcx rdx, zero | ||
| 141 | adox rdx, zero | ||
| 142 | mov [z+56], rdx | ||
| 143 | |||
| 144 | // Restore saved registers and return | ||
| 145 | |||
| 146 | pop r13 | ||
| 147 | pop r12 | ||
| 148 | pop rbp | ||
| 149 | |||
| 150 | #if WINDOWS_ABI | ||
| 151 | pop rsi | ||
| 152 | pop rdi | ||
| 153 | #endif | ||
| 154 | ret | ||
| 155 | |||
| 156 | #if defined(__linux__) && defined(__ELF__) | ||
| 157 | .section .note.GNU-stack,"",%progbits | ||
| 158 | #endif | ||
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_4_8_alt.S b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_4_8_alt.S index 7c534ae907..7eafac3284 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_4_8_alt.S +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_4_8_alt.S | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | // $OpenBSD: bignum_sqr_4_8_alt.S,v 1.7 2025/08/11 14:13:56 jsing Exp $ | ||
| 2 | // | ||
| 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | // | 4 | // |
| 3 | // Permission to use, copy, modify, and/or distribute this software for any | 5 | // Permission to use, copy, modify, and/or distribute this software for any |
| @@ -16,8 +18,8 @@ | |||
| 16 | // Square, z := x^2 | 18 | // Square, z := x^2 |
| 17 | // Input x[4]; output z[8] | 19 | // Input x[4]; output z[8] |
| 18 | // | 20 | // |
| 19 | // extern void bignum_sqr_4_8_alt | 21 | // extern void bignum_sqr_4_8_alt(uint64_t z[static 8], |
| 20 | // (uint64_t z[static 8], uint64_t x[static 4]); | 22 | // const uint64_t x[static 4]); |
| 21 | // | 23 | // |
| 22 | // Standard x86-64 ABI: RDI = z, RSI = x | 24 | // Standard x86-64 ABI: RDI = z, RSI = x |
| 23 | // Microsoft x64 ABI: RCX = z, RDX = x | 25 | // Microsoft x64 ABI: RCX = z, RDX = x |
| @@ -71,7 +73,7 @@ | |||
| 71 | adc c, 0 | 73 | adc c, 0 |
| 72 | 74 | ||
| 73 | S2N_BN_SYMBOL(bignum_sqr_4_8_alt): | 75 | S2N_BN_SYMBOL(bignum_sqr_4_8_alt): |
| 74 | _CET_ENDBR | 76 | _CET_ENDBR |
| 75 | 77 | ||
| 76 | #if WINDOWS_ABI | 78 | #if WINDOWS_ABI |
| 77 | push rdi | 79 | push rdi |
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_6_12.S b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_6_12.S new file mode 100644 index 0000000000..3f055e8b75 --- /dev/null +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_6_12.S | |||
| @@ -0,0 +1,227 @@ | |||
| 1 | // $OpenBSD: bignum_sqr_6_12.S,v 1.4 2025/08/12 10:23:40 jsing Exp $ | ||
| 2 | // | ||
| 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| 4 | // | ||
| 5 | // Permission to use, copy, modify, and/or distribute this software for any | ||
| 6 | // purpose with or without fee is hereby granted, provided that the above | ||
| 7 | // copyright notice and this permission notice appear in all copies. | ||
| 8 | // | ||
| 9 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | |||
| 17 | // ---------------------------------------------------------------------------- | ||
| 18 | // Square, z := x^2 | ||
| 19 | // Input x[6]; output z[12] | ||
| 20 | // | ||
| 21 | // extern void bignum_sqr_6_12(uint64_t z[static 12], const uint64_t x[static 6]); | ||
| 22 | // | ||
| 23 | // Standard x86-64 ABI: RDI = z, RSI = x | ||
| 24 | // Microsoft x64 ABI: RCX = z, RDX = x | ||
| 25 | // ---------------------------------------------------------------------------- | ||
| 26 | |||
| 27 | #include "s2n_bignum_internal.h" | ||
| 28 | |||
| 29 | .intel_syntax noprefix | ||
| 30 | S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_sqr_6_12) | ||
| 31 | S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_sqr_6_12) | ||
| 32 | .text | ||
| 33 | |||
| 34 | // These are actually right | ||
| 35 | |||
| 36 | #define z rdi | ||
| 37 | #define x rsi | ||
| 38 | |||
| 39 | // A zero register | ||
| 40 | |||
| 41 | #define zero rbp | ||
| 42 | #define zeroe ebp | ||
| 43 | |||
| 44 | // Other registers | ||
| 45 | |||
| 46 | #define d1 r8 | ||
| 47 | #define d2 r9 | ||
| 48 | #define d3 r10 | ||
| 49 | #define d4 r11 | ||
| 50 | #define d5 r12 | ||
| 51 | #define d6 r13 | ||
| 52 | #define d7 r14 | ||
| 53 | #define d8 r15 | ||
| 54 | #define d9 rbx | ||
| 55 | |||
| 56 | // Care is needed: re-using the zero register | ||
| 57 | |||
| 58 | #define d10 rbp | ||
| 59 | |||
| 60 | |||
| 61 | S2N_BN_SYMBOL(bignum_sqr_6_12): | ||
| 62 | _CET_ENDBR | ||
| 63 | |||
| 64 | #if WINDOWS_ABI | ||
| 65 | push rdi | ||
| 66 | push rsi | ||
| 67 | mov rdi, rcx | ||
| 68 | mov rsi, rdx | ||
| 69 | #endif | ||
| 70 | |||
| 71 | // Save more registers to play with | ||
| 72 | |||
| 73 | push rbp | ||
| 74 | push rbx | ||
| 75 | push r12 | ||
| 76 | push r13 | ||
| 77 | push r14 | ||
| 78 | push r15 | ||
| 79 | |||
| 80 | // Set up an initial window [d8;...d1] = [34;05;03;01] | ||
| 81 | |||
| 82 | mov rdx, [x] | ||
| 83 | mulx d2, d1, [x+8] | ||
| 84 | mulx d4, d3, [x+24] | ||
| 85 | mulx d6, d5, [x+40] | ||
| 86 | mov rdx, [x+24] | ||
| 87 | mulx d8, d7, [x+32] | ||
| 88 | |||
| 89 | // Clear our zero register, and also initialize the flags for the carry chain | ||
| 90 | |||
| 91 | xor zeroe, zeroe | ||
| 92 | |||
| 93 | // Chain in the addition of 02 + 12 + 13 + 14 + 15 to that window | ||
| 94 | // (no carry-out possible since we add it to the top of a product) | ||
| 95 | |||
| 96 | mov rdx, [x+16] | ||
| 97 | mulx rcx, rax, [x] | ||
| 98 | adcx d2, rax | ||
| 99 | adox d3, rcx | ||
| 100 | mulx rcx, rax, [x+8] | ||
| 101 | adcx d3, rax | ||
| 102 | adox d4, rcx | ||
| 103 | mov rdx, [x+8] | ||
| 104 | mulx rcx, rax, [x+24] | ||
| 105 | adcx d4, rax | ||
| 106 | adox d5, rcx | ||
| 107 | mulx rcx, rax, [x+32] | ||
| 108 | adcx d5, rax | ||
| 109 | adox d6, rcx | ||
| 110 | mulx rcx, rax, [x+40] | ||
| 111 | adcx d6, rax | ||
| 112 | adox d7, rcx | ||
| 113 | adcx d7, zero | ||
| 114 | adox d8, zero | ||
| 115 | adcx d8, zero | ||
| 116 | |||
| 117 | // Again zero out the flags. Actually they are already cleared but it may | ||
| 118 | // help decouple these in the OOO engine not to wait for the chain above | ||
| 119 | |||
| 120 | xor zeroe, zeroe | ||
| 121 | |||
| 122 | // Now chain in the 04 + 23 + 24 + 25 + 35 + 45 terms | ||
| 123 | // We are running out of registers and here our zero register is not zero! | ||
| 124 | |||
| 125 | mov rdx, [x+32] | ||
| 126 | mulx rcx, rax, [x] | ||
| 127 | adcx d4, rax | ||
| 128 | adox d5, rcx | ||
| 129 | mov rdx, [x+16] | ||
| 130 | mulx rcx, rax, [x+24] | ||
| 131 | adcx d5, rax | ||
| 132 | adox d6, rcx | ||
| 133 | mulx rcx, rax, [x+32] | ||
| 134 | adcx d6, rax | ||
| 135 | adox d7, rcx | ||
| 136 | mulx rcx, rax, [x+40] | ||
| 137 | adcx d7, rax | ||
| 138 | adox d8, rcx | ||
| 139 | mov rdx, [x+24] | ||
| 140 | mulx d9, rax, [x+40] | ||
| 141 | adcx d8, rax | ||
| 142 | adox d9, zero | ||
| 143 | mov rdx, [x+32] | ||
| 144 | mulx d10, rax, [x+40] | ||
| 145 | adcx d9, rax | ||
| 146 | mov eax, 0 | ||
| 147 | adox d10, rax | ||
| 148 | adcx d10, rax | ||
| 149 | |||
| 150 | // Again, just for a clear fresh start for the flags | ||
| 151 | |||
| 152 | xor eax, eax | ||
| 153 | |||
| 154 | // Double and add to the 00 + 11 + 22 + 33 + 44 + 55 terms | ||
| 155 | // | ||
| 156 | // We could use shift-double but this seems tidier and in larger squarings | ||
| 157 | // it was actually more efficient. I haven't experimented with this small | ||
| 158 | // case to see how much that matters. Note: the writeback here is sprinkled | ||
| 159 | // into the sequence in such a way that things still work if z = x, i.e. if | ||
| 160 | // the output overwrites the input buffer and beyond. | ||
| 161 | |||
| 162 | mov rdx, [x] | ||
| 163 | mulx rdx, rax, rdx | ||
| 164 | mov [z], rax | ||
| 165 | adcx d1, d1 | ||
| 166 | adox d1, rdx | ||
| 167 | mov rdx, [x+8] | ||
| 168 | mov [z+8], d1 | ||
| 169 | mulx rdx, rax, rdx | ||
| 170 | adcx d2, d2 | ||
| 171 | adox d2, rax | ||
| 172 | adcx d3, d3 | ||
| 173 | adox d3, rdx | ||
| 174 | mov rdx, [x+16] | ||
| 175 | mov [z+16], d2 | ||
| 176 | mulx rdx, rax, rdx | ||
| 177 | adcx d4, d4 | ||
| 178 | adox d4, rax | ||
| 179 | adcx d5, d5 | ||
| 180 | adox d5, rdx | ||
| 181 | mov rdx, [x+24] | ||
| 182 | mov [z+24], d3 | ||
| 183 | mulx rdx, rax, rdx | ||
| 184 | adcx d6, d6 | ||
| 185 | adox d6, rax | ||
| 186 | adcx d7, d7 | ||
| 187 | adox d7, rdx | ||
| 188 | mov rdx, [x+32] | ||
| 189 | mov [z+32], d4 | ||
| 190 | mulx rdx, rax, rdx | ||
| 191 | adcx d8, d8 | ||
| 192 | adox d8, rax | ||
| 193 | adcx d9, d9 | ||
| 194 | adox d9, rdx | ||
| 195 | mov rdx, [x+40] | ||
| 196 | mov [z+40], d5 | ||
| 197 | mulx rdx, rax, rdx | ||
| 198 | mov [z+48], d6 | ||
| 199 | adcx d10, d10 | ||
| 200 | mov [z+56], d7 | ||
| 201 | adox d10, rax | ||
| 202 | mov [z+64], d8 | ||
| 203 | mov eax, 0 | ||
| 204 | mov [z+72], d9 | ||
| 205 | adcx rdx, rax | ||
| 206 | mov [z+80], d10 | ||
| 207 | adox rdx, rax | ||
| 208 | mov [z+88], rdx | ||
| 209 | |||
| 210 | // Restore saved registers and return | ||
| 211 | |||
| 212 | pop r15 | ||
| 213 | pop r14 | ||
| 214 | pop r13 | ||
| 215 | pop r12 | ||
| 216 | pop rbx | ||
| 217 | pop rbp | ||
| 218 | |||
| 219 | #if WINDOWS_ABI | ||
| 220 | pop rsi | ||
| 221 | pop rdi | ||
| 222 | #endif | ||
| 223 | ret | ||
| 224 | |||
| 225 | #if defined(__linux__) && defined(__ELF__) | ||
| 226 | .section .note.GNU-stack,"",%progbits | ||
| 227 | #endif | ||
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_6_12_alt.S b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_6_12_alt.S new file mode 100644 index 0000000000..eb43b0a15b --- /dev/null +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_6_12_alt.S | |||
| @@ -0,0 +1,210 @@ | |||
| 1 | // $OpenBSD: bignum_sqr_6_12_alt.S,v 1.4 2025/08/12 10:23:40 jsing Exp $ | ||
| 2 | // | ||
| 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| 4 | // | ||
| 5 | // Permission to use, copy, modify, and/or distribute this software for any | ||
| 6 | // purpose with or without fee is hereby granted, provided that the above | ||
| 7 | // copyright notice and this permission notice appear in all copies. | ||
| 8 | // | ||
| 9 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | |||
| 17 | // ---------------------------------------------------------------------------- | ||
| 18 | // Square, z := x^2 | ||
| 19 | // Input x[6]; output z[12] | ||
| 20 | // | ||
| 21 | // extern void bignum_sqr_6_12_alt(uint64_t z[static 12], | ||
| 22 | // const uint64_t x[static 6]); | ||
| 23 | // | ||
| 24 | // Standard x86-64 ABI: RDI = z, RSI = x | ||
| 25 | // Microsoft x64 ABI: RCX = z, RDX = x | ||
| 26 | // ---------------------------------------------------------------------------- | ||
| 27 | |||
| 28 | #include "s2n_bignum_internal.h" | ||
| 29 | |||
| 30 | .intel_syntax noprefix | ||
| 31 | S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_sqr_6_12_alt) | ||
| 32 | S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_sqr_6_12_alt) | ||
| 33 | .text | ||
| 34 | |||
| 35 | // Input arguments | ||
| 36 | |||
| 37 | #define z rdi | ||
| 38 | #define x rsi | ||
| 39 | |||
| 40 | // Other variables used as a rotating 3-word window to add terms to | ||
| 41 | |||
| 42 | #define t0 r8 | ||
| 43 | #define t1 r9 | ||
| 44 | #define t2 r10 | ||
| 45 | |||
| 46 | // Additional temporaries for local windows to share doublings | ||
| 47 | |||
| 48 | #define u0 rcx | ||
| 49 | #define u1 r11 | ||
| 50 | |||
| 51 | // Macro for the key "multiply and add to (c,h,l)" step | ||
| 52 | |||
| 53 | #define combadd(c,h,l,numa,numb) \ | ||
| 54 | mov rax, numa; \ | ||
| 55 | mul QWORD PTR numb; \ | ||
| 56 | add l, rax; \ | ||
| 57 | adc h, rdx; \ | ||
| 58 | adc c, 0 | ||
| 59 | |||
| 60 | // Set up initial window (c,h,l) = numa * numb | ||
| 61 | |||
| 62 | #define combaddz(c,h,l,numa,numb) \ | ||
| 63 | mov rax, numa; \ | ||
| 64 | mul QWORD PTR numb; \ | ||
| 65 | xor c, c; \ | ||
| 66 | mov l, rax; \ | ||
| 67 | mov h, rdx | ||
| 68 | |||
| 69 | // Doubling step (c,h,l) = 2 * (c,hh,ll) + (0,h,l) | ||
| 70 | |||
| 71 | #define doubladd(c,h,l,hh,ll) \ | ||
| 72 | add ll, ll; \ | ||
| 73 | adc hh, hh; \ | ||
| 74 | adc c, c; \ | ||
| 75 | add l, ll; \ | ||
| 76 | adc h, hh; \ | ||
| 77 | adc c, 0 | ||
| 78 | |||
| 79 | // Square term incorporation (c,h,l) += numba^2 | ||
| 80 | |||
| 81 | #define combadd1(c,h,l,numa) \ | ||
| 82 | mov rax, numa; \ | ||
| 83 | mul rax; \ | ||
| 84 | add l, rax; \ | ||
| 85 | adc h, rdx; \ | ||
| 86 | adc c, 0 | ||
| 87 | |||
| 88 | // A short form where we don't expect a top carry | ||
| 89 | |||
| 90 | #define combads(h,l,numa) \ | ||
| 91 | mov rax, numa; \ | ||
| 92 | mul rax; \ | ||
| 93 | add l, rax; \ | ||
| 94 | adc h, rdx | ||
| 95 | |||
| 96 | // A version doubling directly before adding, for single non-square terms | ||
| 97 | |||
| 98 | #define combadd2(c,h,l,numa,numb) \ | ||
| 99 | mov rax, numa; \ | ||
| 100 | mul QWORD PTR numb; \ | ||
| 101 | add rax, rax; \ | ||
| 102 | adc rdx, rdx; \ | ||
| 103 | adc c, 0; \ | ||
| 104 | add l, rax; \ | ||
| 105 | adc h, rdx; \ | ||
| 106 | adc c, 0 | ||
| 107 | |||
| 108 | S2N_BN_SYMBOL(bignum_sqr_6_12_alt): | ||
| 109 | _CET_ENDBR | ||
| 110 | |||
| 111 | #if WINDOWS_ABI | ||
| 112 | push rdi | ||
| 113 | push rsi | ||
| 114 | mov rdi, rcx | ||
| 115 | mov rsi, rdx | ||
| 116 | #endif | ||
| 117 | |||
| 118 | // Result term 0 | ||
| 119 | |||
| 120 | mov rax, [x] | ||
| 121 | mul rax | ||
| 122 | |||
| 123 | mov [z], rax | ||
| 124 | mov t0, rdx | ||
| 125 | xor t1, t1 | ||
| 126 | |||
| 127 | // Result term 1 | ||
| 128 | |||
| 129 | xor t2, t2 | ||
| 130 | combadd2(t2,t1,t0,[x],[x+8]) | ||
| 131 | mov [z+8], t0 | ||
| 132 | |||
| 133 | // Result term 2 | ||
| 134 | |||
| 135 | xor t0, t0 | ||
| 136 | combadd1(t0,t2,t1,[x+8]) | ||
| 137 | combadd2(t0,t2,t1,[x],[x+16]) | ||
| 138 | mov [z+16], t1 | ||
| 139 | |||
| 140 | // Result term 3 | ||
| 141 | |||
| 142 | combaddz(t1,u1,u0,[x],[x+24]) | ||
| 143 | combadd(t1,u1,u0,[x+8],[x+16]) | ||
| 144 | doubladd(t1,t0,t2,u1,u0) | ||
| 145 | mov [z+24], t2 | ||
| 146 | |||
| 147 | // Result term 4 | ||
| 148 | |||
| 149 | combaddz(t2,u1,u0,[x],[x+32]) | ||
| 150 | combadd(t2,u1,u0,[x+8],[x+24]) | ||
| 151 | doubladd(t2,t1,t0,u1,u0) | ||
| 152 | combadd1(t2,t1,t0,[x+16]) | ||
| 153 | mov [z+32], t0 | ||
| 154 | |||
| 155 | // Result term 5 | ||
| 156 | |||
| 157 | combaddz(t0,u1,u0,[x],[x+40]) | ||
| 158 | combadd(t0,u1,u0,[x+8],[x+32]) | ||
| 159 | combadd(t0,u1,u0,[x+16],[x+24]) | ||
| 160 | doubladd(t0,t2,t1,u1,u0) | ||
| 161 | mov [z+40], t1 | ||
| 162 | |||
| 163 | // Result term 6 | ||
| 164 | |||
| 165 | combaddz(t1,u1,u0,[x+8],[x+40]) | ||
| 166 | combadd(t1,u1,u0,[x+16],[x+32]) | ||
| 167 | doubladd(t1,t0,t2,u1,u0) | ||
| 168 | combadd1(t1,t0,t2,[x+24]) | ||
| 169 | mov [z+48], t2 | ||
| 170 | |||
| 171 | // Result term 7 | ||
| 172 | |||
| 173 | combaddz(t2,u1,u0,[x+16],[x+40]) | ||
| 174 | combadd(t2,u1,u0,[x+24],[x+32]) | ||
| 175 | doubladd(t2,t1,t0,u1,u0) | ||
| 176 | mov [z+56], t0 | ||
| 177 | |||
| 178 | // Result term 8 | ||
| 179 | |||
| 180 | xor t0, t0 | ||
| 181 | combadd2(t0,t2,t1,[x+24],[x+40]) | ||
| 182 | combadd1(t0,t2,t1,[x+32]) | ||
| 183 | mov [z+64], t1 | ||
| 184 | |||
| 185 | // Result term 9 | ||
| 186 | |||
| 187 | xor t1, t1 | ||
| 188 | combadd2(t1,t0,t2,[x+32],[x+40]) | ||
| 189 | mov [z+72], t2 | ||
| 190 | |||
| 191 | // Result term 10 | ||
| 192 | |||
| 193 | combads(t1,t0,[x+40]) | ||
| 194 | mov [z+80], t0 | ||
| 195 | |||
| 196 | // Result term 11 | ||
| 197 | |||
| 198 | mov [z+88], t1 | ||
| 199 | |||
| 200 | // Return | ||
| 201 | |||
| 202 | #if WINDOWS_ABI | ||
| 203 | pop rsi | ||
| 204 | pop rdi | ||
| 205 | #endif | ||
| 206 | ret | ||
| 207 | |||
| 208 | #if defined(__linux__) && defined(__ELF__) | ||
| 209 | .section .note.GNU-stack,"",%progbits | ||
| 210 | #endif | ||
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_8_16.S b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_8_16.S new file mode 100644 index 0000000000..41277b5b6a --- /dev/null +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_8_16.S | |||
| @@ -0,0 +1,311 @@ | |||
| 1 | // $OpenBSD: bignum_sqr_8_16.S,v 1.4 2025/08/12 10:23:40 jsing Exp $ | ||
| 2 | // | ||
| 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| 4 | // | ||
| 5 | // Permission to use, copy, modify, and/or distribute this software for any | ||
| 6 | // purpose with or without fee is hereby granted, provided that the above | ||
| 7 | // copyright notice and this permission notice appear in all copies. | ||
| 8 | // | ||
| 9 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | |||
| 17 | // ---------------------------------------------------------------------------- | ||
| 18 | // Square, z := x^2 | ||
| 19 | // Input x[8]; output z[16] | ||
| 20 | // | ||
| 21 | // extern void bignum_sqr_8_16(uint64_t z[static 16], const uint64_t x[static 8]); | ||
| 22 | // | ||
| 23 | // Standard x86-64 ABI: RDI = z, RSI = x | ||
| 24 | // Microsoft x64 ABI: RCX = z, RDX = x | ||
| 25 | // ---------------------------------------------------------------------------- | ||
| 26 | |||
| 27 | #include "s2n_bignum_internal.h" | ||
| 28 | |||
| 29 | .intel_syntax noprefix | ||
| 30 | S2N_BN_SYM_VISIBILITY_DIRECTIVE(bignum_sqr_8_16) | ||
| 31 | S2N_BN_SYM_PRIVACY_DIRECTIVE(bignum_sqr_8_16) | ||
| 32 | .text | ||
| 33 | |||
| 34 | // These are actually right | ||
| 35 | |||
| 36 | #define z rdi | ||
| 37 | #define x rsi | ||
| 38 | |||
| 39 | // A zero register | ||
| 40 | |||
| 41 | #define zero rbp | ||
| 42 | #define zeroe ebp | ||
| 43 | |||
| 44 | // mulpadd i, j adds rdx * x[i] into the window at the i+j point | ||
| 45 | |||
| 46 | .macro mulpadd arg1,arg2 | ||
| 47 | mulx rcx, rax, [x+8*\arg1] | ||
| 48 | .if ((\arg1 + \arg2) % 8 == 0) | ||
| 49 | adcx r8, rax | ||
| 50 | adox r9, rcx | ||
| 51 | .elseif ((\arg1 + \arg2) % 8 == 1) | ||
| 52 | adcx r9, rax | ||
| 53 | adox r10, rcx | ||
| 54 | .elseif ((\arg1 + \arg2) % 8 == 2) | ||
| 55 | adcx r10, rax | ||
| 56 | adox r11, rcx | ||
| 57 | .elseif ((\arg1 + \arg2) % 8 == 3) | ||
| 58 | adcx r11, rax | ||
| 59 | adox r12, rcx | ||
| 60 | .elseif ((\arg1 + \arg2) % 8 == 4) | ||
| 61 | adcx r12, rax | ||
| 62 | adox r13, rcx | ||
| 63 | .elseif ((\arg1 + \arg2) % 8 == 5) | ||
| 64 | adcx r13, rax | ||
| 65 | adox r14, rcx | ||
| 66 | .elseif ((\arg1 + \arg2) % 8 == 6) | ||
| 67 | adcx r14, rax | ||
| 68 | adox r15, rcx | ||
| 69 | .elseif ((\arg1 + \arg2) % 8 == 7) | ||
| 70 | adcx r15, rax | ||
| 71 | adox r8, rcx | ||
| 72 | .endif | ||
| 73 | |||
| 74 | .endm | ||
| 75 | |||
| 76 | // mulpade i, j adds rdx * x[i] into the window at i+j | ||
| 77 | // but re-creates the top word assuming nothing to add there | ||
| 78 | |||
| 79 | .macro mulpade arg1,arg2 | ||
| 80 | .if ((\arg1 + \arg2) % 8 == 0) | ||
| 81 | mulx r9, rax, [x+8*\arg1] | ||
| 82 | adcx r8, rax | ||
| 83 | adox r9, zero | ||
| 84 | .elseif ((\arg1 + \arg2) % 8 == 1) | ||
| 85 | mulx r10, rax, [x+8*\arg1] | ||
| 86 | adcx r9, rax | ||
| 87 | adox r10, zero | ||
| 88 | .elseif ((\arg1 + \arg2) % 8 == 2) | ||
| 89 | mulx r11, rax, [x+8*\arg1] | ||
| 90 | adcx r10, rax | ||
| 91 | adox r11, zero | ||
| 92 | .elseif ((\arg1 + \arg2) % 8 == 3) | ||
| 93 | mulx r12, rax, [x+8*\arg1] | ||
| 94 | adcx r11, rax | ||
| 95 | adox r12, zero | ||
| 96 | .elseif ((\arg1 + \arg2) % 8 == 4) | ||
| 97 | mulx r13, rax, [x+8*\arg1] | ||
| 98 | adcx r12, rax | ||
| 99 | adox r13, zero | ||
| 100 | .elseif ((\arg1 + \arg2) % 8 == 5) | ||
| 101 | mulx r14, rax, [x+8*\arg1] | ||
| 102 | adcx r13, rax | ||
| 103 | adox r14, zero | ||
| 104 | .elseif ((\arg1 + \arg2) % 8 == 6) | ||
| 105 | mulx r15, rax, [x+8*\arg1] | ||
| 106 | adcx r14, rax | ||
| 107 | adox r15, zero | ||
| 108 | .elseif ((\arg1 + \arg2) % 8 == 7) | ||
| 109 | mulx r8, rax, [x+8*\arg1] | ||
| 110 | adcx r15, rax | ||
| 111 | adox r8, zero | ||
| 112 | .endif | ||
| 113 | |||
| 114 | .endm | ||
| 115 | |||
| 116 | .macro diagonals | ||
| 117 | |||
| 118 | xor zeroe, zeroe | ||
| 119 | |||
| 120 | // Set initial window [r8..r10] + 2 wb = 10 + 20 + 30 + 40 + 50 + 60 + 70 | ||
| 121 | |||
| 122 | mov rdx, [x] | ||
| 123 | mulx rax, r9, [x+8] | ||
| 124 | mov [z+8], r9 | ||
| 125 | mulx rcx, r10, [x+16] | ||
| 126 | adcx r10, rax | ||
| 127 | mov [z+16], r10 | ||
| 128 | mulx rax, r11, [x+24] | ||
| 129 | adcx r11, rcx | ||
| 130 | mulx rcx, r12, [x+32] | ||
| 131 | adcx r12, rax | ||
| 132 | mulx rax, r13, [x+40] | ||
| 133 | adcx r13, rcx | ||
| 134 | mulx rcx, r14, [x+48] | ||
| 135 | adcx r14, rax | ||
| 136 | mulx r8, r15, [x+56] | ||
| 137 | adcx r15, rcx | ||
| 138 | adcx r8, zero | ||
| 139 | |||
| 140 | // Add in the next diagonal = 21 + 31 + 41 + 51 + 61 + 71 + 54 | ||
| 141 | |||
| 142 | xor zeroe, zeroe | ||
| 143 | mov rdx, [x+8] | ||
| 144 | mulpadd 2, 1 | ||
| 145 | mov [z+24], r11 | ||
| 146 | mulpadd 3, 1 | ||
| 147 | mov [z+32], r12 | ||
| 148 | mulpadd 4, 1 | ||
| 149 | mulpadd 5, 1 | ||
| 150 | mulpadd 6, 1 | ||
| 151 | mulpade 7, 1 | ||
| 152 | mov rdx, [x+32] | ||
| 153 | mulpade 5, 4 | ||
| 154 | adcx r10, zero | ||
| 155 | |||
| 156 | // And the next one = 32 + 42 + 52 + 62 + 72 + 64 + 65 | ||
| 157 | |||
| 158 | xor zeroe, zeroe | ||
| 159 | mov rdx, [x+16] | ||
| 160 | mulpadd 3, 2 | ||
| 161 | mov [z+40], r13 | ||
| 162 | mulpadd 4, 2 | ||
| 163 | mov [z+48], r14 | ||
| 164 | mulpadd 5, 2 | ||
| 165 | mulpadd 6, 2 | ||
| 166 | mulpadd 7, 2 | ||
| 167 | mov rdx, [x+48] | ||
| 168 | mulpade 4, 6 | ||
| 169 | mulpade 5, 6 | ||
| 170 | adcx r12, zero | ||
| 171 | |||
| 172 | // And the final one = 43 + 53 + 63 + 73 + 74 + 75 + 76 | ||
| 173 | |||
| 174 | xor zeroe, zeroe | ||
| 175 | mov rdx, [x+24] | ||
| 176 | mulpadd 4, 3 | ||
| 177 | mov [z+56], r15 | ||
| 178 | mulpadd 5, 3 | ||
| 179 | mov [z+64], r8 | ||
| 180 | mulpadd 6, 3 | ||
| 181 | mulpadd 7, 3 | ||
| 182 | mov rdx, [x+56] | ||
| 183 | mulpadd 4, 7 | ||
| 184 | mulpade 5, 7 | ||
| 185 | mulpade 6, 7 | ||
| 186 | adcx r14, zero | ||
| 187 | |||
| 188 | // Double and add things; use z[1]..z[8] and thereafter the registers | ||
| 189 | // r9..r15 which haven't been written back yet | ||
| 190 | |||
| 191 | xor zeroe, zeroe | ||
| 192 | mov rdx, [x] | ||
| 193 | mulx rcx, rax, rdx | ||
| 194 | mov [z], rax | ||
| 195 | mov rax, [z+8] | ||
| 196 | adcx rax, rax | ||
| 197 | adox rax, rcx | ||
| 198 | mov [z+8], rax | ||
| 199 | |||
| 200 | mov rax, [z+16] | ||
| 201 | mov rdx, [x+8] | ||
| 202 | mulx rcx, rdx, rdx | ||
| 203 | adcx rax, rax | ||
| 204 | adox rax, rdx | ||
| 205 | mov [z+16], rax | ||
| 206 | mov rax, [z+24] | ||
| 207 | adcx rax, rax | ||
| 208 | adox rax, rcx | ||
| 209 | mov [z+24], rax | ||
| 210 | |||
| 211 | mov rax, [z+32] | ||
| 212 | mov rdx, [x+16] | ||
| 213 | mulx rcx, rdx, rdx | ||
| 214 | adcx rax, rax | ||
| 215 | adox rax, rdx | ||
| 216 | mov [z+32], rax | ||
| 217 | mov rax, [z+40] | ||
| 218 | adcx rax, rax | ||
| 219 | adox rax, rcx | ||
| 220 | mov [z+40], rax | ||
| 221 | |||
| 222 | mov rax, [z+48] | ||
| 223 | mov rdx, [x+24] | ||
| 224 | mulx rcx, rdx, rdx | ||
| 225 | adcx rax, rax | ||
| 226 | adox rax, rdx | ||
| 227 | mov [z+48], rax | ||
| 228 | mov rax, [z+56] | ||
| 229 | adcx rax, rax | ||
| 230 | adox rax, rcx | ||
| 231 | mov [z+56], rax | ||
| 232 | |||
| 233 | mov rax, [z+64] | ||
| 234 | mov rdx, [x+32] | ||
| 235 | mulx rcx, rdx, rdx | ||
| 236 | adcx rax, rax | ||
| 237 | adox rax, rdx | ||
| 238 | mov [z+64], rax | ||
| 239 | adcx r9, r9 | ||
| 240 | adox r9, rcx | ||
| 241 | mov [z+72], r9 | ||
| 242 | |||
| 243 | mov rdx, [x+40] | ||
| 244 | mulx rcx, rdx, rdx | ||
| 245 | adcx r10, r10 | ||
| 246 | adox r10, rdx | ||
| 247 | mov [z+80], r10 | ||
| 248 | adcx r11, r11 | ||
| 249 | adox r11, rcx | ||
| 250 | mov [z+88], r11 | ||
| 251 | |||
| 252 | mov rdx, [x+48] | ||
| 253 | mulx rcx, rdx, rdx | ||
| 254 | adcx r12, r12 | ||
| 255 | adox r12, rdx | ||
| 256 | mov [z+96], r12 | ||
| 257 | adcx r13, r13 | ||
| 258 | adox r13, rcx | ||
| 259 | mov [z+104], r13 | ||
| 260 | |||
| 261 | mov rdx, [x+56] | ||
| 262 | mulx r15, rdx, rdx | ||
| 263 | adcx r14, r14 | ||
| 264 | adox r14, rdx | ||
| 265 | mov [z+112], r14 | ||
| 266 | adcx r15, zero | ||
| 267 | adox r15, zero | ||
| 268 | mov [z+120], r15 | ||
| 269 | |||
| 270 | .endm | ||
| 271 | |||
| 272 | |||
| 273 | S2N_BN_SYMBOL(bignum_sqr_8_16): | ||
| 274 | _CET_ENDBR | ||
| 275 | |||
| 276 | #if WINDOWS_ABI | ||
| 277 | push rdi | ||
| 278 | push rsi | ||
| 279 | mov rdi, rcx | ||
| 280 | mov rsi, rdx | ||
| 281 | #endif | ||
| 282 | |||
| 283 | // Save more registers to play with | ||
| 284 | |||
| 285 | push rbp | ||
| 286 | push r12 | ||
| 287 | push r13 | ||
| 288 | push r14 | ||
| 289 | push r15 | ||
| 290 | |||
| 291 | // Do the multiplication | ||
| 292 | |||
| 293 | diagonals | ||
| 294 | |||
| 295 | // Real epilog | ||
| 296 | |||
| 297 | pop r15 | ||
| 298 | pop r14 | ||
| 299 | pop r13 | ||
| 300 | pop r12 | ||
| 301 | pop rbp | ||
| 302 | |||
| 303 | #if WINDOWS_ABI | ||
| 304 | pop rsi | ||
| 305 | pop rdi | ||
| 306 | #endif | ||
| 307 | ret | ||
| 308 | |||
| 309 | #if defined(__linux__) && defined(__ELF__) | ||
| 310 | .section .note.GNU-stack,"",%progbits | ||
| 311 | #endif | ||
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_8_16_alt.S b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_8_16_alt.S index ac0b6f96c2..cb10ba2a12 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_8_16_alt.S +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_8_16_alt.S | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | // $OpenBSD: bignum_sqr_8_16_alt.S,v 1.7 2025/08/11 14:13:56 jsing Exp $ | ||
| 2 | // | ||
| 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | // | 4 | // |
| 3 | // Permission to use, copy, modify, and/or distribute this software for any | 5 | // Permission to use, copy, modify, and/or distribute this software for any |
| @@ -16,7 +18,8 @@ | |||
| 16 | // Square, z := x^2 | 18 | // Square, z := x^2 |
| 17 | // Input x[8]; output z[16] | 19 | // Input x[8]; output z[16] |
| 18 | // | 20 | // |
| 19 | // extern void bignum_sqr_8_16_alt (uint64_t z[static 16], uint64_t x[static 8]); | 21 | // extern void bignum_sqr_8_16_alt(uint64_t z[static 16], |
| 22 | // const uint64_t x[static 8]); | ||
| 20 | // | 23 | // |
| 21 | // Standard x86-64 ABI: RDI = z, RSI = x | 24 | // Standard x86-64 ABI: RDI = z, RSI = x |
| 22 | // Microsoft x64 ABI: RCX = z, RDX = x | 25 | // Microsoft x64 ABI: RCX = z, RDX = x |
| @@ -103,7 +106,7 @@ | |||
| 103 | adc c, 0 | 106 | adc c, 0 |
| 104 | 107 | ||
| 105 | S2N_BN_SYMBOL(bignum_sqr_8_16_alt): | 108 | S2N_BN_SYMBOL(bignum_sqr_8_16_alt): |
| 106 | _CET_ENDBR | 109 | _CET_ENDBR |
| 107 | 110 | ||
| 108 | #if WINDOWS_ABI | 111 | #if WINDOWS_ABI |
| 109 | push rdi | 112 | push rdi |
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_sub.S b/src/lib/libcrypto/bn/arch/amd64/bignum_sub.S index 3ff8a30510..7324d3a71e 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bignum_sub.S +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_sub.S | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | // $OpenBSD: bignum_sub.S,v 1.7 2025/08/11 14:13:56 jsing Exp $ | ||
| 2 | // | ||
| 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | // | 4 | // |
| 3 | // Permission to use, copy, modify, and/or distribute this software for any | 5 | // Permission to use, copy, modify, and/or distribute this software for any |
| @@ -16,9 +18,8 @@ | |||
| 16 | // Subtract, z := x - y | 18 | // Subtract, z := x - y |
| 17 | // Inputs x[m], y[n]; outputs function return (carry-out) and z[p] | 19 | // Inputs x[m], y[n]; outputs function return (carry-out) and z[p] |
| 18 | // | 20 | // |
| 19 | // extern uint64_t bignum_sub | 21 | // extern uint64_t bignum_sub(uint64_t p, uint64_t *z, uint64_t m, |
| 20 | // (uint64_t p, uint64_t *z, | 22 | // const uint64_t *x, uint64_t n, const uint64_t *y); |
| 21 | // uint64_t m, uint64_t *x, uint64_t n, uint64_t *y); | ||
| 22 | // | 23 | // |
| 23 | // Does the z := x - y operation, truncating modulo p words in general and | 24 | // Does the z := x - y operation, truncating modulo p words in general and |
| 24 | // returning a top borrow (0 or 1) in the p'th place, only subtracting input | 25 | // returning a top borrow (0 or 1) in the p'th place, only subtracting input |
| @@ -49,7 +50,7 @@ | |||
| 49 | 50 | ||
| 50 | 51 | ||
| 51 | S2N_BN_SYMBOL(bignum_sub): | 52 | S2N_BN_SYMBOL(bignum_sub): |
| 52 | _CET_ENDBR | 53 | _CET_ENDBR |
| 53 | 54 | ||
| 54 | #if WINDOWS_ABI | 55 | #if WINDOWS_ABI |
| 55 | push rdi | 56 | push rdi |
| @@ -75,7 +76,7 @@ S2N_BN_SYMBOL(bignum_sub): | |||
| 75 | cmp p, n | 76 | cmp p, n |
| 76 | cmovc n, p | 77 | cmovc n, p |
| 77 | cmp m, n | 78 | cmp m, n |
| 78 | jc ylonger | 79 | jc bignum_sub_ylonger |
| 79 | 80 | ||
| 80 | // The case where x is longer or of the same size (p >= m >= n) | 81 | // The case where x is longer or of the same size (p >= m >= n) |
| 81 | 82 | ||
| @@ -83,32 +84,32 @@ S2N_BN_SYMBOL(bignum_sub): | |||
| 83 | sub m, n | 84 | sub m, n |
| 84 | inc m | 85 | inc m |
| 85 | test n, n | 86 | test n, n |
| 86 | jz xtest | 87 | jz bignum_sub_xtest |
| 87 | xmainloop: | 88 | bignum_sub_xmainloop: |
| 88 | mov a, [x+8*i] | 89 | mov a, [x+8*i] |
| 89 | sbb a, [y+8*i] | 90 | sbb a, [y+8*i] |
| 90 | mov [z+8*i],a | 91 | mov [z+8*i],a |
| 91 | inc i | 92 | inc i |
| 92 | dec n | 93 | dec n |
| 93 | jnz xmainloop | 94 | jnz bignum_sub_xmainloop |
| 94 | jmp xtest | 95 | jmp bignum_sub_xtest |
| 95 | xtoploop: | 96 | bignum_sub_xtoploop: |
| 96 | mov a, [x+8*i] | 97 | mov a, [x+8*i] |
| 97 | sbb a, 0 | 98 | sbb a, 0 |
| 98 | mov [z+8*i],a | 99 | mov [z+8*i],a |
| 99 | inc i | 100 | inc i |
| 100 | xtest: | 101 | bignum_sub_xtest: |
| 101 | dec m | 102 | dec m |
| 102 | jnz xtoploop | 103 | jnz bignum_sub_xtoploop |
| 103 | sbb a, a | 104 | sbb a, a |
| 104 | test p, p | 105 | test p, p |
| 105 | jz tailskip | 106 | jz bignum_sub_tailskip |
| 106 | tailloop: | 107 | bignum_sub_tailloop: |
| 107 | mov [z+8*i],a | 108 | mov [z+8*i],a |
| 108 | inc i | 109 | inc i |
| 109 | dec p | 110 | dec p |
| 110 | jnz tailloop | 111 | jnz bignum_sub_tailloop |
| 111 | tailskip: | 112 | bignum_sub_tailskip: |
| 112 | neg a | 113 | neg a |
| 113 | #if WINDOWS_ABI | 114 | #if WINDOWS_ABI |
| 114 | pop rsi | 115 | pop rsi |
| @@ -118,29 +119,29 @@ tailskip: | |||
| 118 | 119 | ||
| 119 | // The case where y is longer (p >= n > m) | 120 | // The case where y is longer (p >= n > m) |
| 120 | 121 | ||
| 121 | ylonger: | 122 | bignum_sub_ylonger: |
| 122 | 123 | ||
| 123 | sub p, n | 124 | sub p, n |
| 124 | sub n, m | 125 | sub n, m |
| 125 | test m, m | 126 | test m, m |
| 126 | jz ytoploop | 127 | jz bignum_sub_ytoploop |
| 127 | ymainloop: | 128 | bignum_sub_ymainloop: |
| 128 | mov a, [x+8*i] | 129 | mov a, [x+8*i] |
| 129 | sbb a, [y+8*i] | 130 | sbb a, [y+8*i] |
| 130 | mov [z+8*i],a | 131 | mov [z+8*i],a |
| 131 | inc i | 132 | inc i |
| 132 | dec m | 133 | dec m |
| 133 | jnz ymainloop | 134 | jnz bignum_sub_ymainloop |
| 134 | ytoploop: | 135 | bignum_sub_ytoploop: |
| 135 | mov ashort, 0 | 136 | mov ashort, 0 |
| 136 | sbb a, [y+8*i] | 137 | sbb a, [y+8*i] |
| 137 | mov [z+8*i],a | 138 | mov [z+8*i],a |
| 138 | inc i | 139 | inc i |
| 139 | dec n | 140 | dec n |
| 140 | jnz ytoploop | 141 | jnz bignum_sub_ytoploop |
| 141 | sbb a, a | 142 | sbb a, a |
| 142 | test p, p | 143 | test p, p |
| 143 | jnz tailloop | 144 | jnz bignum_sub_tailloop |
| 144 | neg a | 145 | neg a |
| 145 | #if WINDOWS_ABI | 146 | #if WINDOWS_ABI |
| 146 | pop rsi | 147 | pop rsi |
diff --git a/src/lib/libcrypto/bn/arch/amd64/bn_arch.c b/src/lib/libcrypto/bn/arch/amd64/bn_arch.c index a377a05681..6c3888687b 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bn_arch.c +++ b/src/lib/libcrypto/bn/arch/amd64/bn_arch.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_arch.c,v 1.7 2023/06/24 16:01:44 jsing Exp $ */ | 1 | /* $OpenBSD: bn_arch.c,v 1.17 2025/09/01 15:33:23 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -19,6 +19,7 @@ | |||
| 19 | 19 | ||
| 20 | #include "bn_arch.h" | 20 | #include "bn_arch.h" |
| 21 | #include "bn_local.h" | 21 | #include "bn_local.h" |
| 22 | #include "crypto_arch.h" | ||
| 22 | #include "s2n_bignum.h" | 23 | #include "s2n_bignum.h" |
| 23 | 24 | ||
| 24 | #ifdef HAVE_BN_ADD | 25 | #ifdef HAVE_BN_ADD |
| @@ -26,8 +27,8 @@ BN_ULONG | |||
| 26 | bn_add(BN_ULONG *r, int r_len, const BN_ULONG *a, int a_len, const BN_ULONG *b, | 27 | bn_add(BN_ULONG *r, int r_len, const BN_ULONG *a, int a_len, const BN_ULONG *b, |
| 27 | int b_len) | 28 | int b_len) |
| 28 | { | 29 | { |
| 29 | return bignum_add(r_len, (uint64_t *)r, a_len, (uint64_t *)a, | 30 | return bignum_add(r_len, (uint64_t *)r, a_len, (const uint64_t *)a, |
| 30 | b_len, (uint64_t *)b); | 31 | b_len, (const uint64_t *)b); |
| 31 | } | 32 | } |
| 32 | #endif | 33 | #endif |
| 33 | 34 | ||
| @@ -36,8 +37,8 @@ bn_add(BN_ULONG *r, int r_len, const BN_ULONG *a, int a_len, const BN_ULONG *b, | |||
| 36 | BN_ULONG | 37 | BN_ULONG |
| 37 | bn_add_words(BN_ULONG *rd, const BN_ULONG *ad, const BN_ULONG *bd, int n) | 38 | bn_add_words(BN_ULONG *rd, const BN_ULONG *ad, const BN_ULONG *bd, int n) |
| 38 | { | 39 | { |
| 39 | return bignum_add(n, (uint64_t *)rd, n, (uint64_t *)ad, n, | 40 | return bignum_add(n, (uint64_t *)rd, n, (const uint64_t *)ad, n, |
| 40 | (uint64_t *)bd); | 41 | (const uint64_t *)bd); |
| 41 | } | 42 | } |
| 42 | #endif | 43 | #endif |
| 43 | 44 | ||
| @@ -46,8 +47,8 @@ BN_ULONG | |||
| 46 | bn_sub(BN_ULONG *r, int r_len, const BN_ULONG *a, int a_len, const BN_ULONG *b, | 47 | bn_sub(BN_ULONG *r, int r_len, const BN_ULONG *a, int a_len, const BN_ULONG *b, |
| 47 | int b_len) | 48 | int b_len) |
| 48 | { | 49 | { |
| 49 | return bignum_sub(r_len, (uint64_t *)r, a_len, (uint64_t *)a, | 50 | return bignum_sub(r_len, (uint64_t *)r, a_len, (const uint64_t *)a, |
| 50 | b_len, (uint64_t *)b); | 51 | b_len, (const uint64_t *)b); |
| 51 | } | 52 | } |
| 52 | #endif | 53 | #endif |
| 53 | 54 | ||
| @@ -55,52 +56,99 @@ bn_sub(BN_ULONG *r, int r_len, const BN_ULONG *a, int a_len, const BN_ULONG *b, | |||
| 55 | BN_ULONG | 56 | BN_ULONG |
| 56 | bn_sub_words(BN_ULONG *rd, const BN_ULONG *ad, const BN_ULONG *bd, int n) | 57 | bn_sub_words(BN_ULONG *rd, const BN_ULONG *ad, const BN_ULONG *bd, int n) |
| 57 | { | 58 | { |
| 58 | return bignum_sub(n, (uint64_t *)rd, n, (uint64_t *)ad, n, | 59 | return bignum_sub(n, (uint64_t *)rd, n, (const uint64_t *)ad, n, |
| 59 | (uint64_t *)bd); | 60 | (const uint64_t *)bd); |
| 60 | } | 61 | } |
| 61 | #endif | 62 | #endif |
| 62 | 63 | ||
| 63 | #ifdef HAVE_BN_MUL_ADD_WORDS | 64 | #ifdef HAVE_BN_MOD_ADD_WORDS |
| 64 | BN_ULONG | 65 | void |
| 65 | bn_mul_add_words(BN_ULONG *rd, const BN_ULONG *ad, int num, BN_ULONG w) | 66 | bn_mod_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, |
| 67 | const BN_ULONG *m, size_t n) | ||
| 66 | { | 68 | { |
| 67 | return bignum_cmadd(num, (uint64_t *)rd, w, num, (uint64_t *)ad); | 69 | bignum_modadd(n, (uint64_t *)r, (const uint64_t *)a, |
| 70 | (const uint64_t *)b, (const uint64_t *)m); | ||
| 68 | } | 71 | } |
| 69 | #endif | 72 | #endif |
| 70 | 73 | ||
| 71 | #ifdef HAVE_BN_MUL_WORDS | 74 | #ifdef HAVE_BN_MOD_SUB_WORDS |
| 72 | BN_ULONG | 75 | void |
| 73 | bn_mul_words(BN_ULONG *rd, const BN_ULONG *ad, int num, BN_ULONG w) | 76 | bn_mod_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, |
| 77 | const BN_ULONG *m, size_t n) | ||
| 74 | { | 78 | { |
| 75 | return bignum_cmul(num, (uint64_t *)rd, w, num, (uint64_t *)ad); | 79 | bignum_modsub(n, (uint64_t *)r, (const uint64_t *)a, |
| 80 | (const uint64_t *)b, (const uint64_t *)m); | ||
| 76 | } | 81 | } |
| 77 | #endif | 82 | #endif |
| 78 | 83 | ||
| 79 | #ifdef HAVE_BN_MUL_COMBA4 | 84 | #ifdef HAVE_BN_MUL_COMBA4 |
| 80 | void | 85 | void |
| 81 | bn_mul_comba4(BN_ULONG *rd, BN_ULONG *ad, BN_ULONG *bd) | 86 | bn_mul_comba4(BN_ULONG *rd, const BN_ULONG *ad, const BN_ULONG *bd) |
| 87 | { | ||
| 88 | if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_ADX) != 0) { | ||
| 89 | bignum_mul_4_8((uint64_t *)rd, (const uint64_t *)ad, | ||
| 90 | (const uint64_t *)bd); | ||
| 91 | return; | ||
| 92 | } | ||
| 93 | |||
| 94 | bignum_mul_4_8_alt((uint64_t *)rd, (const uint64_t *)ad, | ||
| 95 | (const uint64_t *)bd); | ||
| 96 | } | ||
| 97 | #endif | ||
| 98 | |||
| 99 | #ifdef HAVE_BN_MUL_COMBA6 | ||
| 100 | void | ||
| 101 | bn_mul_comba6(BN_ULONG *rd, const BN_ULONG *ad, const BN_ULONG *bd) | ||
| 82 | { | 102 | { |
| 83 | /* XXX - consider using non-alt on CPUs that have the ADX extension. */ | 103 | if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_ADX) != 0) { |
| 84 | bignum_mul_4_8_alt((uint64_t *)rd, (uint64_t *)ad, (uint64_t *)bd); | 104 | bignum_mul_6_12((uint64_t *)rd, (const uint64_t *)ad, |
| 105 | (const uint64_t *)bd); | ||
| 106 | return; | ||
| 107 | } | ||
| 108 | |||
| 109 | bignum_mul_6_12_alt((uint64_t *)rd, (const uint64_t *)ad, | ||
| 110 | (const uint64_t *)bd); | ||
| 85 | } | 111 | } |
| 86 | #endif | 112 | #endif |
| 87 | 113 | ||
| 88 | #ifdef HAVE_BN_MUL_COMBA8 | 114 | #ifdef HAVE_BN_MUL_COMBA8 |
| 89 | void | 115 | void |
| 90 | bn_mul_comba8(BN_ULONG *rd, BN_ULONG *ad, BN_ULONG *bd) | 116 | bn_mul_comba8(BN_ULONG *rd, const BN_ULONG *ad, const BN_ULONG *bd) |
| 91 | { | 117 | { |
| 92 | /* XXX - consider using non-alt on CPUs that have the ADX extension. */ | 118 | if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_ADX) != 0) { |
| 93 | bignum_mul_8_16_alt((uint64_t *)rd, (uint64_t *)ad, (uint64_t *)bd); | 119 | bignum_mul_8_16((uint64_t *)rd, (const uint64_t *)ad, |
| 120 | (const uint64_t *)bd); | ||
| 121 | return; | ||
| 122 | } | ||
| 123 | |||
| 124 | bignum_mul_8_16_alt((uint64_t *)rd, (const uint64_t *)ad, | ||
| 125 | (const uint64_t *)bd); | ||
| 94 | } | 126 | } |
| 95 | #endif | 127 | #endif |
| 96 | 128 | ||
| 97 | #ifdef HAVE_BN_SQR | 129 | #ifdef HAVE_BN_MUL_WORDS |
| 98 | int | 130 | void |
| 99 | bn_sqr(BIGNUM *r, const BIGNUM *a, int r_len, BN_CTX *ctx) | 131 | bn_mul_words(BN_ULONG *r, const BN_ULONG *a, int a_len, const BN_ULONG *b, |
| 132 | int b_len) | ||
| 133 | { | ||
| 134 | bignum_mul(a_len + b_len, (uint64_t *)r, a_len, (const uint64_t *)a, | ||
| 135 | b_len, (const uint64_t *)b); | ||
| 136 | } | ||
| 137 | #endif | ||
| 138 | |||
| 139 | #ifdef HAVE_BN_MULW_ADD_WORDS | ||
| 140 | BN_ULONG | ||
| 141 | bn_mulw_add_words(BN_ULONG *rd, const BN_ULONG *ad, int num, BN_ULONG w) | ||
| 100 | { | 142 | { |
| 101 | bignum_sqr(r_len, (uint64_t *)r->d, a->top, (uint64_t *)a->d); | 143 | return bignum_cmadd(num, (uint64_t *)rd, w, num, (const uint64_t *)ad); |
| 144 | } | ||
| 145 | #endif | ||
| 102 | 146 | ||
| 103 | return 1; | 147 | #ifdef HAVE_BN_MULW_WORDS |
| 148 | BN_ULONG | ||
| 149 | bn_mulw_words(BN_ULONG *rd, const BN_ULONG *ad, int num, BN_ULONG w) | ||
| 150 | { | ||
| 151 | return bignum_cmul(num, (uint64_t *)rd, w, num, (const uint64_t *)ad); | ||
| 104 | } | 152 | } |
| 105 | #endif | 153 | #endif |
| 106 | 154 | ||
| @@ -108,8 +156,25 @@ bn_sqr(BIGNUM *r, const BIGNUM *a, int r_len, BN_CTX *ctx) | |||
| 108 | void | 156 | void |
| 109 | bn_sqr_comba4(BN_ULONG *rd, const BN_ULONG *ad) | 157 | bn_sqr_comba4(BN_ULONG *rd, const BN_ULONG *ad) |
| 110 | { | 158 | { |
| 111 | /* XXX - consider using non-alt on CPUs that have the ADX extension. */ | 159 | if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_ADX) != 0) { |
| 112 | bignum_sqr_4_8_alt((uint64_t *)rd, (uint64_t *)ad); | 160 | bignum_sqr_4_8((uint64_t *)rd, (const uint64_t *)ad); |
| 161 | return; | ||
| 162 | } | ||
| 163 | |||
| 164 | bignum_sqr_4_8_alt((uint64_t *)rd, (const uint64_t *)ad); | ||
| 165 | } | ||
| 166 | #endif | ||
| 167 | |||
| 168 | #ifdef HAVE_BN_SQR_COMBA6 | ||
| 169 | void | ||
| 170 | bn_sqr_comba6(BN_ULONG *rd, const BN_ULONG *ad) | ||
| 171 | { | ||
| 172 | if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_ADX) != 0) { | ||
| 173 | bignum_sqr_6_12((uint64_t *)rd, (const uint64_t *)ad); | ||
| 174 | return; | ||
| 175 | } | ||
| 176 | |||
| 177 | bignum_sqr_6_12_alt((uint64_t *)rd, (const uint64_t *)ad); | ||
| 113 | } | 178 | } |
| 114 | #endif | 179 | #endif |
| 115 | 180 | ||
| @@ -117,8 +182,20 @@ bn_sqr_comba4(BN_ULONG *rd, const BN_ULONG *ad) | |||
| 117 | void | 182 | void |
| 118 | bn_sqr_comba8(BN_ULONG *rd, const BN_ULONG *ad) | 183 | bn_sqr_comba8(BN_ULONG *rd, const BN_ULONG *ad) |
| 119 | { | 184 | { |
| 120 | /* XXX - consider using non-alt on CPUs that have the ADX extension. */ | 185 | if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_ADX) != 0) { |
| 121 | bignum_sqr_8_16_alt((uint64_t *)rd, (uint64_t *)ad); | 186 | bignum_sqr_8_16((uint64_t *)rd, (const uint64_t *)ad); |
| 187 | return; | ||
| 188 | } | ||
| 189 | |||
| 190 | bignum_sqr_8_16_alt((uint64_t *)rd, (const uint64_t *)ad); | ||
| 191 | } | ||
| 192 | #endif | ||
| 193 | |||
| 194 | #ifdef HAVE_BN_SQR_WORDS | ||
| 195 | void | ||
| 196 | bn_sqr_words(BN_ULONG *rd, const BN_ULONG *ad, int a_len) | ||
| 197 | { | ||
| 198 | bignum_sqr(a_len * 2, (uint64_t *)rd, a_len, (const uint64_t *)ad); | ||
| 122 | } | 199 | } |
| 123 | #endif | 200 | #endif |
| 124 | 201 | ||
diff --git a/src/lib/libcrypto/bn/arch/amd64/bn_arch.h b/src/lib/libcrypto/bn/arch/amd64/bn_arch.h index 927cd75208..3cb1d1d274 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bn_arch.h +++ b/src/lib/libcrypto/bn/arch/amd64/bn_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_arch.h,v 1.14 2024/03/26 06:09:25 jsing Exp $ */ | 1 | /* $OpenBSD: bn_arch.h,v 1.19 2025/09/01 15:15:44 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -27,14 +27,20 @@ | |||
| 27 | 27 | ||
| 28 | #define HAVE_BN_DIV_WORDS | 28 | #define HAVE_BN_DIV_WORDS |
| 29 | 29 | ||
| 30 | #define HAVE_BN_MUL_ADD_WORDS | 30 | #define HAVE_BN_MOD_ADD_WORDS |
| 31 | #define HAVE_BN_MOD_SUB_WORDS | ||
| 32 | |||
| 31 | #define HAVE_BN_MUL_COMBA4 | 33 | #define HAVE_BN_MUL_COMBA4 |
| 34 | #define HAVE_BN_MUL_COMBA6 | ||
| 32 | #define HAVE_BN_MUL_COMBA8 | 35 | #define HAVE_BN_MUL_COMBA8 |
| 33 | #define HAVE_BN_MUL_WORDS | 36 | #define HAVE_BN_MUL_WORDS |
| 37 | #define HAVE_BN_MULW_ADD_WORDS | ||
| 38 | #define HAVE_BN_MULW_WORDS | ||
| 34 | 39 | ||
| 35 | #define HAVE_BN_SQR | ||
| 36 | #define HAVE_BN_SQR_COMBA4 | 40 | #define HAVE_BN_SQR_COMBA4 |
| 41 | #define HAVE_BN_SQR_COMBA6 | ||
| 37 | #define HAVE_BN_SQR_COMBA8 | 42 | #define HAVE_BN_SQR_COMBA8 |
| 43 | #define HAVE_BN_SQR_WORDS | ||
| 38 | 44 | ||
| 39 | #define HAVE_BN_SUB | 45 | #define HAVE_BN_SUB |
| 40 | #define HAVE_BN_SUB_WORDS | 46 | #define HAVE_BN_SUB_WORDS |
diff --git a/src/lib/libcrypto/bn/arch/amd64/word_clz.S b/src/lib/libcrypto/bn/arch/amd64/word_clz.S index 3926fcd4b0..705fbdbbda 100644 --- a/src/lib/libcrypto/bn/arch/amd64/word_clz.S +++ b/src/lib/libcrypto/bn/arch/amd64/word_clz.S | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | // $OpenBSD: word_clz.S,v 1.7 2025/08/11 14:13:56 jsing Exp $ | ||
| 2 | // | ||
| 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | // | 4 | // |
| 3 | // Permission to use, copy, modify, and/or distribute this software for any | 5 | // Permission to use, copy, modify, and/or distribute this software for any |
| @@ -16,7 +18,7 @@ | |||
| 16 | // Count leading zero bits in a single word | 18 | // Count leading zero bits in a single word |
| 17 | // Input a; output function return | 19 | // Input a; output function return |
| 18 | // | 20 | // |
| 19 | // extern uint64_t word_clz (uint64_t a); | 21 | // extern uint64_t word_clz(uint64_t a); |
| 20 | // | 22 | // |
| 21 | // Standard x86-64 ABI: RDI = a, returns RAX | 23 | // Standard x86-64 ABI: RDI = a, returns RAX |
| 22 | // Microsoft x64 ABI: RCX = a, returns RAX | 24 | // Microsoft x64 ABI: RCX = a, returns RAX |
| @@ -30,7 +32,7 @@ | |||
| 30 | .text | 32 | .text |
| 31 | 33 | ||
| 32 | S2N_BN_SYMBOL(word_clz): | 34 | S2N_BN_SYMBOL(word_clz): |
| 33 | _CET_ENDBR | 35 | _CET_ENDBR |
| 34 | 36 | ||
| 35 | #if WINDOWS_ABI | 37 | #if WINDOWS_ABI |
| 36 | push rdi | 38 | push rdi |
diff --git a/src/lib/libcrypto/bn/arch/i386/bn_arch.h b/src/lib/libcrypto/bn/arch/i386/bn_arch.h index eef519fcc7..288cbdeaa9 100644 --- a/src/lib/libcrypto/bn/arch/i386/bn_arch.h +++ b/src/lib/libcrypto/bn/arch/i386/bn_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_arch.h,v 1.9 2023/02/16 10:41:03 jsing Exp $ */ | 1 | /* $OpenBSD: bn_arch.h,v 1.11 2025/09/07 03:56:37 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -26,14 +26,13 @@ | |||
| 26 | 26 | ||
| 27 | #define HAVE_BN_DIV_WORDS | 27 | #define HAVE_BN_DIV_WORDS |
| 28 | 28 | ||
| 29 | #define HAVE_BN_MUL_ADD_WORDS | ||
| 30 | #define HAVE_BN_MUL_COMBA4 | 29 | #define HAVE_BN_MUL_COMBA4 |
| 31 | #define HAVE_BN_MUL_COMBA8 | 30 | #define HAVE_BN_MUL_COMBA8 |
| 32 | #define HAVE_BN_MUL_WORDS | 31 | #define HAVE_BN_MULW_ADD_WORDS |
| 32 | #define HAVE_BN_MULW_WORDS | ||
| 33 | 33 | ||
| 34 | #define HAVE_BN_SQR_COMBA4 | 34 | #define HAVE_BN_SQR_COMBA4 |
| 35 | #define HAVE_BN_SQR_COMBA8 | 35 | #define HAVE_BN_SQR_COMBA8 |
| 36 | #define HAVE_BN_SQR_WORDS | ||
| 37 | 36 | ||
| 38 | #define HAVE_BN_SUB_WORDS | 37 | #define HAVE_BN_SUB_WORDS |
| 39 | 38 | ||
diff --git a/src/lib/libcrypto/bn/arch/mips64/bn_arch.h b/src/lib/libcrypto/bn/arch/mips64/bn_arch.h index 53771bce1e..562a398f33 100644 --- a/src/lib/libcrypto/bn/arch/mips64/bn_arch.h +++ b/src/lib/libcrypto/bn/arch/mips64/bn_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_arch.h,v 1.7 2023/01/23 12:17:58 jsing Exp $ */ | 1 | /* $OpenBSD: bn_arch.h,v 1.9 2025/09/07 03:56:37 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -25,14 +25,13 @@ | |||
| 25 | #define HAVE_BN_DIV_WORDS | 25 | #define HAVE_BN_DIV_WORDS |
| 26 | #define HAVE_BN_DIV_3_WORDS | 26 | #define HAVE_BN_DIV_3_WORDS |
| 27 | 27 | ||
| 28 | #define HAVE_BN_MUL_ADD_WORDS | ||
| 29 | #define HAVE_BN_MUL_COMBA4 | 28 | #define HAVE_BN_MUL_COMBA4 |
| 30 | #define HAVE_BN_MUL_COMBA8 | 29 | #define HAVE_BN_MUL_COMBA8 |
| 31 | #define HAVE_BN_MUL_WORDS | 30 | #define HAVE_BN_MULW_ADD_WORDS |
| 31 | #define HAVE_BN_MULW_WORDS | ||
| 32 | 32 | ||
| 33 | #define HAVE_BN_SQR_COMBA4 | 33 | #define HAVE_BN_SQR_COMBA4 |
| 34 | #define HAVE_BN_SQR_COMBA8 | 34 | #define HAVE_BN_SQR_COMBA8 |
| 35 | #define HAVE_BN_SQR_WORDS | ||
| 36 | 35 | ||
| 37 | #define HAVE_BN_SUB_WORDS | 36 | #define HAVE_BN_SUB_WORDS |
| 38 | 37 | ||
diff --git a/src/lib/libcrypto/bn/arch/powerpc/bn_arch.h b/src/lib/libcrypto/bn/arch/powerpc/bn_arch.h index 46e932a2d5..21bcdf48d3 100644 --- a/src/lib/libcrypto/bn/arch/powerpc/bn_arch.h +++ b/src/lib/libcrypto/bn/arch/powerpc/bn_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_arch.h,v 1.6 2023/01/23 12:17:58 jsing Exp $ */ | 1 | /* $OpenBSD: bn_arch.h,v 1.8 2025/09/07 03:56:37 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -24,14 +24,13 @@ | |||
| 24 | 24 | ||
| 25 | #define HAVE_BN_DIV_WORDS | 25 | #define HAVE_BN_DIV_WORDS |
| 26 | 26 | ||
| 27 | #define HAVE_BN_MUL_ADD_WORDS | ||
| 28 | #define HAVE_BN_MUL_COMBA4 | 27 | #define HAVE_BN_MUL_COMBA4 |
| 29 | #define HAVE_BN_MUL_COMBA8 | 28 | #define HAVE_BN_MUL_COMBA8 |
| 30 | #define HAVE_BN_MUL_WORDS | 29 | #define HAVE_BN_MULW_ADD_WORDS |
| 30 | #define HAVE_BN_MULW_WORDS | ||
| 31 | 31 | ||
| 32 | #define HAVE_BN_SQR_COMBA4 | 32 | #define HAVE_BN_SQR_COMBA4 |
| 33 | #define HAVE_BN_SQR_COMBA8 | 33 | #define HAVE_BN_SQR_COMBA8 |
| 34 | #define HAVE_BN_SQR_WORDS | ||
| 35 | 34 | ||
| 36 | #define HAVE_BN_SUB_WORDS | 35 | #define HAVE_BN_SUB_WORDS |
| 37 | 36 | ||
diff --git a/src/lib/libcrypto/bn/asm/bn-586.pl b/src/lib/libcrypto/bn/asm/bn-586.pl index 71b775af8d..9b4b11ad5b 100644 --- a/src/lib/libcrypto/bn/asm/bn-586.pl +++ b/src/lib/libcrypto/bn/asm/bn-586.pl | |||
| @@ -6,21 +6,20 @@ require "x86asm.pl"; | |||
| 6 | 6 | ||
| 7 | &asm_init($ARGV[0],$0); | 7 | &asm_init($ARGV[0],$0); |
| 8 | 8 | ||
| 9 | $sse2=0; | 9 | $sse2=1; |
| 10 | for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } | ||
| 11 | 10 | ||
| 12 | &external_label("OPENSSL_ia32cap_P") if ($sse2); | 11 | &external_label("OPENSSL_ia32cap_P") if ($sse2); |
| 13 | 12 | ||
| 14 | &bn_mul_add_words("bn_mul_add_words"); | 13 | &bn_mulw_add_words("bn_mulw_add_words"); |
| 15 | &bn_mul_words("bn_mul_words"); | 14 | &bn_mulw_words("bn_mulw_words"); |
| 16 | &bn_sqr_words("bn_sqr_words"); | 15 | &bn_sqr_word_wise("bn_sqr_word_wise"); |
| 17 | &bn_div_words("bn_div_words"); | 16 | &bn_div_words("bn_div_words"); |
| 18 | &bn_add_words("bn_add_words"); | 17 | &bn_add_words("bn_add_words"); |
| 19 | &bn_sub_words("bn_sub_words"); | 18 | &bn_sub_words("bn_sub_words"); |
| 20 | 19 | ||
| 21 | &asm_finish(); | 20 | &asm_finish(); |
| 22 | 21 | ||
| 23 | sub bn_mul_add_words | 22 | sub bn_mulw_add_words |
| 24 | { | 23 | { |
| 25 | local($name)=@_; | 24 | local($name)=@_; |
| 26 | 25 | ||
| @@ -207,7 +206,7 @@ sub bn_mul_add_words | |||
| 207 | &function_end($name); | 206 | &function_end($name); |
| 208 | } | 207 | } |
| 209 | 208 | ||
| 210 | sub bn_mul_words | 209 | sub bn_mulw_words |
| 211 | { | 210 | { |
| 212 | local($name)=@_; | 211 | local($name)=@_; |
| 213 | 212 | ||
| @@ -319,7 +318,7 @@ sub bn_mul_words | |||
| 319 | &function_end($name); | 318 | &function_end($name); |
| 320 | } | 319 | } |
| 321 | 320 | ||
| 322 | sub bn_sqr_words | 321 | sub bn_sqr_word_wise |
| 323 | { | 322 | { |
| 324 | local($name)=@_; | 323 | local($name)=@_; |
| 325 | 324 | ||
diff --git a/src/lib/libcrypto/bn/asm/mips.pl b/src/lib/libcrypto/bn/asm/mips.pl index 02d43e15b0..aaa0c5d8b0 100644 --- a/src/lib/libcrypto/bn/asm/mips.pl +++ b/src/lib/libcrypto/bn/asm/mips.pl | |||
| @@ -110,19 +110,19 @@ $code.=<<___; | |||
| 110 | .set noat | 110 | .set noat |
| 111 | 111 | ||
| 112 | .align 5 | 112 | .align 5 |
| 113 | .globl bn_mul_add_words | 113 | .globl bn_mulw_add_words |
| 114 | .ent bn_mul_add_words | 114 | .ent bn_mulw_add_words |
| 115 | bn_mul_add_words: | 115 | bn_mulw_add_words: |
| 116 | .set noreorder | 116 | .set noreorder |
| 117 | bgtz $a2,bn_mul_add_words_internal | 117 | bgtz $a2,bn_mulw_add_words_internal |
| 118 | move $v0,$zero | 118 | move $v0,$zero |
| 119 | jr $ra | 119 | jr $ra |
| 120 | move $a0,$v0 | 120 | move $a0,$v0 |
| 121 | .end bn_mul_add_words | 121 | .end bn_mulw_add_words |
| 122 | 122 | ||
| 123 | .align 5 | 123 | .align 5 |
| 124 | .ent bn_mul_add_words_internal | 124 | .ent bn_mulw_add_words_internal |
| 125 | bn_mul_add_words_internal: | 125 | bn_mulw_add_words_internal: |
| 126 | ___ | 126 | ___ |
| 127 | $code.=<<___ if ($flavour =~ /nubi/i); | 127 | $code.=<<___ if ($flavour =~ /nubi/i); |
| 128 | .frame $sp,6*$SZREG,$ra | 128 | .frame $sp,6*$SZREG,$ra |
| @@ -140,9 +140,9 @@ $code.=<<___; | |||
| 140 | .set reorder | 140 | .set reorder |
| 141 | li $minus4,-4 | 141 | li $minus4,-4 |
| 142 | and $ta0,$a2,$minus4 | 142 | and $ta0,$a2,$minus4 |
| 143 | beqz $ta0,.L_bn_mul_add_words_tail | 143 | beqz $ta0,.L_bn_mulw_add_words_tail |
| 144 | 144 | ||
| 145 | .L_bn_mul_add_words_loop: | 145 | .L_bn_mulw_add_words_loop: |
| 146 | $LD $t0,0($a1) | 146 | $LD $t0,0($a1) |
| 147 | $MULTU $t0,$a3 | 147 | $MULTU $t0,$a3 |
| 148 | $LD $t1,0($a0) | 148 | $LD $t1,0($a0) |
| @@ -201,13 +201,13 @@ $code.=<<___; | |||
| 201 | sltu $at,$ta3,$at | 201 | sltu $at,$ta3,$at |
| 202 | $ST $ta3,-$BNSZ($a0) | 202 | $ST $ta3,-$BNSZ($a0) |
| 203 | .set noreorder | 203 | .set noreorder |
| 204 | bgtz $ta0,.L_bn_mul_add_words_loop | 204 | bgtz $ta0,.L_bn_mulw_add_words_loop |
| 205 | $ADDU $v0,$at | 205 | $ADDU $v0,$at |
| 206 | 206 | ||
| 207 | beqz $a2,.L_bn_mul_add_words_return | 207 | beqz $a2,.L_bn_mulw_add_words_return |
| 208 | nop | 208 | nop |
| 209 | 209 | ||
| 210 | .L_bn_mul_add_words_tail: | 210 | .L_bn_mulw_add_words_tail: |
| 211 | .set reorder | 211 | .set reorder |
| 212 | $LD $t0,0($a1) | 212 | $LD $t0,0($a1) |
| 213 | $MULTU $t0,$a3 | 213 | $MULTU $t0,$a3 |
| @@ -222,7 +222,7 @@ $code.=<<___; | |||
| 222 | sltu $at,$t1,$at | 222 | sltu $at,$t1,$at |
| 223 | $ST $t1,0($a0) | 223 | $ST $t1,0($a0) |
| 224 | $ADDU $v0,$at | 224 | $ADDU $v0,$at |
| 225 | beqz $a2,.L_bn_mul_add_words_return | 225 | beqz $a2,.L_bn_mulw_add_words_return |
| 226 | 226 | ||
| 227 | $LD $t0,$BNSZ($a1) | 227 | $LD $t0,$BNSZ($a1) |
| 228 | $MULTU $t0,$a3 | 228 | $MULTU $t0,$a3 |
| @@ -237,7 +237,7 @@ $code.=<<___; | |||
| 237 | sltu $at,$t1,$at | 237 | sltu $at,$t1,$at |
| 238 | $ST $t1,$BNSZ($a0) | 238 | $ST $t1,$BNSZ($a0) |
| 239 | $ADDU $v0,$at | 239 | $ADDU $v0,$at |
| 240 | beqz $a2,.L_bn_mul_add_words_return | 240 | beqz $a2,.L_bn_mulw_add_words_return |
| 241 | 241 | ||
| 242 | $LD $t0,2*$BNSZ($a1) | 242 | $LD $t0,2*$BNSZ($a1) |
| 243 | $MULTU $t0,$a3 | 243 | $MULTU $t0,$a3 |
| @@ -252,7 +252,7 @@ $code.=<<___; | |||
| 252 | $ST $t1,2*$BNSZ($a0) | 252 | $ST $t1,2*$BNSZ($a0) |
| 253 | $ADDU $v0,$at | 253 | $ADDU $v0,$at |
| 254 | 254 | ||
| 255 | .L_bn_mul_add_words_return: | 255 | .L_bn_mulw_add_words_return: |
| 256 | .set noreorder | 256 | .set noreorder |
| 257 | ___ | 257 | ___ |
| 258 | $code.=<<___ if ($flavour =~ /nubi/i); | 258 | $code.=<<___ if ($flavour =~ /nubi/i); |
| @@ -266,22 +266,22 @@ ___ | |||
| 266 | $code.=<<___; | 266 | $code.=<<___; |
| 267 | jr $ra | 267 | jr $ra |
| 268 | move $a0,$v0 | 268 | move $a0,$v0 |
| 269 | .end bn_mul_add_words_internal | 269 | .end bn_mulw_add_words_internal |
| 270 | 270 | ||
| 271 | .align 5 | 271 | .align 5 |
| 272 | .globl bn_mul_words | 272 | .globl bn_mulw_words |
| 273 | .ent bn_mul_words | 273 | .ent bn_mulw_words |
| 274 | bn_mul_words: | 274 | bn_mulw_words: |
| 275 | .set noreorder | 275 | .set noreorder |
| 276 | bgtz $a2,bn_mul_words_internal | 276 | bgtz $a2,bn_mulw_words_internal |
| 277 | move $v0,$zero | 277 | move $v0,$zero |
| 278 | jr $ra | 278 | jr $ra |
| 279 | move $a0,$v0 | 279 | move $a0,$v0 |
| 280 | .end bn_mul_words | 280 | .end bn_mulw_words |
| 281 | 281 | ||
| 282 | .align 5 | 282 | .align 5 |
| 283 | .ent bn_mul_words_internal | 283 | .ent bn_mulw_words_internal |
| 284 | bn_mul_words_internal: | 284 | bn_mulw_words_internal: |
| 285 | ___ | 285 | ___ |
| 286 | $code.=<<___ if ($flavour =~ /nubi/i); | 286 | $code.=<<___ if ($flavour =~ /nubi/i); |
| 287 | .frame $sp,6*$SZREG,$ra | 287 | .frame $sp,6*$SZREG,$ra |
| @@ -299,9 +299,9 @@ $code.=<<___; | |||
| 299 | .set reorder | 299 | .set reorder |
| 300 | li $minus4,-4 | 300 | li $minus4,-4 |
| 301 | and $ta0,$a2,$minus4 | 301 | and $ta0,$a2,$minus4 |
| 302 | beqz $ta0,.L_bn_mul_words_tail | 302 | beqz $ta0,.L_bn_mulw_words_tail |
| 303 | 303 | ||
| 304 | .L_bn_mul_words_loop: | 304 | .L_bn_mulw_words_loop: |
| 305 | $LD $t0,0($a1) | 305 | $LD $t0,0($a1) |
| 306 | $MULTU $t0,$a3 | 306 | $MULTU $t0,$a3 |
| 307 | $LD $t2,$BNSZ($a1) | 307 | $LD $t2,$BNSZ($a1) |
| @@ -341,13 +341,13 @@ $code.=<<___; | |||
| 341 | sltu $ta3,$v0,$at | 341 | sltu $ta3,$v0,$at |
| 342 | $ST $v0,-$BNSZ($a0) | 342 | $ST $v0,-$BNSZ($a0) |
| 343 | .set noreorder | 343 | .set noreorder |
| 344 | bgtz $ta0,.L_bn_mul_words_loop | 344 | bgtz $ta0,.L_bn_mulw_words_loop |
| 345 | $ADDU $v0,$ta3,$ta2 | 345 | $ADDU $v0,$ta3,$ta2 |
| 346 | 346 | ||
| 347 | beqz $a2,.L_bn_mul_words_return | 347 | beqz $a2,.L_bn_mulw_words_return |
| 348 | nop | 348 | nop |
| 349 | 349 | ||
| 350 | .L_bn_mul_words_tail: | 350 | .L_bn_mulw_words_tail: |
| 351 | .set reorder | 351 | .set reorder |
| 352 | $LD $t0,0($a1) | 352 | $LD $t0,0($a1) |
| 353 | $MULTU $t0,$a3 | 353 | $MULTU $t0,$a3 |
| @@ -358,7 +358,7 @@ $code.=<<___; | |||
| 358 | sltu $t1,$v0,$at | 358 | sltu $t1,$v0,$at |
| 359 | $ST $v0,0($a0) | 359 | $ST $v0,0($a0) |
| 360 | $ADDU $v0,$t1,$t0 | 360 | $ADDU $v0,$t1,$t0 |
| 361 | beqz $a2,.L_bn_mul_words_return | 361 | beqz $a2,.L_bn_mulw_words_return |
| 362 | 362 | ||
| 363 | $LD $t0,$BNSZ($a1) | 363 | $LD $t0,$BNSZ($a1) |
| 364 | $MULTU $t0,$a3 | 364 | $MULTU $t0,$a3 |
| @@ -369,7 +369,7 @@ $code.=<<___; | |||
| 369 | sltu $t1,$v0,$at | 369 | sltu $t1,$v0,$at |
| 370 | $ST $v0,$BNSZ($a0) | 370 | $ST $v0,$BNSZ($a0) |
| 371 | $ADDU $v0,$t1,$t0 | 371 | $ADDU $v0,$t1,$t0 |
| 372 | beqz $a2,.L_bn_mul_words_return | 372 | beqz $a2,.L_bn_mulw_words_return |
| 373 | 373 | ||
| 374 | $LD $t0,2*$BNSZ($a1) | 374 | $LD $t0,2*$BNSZ($a1) |
| 375 | $MULTU $t0,$a3 | 375 | $MULTU $t0,$a3 |
| @@ -380,7 +380,7 @@ $code.=<<___; | |||
| 380 | $ST $v0,2*$BNSZ($a0) | 380 | $ST $v0,2*$BNSZ($a0) |
| 381 | $ADDU $v0,$t1,$t0 | 381 | $ADDU $v0,$t1,$t0 |
| 382 | 382 | ||
| 383 | .L_bn_mul_words_return: | 383 | .L_bn_mulw_words_return: |
| 384 | .set noreorder | 384 | .set noreorder |
| 385 | ___ | 385 | ___ |
| 386 | $code.=<<___ if ($flavour =~ /nubi/i); | 386 | $code.=<<___ if ($flavour =~ /nubi/i); |
| @@ -394,22 +394,22 @@ ___ | |||
| 394 | $code.=<<___; | 394 | $code.=<<___; |
| 395 | jr $ra | 395 | jr $ra |
| 396 | move $a0,$v0 | 396 | move $a0,$v0 |
| 397 | .end bn_mul_words_internal | 397 | .end bn_mulw_words_internal |
| 398 | 398 | ||
| 399 | .align 5 | 399 | .align 5 |
| 400 | .globl bn_sqr_words | 400 | .globl bn_sqr_word_wise |
| 401 | .ent bn_sqr_words | 401 | .ent bn_sqr_word_wise |
| 402 | bn_sqr_words: | 402 | bn_sqr_word_wise: |
| 403 | .set noreorder | 403 | .set noreorder |
| 404 | bgtz $a2,bn_sqr_words_internal | 404 | bgtz $a2,bn_sqr_word_wise_internal |
| 405 | move $v0,$zero | 405 | move $v0,$zero |
| 406 | jr $ra | 406 | jr $ra |
| 407 | move $a0,$v0 | 407 | move $a0,$v0 |
| 408 | .end bn_sqr_words | 408 | .end bn_sqr_word_wise |
| 409 | 409 | ||
| 410 | .align 5 | 410 | .align 5 |
| 411 | .ent bn_sqr_words_internal | 411 | .ent bn_sqr_word_wise_internal |
| 412 | bn_sqr_words_internal: | 412 | bn_sqr_word_wise_internal: |
| 413 | ___ | 413 | ___ |
| 414 | $code.=<<___ if ($flavour =~ /nubi/i); | 414 | $code.=<<___ if ($flavour =~ /nubi/i); |
| 415 | .frame $sp,6*$SZREG,$ra | 415 | .frame $sp,6*$SZREG,$ra |
| @@ -427,9 +427,9 @@ $code.=<<___; | |||
| 427 | .set reorder | 427 | .set reorder |
| 428 | li $minus4,-4 | 428 | li $minus4,-4 |
| 429 | and $ta0,$a2,$minus4 | 429 | and $ta0,$a2,$minus4 |
| 430 | beqz $ta0,.L_bn_sqr_words_tail | 430 | beqz $ta0,.L_bn_sqr_word_wise_tail |
| 431 | 431 | ||
| 432 | .L_bn_sqr_words_loop: | 432 | .L_bn_sqr_word_wise_loop: |
| 433 | $LD $t0,0($a1) | 433 | $LD $t0,0($a1) |
| 434 | $MULTU $t0,$t0 | 434 | $MULTU $t0,$t0 |
| 435 | $LD $t2,$BNSZ($a1) | 435 | $LD $t2,$BNSZ($a1) |
| @@ -463,13 +463,13 @@ $code.=<<___; | |||
| 463 | $ST $ta3,-2*$BNSZ($a0) | 463 | $ST $ta3,-2*$BNSZ($a0) |
| 464 | 464 | ||
| 465 | .set noreorder | 465 | .set noreorder |
| 466 | bgtz $ta0,.L_bn_sqr_words_loop | 466 | bgtz $ta0,.L_bn_sqr_word_wise_loop |
| 467 | $ST $ta2,-$BNSZ($a0) | 467 | $ST $ta2,-$BNSZ($a0) |
| 468 | 468 | ||
| 469 | beqz $a2,.L_bn_sqr_words_return | 469 | beqz $a2,.L_bn_sqr_word_wise_return |
| 470 | nop | 470 | nop |
| 471 | 471 | ||
| 472 | .L_bn_sqr_words_tail: | 472 | .L_bn_sqr_word_wise_tail: |
| 473 | .set reorder | 473 | .set reorder |
| 474 | $LD $t0,0($a1) | 474 | $LD $t0,0($a1) |
| 475 | $MULTU $t0,$t0 | 475 | $MULTU $t0,$t0 |
| @@ -478,7 +478,7 @@ $code.=<<___; | |||
| 478 | mfhi $t0 | 478 | mfhi $t0 |
| 479 | $ST $t1,0($a0) | 479 | $ST $t1,0($a0) |
| 480 | $ST $t0,$BNSZ($a0) | 480 | $ST $t0,$BNSZ($a0) |
| 481 | beqz $a2,.L_bn_sqr_words_return | 481 | beqz $a2,.L_bn_sqr_word_wise_return |
| 482 | 482 | ||
| 483 | $LD $t0,$BNSZ($a1) | 483 | $LD $t0,$BNSZ($a1) |
| 484 | $MULTU $t0,$t0 | 484 | $MULTU $t0,$t0 |
| @@ -487,7 +487,7 @@ $code.=<<___; | |||
| 487 | mfhi $t0 | 487 | mfhi $t0 |
| 488 | $ST $t1,2*$BNSZ($a0) | 488 | $ST $t1,2*$BNSZ($a0) |
| 489 | $ST $t0,3*$BNSZ($a0) | 489 | $ST $t0,3*$BNSZ($a0) |
| 490 | beqz $a2,.L_bn_sqr_words_return | 490 | beqz $a2,.L_bn_sqr_word_wise_return |
| 491 | 491 | ||
| 492 | $LD $t0,2*$BNSZ($a1) | 492 | $LD $t0,2*$BNSZ($a1) |
| 493 | $MULTU $t0,$t0 | 493 | $MULTU $t0,$t0 |
| @@ -496,7 +496,7 @@ $code.=<<___; | |||
| 496 | $ST $t1,4*$BNSZ($a0) | 496 | $ST $t1,4*$BNSZ($a0) |
| 497 | $ST $t0,5*$BNSZ($a0) | 497 | $ST $t0,5*$BNSZ($a0) |
| 498 | 498 | ||
| 499 | .L_bn_sqr_words_return: | 499 | .L_bn_sqr_word_wise_return: |
| 500 | .set noreorder | 500 | .set noreorder |
| 501 | ___ | 501 | ___ |
| 502 | $code.=<<___ if ($flavour =~ /nubi/i); | 502 | $code.=<<___ if ($flavour =~ /nubi/i); |
| @@ -511,7 +511,7 @@ $code.=<<___; | |||
| 511 | jr $ra | 511 | jr $ra |
| 512 | move $a0,$v0 | 512 | move $a0,$v0 |
| 513 | 513 | ||
| 514 | .end bn_sqr_words_internal | 514 | .end bn_sqr_word_wise_internal |
| 515 | 515 | ||
| 516 | .align 5 | 516 | .align 5 |
| 517 | .globl bn_add_words | 517 | .globl bn_add_words |
diff --git a/src/lib/libcrypto/bn/asm/ppc.pl b/src/lib/libcrypto/bn/asm/ppc.pl index c9b7f9477d..9b8dc55bff 100644 --- a/src/lib/libcrypto/bn/asm/ppc.pl +++ b/src/lib/libcrypto/bn/asm/ppc.pl | |||
| @@ -204,9 +204,9 @@ $data=<<EOF; | |||
| 204 | # bn_sub_words | 204 | # bn_sub_words |
| 205 | # bn_add_words | 205 | # bn_add_words |
| 206 | # bn_div_words | 206 | # bn_div_words |
| 207 | # bn_sqr_words | 207 | # bn_sqr_word_wise |
| 208 | # bn_mul_words | 208 | # bn_mulw_words |
| 209 | # bn_mul_add_words | 209 | # bn_mulw_add_words |
| 210 | # | 210 | # |
| 211 | # NOTE: It is possible to optimize this code more for | 211 | # NOTE: It is possible to optimize this code more for |
| 212 | # specific PowerPC or Power architectures. On the Northstar | 212 | # specific PowerPC or Power architectures. On the Northstar |
| @@ -248,9 +248,9 @@ $data=<<EOF; | |||
| 248 | .globl .bn_sub_words | 248 | .globl .bn_sub_words |
| 249 | .globl .bn_add_words | 249 | .globl .bn_add_words |
| 250 | .globl .bn_div_words | 250 | .globl .bn_div_words |
| 251 | .globl .bn_sqr_words | 251 | .globl .bn_sqr_word_wise |
| 252 | .globl .bn_mul_words | 252 | .globl .bn_mulw_words |
| 253 | .globl .bn_mul_add_words | 253 | .globl .bn_mulw_add_words |
| 254 | 254 | ||
| 255 | # .text section | 255 | # .text section |
| 256 | 256 | ||
| @@ -1702,16 +1702,16 @@ Lppcasm_div9: | |||
| 1702 | 1702 | ||
| 1703 | # | 1703 | # |
| 1704 | # NOTE: The following label name should be changed to | 1704 | # NOTE: The following label name should be changed to |
| 1705 | # "bn_sqr_words" i.e. remove the first dot | 1705 | # "bn_sqr_word_wise" i.e. remove the first dot |
| 1706 | # for the gcc compiler. This should be automatically | 1706 | # for the gcc compiler. This should be automatically |
| 1707 | # done in the build | 1707 | # done in the build |
| 1708 | # | 1708 | # |
| 1709 | .align 4 | 1709 | .align 4 |
| 1710 | .bn_sqr_words: | 1710 | .bn_sqr_word_wise: |
| 1711 | # | 1711 | # |
| 1712 | # Optimized version of bn_sqr_words | 1712 | # Optimized version of bn_sqr_word_wise |
| 1713 | # | 1713 | # |
| 1714 | # void bn_sqr_words(BN_ULONG *r, BN_ULONG *a, int n) | 1714 | # void bn_sqr_word_wise(BN_ULONG *r, BN_ULONG *a, int n) |
| 1715 | # | 1715 | # |
| 1716 | # r3 = r | 1716 | # r3 = r |
| 1717 | # r4 = a | 1717 | # r4 = a |
| @@ -1740,15 +1740,15 @@ Lppcasm_sqr_adios: | |||
| 1740 | 1740 | ||
| 1741 | # | 1741 | # |
| 1742 | # NOTE: The following label name should be changed to | 1742 | # NOTE: The following label name should be changed to |
| 1743 | # "bn_mul_words" i.e. remove the first dot | 1743 | # "bn_mulw_words" i.e. remove the first dot |
| 1744 | # for the gcc compiler. This should be automatically | 1744 | # for the gcc compiler. This should be automatically |
| 1745 | # done in the build | 1745 | # done in the build |
| 1746 | # | 1746 | # |
| 1747 | 1747 | ||
| 1748 | .align 4 | 1748 | .align 4 |
| 1749 | .bn_mul_words: | 1749 | .bn_mulw_words: |
| 1750 | # | 1750 | # |
| 1751 | # BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w) | 1751 | # BN_ULONG bn_mulw_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w) |
| 1752 | # | 1752 | # |
| 1753 | # r3 = rp | 1753 | # r3 = rp |
| 1754 | # r4 = ap | 1754 | # r4 = ap |
| @@ -1842,15 +1842,15 @@ Lppcasm_mw_OVER: | |||
| 1842 | 1842 | ||
| 1843 | # | 1843 | # |
| 1844 | # NOTE: The following label name should be changed to | 1844 | # NOTE: The following label name should be changed to |
| 1845 | # "bn_mul_add_words" i.e. remove the first dot | 1845 | # "bn_mulw_add_words" i.e. remove the first dot |
| 1846 | # for the gcc compiler. This should be automatically | 1846 | # for the gcc compiler. This should be automatically |
| 1847 | # done in the build | 1847 | # done in the build |
| 1848 | # | 1848 | # |
| 1849 | 1849 | ||
| 1850 | .align 4 | 1850 | .align 4 |
| 1851 | .bn_mul_add_words: | 1851 | .bn_mulw_add_words: |
| 1852 | # | 1852 | # |
| 1853 | # BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w) | 1853 | # BN_ULONG bn_mulw_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w) |
| 1854 | # | 1854 | # |
| 1855 | # r3 = rp | 1855 | # r3 = rp |
| 1856 | # r4 = ap | 1856 | # r4 = ap |
diff --git a/src/lib/libcrypto/bn/asm/x86-mont.pl b/src/lib/libcrypto/bn/asm/x86-mont.pl index 6524651748..3be440f11f 100755 --- a/src/lib/libcrypto/bn/asm/x86-mont.pl +++ b/src/lib/libcrypto/bn/asm/x86-mont.pl | |||
| @@ -32,8 +32,7 @@ require "x86asm.pl"; | |||
| 32 | 32 | ||
| 33 | &asm_init($ARGV[0],$0); | 33 | &asm_init($ARGV[0],$0); |
| 34 | 34 | ||
| 35 | $sse2=0; | 35 | $sse2=1; |
| 36 | for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } | ||
| 37 | 36 | ||
| 38 | &external_label("OPENSSL_ia32cap_P") if ($sse2); | 37 | &external_label("OPENSSL_ia32cap_P") if ($sse2); |
| 39 | 38 | ||
diff --git a/src/lib/libcrypto/bn/bn.h b/src/lib/libcrypto/bn/bn.h index 7c3c0b142f..3f9e24a868 100644 --- a/src/lib/libcrypto/bn/bn.h +++ b/src/lib/libcrypto/bn/bn.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn.h,v 1.80 2025/03/09 15:22:40 tb Exp $ */ | 1 | /* $OpenBSD: bn.h,v 1.85 2025/12/05 17:25:55 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -125,6 +125,8 @@ | |||
| 125 | #ifndef HEADER_BN_H | 125 | #ifndef HEADER_BN_H |
| 126 | #define HEADER_BN_H | 126 | #define HEADER_BN_H |
| 127 | 127 | ||
| 128 | #include <inttypes.h> | ||
| 129 | #include <stdint.h> | ||
| 128 | #include <stdio.h> | 130 | #include <stdio.h> |
| 129 | #include <stdlib.h> | 131 | #include <stdlib.h> |
| 130 | 132 | ||
| @@ -138,59 +140,17 @@ | |||
| 138 | extern "C" { | 140 | extern "C" { |
| 139 | #endif | 141 | #endif |
| 140 | 142 | ||
| 141 | /* This next option uses the C libraries (2 word)/(1 word) function. | 143 | #if defined(_LP64) || defined(_WIN64) |
| 142 | * If it is not defined, I use my C version (which is slower). | ||
| 143 | * The reason for this flag is that when the particular C compiler | ||
| 144 | * library routine is used, and the library is linked with a different | ||
| 145 | * compiler, the library is missing. This mostly happens when the | ||
| 146 | * library is built with gcc and then linked using normal cc. This would | ||
| 147 | * be a common occurrence because gcc normally produces code that is | ||
| 148 | * 2 times faster than system compilers for the big number stuff. | ||
| 149 | * For machines with only one compiler (or shared libraries), this should | ||
| 150 | * be on. Again this in only really a problem on machines | ||
| 151 | * using "long long's", are 32bit, and are not using my assembler code. */ | ||
| 152 | /* #define BN_DIV2W */ | ||
| 153 | |||
| 154 | #ifdef _LP64 | ||
| 155 | #undef BN_LLONG | 144 | #undef BN_LLONG |
| 156 | #define BN_ULONG unsigned long | 145 | #define BN_ULONG uint64_t |
| 157 | #define BN_LONG long | ||
| 158 | #define BN_BITS 128 | ||
| 159 | #define BN_BYTES 8 | 146 | #define BN_BYTES 8 |
| 160 | #define BN_BITS2 64 | 147 | #define BN_BITS2 64 |
| 161 | #define BN_BITS4 32 | ||
| 162 | #define BN_MASK2 (0xffffffffffffffffL) | ||
| 163 | #define BN_MASK2l (0xffffffffL) | ||
| 164 | #define BN_MASK2h (0xffffffff00000000L) | ||
| 165 | #define BN_MASK2h1 (0xffffffff80000000L) | ||
| 166 | #define BN_TBIT (0x8000000000000000L) | ||
| 167 | #define BN_DEC_CONV (10000000000000000000UL) | ||
| 168 | #define BN_DEC_FMT1 "%lu" | ||
| 169 | #define BN_DEC_FMT2 "%019lu" | ||
| 170 | #define BN_DEC_NUM 19 | ||
| 171 | #define BN_HEX_FMT1 "%lX" | ||
| 172 | #define BN_HEX_FMT2 "%016lX" | ||
| 173 | #else | 148 | #else |
| 174 | #define BN_ULLONG unsigned long long | 149 | #define BN_ULLONG uint64_t |
| 175 | #define BN_LLONG | 150 | #define BN_LLONG |
| 176 | #define BN_ULONG unsigned int | 151 | #define BN_ULONG uint32_t |
| 177 | #define BN_LONG int | ||
| 178 | #define BN_BITS 64 | ||
| 179 | #define BN_BYTES 4 | 152 | #define BN_BYTES 4 |
| 180 | #define BN_BITS2 32 | 153 | #define BN_BITS2 32 |
| 181 | #define BN_BITS4 16 | ||
| 182 | #define BN_MASK (0xffffffffffffffffLL) | ||
| 183 | #define BN_MASK2 (0xffffffffL) | ||
| 184 | #define BN_MASK2l (0xffff) | ||
| 185 | #define BN_MASK2h1 (0xffff8000L) | ||
| 186 | #define BN_MASK2h (0xffff0000L) | ||
| 187 | #define BN_TBIT (0x80000000L) | ||
| 188 | #define BN_DEC_CONV (1000000000L) | ||
| 189 | #define BN_DEC_FMT1 "%u" | ||
| 190 | #define BN_DEC_FMT2 "%09u" | ||
| 191 | #define BN_DEC_NUM 9 | ||
| 192 | #define BN_HEX_FMT1 "%X" | ||
| 193 | #define BN_HEX_FMT2 "%08X" | ||
| 194 | #endif | 154 | #endif |
| 195 | 155 | ||
| 196 | #define BN_FLG_MALLOCED 0x01 | 156 | #define BN_FLG_MALLOCED 0x01 |
diff --git a/src/lib/libcrypto/bn/bn_add.c b/src/lib/libcrypto/bn/bn_add.c index 86768a312a..81fa60e429 100644 --- a/src/lib/libcrypto/bn/bn_add.c +++ b/src/lib/libcrypto/bn/bn_add.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_add.c,v 1.26 2023/07/08 12:21:58 beck Exp $ */ | 1 | /* $OpenBSD: bn_add.c,v 1.29 2025/05/25 04:53:05 jsing Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -60,44 +60,10 @@ | |||
| 60 | #include <limits.h> | 60 | #include <limits.h> |
| 61 | #include <stdio.h> | 61 | #include <stdio.h> |
| 62 | 62 | ||
| 63 | #include <openssl/err.h> | ||
| 64 | |||
| 65 | #include "bn_arch.h" | 63 | #include "bn_arch.h" |
| 66 | #include "bn_local.h" | 64 | #include "bn_local.h" |
| 67 | #include "bn_internal.h" | 65 | #include "bn_internal.h" |
| 68 | 66 | #include "err_local.h" | |
| 69 | /* | ||
| 70 | * bn_add_words() computes (carry:r[i]) = a[i] + b[i] + carry, where a and b | ||
| 71 | * are both arrays of words. Any carry resulting from the addition is returned. | ||
| 72 | */ | ||
| 73 | #ifndef HAVE_BN_ADD_WORDS | ||
| 74 | BN_ULONG | ||
| 75 | bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) | ||
| 76 | { | ||
| 77 | BN_ULONG carry = 0; | ||
| 78 | |||
| 79 | assert(n >= 0); | ||
| 80 | if (n <= 0) | ||
| 81 | return 0; | ||
| 82 | |||
| 83 | while (n & ~3) { | ||
| 84 | bn_qwaddqw(a[3], a[2], a[1], a[0], b[3], b[2], b[1], b[0], | ||
| 85 | carry, &carry, &r[3], &r[2], &r[1], &r[0]); | ||
| 86 | a += 4; | ||
| 87 | b += 4; | ||
| 88 | r += 4; | ||
| 89 | n -= 4; | ||
| 90 | } | ||
| 91 | while (n) { | ||
| 92 | bn_addw_addw(a[0], b[0], carry, &carry, &r[0]); | ||
| 93 | a++; | ||
| 94 | b++; | ||
| 95 | r++; | ||
| 96 | n--; | ||
| 97 | } | ||
| 98 | return carry; | ||
| 99 | } | ||
| 100 | #endif | ||
| 101 | 67 | ||
| 102 | /* | 68 | /* |
| 103 | * bn_add() computes (carry:r[i]) = a[i] + b[i] + carry, where a and b are both | 69 | * bn_add() computes (carry:r[i]) = a[i] + b[i] + carry, where a and b are both |
| @@ -147,40 +113,6 @@ bn_add(BN_ULONG *r, int r_len, const BN_ULONG *a, int a_len, const BN_ULONG *b, | |||
| 147 | #endif | 113 | #endif |
| 148 | 114 | ||
| 149 | /* | 115 | /* |
| 150 | * bn_sub_words() computes (borrow:r[i]) = a[i] - b[i] - borrow, where a and b | ||
| 151 | * are both arrays of words. Any borrow resulting from the subtraction is | ||
| 152 | * returned. | ||
| 153 | */ | ||
| 154 | #ifndef HAVE_BN_SUB_WORDS | ||
| 155 | BN_ULONG | ||
| 156 | bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) | ||
| 157 | { | ||
| 158 | BN_ULONG borrow = 0; | ||
| 159 | |||
| 160 | assert(n >= 0); | ||
| 161 | if (n <= 0) | ||
| 162 | return 0; | ||
| 163 | |||
| 164 | while (n & ~3) { | ||
| 165 | bn_qwsubqw(a[3], a[2], a[1], a[0], b[3], b[2], b[1], b[0], | ||
| 166 | borrow, &borrow, &r[3], &r[2], &r[1], &r[0]); | ||
| 167 | a += 4; | ||
| 168 | b += 4; | ||
| 169 | r += 4; | ||
| 170 | n -= 4; | ||
| 171 | } | ||
| 172 | while (n) { | ||
| 173 | bn_subw_subw(a[0], b[0], borrow, &borrow, &r[0]); | ||
| 174 | a++; | ||
| 175 | b++; | ||
| 176 | r++; | ||
| 177 | n--; | ||
| 178 | } | ||
| 179 | return borrow; | ||
| 180 | } | ||
| 181 | #endif | ||
| 182 | |||
| 183 | /* | ||
| 184 | * bn_sub() computes (borrow:r[i]) = a[i] - b[i] - borrow, where a and b are both | 116 | * bn_sub() computes (borrow:r[i]) = a[i] - b[i] - borrow, where a and b are both |
| 185 | * arrays of words (r may be the same as a or b). The length of a and b may | 117 | * arrays of words (r may be the same as a or b). The length of a and b may |
| 186 | * differ, while r must be at least max(a_len, b_len) in length. Any borrow | 118 | * differ, while r must be at least max(a_len, b_len) in length. Any borrow |
| @@ -208,7 +140,7 @@ bn_sub(BN_ULONG *r, int r_len, const BN_ULONG *a, int a_len, const BN_ULONG *b, | |||
| 208 | /* XXX - consider doing four at a time to match bn_sub_words. */ | 140 | /* XXX - consider doing four at a time to match bn_sub_words. */ |
| 209 | while (diff_len < 0) { | 141 | while (diff_len < 0) { |
| 210 | /* Compute r[0] = 0 - b[0] - borrow. */ | 142 | /* Compute r[0] = 0 - b[0] - borrow. */ |
| 211 | bn_subw(0 - b[0], borrow, &borrow, &r[0]); | 143 | bn_subw_subw(0, b[0], borrow, &borrow, &r[0]); |
| 212 | diff_len++; | 144 | diff_len++; |
| 213 | b++; | 145 | b++; |
| 214 | r++; | 146 | r++; |
| @@ -217,7 +149,7 @@ bn_sub(BN_ULONG *r, int r_len, const BN_ULONG *a, int a_len, const BN_ULONG *b, | |||
| 217 | /* XXX - consider doing four at a time to match bn_sub_words. */ | 149 | /* XXX - consider doing four at a time to match bn_sub_words. */ |
| 218 | while (diff_len > 0) { | 150 | while (diff_len > 0) { |
| 219 | /* Compute r[0] = a[0] - 0 - borrow. */ | 151 | /* Compute r[0] = a[0] - 0 - borrow. */ |
| 220 | bn_subw(a[0], borrow, &borrow, &r[0]); | 152 | bn_subw_subw(a[0], 0, borrow, &borrow, &r[0]); |
| 221 | diff_len--; | 153 | diff_len--; |
| 222 | a++; | 154 | a++; |
| 223 | r++; | 155 | r++; |
diff --git a/src/lib/libcrypto/bn/bn_add_sub.c b/src/lib/libcrypto/bn/bn_add_sub.c new file mode 100644 index 0000000000..5c9d5a2b1a --- /dev/null +++ b/src/lib/libcrypto/bn/bn_add_sub.c | |||
| @@ -0,0 +1,178 @@ | |||
| 1 | /* $OpenBSD: bn_add_sub.c,v 1.1 2025/05/25 04:30:55 jsing Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2023,2024,2025 Joel Sing <jsing@openbsd.org> | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <openssl/bn.h> | ||
| 19 | |||
| 20 | #include "bn_internal.h" | ||
| 21 | |||
| 22 | /* | ||
| 23 | * bn_add_words() computes (carry:r[i]) = a[i] + b[i] + carry, where a and b | ||
| 24 | * are both arrays of words. Any carry resulting from the addition is returned. | ||
| 25 | */ | ||
| 26 | #ifndef HAVE_BN_ADD_WORDS | ||
| 27 | BN_ULONG | ||
| 28 | bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) | ||
| 29 | { | ||
| 30 | BN_ULONG carry = 0; | ||
| 31 | |||
| 32 | while (n >= 4) { | ||
| 33 | bn_qwaddqw(a[3], a[2], a[1], a[0], b[3], b[2], b[1], b[0], | ||
| 34 | carry, &carry, &r[3], &r[2], &r[1], &r[0]); | ||
| 35 | a += 4; | ||
| 36 | b += 4; | ||
| 37 | r += 4; | ||
| 38 | n -= 4; | ||
| 39 | } | ||
| 40 | while (n > 0) { | ||
| 41 | bn_addw_addw(a[0], b[0], carry, &carry, &r[0]); | ||
| 42 | a++; | ||
| 43 | b++; | ||
| 44 | r++; | ||
| 45 | n--; | ||
| 46 | } | ||
| 47 | |||
| 48 | return carry; | ||
| 49 | } | ||
| 50 | #endif | ||
| 51 | |||
| 52 | /* | ||
| 53 | * bn_sub_words() computes (borrow:r[i]) = a[i] - b[i] - borrow, where a and b | ||
| 54 | * are both arrays of words. Any borrow resulting from the subtraction is | ||
| 55 | * returned. | ||
| 56 | */ | ||
| 57 | #ifndef HAVE_BN_SUB_WORDS | ||
| 58 | BN_ULONG | ||
| 59 | bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) | ||
| 60 | { | ||
| 61 | BN_ULONG borrow = 0; | ||
| 62 | |||
| 63 | while (n >= 4) { | ||
| 64 | bn_qwsubqw(a[3], a[2], a[1], a[0], b[3], b[2], b[1], b[0], | ||
| 65 | borrow, &borrow, &r[3], &r[2], &r[1], &r[0]); | ||
| 66 | a += 4; | ||
| 67 | b += 4; | ||
| 68 | r += 4; | ||
| 69 | n -= 4; | ||
| 70 | } | ||
| 71 | while (n > 0) { | ||
| 72 | bn_subw_subw(a[0], b[0], borrow, &borrow, &r[0]); | ||
| 73 | a++; | ||
| 74 | b++; | ||
| 75 | r++; | ||
| 76 | n--; | ||
| 77 | } | ||
| 78 | |||
| 79 | return borrow; | ||
| 80 | } | ||
| 81 | #endif | ||
| 82 | |||
| 83 | /* | ||
| 84 | * bn_sub_borrow() computes a[i] - b[i], returning the resulting borrow only. | ||
| 85 | */ | ||
| 86 | #ifndef HAVE_BN_SUB_WORDS_BORROW | ||
| 87 | BN_ULONG | ||
| 88 | bn_sub_words_borrow(const BN_ULONG *a, const BN_ULONG *b, size_t n) | ||
| 89 | { | ||
| 90 | BN_ULONG borrow = 0; | ||
| 91 | BN_ULONG r; | ||
| 92 | |||
| 93 | while (n >= 4) { | ||
| 94 | bn_qwsubqw(a[3], a[2], a[1], a[0], b[3], b[2], b[1], b[0], | ||
| 95 | borrow, &borrow, &r, &r, &r, &r); | ||
| 96 | a += 4; | ||
| 97 | b += 4; | ||
| 98 | n -= 4; | ||
| 99 | } | ||
| 100 | while (n > 0) { | ||
| 101 | bn_subw_subw(a[0], b[0], borrow, &borrow, &r); | ||
| 102 | a++; | ||
| 103 | b++; | ||
| 104 | n--; | ||
| 105 | } | ||
| 106 | |||
| 107 | return borrow; | ||
| 108 | } | ||
| 109 | #endif | ||
| 110 | |||
| 111 | /* | ||
| 112 | * bn_add_words_masked() computes r[] = a[] + (b[] & mask), where a, b and r are | ||
| 113 | * arrays of words with length n (r may be the same as a or b). | ||
| 114 | */ | ||
| 115 | #ifndef HAVE_BN_ADD_WORDS_MASKED | ||
| 116 | BN_ULONG | ||
| 117 | bn_add_words_masked(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, | ||
| 118 | BN_ULONG mask, size_t n) | ||
| 119 | { | ||
| 120 | BN_ULONG carry = 0; | ||
| 121 | |||
| 122 | /* XXX - consider conditional/masked versions of bn_addw_addw/bn_qwaddqw. */ | ||
| 123 | |||
| 124 | while (n >= 4) { | ||
| 125 | bn_qwaddqw(a[3], a[2], a[1], a[0], b[3] & mask, b[2] & mask, | ||
| 126 | b[1] & mask, b[0] & mask, carry, &carry, &r[3], &r[2], | ||
| 127 | &r[1], &r[0]); | ||
| 128 | a += 4; | ||
| 129 | b += 4; | ||
| 130 | r += 4; | ||
| 131 | n -= 4; | ||
| 132 | } | ||
| 133 | while (n > 0) { | ||
| 134 | bn_addw_addw(a[0], b[0] & mask, carry, &carry, &r[0]); | ||
| 135 | a++; | ||
| 136 | b++; | ||
| 137 | r++; | ||
| 138 | n--; | ||
| 139 | } | ||
| 140 | |||
| 141 | return carry; | ||
| 142 | } | ||
| 143 | #endif | ||
| 144 | |||
| 145 | /* | ||
| 146 | * bn_sub_words_masked() computes r[] = a[] - (b[] & mask), where a, b and r are | ||
| 147 | * arrays of words with length n (r may be the same as a or b). | ||
| 148 | */ | ||
| 149 | #ifndef HAVE_BN_SUB_WORDS_MASKED | ||
| 150 | BN_ULONG | ||
| 151 | bn_sub_words_masked(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, | ||
| 152 | BN_ULONG mask, size_t n) | ||
| 153 | { | ||
| 154 | BN_ULONG borrow = 0; | ||
| 155 | |||
| 156 | /* XXX - consider conditional/masked versions of bn_subw_subw/bn_qwsubqw. */ | ||
| 157 | |||
| 158 | /* Compute conditional r[i] = a[i] - b[i]. */ | ||
| 159 | while (n >= 4) { | ||
| 160 | bn_qwsubqw(a[3], a[2], a[1], a[0], b[3] & mask, b[2] & mask, | ||
| 161 | b[1] & mask, b[0] & mask, borrow, &borrow, &r[3], &r[2], | ||
| 162 | &r[1], &r[0]); | ||
| 163 | a += 4; | ||
| 164 | b += 4; | ||
| 165 | r += 4; | ||
| 166 | n -= 4; | ||
| 167 | } | ||
| 168 | while (n > 0) { | ||
| 169 | bn_subw_subw(a[0], b[0] & mask, borrow, &borrow, &r[0]); | ||
| 170 | a++; | ||
| 171 | b++; | ||
| 172 | r++; | ||
| 173 | n--; | ||
| 174 | } | ||
| 175 | |||
| 176 | return borrow; | ||
| 177 | } | ||
| 178 | #endif | ||
diff --git a/src/lib/libcrypto/bn/bn_convert.c b/src/lib/libcrypto/bn/bn_convert.c index 6a6354f44e..ab5bc519c8 100644 --- a/src/lib/libcrypto/bn/bn_convert.c +++ b/src/lib/libcrypto/bn/bn_convert.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_convert.c,v 1.23 2024/11/08 14:18:44 jsing Exp $ */ | 1 | /* $OpenBSD: bn_convert.c,v 1.25 2025/12/05 14:12:32 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -65,11 +65,19 @@ | |||
| 65 | 65 | ||
| 66 | #include <openssl/bio.h> | 66 | #include <openssl/bio.h> |
| 67 | #include <openssl/buffer.h> | 67 | #include <openssl/buffer.h> |
| 68 | #include <openssl/err.h> | ||
| 69 | 68 | ||
| 70 | #include "bn_local.h" | 69 | #include "bn_local.h" |
| 71 | #include "bytestring.h" | 70 | #include "bytestring.h" |
| 72 | #include "crypto_internal.h" | 71 | #include "crypto_internal.h" |
| 72 | #include "err_local.h" | ||
| 73 | |||
| 74 | #if BN_BYTES == 8 | ||
| 75 | #define BN_DEC_CONV UINT64_C(10000000000000000000) | ||
| 76 | #define BN_DEC_NUM 19 | ||
| 77 | #else | ||
| 78 | #define BN_DEC_CONV UINT32_C(1000000000) | ||
| 79 | #define BN_DEC_NUM 9 | ||
| 80 | #endif | ||
| 73 | 81 | ||
| 74 | static int bn_dec2bn_cbs(BIGNUM **bnp, CBS *cbs); | 82 | static int bn_dec2bn_cbs(BIGNUM **bnp, CBS *cbs); |
| 75 | static int bn_hex2bn_cbs(BIGNUM **bnp, CBS *cbs); | 83 | static int bn_hex2bn_cbs(BIGNUM **bnp, CBS *cbs); |
diff --git a/src/lib/libcrypto/bn/bn_ctx.c b/src/lib/libcrypto/bn/bn_ctx.c index 129b9c9781..eda93dcaa4 100644 --- a/src/lib/libcrypto/bn/bn_ctx.c +++ b/src/lib/libcrypto/bn/bn_ctx.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_ctx.c,v 1.22 2023/07/08 12:21:58 beck Exp $ */ | 1 | /* $OpenBSD: bn_ctx.c,v 1.23 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -19,9 +19,9 @@ | |||
| 19 | #include <string.h> | 19 | #include <string.h> |
| 20 | 20 | ||
| 21 | #include <openssl/opensslconf.h> | 21 | #include <openssl/opensslconf.h> |
| 22 | #include <openssl/err.h> | ||
| 23 | 22 | ||
| 24 | #include "bn_local.h" | 23 | #include "bn_local.h" |
| 24 | #include "err_local.h" | ||
| 25 | 25 | ||
| 26 | #define BN_CTX_INITIAL_LEN 8 | 26 | #define BN_CTX_INITIAL_LEN 8 |
| 27 | 27 | ||
diff --git a/src/lib/libcrypto/bn/bn_div.c b/src/lib/libcrypto/bn/bn_div.c index 09a8a364df..0a914db752 100644 --- a/src/lib/libcrypto/bn/bn_div.c +++ b/src/lib/libcrypto/bn/bn_div.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_div.c,v 1.41 2024/04/10 14:58:06 beck Exp $ */ | 1 | /* $OpenBSD: bn_div.c,v 1.44 2025/09/07 06:28:03 jsing Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -62,25 +62,15 @@ | |||
| 62 | #include <openssl/opensslconf.h> | 62 | #include <openssl/opensslconf.h> |
| 63 | 63 | ||
| 64 | #include <openssl/bn.h> | 64 | #include <openssl/bn.h> |
| 65 | #include <openssl/err.h> | ||
| 66 | 65 | ||
| 67 | #include "bn_arch.h" | 66 | #include "bn_arch.h" |
| 68 | #include "bn_local.h" | 67 | #include "bn_local.h" |
| 69 | #include "bn_internal.h" | 68 | #include "bn_internal.h" |
| 69 | #include "err_local.h" | ||
| 70 | 70 | ||
| 71 | BN_ULONG bn_div_3_words(const BN_ULONG *m, BN_ULONG d1, BN_ULONG d0); | 71 | BN_ULONG bn_div_3_words(const BN_ULONG *m, BN_ULONG d1, BN_ULONG d0); |
| 72 | 72 | ||
| 73 | #ifndef HAVE_BN_DIV_WORDS | 73 | #ifndef HAVE_BN_DIV_WORDS |
| 74 | #if defined(BN_LLONG) && defined(BN_DIV2W) | ||
| 75 | |||
| 76 | BN_ULONG | ||
| 77 | bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d) | ||
| 78 | { | ||
| 79 | return ((BN_ULONG)(((((BN_ULLONG)h) << BN_BITS2)|l)/(BN_ULLONG)d)); | ||
| 80 | } | ||
| 81 | |||
| 82 | #else | ||
| 83 | |||
| 84 | /* Divide h,l by d and return the result. */ | 74 | /* Divide h,l by d and return the result. */ |
| 85 | /* I need to test this some more :-( */ | 75 | /* I need to test this some more :-( */ |
| 86 | BN_ULONG | 76 | BN_ULONG |
| @@ -148,7 +138,6 @@ bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d) | |||
| 148 | ret |= q; | 138 | ret |= q; |
| 149 | return (ret); | 139 | return (ret); |
| 150 | } | 140 | } |
| 151 | #endif /* !defined(BN_LLONG) && defined(BN_DIV2W) */ | ||
| 152 | #endif | 141 | #endif |
| 153 | 142 | ||
| 154 | /* | 143 | /* |
| @@ -375,7 +364,7 @@ BN_div_internal(BIGNUM *quotient, BIGNUM *remainder, const BIGNUM *numerator, | |||
| 375 | * | wnum - sdiv * q | < sdiv | 364 | * | wnum - sdiv * q | < sdiv |
| 376 | */ | 365 | */ |
| 377 | q = bn_div_3_words(wnump, d1, d0); | 366 | q = bn_div_3_words(wnump, d1, d0); |
| 378 | l0 = bn_mul_words(tmp->d, sdiv->d, div_n, q); | 367 | l0 = bn_mulw_words(tmp->d, sdiv->d, div_n, q); |
| 379 | tmp->d[div_n] = l0; | 368 | tmp->d[div_n] = l0; |
| 380 | wnum.d--; | 369 | wnum.d--; |
| 381 | 370 | ||
diff --git a/src/lib/libcrypto/bn/bn_exp.c b/src/lib/libcrypto/bn/bn_exp.c index e925d325d2..6a5c1c857a 100644 --- a/src/lib/libcrypto/bn/bn_exp.c +++ b/src/lib/libcrypto/bn/bn_exp.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_exp.c,v 1.58 2025/02/13 11:15:09 tb Exp $ */ | 1 | /* $OpenBSD: bn_exp.c,v 1.59 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -112,10 +112,9 @@ | |||
| 112 | #include <stdlib.h> | 112 | #include <stdlib.h> |
| 113 | #include <string.h> | 113 | #include <string.h> |
| 114 | 114 | ||
| 115 | #include <openssl/err.h> | ||
| 116 | |||
| 117 | #include "bn_local.h" | 115 | #include "bn_local.h" |
| 118 | #include "constant_time.h" | 116 | #include "constant_time.h" |
| 117 | #include "err_local.h" | ||
| 119 | 118 | ||
| 120 | /* maximum precomputation table size for *variable* sliding windows */ | 119 | /* maximum precomputation table size for *variable* sliding windows */ |
| 121 | #define TABLE_SIZE 32 | 120 | #define TABLE_SIZE 32 |
diff --git a/src/lib/libcrypto/bn/bn_gcd.c b/src/lib/libcrypto/bn/bn_gcd.c index fa5d71a7f3..319d9ca390 100644 --- a/src/lib/libcrypto/bn/bn_gcd.c +++ b/src/lib/libcrypto/bn/bn_gcd.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_gcd.c,v 1.29 2024/04/10 14:58:06 beck Exp $ */ | 1 | /* $OpenBSD: bn_gcd.c,v 1.31 2025/06/02 12:40:10 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -109,9 +109,8 @@ | |||
| 109 | * | 109 | * |
| 110 | */ | 110 | */ |
| 111 | 111 | ||
| 112 | #include <openssl/err.h> | ||
| 113 | |||
| 114 | #include "bn_local.h" | 112 | #include "bn_local.h" |
| 113 | #include "err_local.h" | ||
| 115 | 114 | ||
| 116 | static BIGNUM * | 115 | static BIGNUM * |
| 117 | euclid(BIGNUM *a, BIGNUM *b) | 116 | euclid(BIGNUM *a, BIGNUM *b) |
| @@ -681,8 +680,10 @@ BN_mod_inverse_internal(BIGNUM *in, const BIGNUM *a, const BIGNUM *n, BN_CTX *ct | |||
| 681 | /* A >= 2*B, so D=2 or D=3 */ | 680 | /* A >= 2*B, so D=2 or D=3 */ |
| 682 | if (!BN_sub(M, A, T)) | 681 | if (!BN_sub(M, A, T)) |
| 683 | goto err; | 682 | goto err; |
| 684 | if (!BN_add(D,T,B)) goto err; /* use D (:= 3*B) as temp */ | 683 | /* use D (:= 3*B) as temp */ |
| 685 | if (BN_ucmp(A, D) < 0) { | 684 | if (!BN_add(D, T, B)) |
| 685 | goto err; | ||
| 686 | if (BN_ucmp(A, D) < 0) { | ||
| 686 | /* A < 3*B, so D=2 */ | 687 | /* A < 3*B, so D=2 */ |
| 687 | if (!BN_set_word(D, 2)) | 688 | if (!BN_set_word(D, 2)) |
| 688 | goto err; | 689 | goto err; |
diff --git a/src/lib/libcrypto/bn/bn_internal.h b/src/lib/libcrypto/bn/bn_internal.h index fd04bc9f8a..efe8202aa0 100644 --- a/src/lib/libcrypto/bn/bn_internal.h +++ b/src/lib/libcrypto/bn/bn_internal.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_internal.h,v 1.15 2023/06/25 11:42:26 jsing Exp $ */ | 1 | /* $OpenBSD: bn_internal.h,v 1.21 2025/12/05 14:12:32 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <openssl/bn.h> | 18 | #include <openssl/bn.h> |
| 19 | 19 | ||
| 20 | #include "bn_arch.h" | 20 | #include "bn_arch.h" |
| 21 | #include "bn_local.h" | ||
| 21 | 22 | ||
| 22 | #ifndef HEADER_BN_INTERNAL_H | 23 | #ifndef HEADER_BN_INTERNAL_H |
| 23 | #define HEADER_BN_INTERNAL_H | 24 | #define HEADER_BN_INTERNAL_H |
| @@ -26,6 +27,30 @@ int bn_word_clz(BN_ULONG w); | |||
| 26 | 27 | ||
| 27 | int bn_bitsize(const BIGNUM *bn); | 28 | int bn_bitsize(const BIGNUM *bn); |
| 28 | 29 | ||
| 30 | BN_ULONG bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, | ||
| 31 | int num); | ||
| 32 | BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, | ||
| 33 | int num); | ||
| 34 | BN_ULONG bn_sub_words_borrow(const BN_ULONG *a, const BN_ULONG *b, size_t n); | ||
| 35 | BN_ULONG bn_add_words_masked(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, | ||
| 36 | BN_ULONG mask, size_t n); | ||
| 37 | BN_ULONG bn_sub_words_masked(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, | ||
| 38 | BN_ULONG mask, size_t n); | ||
| 39 | void bn_mod_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, | ||
| 40 | const BN_ULONG *m, size_t n); | ||
| 41 | void bn_mod_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, | ||
| 42 | const BN_ULONG *m, size_t n); | ||
| 43 | void bn_mod_mul_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, | ||
| 44 | const BN_ULONG *m, BN_ULONG *t, BN_ULONG m0, size_t n); | ||
| 45 | void bn_mod_sqr_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *m, | ||
| 46 | BN_ULONG *t, BN_ULONG m0, size_t n); | ||
| 47 | |||
| 48 | void bn_montgomery_multiply_words(BN_ULONG *rp, const BN_ULONG *ap, | ||
| 49 | const BN_ULONG *bp, const BN_ULONG *np, BN_ULONG *tp, BN_ULONG n0, | ||
| 50 | int n_len); | ||
| 51 | void bn_montgomery_reduce_words(BN_ULONG *r, BN_ULONG *a, const BN_ULONG *n, | ||
| 52 | BN_ULONG n0, int n_len); | ||
| 53 | |||
| 29 | #ifndef HAVE_BN_CT_NE_ZERO | 54 | #ifndef HAVE_BN_CT_NE_ZERO |
| 30 | static inline int | 55 | static inline int |
| 31 | bn_ct_ne_zero(BN_ULONG w) | 56 | bn_ct_ne_zero(BN_ULONG w) |
diff --git a/src/lib/libcrypto/bn/bn_isqrt.c b/src/lib/libcrypto/bn/bn_isqrt.c index 018d5f34bd..b725519e1a 100644 --- a/src/lib/libcrypto/bn/bn_isqrt.c +++ b/src/lib/libcrypto/bn/bn_isqrt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_isqrt.c,v 1.10 2023/06/04 17:28:35 tb Exp $ */ | 1 | /* $OpenBSD: bn_isqrt.c,v 1.11 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> | 3 | * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> |
| 4 | * | 4 | * |
| @@ -19,10 +19,10 @@ | |||
| 19 | #include <stdint.h> | 19 | #include <stdint.h> |
| 20 | 20 | ||
| 21 | #include <openssl/bn.h> | 21 | #include <openssl/bn.h> |
| 22 | #include <openssl/err.h> | ||
| 23 | 22 | ||
| 24 | #include "bn_local.h" | 23 | #include "bn_local.h" |
| 25 | #include "crypto_internal.h" | 24 | #include "crypto_internal.h" |
| 25 | #include "err_local.h" | ||
| 26 | 26 | ||
| 27 | /* | 27 | /* |
| 28 | * Calculate integer square root of |n| using a variant of Newton's method. | 28 | * Calculate integer square root of |n| using a variant of Newton's method. |
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index 72b988650c..0326e72c4d 100644 --- a/src/lib/libcrypto/bn/bn_lib.c +++ b/src/lib/libcrypto/bn/bn_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_lib.c,v 1.93 2024/04/16 13:07:14 jsing Exp $ */ | 1 | /* $OpenBSD: bn_lib.c,v 1.95 2025/12/15 12:09:46 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -63,10 +63,9 @@ | |||
| 63 | 63 | ||
| 64 | #include <openssl/opensslconf.h> | 64 | #include <openssl/opensslconf.h> |
| 65 | 65 | ||
| 66 | #include <openssl/err.h> | ||
| 67 | |||
| 68 | #include "bn_local.h" | 66 | #include "bn_local.h" |
| 69 | #include "bn_internal.h" | 67 | #include "bn_internal.h" |
| 68 | #include "err_local.h" | ||
| 70 | 69 | ||
| 71 | BIGNUM * | 70 | BIGNUM * |
| 72 | BN_new(void) | 71 | BN_new(void) |
| @@ -350,7 +349,7 @@ BN_ULONG | |||
| 350 | BN_get_word(const BIGNUM *a) | 349 | BN_get_word(const BIGNUM *a) |
| 351 | { | 350 | { |
| 352 | if (a->top > 1) | 351 | if (a->top > 1) |
| 353 | return BN_MASK2; | 352 | return (BN_ULONG)-1; |
| 354 | else if (a->top == 1) | 353 | else if (a->top == 1) |
| 355 | return a->d[0]; | 354 | return a->d[0]; |
| 356 | /* a->top == 0 */ | 355 | /* a->top == 0 */ |
diff --git a/src/lib/libcrypto/bn/bn_local.h b/src/lib/libcrypto/bn/bn_local.h index 067ffab3d9..106a2cdf2d 100644 --- a/src/lib/libcrypto/bn/bn_local.h +++ b/src/lib/libcrypto/bn/bn_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_local.h,v 1.50 2025/02/13 11:04:20 tb Exp $ */ | 1 | /* $OpenBSD: bn_local.h,v 1.61 2025/12/05 14:12:32 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -116,6 +116,20 @@ | |||
| 116 | 116 | ||
| 117 | #include <openssl/bn.h> | 117 | #include <openssl/bn.h> |
| 118 | 118 | ||
| 119 | #if BN_BYTES == 8 | ||
| 120 | #define BN_MASK2 UINT64_C(0xffffffffffffffff) | ||
| 121 | #define BN_MASK2l UINT64_C(0xffffffff) | ||
| 122 | #define BN_MASK2h UINT64_C(0xffffffff00000000) | ||
| 123 | #define BN_BITS 128 | ||
| 124 | #define BN_BITS4 32 | ||
| 125 | #else | ||
| 126 | #define BN_MASK2 UINT32_C(0xffffffff) | ||
| 127 | #define BN_MASK2l UINT32_C(0xffff) | ||
| 128 | #define BN_MASK2h UINT32_C(0xffff0000) | ||
| 129 | #define BN_BITS 64 | ||
| 130 | #define BN_BITS4 16 | ||
| 131 | #endif | ||
| 132 | |||
| 119 | __BEGIN_HIDDEN_DECLS | 133 | __BEGIN_HIDDEN_DECLS |
| 120 | 134 | ||
| 121 | struct bignum_st { | 135 | struct bignum_st { |
| @@ -239,12 +253,16 @@ BN_ULONG bn_add(BN_ULONG *r, int r_len, const BN_ULONG *a, int a_len, | |||
| 239 | BN_ULONG bn_sub(BN_ULONG *r, int r_len, const BN_ULONG *a, int a_len, | 253 | BN_ULONG bn_sub(BN_ULONG *r, int r_len, const BN_ULONG *a, int a_len, |
| 240 | const BN_ULONG *b, int b_len); | 254 | const BN_ULONG *b, int b_len); |
| 241 | 255 | ||
| 242 | void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb); | 256 | void bn_mul_comba4(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b); |
| 243 | void bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b); | 257 | void bn_mul_comba6(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b); |
| 244 | void bn_mul_comba8(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b); | 258 | void bn_mul_comba8(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b); |
| 259 | void bn_mul_words(BN_ULONG *r, const BN_ULONG *a, int a_len, const BN_ULONG *b, | ||
| 260 | int b_len); | ||
| 245 | 261 | ||
| 246 | void bn_sqr_comba4(BN_ULONG *r, const BN_ULONG *a); | 262 | void bn_sqr_comba4(BN_ULONG *r, const BN_ULONG *a); |
| 263 | void bn_sqr_comba6(BN_ULONG *r, const BN_ULONG *a); | ||
| 247 | void bn_sqr_comba8(BN_ULONG *r, const BN_ULONG *a); | 264 | void bn_sqr_comba8(BN_ULONG *r, const BN_ULONG *a); |
| 265 | void bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, int a_len); | ||
| 248 | 266 | ||
| 249 | int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, | 267 | int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, |
| 250 | const BN_ULONG *np, const BN_ULONG *n0, int num); | 268 | const BN_ULONG *np, const BN_ULONG *n0, int num); |
| @@ -254,13 +272,8 @@ int bn_expand_bits(BIGNUM *a, size_t bits); | |||
| 254 | int bn_expand_bytes(BIGNUM *a, size_t bytes); | 272 | int bn_expand_bytes(BIGNUM *a, size_t bytes); |
| 255 | int bn_wexpand(BIGNUM *a, int words); | 273 | int bn_wexpand(BIGNUM *a, int words); |
| 256 | 274 | ||
| 257 | BN_ULONG bn_add_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, | 275 | BN_ULONG bn_mulw_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w); |
| 258 | int num); | 276 | BN_ULONG bn_mulw_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w); |
| 259 | BN_ULONG bn_sub_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, | ||
| 260 | int num); | ||
| 261 | BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w); | ||
| 262 | BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w); | ||
| 263 | void bn_sqr_words(BN_ULONG *rp, const BN_ULONG *ap, int num); | ||
| 264 | BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d); | 277 | BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d); |
| 265 | void bn_div_rem_words(BN_ULONG h, BN_ULONG l, BN_ULONG d, BN_ULONG *out_q, | 278 | void bn_div_rem_words(BN_ULONG h, BN_ULONG l, BN_ULONG d, BN_ULONG *out_q, |
| 266 | BN_ULONG *out_r); | 279 | BN_ULONG *out_r); |
diff --git a/src/lib/libcrypto/bn/bn_mod.c b/src/lib/libcrypto/bn/bn_mod.c index 365f6fcf03..7198c02e3b 100644 --- a/src/lib/libcrypto/bn/bn_mod.c +++ b/src/lib/libcrypto/bn/bn_mod.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_mod.c,v 1.22 2023/07/08 12:21:58 beck Exp $ */ | 1 | /* $OpenBSD: bn_mod.c,v 1.23 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> | 2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> |
| 3 | * for the OpenSSL project. */ | 3 | * for the OpenSSL project. */ |
| 4 | /* ==================================================================== | 4 | /* ==================================================================== |
| @@ -111,9 +111,8 @@ | |||
| 111 | * [including the GNU Public Licence.] | 111 | * [including the GNU Public Licence.] |
| 112 | */ | 112 | */ |
| 113 | 113 | ||
| 114 | #include <openssl/err.h> | ||
| 115 | |||
| 116 | #include "bn_local.h" | 114 | #include "bn_local.h" |
| 115 | #include "err_local.h" | ||
| 117 | 116 | ||
| 118 | int | 117 | int |
| 119 | BN_mod_ct(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx) | 118 | BN_mod_ct(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx) |
diff --git a/src/lib/libcrypto/bn/bn_mod_sqrt.c b/src/lib/libcrypto/bn/bn_mod_sqrt.c index 280002cc48..fc55f84317 100644 --- a/src/lib/libcrypto/bn/bn_mod_sqrt.c +++ b/src/lib/libcrypto/bn/bn_mod_sqrt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_mod_sqrt.c,v 1.3 2023/08/03 18:53:55 tb Exp $ */ | 1 | /* $OpenBSD: bn_mod_sqrt.c,v 1.4 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> |
| @@ -16,9 +16,8 @@ | |||
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | #include <openssl/err.h> | ||
| 20 | |||
| 21 | #include "bn_local.h" | 19 | #include "bn_local.h" |
| 20 | #include "err_local.h" | ||
| 22 | 21 | ||
| 23 | /* | 22 | /* |
| 24 | * Tonelli-Shanks according to H. Cohen "A Course in Computational Algebraic | 23 | * Tonelli-Shanks according to H. Cohen "A Course in Computational Algebraic |
diff --git a/src/lib/libcrypto/bn/bn_mod_words.c b/src/lib/libcrypto/bn/bn_mod_words.c new file mode 100644 index 0000000000..f368e074db --- /dev/null +++ b/src/lib/libcrypto/bn/bn_mod_words.c | |||
| @@ -0,0 +1,110 @@ | |||
| 1 | /* $OpenBSD: bn_mod_words.c,v 1.7 2025/09/07 05:21:29 jsing Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include "bn_local.h" | ||
| 19 | #include "bn_internal.h" | ||
| 20 | |||
| 21 | /* | ||
| 22 | * bn_mod_add_words() computes r[] = (a[] + b[]) mod m[], where a, b, r and | ||
| 23 | * m are arrays of words with length n (r may be the same as a or b). | ||
| 24 | */ | ||
| 25 | #ifndef HAVE_BN_MOD_ADD_WORDS | ||
| 26 | void | ||
| 27 | bn_mod_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, | ||
| 28 | const BN_ULONG *m, size_t n) | ||
| 29 | { | ||
| 30 | BN_ULONG carry, mask; | ||
| 31 | |||
| 32 | /* | ||
| 33 | * Compute a + b, then compute r - m to determine if r >= m, considering | ||
| 34 | * any carry that resulted from the addition. Finally complete a | ||
| 35 | * conditional subtraction of r - m. | ||
| 36 | */ | ||
| 37 | /* XXX - change bn_add_words to use size_t. */ | ||
| 38 | carry = bn_add_words(r, a, b, n); | ||
| 39 | mask = ~(carry - bn_sub_words_borrow(r, m, n)); | ||
| 40 | bn_sub_words_masked(r, r, m, mask, n); | ||
| 41 | } | ||
| 42 | #endif | ||
| 43 | |||
| 44 | /* | ||
| 45 | * bn_mod_sub_words() computes r[] = (a[] - b[]) mod m[], where a, b, r and | ||
| 46 | * m are arrays of words with length n (r may be the same as a or b). | ||
| 47 | */ | ||
| 48 | #ifndef HAVE_BN_MOD_SUB_WORDS | ||
| 49 | void | ||
| 50 | bn_mod_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, | ||
| 51 | const BN_ULONG *m, size_t n) | ||
| 52 | { | ||
| 53 | BN_ULONG borrow, mask; | ||
| 54 | |||
| 55 | /* | ||
| 56 | * Compute a - b, then complete a conditional addition of r + m | ||
| 57 | * based on the resulting borrow. | ||
| 58 | */ | ||
| 59 | /* XXX - change bn_sub_words to use size_t. */ | ||
| 60 | borrow = bn_sub_words(r, a, b, n); | ||
| 61 | mask = (0 - borrow); | ||
| 62 | bn_add_words_masked(r, r, m, mask, n); | ||
| 63 | } | ||
| 64 | #endif | ||
| 65 | |||
| 66 | /* | ||
| 67 | * bn_mod_mul_words() computes r[] = (a[] * b[]) mod m[], where a, b, r and | ||
| 68 | * m are arrays of words with length n (r may be the same as a or b) in the | ||
| 69 | * Montgomery domain. The result remains in the Montgomery domain. | ||
| 70 | */ | ||
| 71 | #ifndef HAVE_BN_MOD_MUL_WORDS | ||
| 72 | void | ||
| 73 | bn_mod_mul_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, | ||
| 74 | const BN_ULONG *m, BN_ULONG *t, BN_ULONG m0, size_t n) | ||
| 75 | { | ||
| 76 | if (n == 4) { | ||
| 77 | bn_mul_comba4(t, a, b); | ||
| 78 | } else if (n == 6) { | ||
| 79 | bn_mul_comba6(t, a, b); | ||
| 80 | } else if (n == 8) { | ||
| 81 | bn_mul_comba8(t, a, b); | ||
| 82 | } else { | ||
| 83 | bn_mul_words(t, a, n, b, n); | ||
| 84 | } | ||
| 85 | bn_montgomery_reduce_words(r, t, m, m0, n); | ||
| 86 | } | ||
| 87 | #endif | ||
| 88 | |||
| 89 | /* | ||
| 90 | * bn_mod_sqr_words() computes r[] = (a[] * a[]) mod m[], where a, r and | ||
| 91 | * m are arrays of words with length n (r may be the same as a) in the | ||
| 92 | * Montgomery domain. The result remains in the Montgomery domain. | ||
| 93 | */ | ||
| 94 | #ifndef HAVE_BN_MOD_SQR_WORDS | ||
| 95 | void | ||
| 96 | bn_mod_sqr_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *m, | ||
| 97 | BN_ULONG *t, BN_ULONG m0, size_t n) | ||
| 98 | { | ||
| 99 | if (n == 4) { | ||
| 100 | bn_sqr_comba4(t, a); | ||
| 101 | } else if (n == 6) { | ||
| 102 | bn_sqr_comba6(t, a); | ||
| 103 | } else if (n == 8) { | ||
| 104 | bn_sqr_comba8(t, a); | ||
| 105 | } else { | ||
| 106 | bn_sqr_words(t, a, n); | ||
| 107 | } | ||
| 108 | bn_montgomery_reduce_words(r, t, m, m0, n); | ||
| 109 | } | ||
| 110 | #endif | ||
diff --git a/src/lib/libcrypto/bn/bn_mont.c b/src/lib/libcrypto/bn/bn_mont.c index edd7bcd0c8..c9e95fb08b 100644 --- a/src/lib/libcrypto/bn/bn_mont.c +++ b/src/lib/libcrypto/bn/bn_mont.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_mont.c,v 1.66 2025/03/09 15:22:40 tb Exp $ */ | 1 | /* $OpenBSD: bn_mont.c,v 1.70 2025/08/30 07:54:27 jsing Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -116,6 +116,7 @@ | |||
| 116 | * sections 3.8 and 4.2 in http://security.ece.orst.edu/koc/papers/r01rsasw.pdf | 116 | * sections 3.8 and 4.2 in http://security.ece.orst.edu/koc/papers/r01rsasw.pdf |
| 117 | */ | 117 | */ |
| 118 | 118 | ||
| 119 | #include <limits.h> | ||
| 119 | #include <stdio.h> | 120 | #include <stdio.h> |
| 120 | #include <stdint.h> | 121 | #include <stdint.h> |
| 121 | #include <string.h> | 122 | #include <string.h> |
| @@ -214,7 +215,7 @@ BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) | |||
| 214 | goto err; | 215 | goto err; |
| 215 | mont->N.neg = 0; | 216 | mont->N.neg = 0; |
| 216 | mont->ri = ((BN_num_bits(mod) + BN_BITS2 - 1) / BN_BITS2) * BN_BITS2; | 217 | mont->ri = ((BN_num_bits(mod) + BN_BITS2 - 1) / BN_BITS2) * BN_BITS2; |
| 217 | if (mont->ri * 2 < mont->ri) | 218 | if (mont->ri > INT_MAX / 2) |
| 218 | goto err; | 219 | goto err; |
| 219 | 220 | ||
| 220 | /* | 221 | /* |
| @@ -316,6 +317,44 @@ BN_MONT_CTX_set_locked(BN_MONT_CTX **pmctx, int lock, const BIGNUM *mod, | |||
| 316 | LCRYPTO_ALIAS(BN_MONT_CTX_set_locked); | 317 | LCRYPTO_ALIAS(BN_MONT_CTX_set_locked); |
| 317 | 318 | ||
| 318 | /* | 319 | /* |
| 320 | * bn_montgomery_reduce_words() performs Montgomery reduction, reducing the input | ||
| 321 | * from its Montgomery form aR to a, returning the result in r. a must be twice | ||
| 322 | * the length of the modulus. Note that the input is mutated in the process of | ||
| 323 | * performing the reduction. | ||
| 324 | */ | ||
| 325 | void | ||
| 326 | bn_montgomery_reduce_words(BN_ULONG *r, BN_ULONG *a, const BN_ULONG *n, | ||
| 327 | BN_ULONG n0, int n_len) | ||
| 328 | { | ||
| 329 | BN_ULONG v, mask; | ||
| 330 | BN_ULONG carry = 0; | ||
| 331 | int i; | ||
| 332 | |||
| 333 | /* Add multiples of the modulus, so that it becomes divisible by R. */ | ||
| 334 | for (i = 0; i < n_len; i++) { | ||
| 335 | v = bn_mulw_add_words(&a[i], n, n_len, a[i] * n0); | ||
| 336 | bn_addw_addw(v, a[i + n_len], carry, &carry, &a[i + n_len]); | ||
| 337 | } | ||
| 338 | |||
| 339 | /* Divide by R (this is the equivalent of right shifting by n_len). */ | ||
| 340 | a = &a[n_len]; | ||
| 341 | |||
| 342 | /* | ||
| 343 | * The output is now in the range of [0, 2N). Attempt to reduce once by | ||
| 344 | * subtracting the modulus. If the reduction was necessary then the | ||
| 345 | * result is already in r, otherwise copy the value prior to reduction | ||
| 346 | * from the top half of a. | ||
| 347 | */ | ||
| 348 | mask = carry - bn_sub_words(r, a, n, n_len); | ||
| 349 | |||
| 350 | for (i = 0; i < n_len; i++) { | ||
| 351 | *r = (*r & ~mask) | (*a & mask); | ||
| 352 | r++; | ||
| 353 | a++; | ||
| 354 | } | ||
| 355 | } | ||
| 356 | |||
| 357 | /* | ||
| 319 | * bn_montgomery_reduce() performs Montgomery reduction, reducing the input | 358 | * bn_montgomery_reduce() performs Montgomery reduction, reducing the input |
| 320 | * from its Montgomery form aR to a, returning the result in r. Note that the | 359 | * from its Montgomery form aR to a, returning the result in r. Note that the |
| 321 | * input is mutated in the process of performing the reduction, destroying its | 360 | * input is mutated in the process of performing the reduction, destroying its |
| @@ -325,7 +364,6 @@ static int | |||
| 325 | bn_montgomery_reduce(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mctx) | 364 | bn_montgomery_reduce(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mctx) |
| 326 | { | 365 | { |
| 327 | BIGNUM *n; | 366 | BIGNUM *n; |
| 328 | BN_ULONG *ap, *rp, n0, v, carry, mask; | ||
| 329 | int i, max, n_len; | 367 | int i, max, n_len; |
| 330 | 368 | ||
| 331 | n = &mctx->N; | 369 | n = &mctx->N; |
| @@ -341,7 +379,8 @@ bn_montgomery_reduce(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mctx) | |||
| 341 | 379 | ||
| 342 | /* | 380 | /* |
| 343 | * Expand a to twice the length of the modulus, zero if necessary. | 381 | * Expand a to twice the length of the modulus, zero if necessary. |
| 344 | * XXX - make this a requirement of the caller. | 382 | * XXX - make this a requirement of the caller or use a temporary |
| 383 | * allocation. | ||
| 345 | */ | 384 | */ |
| 346 | if ((max = 2 * n_len) < n_len) | 385 | if ((max = 2 * n_len) < n_len) |
| 347 | return 0; | 386 | return 0; |
| @@ -350,33 +389,8 @@ bn_montgomery_reduce(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mctx) | |||
| 350 | for (i = a->top; i < max; i++) | 389 | for (i = a->top; i < max; i++) |
| 351 | a->d[i] = 0; | 390 | a->d[i] = 0; |
| 352 | 391 | ||
| 353 | carry = 0; | 392 | bn_montgomery_reduce_words(r->d, a->d, n->d, mctx->n0[0], n_len); |
| 354 | n0 = mctx->n0[0]; | ||
| 355 | 393 | ||
| 356 | /* Add multiples of the modulus, so that it becomes divisible by R. */ | ||
| 357 | for (i = 0; i < n_len; i++) { | ||
| 358 | v = bn_mul_add_words(&a->d[i], n->d, n_len, a->d[i] * n0); | ||
| 359 | bn_addw_addw(v, a->d[i + n_len], carry, &carry, | ||
| 360 | &a->d[i + n_len]); | ||
| 361 | } | ||
| 362 | |||
| 363 | /* Divide by R (this is the equivalent of right shifting by n_len). */ | ||
| 364 | ap = &a->d[n_len]; | ||
| 365 | |||
| 366 | /* | ||
| 367 | * The output is now in the range of [0, 2N). Attempt to reduce once by | ||
| 368 | * subtracting the modulus. If the reduction was necessary then the | ||
| 369 | * result is already in r, otherwise copy the value prior to reduction | ||
| 370 | * from the top half of a. | ||
| 371 | */ | ||
| 372 | mask = carry - bn_sub_words(r->d, ap, n->d, n_len); | ||
| 373 | |||
| 374 | rp = r->d; | ||
| 375 | for (i = 0; i < n_len; i++) { | ||
| 376 | *rp = (*rp & ~mask) | (*ap & mask); | ||
| 377 | rp++; | ||
| 378 | ap++; | ||
| 379 | } | ||
| 380 | r->top = n_len; | 394 | r->top = n_len; |
| 381 | 395 | ||
| 382 | bn_correct_top(r); | 396 | bn_correct_top(r); |
| @@ -417,7 +431,7 @@ bn_mod_mul_montgomery_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, | |||
| 417 | return ret; | 431 | return ret; |
| 418 | } | 432 | } |
| 419 | 433 | ||
| 420 | static void | 434 | static inline void |
| 421 | bn_montgomery_multiply_word(const BN_ULONG *ap, BN_ULONG b, const BN_ULONG *np, | 435 | bn_montgomery_multiply_word(const BN_ULONG *ap, BN_ULONG b, const BN_ULONG *np, |
| 422 | BN_ULONG *tp, BN_ULONG w, BN_ULONG *carry_a, BN_ULONG *carry_n, int n_len) | 436 | BN_ULONG *tp, BN_ULONG w, BN_ULONG *carry_a, BN_ULONG *carry_n, int n_len) |
| 423 | { | 437 | { |
| @@ -452,7 +466,7 @@ bn_montgomery_multiply_word(const BN_ULONG *ap, BN_ULONG b, const BN_ULONG *np, | |||
| 452 | * given word arrays. The caller must ensure that rp, ap, bp and np are all | 466 | * given word arrays. The caller must ensure that rp, ap, bp and np are all |
| 453 | * n_len words in length, while tp must be n_len * 2 + 2 words in length. | 467 | * n_len words in length, while tp must be n_len * 2 + 2 words in length. |
| 454 | */ | 468 | */ |
| 455 | static void | 469 | void |
| 456 | bn_montgomery_multiply_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, | 470 | bn_montgomery_multiply_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, |
| 457 | const BN_ULONG *np, BN_ULONG *tp, BN_ULONG n0, int n_len) | 471 | const BN_ULONG *np, BN_ULONG *tp, BN_ULONG n0, int n_len) |
| 458 | { | 472 | { |
diff --git a/src/lib/libcrypto/bn/bn_mul.c b/src/lib/libcrypto/bn/bn_mul.c index bdeb9b0fe8..7db0f61849 100644 --- a/src/lib/libcrypto/bn/bn_mul.c +++ b/src/lib/libcrypto/bn/bn_mul.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_mul.c,v 1.39 2023/07/08 12:21:58 beck Exp $ */ | 1 | /* $OpenBSD: bn_mul.c,v 1.46 2025/09/01 15:39:59 jsing Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -57,6 +57,7 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <assert.h> | 59 | #include <assert.h> |
| 60 | #include <limits.h> | ||
| 60 | #include <stdio.h> | 61 | #include <stdio.h> |
| 61 | #include <string.h> | 62 | #include <string.h> |
| 62 | 63 | ||
| @@ -73,7 +74,7 @@ | |||
| 73 | */ | 74 | */ |
| 74 | #ifndef HAVE_BN_MUL_COMBA4 | 75 | #ifndef HAVE_BN_MUL_COMBA4 |
| 75 | void | 76 | void |
| 76 | bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b) | 77 | bn_mul_comba4(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b) |
| 77 | { | 78 | { |
| 78 | BN_ULONG c0, c1, c2; | 79 | BN_ULONG c0, c1, c2; |
| 79 | 80 | ||
| @@ -103,13 +104,73 @@ bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b) | |||
| 103 | #endif | 104 | #endif |
| 104 | 105 | ||
| 105 | /* | 106 | /* |
| 107 | * bn_mul_comba6() computes r[] = a[] * b[] using Comba multiplication | ||
| 108 | * (https://everything2.com/title/Comba+multiplication), where a and b are both | ||
| 109 | * six word arrays, producing a 12 word array result. | ||
| 110 | */ | ||
| 111 | #ifndef HAVE_BN_MUL_COMBA6 | ||
| 112 | void | ||
| 113 | bn_mul_comba6(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b) | ||
| 114 | { | ||
| 115 | BN_ULONG c0, c1, c2; | ||
| 116 | |||
| 117 | bn_mulw_addtw(a[0], b[0], 0, 0, 0, &c2, &c1, &r[0]); | ||
| 118 | |||
| 119 | bn_mulw_addtw(a[0], b[1], 0, c2, c1, &c2, &c1, &c0); | ||
| 120 | bn_mulw_addtw(a[1], b[0], c2, c1, c0, &c2, &c1, &r[1]); | ||
| 121 | |||
| 122 | bn_mulw_addtw(a[2], b[0], 0, c2, c1, &c2, &c1, &c0); | ||
| 123 | bn_mulw_addtw(a[1], b[1], c2, c1, c0, &c2, &c1, &c0); | ||
| 124 | bn_mulw_addtw(a[0], b[2], c2, c1, c0, &c2, &c1, &r[2]); | ||
| 125 | |||
| 126 | bn_mulw_addtw(a[0], b[3], 0, c2, c1, &c2, &c1, &c0); | ||
| 127 | bn_mulw_addtw(a[1], b[2], c2, c1, c0, &c2, &c1, &c0); | ||
| 128 | bn_mulw_addtw(a[2], b[1], c2, c1, c0, &c2, &c1, &c0); | ||
| 129 | bn_mulw_addtw(a[3], b[0], c2, c1, c0, &c2, &c1, &r[3]); | ||
| 130 | |||
| 131 | bn_mulw_addtw(a[4], b[0], 0, c2, c1, &c2, &c1, &c0); | ||
| 132 | bn_mulw_addtw(a[3], b[1], c2, c1, c0, &c2, &c1, &c0); | ||
| 133 | bn_mulw_addtw(a[2], b[2], c2, c1, c0, &c2, &c1, &c0); | ||
| 134 | bn_mulw_addtw(a[1], b[3], c2, c1, c0, &c2, &c1, &c0); | ||
| 135 | bn_mulw_addtw(a[0], b[4], c2, c1, c0, &c2, &c1, &r[4]); | ||
| 136 | |||
| 137 | bn_mulw_addtw(a[0], b[5], 0, c2, c1, &c2, &c1, &c0); | ||
| 138 | bn_mulw_addtw(a[1], b[4], c2, c1, c0, &c2, &c1, &c0); | ||
| 139 | bn_mulw_addtw(a[2], b[3], c2, c1, c0, &c2, &c1, &c0); | ||
| 140 | bn_mulw_addtw(a[3], b[2], c2, c1, c0, &c2, &c1, &c0); | ||
| 141 | bn_mulw_addtw(a[4], b[1], c2, c1, c0, &c2, &c1, &c0); | ||
| 142 | bn_mulw_addtw(a[5], b[0], c2, c1, c0, &c2, &c1, &r[5]); | ||
| 143 | |||
| 144 | bn_mulw_addtw(a[5], b[1], 0, c2, c1, &c2, &c1, &c0); | ||
| 145 | bn_mulw_addtw(a[4], b[2], c2, c1, c0, &c2, &c1, &c0); | ||
| 146 | bn_mulw_addtw(a[3], b[3], c2, c1, c0, &c2, &c1, &c0); | ||
| 147 | bn_mulw_addtw(a[2], b[4], c2, c1, c0, &c2, &c1, &c0); | ||
| 148 | bn_mulw_addtw(a[1], b[5], c2, c1, c0, &c2, &c1, &r[6]); | ||
| 149 | |||
| 150 | bn_mulw_addtw(a[2], b[5], 0, c2, c1, &c2, &c1, &c0); | ||
| 151 | bn_mulw_addtw(a[3], b[4], c2, c1, c0, &c2, &c1, &c0); | ||
| 152 | bn_mulw_addtw(a[4], b[3], c2, c1, c0, &c2, &c1, &c0); | ||
| 153 | bn_mulw_addtw(a[5], b[2], c2, c1, c0, &c2, &c1, &r[7]); | ||
| 154 | |||
| 155 | bn_mulw_addtw(a[5], b[3], 0, c2, c1, &c2, &c1, &c0); | ||
| 156 | bn_mulw_addtw(a[4], b[4], c2, c1, c0, &c2, &c1, &c0); | ||
| 157 | bn_mulw_addtw(a[3], b[5], c2, c1, c0, &c2, &c1, &r[8]); | ||
| 158 | |||
| 159 | bn_mulw_addtw(a[4], b[5], 0, c2, c1, &c2, &c1, &c0); | ||
| 160 | bn_mulw_addtw(a[5], b[4], c2, c1, c0, &c2, &c1, &r[9]); | ||
| 161 | |||
| 162 | bn_mulw_addtw(a[5], b[5], 0, c2, c1, &c2, &r[11], &r[10]); | ||
| 163 | } | ||
| 164 | #endif | ||
| 165 | |||
| 166 | /* | ||
| 106 | * bn_mul_comba8() computes r[] = a[] * b[] using Comba multiplication | 167 | * bn_mul_comba8() computes r[] = a[] * b[] using Comba multiplication |
| 107 | * (https://everything2.com/title/Comba+multiplication), where a and b are both | 168 | * (https://everything2.com/title/Comba+multiplication), where a and b are both |
| 108 | * eight word arrays, producing a 16 word array result. | 169 | * eight word arrays, producing a 16 word array result. |
| 109 | */ | 170 | */ |
| 110 | #ifndef HAVE_BN_MUL_COMBA8 | 171 | #ifndef HAVE_BN_MUL_COMBA8 |
| 111 | void | 172 | void |
| 112 | bn_mul_comba8(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b) | 173 | bn_mul_comba8(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b) |
| 113 | { | 174 | { |
| 114 | BN_ULONG c0, c1, c2; | 175 | BN_ULONG c0, c1, c2; |
| 115 | 176 | ||
| @@ -195,14 +256,13 @@ bn_mul_comba8(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b) | |||
| 195 | #endif | 256 | #endif |
| 196 | 257 | ||
| 197 | /* | 258 | /* |
| 198 | * bn_mul_words() computes (carry:r[i]) = a[i] * w + carry, where a is an array | 259 | * bn_mulw_words() computes (carry:r[i]) = a[i] * w + carry, where a is an array |
| 199 | * of words and w is a single word. This should really be called bn_mulw_words() | 260 | * of words and w is a single word. This is used as a step in the multiplication |
| 200 | * since only one input is an array. This is used as a step in the multiplication | ||
| 201 | * of word arrays. | 261 | * of word arrays. |
| 202 | */ | 262 | */ |
| 203 | #ifndef HAVE_BN_MUL_WORDS | 263 | #ifndef HAVE_BN_MULW_WORDS |
| 204 | BN_ULONG | 264 | BN_ULONG |
| 205 | bn_mul_words(BN_ULONG *r, const BN_ULONG *a, int num, BN_ULONG w) | 265 | bn_mulw_words(BN_ULONG *r, const BN_ULONG *a, int num, BN_ULONG w) |
| 206 | { | 266 | { |
| 207 | BN_ULONG carry = 0; | 267 | BN_ULONG carry = 0; |
| 208 | 268 | ||
| @@ -228,14 +288,13 @@ bn_mul_words(BN_ULONG *r, const BN_ULONG *a, int num, BN_ULONG w) | |||
| 228 | #endif | 288 | #endif |
| 229 | 289 | ||
| 230 | /* | 290 | /* |
| 231 | * bn_mul_add_words() computes (carry:r[i]) = a[i] * w + r[i] + carry, where | 291 | * bn_mulw_add_words() computes (carry:r[i]) = a[i] * w + r[i] + carry, where |
| 232 | * a is an array of words and w is a single word. This should really be called | 292 | * a is an array of words and w is a single word. This is used as a step in the |
| 233 | * bn_mulw_add_words() since only one input is an array. This is used as a step | 293 | * multiplication of word arrays. |
| 234 | * in the multiplication of word arrays. | ||
| 235 | */ | 294 | */ |
| 236 | #ifndef HAVE_BN_MUL_ADD_WORDS | 295 | #ifndef HAVE_BN_MULW_ADD_WORDS |
| 237 | BN_ULONG | 296 | BN_ULONG |
| 238 | bn_mul_add_words(BN_ULONG *r, const BN_ULONG *a, int num, BN_ULONG w) | 297 | bn_mulw_add_words(BN_ULONG *r, const BN_ULONG *a, int num, BN_ULONG w) |
| 239 | { | 298 | { |
| 240 | BN_ULONG carry = 0; | 299 | BN_ULONG carry = 0; |
| 241 | 300 | ||
| @@ -262,62 +321,60 @@ bn_mul_add_words(BN_ULONG *r, const BN_ULONG *a, int num, BN_ULONG w) | |||
| 262 | } | 321 | } |
| 263 | #endif | 322 | #endif |
| 264 | 323 | ||
| 324 | #ifndef HAVE_BN_MUL_WORDS | ||
| 265 | void | 325 | void |
| 266 | bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb) | 326 | bn_mul_words(BN_ULONG *r, const BN_ULONG *a, int a_len, const BN_ULONG *b, |
| 327 | int b_len) | ||
| 267 | { | 328 | { |
| 268 | BN_ULONG *rr; | 329 | BN_ULONG *rr; |
| 269 | 330 | ||
| 270 | 331 | if (a_len < b_len) { | |
| 271 | if (na < nb) { | ||
| 272 | int itmp; | 332 | int itmp; |
| 273 | BN_ULONG *ltmp; | 333 | const BN_ULONG *ltmp; |
| 274 | 334 | ||
| 275 | itmp = na; | 335 | itmp = a_len; |
| 276 | na = nb; | 336 | a_len = b_len; |
| 277 | nb = itmp; | 337 | b_len = itmp; |
| 278 | ltmp = a; | 338 | ltmp = a; |
| 279 | a = b; | 339 | a = b; |
| 280 | b = ltmp; | 340 | b = ltmp; |
| 281 | 341 | ||
| 282 | } | 342 | } |
| 283 | rr = &(r[na]); | 343 | rr = &(r[a_len]); |
| 284 | if (nb <= 0) { | 344 | if (b_len <= 0) { |
| 285 | (void)bn_mul_words(r, a, na, 0); | 345 | (void)bn_mulw_words(r, a, a_len, 0); |
| 286 | return; | 346 | return; |
| 287 | } else | 347 | } else |
| 288 | rr[0] = bn_mul_words(r, a, na, b[0]); | 348 | rr[0] = bn_mulw_words(r, a, a_len, b[0]); |
| 289 | 349 | ||
| 290 | for (;;) { | 350 | for (;;) { |
| 291 | if (--nb <= 0) | 351 | if (--b_len <= 0) |
| 292 | return; | 352 | return; |
| 293 | rr[1] = bn_mul_add_words(&(r[1]), a, na, b[1]); | 353 | rr[1] = bn_mulw_add_words(&(r[1]), a, a_len, b[1]); |
| 294 | if (--nb <= 0) | 354 | if (--b_len <= 0) |
| 295 | return; | 355 | return; |
| 296 | rr[2] = bn_mul_add_words(&(r[2]), a, na, b[2]); | 356 | rr[2] = bn_mulw_add_words(&(r[2]), a, a_len, b[2]); |
| 297 | if (--nb <= 0) | 357 | if (--b_len <= 0) |
| 298 | return; | 358 | return; |
| 299 | rr[3] = bn_mul_add_words(&(r[3]), a, na, b[3]); | 359 | rr[3] = bn_mulw_add_words(&(r[3]), a, a_len, b[3]); |
| 300 | if (--nb <= 0) | 360 | if (--b_len <= 0) |
| 301 | return; | 361 | return; |
| 302 | rr[4] = bn_mul_add_words(&(r[4]), a, na, b[4]); | 362 | rr[4] = bn_mulw_add_words(&(r[4]), a, a_len, b[4]); |
| 303 | rr += 4; | 363 | rr += 4; |
| 304 | r += 4; | 364 | r += 4; |
| 305 | b += 4; | 365 | b += 4; |
| 306 | } | 366 | } |
| 307 | } | 367 | } |
| 368 | #endif | ||
| 308 | 369 | ||
| 309 | 370 | static int | |
| 310 | #ifndef HAVE_BN_MUL | ||
| 311 | int | ||
| 312 | bn_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, int rn, BN_CTX *ctx) | 371 | bn_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, int rn, BN_CTX *ctx) |
| 313 | { | 372 | { |
| 314 | bn_mul_normal(r->d, a->d, a->top, b->d, b->top); | 373 | bn_mul_words(r->d, a->d, a->top, b->d, b->top); |
| 315 | 374 | ||
| 316 | return 1; | 375 | return 1; |
| 317 | } | 376 | } |
| 318 | 377 | ||
| 319 | #endif /* HAVE_BN_MUL */ | ||
| 320 | |||
| 321 | int | 378 | int |
| 322 | BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) | 379 | BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) |
| 323 | { | 380 | { |
| @@ -338,14 +395,16 @@ BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) | |||
| 338 | if (rr == NULL) | 395 | if (rr == NULL) |
| 339 | goto err; | 396 | goto err; |
| 340 | 397 | ||
| 341 | rn = a->top + b->top; | 398 | if (a->top > INT_MAX - b->top) |
| 342 | if (rn < a->top) | ||
| 343 | goto err; | 399 | goto err; |
| 400 | rn = a->top + b->top; | ||
| 344 | if (!bn_wexpand(rr, rn)) | 401 | if (!bn_wexpand(rr, rn)) |
| 345 | goto err; | 402 | goto err; |
| 346 | 403 | ||
| 347 | if (a->top == 4 && b->top == 4) { | 404 | if (a->top == 4 && b->top == 4) { |
| 348 | bn_mul_comba4(rr->d, a->d, b->d); | 405 | bn_mul_comba4(rr->d, a->d, b->d); |
| 406 | } else if (a->top == 6 && b->top == 6) { | ||
| 407 | bn_mul_comba6(rr->d, a->d, b->d); | ||
| 349 | } else if (a->top == 8 && b->top == 8) { | 408 | } else if (a->top == 8 && b->top == 8) { |
| 350 | bn_mul_comba8(rr->d, a->d, b->d); | 409 | bn_mul_comba8(rr->d, a->d, b->d); |
| 351 | } else { | 410 | } else { |
diff --git a/src/lib/libcrypto/bn/bn_prime.c b/src/lib/libcrypto/bn/bn_prime.c index 5a4aa50bf1..3d7f18a8ea 100644 --- a/src/lib/libcrypto/bn/bn_prime.c +++ b/src/lib/libcrypto/bn/bn_prime.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_prime.c,v 1.34 2023/07/20 06:26:27 tb Exp $ */ | 1 | /* $OpenBSD: bn_prime.c,v 1.37 2025/11/08 16:27:33 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -109,12 +109,12 @@ | |||
| 109 | * | 109 | * |
| 110 | */ | 110 | */ |
| 111 | 111 | ||
| 112 | #include <stdio.h> | 112 | #include <stddef.h> |
| 113 | #include <time.h> | ||
| 114 | 113 | ||
| 115 | #include <openssl/err.h> | 114 | #include <openssl/bn.h> |
| 116 | 115 | ||
| 117 | #include "bn_local.h" | 116 | #include "bn_local.h" |
| 117 | #include "err_local.h" | ||
| 118 | 118 | ||
| 119 | /* The quick sieve algorithm approach to weeding out primes is | 119 | /* The quick sieve algorithm approach to weeding out primes is |
| 120 | * Philip Zimmermann's, as implemented in PGP. I have had a read of | 120 | * Philip Zimmermann's, as implemented in PGP. I have had a read of |
| @@ -339,7 +339,7 @@ probable_prime_dh(BIGNUM *rnd, int bits, const BIGNUM *add, const BIGNUM *rem, | |||
| 339 | loop: | 339 | loop: |
| 340 | for (i = 1; i < NUMPRIMES; i++) { | 340 | for (i = 1; i < NUMPRIMES; i++) { |
| 341 | /* check that rnd is a prime */ | 341 | /* check that rnd is a prime */ |
| 342 | BN_LONG mod = BN_mod_word(rnd, primes[i]); | 342 | BN_ULONG mod = BN_mod_word(rnd, primes[i]); |
| 343 | if (mod == (BN_ULONG)-1) | 343 | if (mod == (BN_ULONG)-1) |
| 344 | goto err; | 344 | goto err; |
| 345 | if (mod <= 1) { | 345 | if (mod <= 1) { |
diff --git a/src/lib/libcrypto/bn/bn_rand.c b/src/lib/libcrypto/bn/bn_rand.c index 9cfcd8e2c0..d3b16f70a0 100644 --- a/src/lib/libcrypto/bn/bn_rand.c +++ b/src/lib/libcrypto/bn/bn_rand.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_rand.c,v 1.30 2024/03/16 20:42:33 tb Exp $ */ | 1 | /* $OpenBSD: bn_rand.c,v 1.31 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -115,9 +115,8 @@ | |||
| 115 | #include <string.h> | 115 | #include <string.h> |
| 116 | #include <time.h> | 116 | #include <time.h> |
| 117 | 117 | ||
| 118 | #include <openssl/err.h> | ||
| 119 | |||
| 120 | #include "bn_local.h" | 118 | #include "bn_local.h" |
| 119 | #include "err_local.h" | ||
| 121 | 120 | ||
| 122 | static int | 121 | static int |
| 123 | bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) | 122 | bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) |
diff --git a/src/lib/libcrypto/bn/bn_recp.c b/src/lib/libcrypto/bn/bn_recp.c index e3f22c52a9..ed5049b772 100644 --- a/src/lib/libcrypto/bn/bn_recp.c +++ b/src/lib/libcrypto/bn/bn_recp.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_recp.c,v 1.33 2025/02/04 20:22:20 tb Exp $ */ | 1 | /* $OpenBSD: bn_recp.c,v 1.34 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -58,9 +58,8 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | 60 | ||
| 61 | #include <openssl/err.h> | ||
| 62 | |||
| 63 | #include "bn_local.h" | 61 | #include "bn_local.h" |
| 62 | #include "err_local.h" | ||
| 64 | 63 | ||
| 65 | struct bn_recp_ctx_st { | 64 | struct bn_recp_ctx_st { |
| 66 | BIGNUM *N; /* the divisor */ | 65 | BIGNUM *N; /* the divisor */ |
diff --git a/src/lib/libcrypto/bn/bn_shift.c b/src/lib/libcrypto/bn/bn_shift.c index 12edc7c0a0..b9f73cc322 100644 --- a/src/lib/libcrypto/bn/bn_shift.c +++ b/src/lib/libcrypto/bn/bn_shift.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_shift.c,v 1.22 2023/07/08 12:21:58 beck Exp $ */ | 1 | /* $OpenBSD: bn_shift.c,v 1.23 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2022, 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2022, 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -16,9 +16,9 @@ | |||
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include <openssl/bn.h> | 18 | #include <openssl/bn.h> |
| 19 | #include <openssl/err.h> | ||
| 20 | 19 | ||
| 21 | #include "bn_local.h" | 20 | #include "bn_local.h" |
| 21 | #include "err_local.h" | ||
| 22 | 22 | ||
| 23 | static inline int | 23 | static inline int |
| 24 | bn_lshift(BIGNUM *r, const BIGNUM *a, int n) | 24 | bn_lshift(BIGNUM *r, const BIGNUM *a, int n) |
diff --git a/src/lib/libcrypto/bn/bn_sqr.c b/src/lib/libcrypto/bn/bn_sqr.c index 0dbccbf85d..27e08bdf13 100644 --- a/src/lib/libcrypto/bn/bn_sqr.c +++ b/src/lib/libcrypto/bn/bn_sqr.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_sqr.c,v 1.36 2023/07/08 12:21:58 beck Exp $ */ | 1 | /* $OpenBSD: bn_sqr.c,v 1.42 2025/09/07 05:21:29 jsing Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -64,8 +64,6 @@ | |||
| 64 | #include "bn_local.h" | 64 | #include "bn_local.h" |
| 65 | #include "bn_internal.h" | 65 | #include "bn_internal.h" |
| 66 | 66 | ||
| 67 | int bn_sqr(BIGNUM *r, const BIGNUM *a, int max, BN_CTX *ctx); | ||
| 68 | |||
| 69 | /* | 67 | /* |
| 70 | * bn_sqr_comba4() computes r[] = a[] * a[] using Comba multiplication | 68 | * bn_sqr_comba4() computes r[] = a[] * a[] using Comba multiplication |
| 71 | * (https://everything2.com/title/Comba+multiplication), where a is a | 69 | * (https://everything2.com/title/Comba+multiplication), where a is a |
| @@ -97,6 +95,51 @@ bn_sqr_comba4(BN_ULONG *r, const BN_ULONG *a) | |||
| 97 | #endif | 95 | #endif |
| 98 | 96 | ||
| 99 | /* | 97 | /* |
| 98 | * bn_sqr_comba6() computes r[] = a[] * a[] using Comba multiplication | ||
| 99 | * (https://everything2.com/title/Comba+multiplication), where a is an | ||
| 100 | * six word array, producing an 12 word array result. | ||
| 101 | */ | ||
| 102 | #ifndef HAVE_BN_SQR_COMBA6 | ||
| 103 | void | ||
| 104 | bn_sqr_comba6(BN_ULONG *r, const BN_ULONG *a) | ||
| 105 | { | ||
| 106 | BN_ULONG c2, c1, c0; | ||
| 107 | |||
| 108 | bn_mulw_addtw(a[0], a[0], 0, 0, 0, &c2, &c1, &r[0]); | ||
| 109 | |||
| 110 | bn_mul2_mulw_addtw(a[1], a[0], 0, c2, c1, &c2, &c1, &r[1]); | ||
| 111 | |||
| 112 | bn_mulw_addtw(a[1], a[1], 0, c2, c1, &c2, &c1, &c0); | ||
| 113 | bn_mul2_mulw_addtw(a[2], a[0], c2, c1, c0, &c2, &c1, &r[2]); | ||
| 114 | |||
| 115 | bn_mul2_mulw_addtw(a[3], a[0], 0, c2, c1, &c2, &c1, &c0); | ||
| 116 | bn_mul2_mulw_addtw(a[2], a[1], c2, c1, c0, &c2, &c1, &r[3]); | ||
| 117 | |||
| 118 | bn_mulw_addtw(a[2], a[2], 0, c2, c1, &c2, &c1, &c0); | ||
| 119 | bn_mul2_mulw_addtw(a[3], a[1], c2, c1, c0, &c2, &c1, &c0); | ||
| 120 | bn_mul2_mulw_addtw(a[4], a[0], c2, c1, c0, &c2, &c1, &r[4]); | ||
| 121 | |||
| 122 | bn_mul2_mulw_addtw(a[5], a[0], 0, c2, c1, &c2, &c1, &c0); | ||
| 123 | bn_mul2_mulw_addtw(a[4], a[1], c2, c1, c0, &c2, &c1, &c0); | ||
| 124 | bn_mul2_mulw_addtw(a[3], a[2], c2, c1, c0, &c2, &c1, &r[5]); | ||
| 125 | |||
| 126 | bn_mulw_addtw(a[3], a[3], 0, c2, c1, &c2, &c1, &c0); | ||
| 127 | bn_mul2_mulw_addtw(a[4], a[2], c2, c1, c0, &c2, &c1, &c0); | ||
| 128 | bn_mul2_mulw_addtw(a[5], a[1], c2, c1, c0, &c2, &c1, &r[6]); | ||
| 129 | |||
| 130 | bn_mul2_mulw_addtw(a[5], a[2], 0, c2, c1, &c2, &c1, &c0); | ||
| 131 | bn_mul2_mulw_addtw(a[4], a[3], c2, c1, c0, &c2, &c1, &r[7]); | ||
| 132 | |||
| 133 | bn_mulw_addtw(a[4], a[4], 0, c2, c1, &c2, &c1, &c0); | ||
| 134 | bn_mul2_mulw_addtw(a[5], a[3], c2, c1, c0, &c2, &c1, &r[8]); | ||
| 135 | |||
| 136 | bn_mul2_mulw_addtw(a[5], a[4], 0, c2, c1, &c2, &c1, &r[9]); | ||
| 137 | |||
| 138 | bn_mulw_addtw(a[5], a[5], 0, c2, c1, &c2, &r[11], &r[10]); | ||
| 139 | } | ||
| 140 | #endif | ||
| 141 | |||
| 142 | /* | ||
| 100 | * bn_sqr_comba8() computes r[] = a[] * a[] using Comba multiplication | 143 | * bn_sqr_comba8() computes r[] = a[] * a[] using Comba multiplication |
| 101 | * (https://everything2.com/title/Comba+multiplication), where a is an | 144 | * (https://everything2.com/title/Comba+multiplication), where a is an |
| 102 | * eight word array, producing an 16 word array result. | 145 | * eight word array, producing an 16 word array result. |
| @@ -160,7 +203,7 @@ bn_sqr_comba8(BN_ULONG *r, const BN_ULONG *a) | |||
| 160 | } | 203 | } |
| 161 | #endif | 204 | #endif |
| 162 | 205 | ||
| 163 | #ifndef HAVE_BN_SQR | 206 | #ifndef HAVE_BN_SQR_WORDS |
| 164 | /* | 207 | /* |
| 165 | * bn_sqr_add_words() computes (r[i*2+1]:r[i*2]) = (r[i*2+1]:r[i*2]) + a[i] * a[i]. | 208 | * bn_sqr_add_words() computes (r[i*2+1]:r[i*2]) = (r[i*2+1]:r[i*2]) + a[i] * a[i]. |
| 166 | */ | 209 | */ |
| @@ -197,12 +240,16 @@ bn_sqr_add_words(BN_ULONG *r, const BN_ULONG *a, int n) | |||
| 197 | } | 240 | } |
| 198 | } | 241 | } |
| 199 | 242 | ||
| 200 | static void | 243 | /* |
| 201 | bn_sqr_normal(BN_ULONG *r, int r_len, const BN_ULONG *a, int a_len) | 244 | * bn_sqr_words() computes r[] = a[] * a[]. |
| 245 | */ | ||
| 246 | void | ||
| 247 | bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, int a_len) | ||
| 202 | { | 248 | { |
| 203 | const BN_ULONG *ap; | 249 | const BN_ULONG *ap; |
| 204 | BN_ULONG *rp; | 250 | BN_ULONG *rp; |
| 205 | BN_ULONG w; | 251 | BN_ULONG w; |
| 252 | int r_len; | ||
| 206 | int n; | 253 | int n; |
| 207 | 254 | ||
| 208 | if (a_len <= 0) | 255 | if (a_len <= 0) |
| @@ -213,13 +260,14 @@ bn_sqr_normal(BN_ULONG *r, int r_len, const BN_ULONG *a, int a_len) | |||
| 213 | ap++; | 260 | ap++; |
| 214 | 261 | ||
| 215 | rp = r; | 262 | rp = r; |
| 263 | r_len = a_len * 2; | ||
| 216 | rp[0] = rp[r_len - 1] = 0; | 264 | rp[0] = rp[r_len - 1] = 0; |
| 217 | rp++; | 265 | rp++; |
| 218 | 266 | ||
| 219 | /* Compute initial product - r[n:1] = a[n:1] * a[0] */ | 267 | /* Compute initial product - r[n:1] = a[n:1] * a[0] */ |
| 220 | n = a_len - 1; | 268 | n = a_len - 1; |
| 221 | if (n > 0) { | 269 | if (n > 0) { |
| 222 | rp[n] = bn_mul_words(rp, ap, n, w); | 270 | rp[n] = bn_mulw_words(rp, ap, n, w); |
| 223 | } | 271 | } |
| 224 | rp += 2; | 272 | rp += 2; |
| 225 | n--; | 273 | n--; |
| @@ -229,7 +277,7 @@ bn_sqr_normal(BN_ULONG *r, int r_len, const BN_ULONG *a, int a_len) | |||
| 229 | w = ap[0]; | 277 | w = ap[0]; |
| 230 | ap++; | 278 | ap++; |
| 231 | 279 | ||
| 232 | rp[n] = bn_mul_add_words(rp, ap, n, w); | 280 | rp[n] = bn_mulw_add_words(rp, ap, n, w); |
| 233 | rp += 2; | 281 | rp += 2; |
| 234 | n--; | 282 | n--; |
| 235 | } | 283 | } |
| @@ -240,20 +288,20 @@ bn_sqr_normal(BN_ULONG *r, int r_len, const BN_ULONG *a, int a_len) | |||
| 240 | /* Add squares. */ | 288 | /* Add squares. */ |
| 241 | bn_sqr_add_words(r, a, a_len); | 289 | bn_sqr_add_words(r, a, a_len); |
| 242 | } | 290 | } |
| 291 | #endif | ||
| 243 | 292 | ||
| 244 | /* | 293 | /* |
| 245 | * bn_sqr() computes a * a, storing the result in r. The caller must ensure that | 294 | * bn_sqr() computes a * a, storing the result in r. The caller must ensure that |
| 246 | * r is not the same BIGNUM as a and that r has been expanded to rn = a->top * 2 | 295 | * r is not the same BIGNUM as a and that r has been expanded to rn = a->top * 2 |
| 247 | * words. | 296 | * words. |
| 248 | */ | 297 | */ |
| 249 | int | 298 | static int |
| 250 | bn_sqr(BIGNUM *r, const BIGNUM *a, int r_len, BN_CTX *ctx) | 299 | bn_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) |
| 251 | { | 300 | { |
| 252 | bn_sqr_normal(r->d, r_len, a->d, a->top); | 301 | bn_sqr_words(r->d, a->d, a->top); |
| 253 | 302 | ||
| 254 | return 1; | 303 | return 1; |
| 255 | } | 304 | } |
| 256 | #endif | ||
| 257 | 305 | ||
| 258 | int | 306 | int |
| 259 | BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) | 307 | BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) |
| @@ -281,10 +329,12 @@ BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) | |||
| 281 | 329 | ||
| 282 | if (a->top == 4) { | 330 | if (a->top == 4) { |
| 283 | bn_sqr_comba4(rr->d, a->d); | 331 | bn_sqr_comba4(rr->d, a->d); |
| 332 | } else if (a->top == 6) { | ||
| 333 | bn_sqr_comba6(rr->d, a->d); | ||
| 284 | } else if (a->top == 8) { | 334 | } else if (a->top == 8) { |
| 285 | bn_sqr_comba8(rr->d, a->d); | 335 | bn_sqr_comba8(rr->d, a->d); |
| 286 | } else { | 336 | } else { |
| 287 | if (!bn_sqr(rr, a, r_len, ctx)) | 337 | if (!bn_sqr(rr, a, ctx)) |
| 288 | goto err; | 338 | goto err; |
| 289 | } | 339 | } |
| 290 | 340 | ||
diff --git a/src/lib/libcrypto/bn/bn_word.c b/src/lib/libcrypto/bn/bn_word.c index a82b911e67..e035878cb9 100644 --- a/src/lib/libcrypto/bn/bn_word.c +++ b/src/lib/libcrypto/bn/bn_word.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_word.c,v 1.21 2023/07/08 12:21:58 beck Exp $ */ | 1 | /* $OpenBSD: bn_word.c,v 1.22 2025/08/30 07:54:27 jsing Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -232,7 +232,7 @@ BN_mul_word(BIGNUM *a, BN_ULONG w) | |||
| 232 | if (w == 0) | 232 | if (w == 0) |
| 233 | BN_zero(a); | 233 | BN_zero(a); |
| 234 | else { | 234 | else { |
| 235 | ll = bn_mul_words(a->d, a->d, a->top, w); | 235 | ll = bn_mulw_words(a->d, a->d, a->top, w); |
| 236 | if (ll) { | 236 | if (ll) { |
| 237 | if (!bn_wexpand(a, a->top + 1)) | 237 | if (!bn_wexpand(a, a->top + 1)) |
| 238 | return (0); | 238 | return (0); |
diff --git a/src/lib/libcrypto/bn/s2n_bignum.h b/src/lib/libcrypto/bn/s2n_bignum.h index ce6e8cdc94..7d77894cdc 100644 --- a/src/lib/libcrypto/bn/s2n_bignum.h +++ b/src/lib/libcrypto/bn/s2n_bignum.h | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | // $OpenBSD: s2n_bignum.h,v 1.4 2025/08/12 10:01:37 jsing Exp $ | ||
| 2 | // | ||
| 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | // | 4 | // |
| 3 | // Permission to use, copy, modify, and/or distribute this software for any | 5 | // Permission to use, copy, modify, and/or distribute this software for any |
| @@ -34,182 +36,240 @@ | |||
| 34 | // throughput, generally offering higher performance there. | 36 | // throughput, generally offering higher performance there. |
| 35 | // ---------------------------------------------------------------------------- | 37 | // ---------------------------------------------------------------------------- |
| 36 | 38 | ||
| 39 | |||
| 40 | #if defined(_MSC_VER) || !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L || defined(__STDC_NO_VLA__) | ||
| 41 | #define S2N_BIGNUM_STATIC | ||
| 42 | #else | ||
| 43 | #define S2N_BIGNUM_STATIC static | ||
| 44 | #endif | ||
| 45 | |||
| 37 | // Add, z := x + y | 46 | // Add, z := x + y |
| 38 | // Inputs x[m], y[n]; outputs function return (carry-out) and z[p] | 47 | // Inputs x[m], y[n]; outputs function return (carry-out) and z[p] |
| 39 | extern uint64_t bignum_add (uint64_t p, uint64_t *z, uint64_t m, uint64_t *x, uint64_t n, uint64_t *y); | 48 | extern uint64_t bignum_add (uint64_t p, uint64_t *z, uint64_t m, const uint64_t *x, uint64_t n, const uint64_t *y); |
| 40 | 49 | ||
| 41 | // Add modulo p_25519, z := (x + y) mod p_25519, assuming x and y reduced | 50 | // Add modulo p_25519, z := (x + y) mod p_25519, assuming x and y reduced |
| 42 | // Inputs x[4], y[4]; output z[4] | 51 | // Inputs x[4], y[4]; output z[4] |
| 43 | extern void bignum_add_p25519 (uint64_t z[static 4], uint64_t x[static 4], uint64_t y[static 4]); | 52 | extern void bignum_add_p25519 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4]); |
| 44 | 53 | ||
| 45 | // Add modulo p_256, z := (x + y) mod p_256, assuming x and y reduced | 54 | // Add modulo p_256, z := (x + y) mod p_256, assuming x and y reduced |
| 46 | // Inputs x[4], y[4]; output z[4] | 55 | // Inputs x[4], y[4]; output z[4] |
| 47 | extern void bignum_add_p256 (uint64_t z[static 4], uint64_t x[static 4], uint64_t y[static 4]); | 56 | extern void bignum_add_p256 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4]); |
| 48 | 57 | ||
| 49 | // Add modulo p_256k1, z := (x + y) mod p_256k1, assuming x and y reduced | 58 | // Add modulo p_256k1, z := (x + y) mod p_256k1, assuming x and y reduced |
| 50 | // Inputs x[4], y[4]; output z[4] | 59 | // Inputs x[4], y[4]; output z[4] |
| 51 | extern void bignum_add_p256k1 (uint64_t z[static 4], uint64_t x[static 4], uint64_t y[static 4]); | 60 | extern void bignum_add_p256k1 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4]); |
| 52 | 61 | ||
| 53 | // Add modulo p_384, z := (x + y) mod p_384, assuming x and y reduced | 62 | // Add modulo p_384, z := (x + y) mod p_384, assuming x and y reduced |
| 54 | // Inputs x[6], y[6]; output z[6] | 63 | // Inputs x[6], y[6]; output z[6] |
| 55 | extern void bignum_add_p384 (uint64_t z[static 6], uint64_t x[static 6], uint64_t y[static 6]); | 64 | extern void bignum_add_p384 (uint64_t z[S2N_BIGNUM_STATIC 6], const uint64_t x[S2N_BIGNUM_STATIC 6], const uint64_t y[S2N_BIGNUM_STATIC 6]); |
| 56 | 65 | ||
| 57 | // Add modulo p_521, z := (x + y) mod p_521, assuming x and y reduced | 66 | // Add modulo p_521, z := (x + y) mod p_521, assuming x and y reduced |
| 58 | // Inputs x[9], y[9]; output z[9] | 67 | // Inputs x[9], y[9]; output z[9] |
| 59 | extern void bignum_add_p521 (uint64_t z[static 9], uint64_t x[static 9], uint64_t y[static 9]); | 68 | extern void bignum_add_p521 (uint64_t z[S2N_BIGNUM_STATIC 9], const uint64_t x[S2N_BIGNUM_STATIC 9], const uint64_t y[S2N_BIGNUM_STATIC 9]); |
| 69 | |||
| 70 | // Add modulo p_sm2, z := (x + y) mod p_sm2, assuming x and y reduced | ||
| 71 | // Inputs x[4], y[4]; output z[4] | ||
| 72 | extern void bignum_add_sm2 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4]); | ||
| 60 | 73 | ||
| 61 | // Compute "amontification" constant z :== 2^{128k} (congruent mod m) | 74 | // Compute "amontification" constant z :== 2^{128k} (congruent mod m) |
| 62 | // Input m[k]; output z[k]; temporary buffer t[>=k] | 75 | // Input m[k]; output z[k]; temporary buffer t[>=k] |
| 63 | extern void bignum_amontifier (uint64_t k, uint64_t *z, uint64_t *m, uint64_t *t); | 76 | extern void bignum_amontifier (uint64_t k, uint64_t *z, const uint64_t *m, uint64_t *t); |
| 64 | 77 | ||
| 65 | // Almost-Montgomery multiply, z :== (x * y / 2^{64k}) (congruent mod m) | 78 | // Almost-Montgomery multiply, z :== (x * y / 2^{64k}) (congruent mod m) |
| 66 | // Inputs x[k], y[k], m[k]; output z[k] | 79 | // Inputs x[k], y[k], m[k]; output z[k] |
| 67 | extern void bignum_amontmul (uint64_t k, uint64_t *z, uint64_t *x, uint64_t *y, uint64_t *m); | 80 | extern void bignum_amontmul (uint64_t k, uint64_t *z, const uint64_t *x, const uint64_t *y, const uint64_t *m); |
| 68 | 81 | ||
| 69 | // Almost-Montgomery reduce, z :== (x' / 2^{64p}) (congruent mod m) | 82 | // Almost-Montgomery reduce, z :== (x' / 2^{64p}) (congruent mod m) |
| 70 | // Inputs x[n], m[k], p; output z[k] | 83 | // Inputs x[n], m[k], p; output z[k] |
| 71 | extern void bignum_amontredc (uint64_t k, uint64_t *z, uint64_t n, uint64_t *x, uint64_t *m, uint64_t p); | 84 | extern void bignum_amontredc (uint64_t k, uint64_t *z, uint64_t n, const uint64_t *x, const uint64_t *m, uint64_t p); |
| 72 | 85 | ||
| 73 | // Almost-Montgomery square, z :== (x^2 / 2^{64k}) (congruent mod m) | 86 | // Almost-Montgomery square, z :== (x^2 / 2^{64k}) (congruent mod m) |
| 74 | // Inputs x[k], m[k]; output z[k] | 87 | // Inputs x[k], m[k]; output z[k] |
| 75 | extern void bignum_amontsqr (uint64_t k, uint64_t *z, uint64_t *x, uint64_t *m); | 88 | extern void bignum_amontsqr (uint64_t k, uint64_t *z, const uint64_t *x, const uint64_t *m); |
| 76 | 89 | ||
| 77 | // Convert 4-digit (256-bit) bignum to/from big-endian form | 90 | // Convert 4-digit (256-bit) bignum to/from big-endian form |
| 78 | // Input x[4]; output z[4] | 91 | // Input x[4]; output z[4] |
| 79 | extern void bignum_bigendian_4 (uint64_t z[static 4], uint64_t x[static 4]); | 92 | extern void bignum_bigendian_4 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 80 | 93 | ||
| 81 | // Convert 6-digit (384-bit) bignum to/from big-endian form | 94 | // Convert 6-digit (384-bit) bignum to/from big-endian form |
| 82 | // Input x[6]; output z[6] | 95 | // Input x[6]; output z[6] |
| 83 | extern void bignum_bigendian_6 (uint64_t z[static 6], uint64_t x[static 6]); | 96 | extern void bignum_bigendian_6 (uint64_t z[S2N_BIGNUM_STATIC 6], const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 84 | 97 | ||
| 85 | // Select bitfield starting at bit n with length l <= 64 | 98 | // Select bitfield starting at bit n with length l <= 64 |
| 86 | // Inputs x[k], n, l; output function return | 99 | // Inputs x[k], n, l; output function return |
| 87 | extern uint64_t bignum_bitfield (uint64_t k, uint64_t *x, uint64_t n, uint64_t l); | 100 | extern uint64_t bignum_bitfield (uint64_t k, const uint64_t *x, uint64_t n, uint64_t l); |
| 88 | 101 | ||
| 89 | // Return size of bignum in bits | 102 | // Return size of bignum in bits |
| 90 | // Input x[k]; output function return | 103 | // Input x[k]; output function return |
| 91 | extern uint64_t bignum_bitsize (uint64_t k, uint64_t *x); | 104 | extern uint64_t bignum_bitsize (uint64_t k, const uint64_t *x); |
| 92 | 105 | ||
| 93 | // Divide by a single (nonzero) word, z := x / m and return x mod m | 106 | // Divide by a single (nonzero) word, z := x / m and return x mod m |
| 94 | // Inputs x[n], m; outputs function return (remainder) and z[k] | 107 | // Inputs x[n], m; outputs function return (remainder) and z[k] |
| 95 | extern uint64_t bignum_cdiv (uint64_t k, uint64_t *z, uint64_t n, uint64_t *x, uint64_t m); | 108 | extern uint64_t bignum_cdiv (uint64_t k, uint64_t *z, uint64_t n, const uint64_t *x, uint64_t m); |
| 96 | 109 | ||
| 97 | // Divide by a single word, z := x / m when known to be exact | 110 | // Divide by a single word, z := x / m when known to be exact |
| 98 | // Inputs x[n], m; output z[k] | 111 | // Inputs x[n], m; output z[k] |
| 99 | extern void bignum_cdiv_exact (uint64_t k, uint64_t *z, uint64_t n, uint64_t *x, uint64_t m); | 112 | extern void bignum_cdiv_exact (uint64_t k, uint64_t *z, uint64_t n, const uint64_t *x, uint64_t m); |
| 100 | 113 | ||
| 101 | // Count leading zero digits (64-bit words) | 114 | // Count leading zero digits (64-bit words) |
| 102 | // Input x[k]; output function return | 115 | // Input x[k]; output function return |
| 103 | extern uint64_t bignum_cld (uint64_t k, uint64_t *x); | 116 | extern uint64_t bignum_cld (uint64_t k, const uint64_t *x); |
| 104 | 117 | ||
| 105 | // Count leading zero bits | 118 | // Count leading zero bits |
| 106 | // Input x[k]; output function return | 119 | // Input x[k]; output function return |
| 107 | extern uint64_t bignum_clz (uint64_t k, uint64_t *x); | 120 | extern uint64_t bignum_clz (uint64_t k, const uint64_t *x); |
| 108 | 121 | ||
| 109 | // Multiply-add with single-word multiplier, z := z + c * y | 122 | // Multiply-add with single-word multiplier, z := z + c * y |
| 110 | // Inputs c, y[n]; outputs function return (carry-out) and z[k] | 123 | // Inputs c, y[n]; outputs function return (carry-out) and z[k] |
| 111 | extern uint64_t bignum_cmadd (uint64_t k, uint64_t *z, uint64_t c, uint64_t n, uint64_t *y); | 124 | extern uint64_t bignum_cmadd (uint64_t k, uint64_t *z, uint64_t c, uint64_t n, const uint64_t *y); |
| 112 | 125 | ||
| 113 | // Negated multiply-add with single-word multiplier, z := z - c * y | 126 | // Negated multiply-add with single-word multiplier, z := z - c * y |
| 114 | // Inputs c, y[n]; outputs function return (negative carry-out) and z[k] | 127 | // Inputs c, y[n]; outputs function return (negative carry-out) and z[k] |
| 115 | extern uint64_t bignum_cmnegadd (uint64_t k, uint64_t *z, uint64_t c, uint64_t n, uint64_t *y); | 128 | extern uint64_t bignum_cmnegadd (uint64_t k, uint64_t *z, uint64_t c, uint64_t n, const uint64_t *y); |
| 116 | 129 | ||
| 117 | // Find modulus of bignum w.r.t. single nonzero word m, returning x mod m | 130 | // Find modulus of bignum w.r.t. single nonzero word m, returning x mod m |
| 118 | // Input x[k], m; output function return | 131 | // Input x[k], m; output function return |
| 119 | extern uint64_t bignum_cmod (uint64_t k, uint64_t *x, uint64_t m); | 132 | extern uint64_t bignum_cmod (uint64_t k, const uint64_t *x, uint64_t m); |
| 120 | 133 | ||
| 121 | // Multiply by a single word, z := c * y | 134 | // Multiply by a single word, z := c * y |
| 122 | // Inputs c, y[n]; outputs function return (carry-out) and z[k] | 135 | // Inputs c, y[n]; outputs function return (carry-out) and z[k] |
| 123 | extern uint64_t bignum_cmul (uint64_t k, uint64_t *z, uint64_t c, uint64_t n, uint64_t *y); | 136 | extern uint64_t bignum_cmul (uint64_t k, uint64_t *z, uint64_t c, uint64_t n, const uint64_t *y); |
| 124 | 137 | ||
| 125 | // Multiply by a single word modulo p_25519, z := (c * x) mod p_25519, assuming x reduced | 138 | // Multiply by a single word modulo p_25519, z := (c * x) mod p_25519, assuming x reduced |
| 126 | // Inputs c, x[4]; output z[4] | 139 | // Inputs c, x[4]; output z[4] |
| 127 | extern void bignum_cmul_p25519 (uint64_t z[static 4], uint64_t c, uint64_t x[static 4]); | 140 | extern void bignum_cmul_p25519 (uint64_t z[S2N_BIGNUM_STATIC 4], uint64_t c, const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 128 | extern void bignum_cmul_p25519_alt (uint64_t z[static 4], uint64_t c, uint64_t x[static 4]); | 141 | extern void bignum_cmul_p25519_alt (uint64_t z[S2N_BIGNUM_STATIC 4], uint64_t c, const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 129 | 142 | ||
| 130 | // Multiply by a single word modulo p_256, z := (c * x) mod p_256, assuming x reduced | 143 | // Multiply by a single word modulo p_256, z := (c * x) mod p_256, assuming x reduced |
| 131 | // Inputs c, x[4]; output z[4] | 144 | // Inputs c, x[4]; output z[4] |
| 132 | extern void bignum_cmul_p256 (uint64_t z[static 4], uint64_t c, uint64_t x[static 4]); | 145 | extern void bignum_cmul_p256 (uint64_t z[S2N_BIGNUM_STATIC 4], uint64_t c, const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 133 | extern void bignum_cmul_p256_alt (uint64_t z[static 4], uint64_t c, uint64_t x[static 4]); | 146 | extern void bignum_cmul_p256_alt (uint64_t z[S2N_BIGNUM_STATIC 4], uint64_t c, const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 134 | 147 | ||
| 135 | // Multiply by a single word modulo p_256k1, z := (c * x) mod p_256k1, assuming x reduced | 148 | // Multiply by a single word modulo p_256k1, z := (c * x) mod p_256k1, assuming x reduced |
| 136 | // Inputs c, x[4]; output z[4] | 149 | // Inputs c, x[4]; output z[4] |
| 137 | extern void bignum_cmul_p256k1 (uint64_t z[static 4], uint64_t c, uint64_t x[static 4]); | 150 | extern void bignum_cmul_p256k1 (uint64_t z[S2N_BIGNUM_STATIC 4], uint64_t c, const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 138 | extern void bignum_cmul_p256k1_alt (uint64_t z[static 4], uint64_t c, uint64_t x[static 4]); | 151 | extern void bignum_cmul_p256k1_alt (uint64_t z[S2N_BIGNUM_STATIC 4], uint64_t c, const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 139 | 152 | ||
| 140 | // Multiply by a single word modulo p_384, z := (c * x) mod p_384, assuming x reduced | 153 | // Multiply by a single word modulo p_384, z := (c * x) mod p_384, assuming x reduced |
| 141 | // Inputs c, x[6]; output z[6] | 154 | // Inputs c, x[6]; output z[6] |
| 142 | extern void bignum_cmul_p384 (uint64_t z[static 6], uint64_t c, uint64_t x[static 6]); | 155 | extern void bignum_cmul_p384 (uint64_t z[S2N_BIGNUM_STATIC 6], uint64_t c, const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 143 | extern void bignum_cmul_p384_alt (uint64_t z[static 6], uint64_t c, uint64_t x[static 6]); | 156 | extern void bignum_cmul_p384_alt (uint64_t z[S2N_BIGNUM_STATIC 6], uint64_t c, const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 144 | 157 | ||
| 145 | // Multiply by a single word modulo p_521, z := (c * x) mod p_521, assuming x reduced | 158 | // Multiply by a single word modulo p_521, z := (c * x) mod p_521, assuming x reduced |
| 146 | // Inputs c, x[9]; output z[9] | 159 | // Inputs c, x[9]; output z[9] |
| 147 | extern void bignum_cmul_p521 (uint64_t z[static 9], uint64_t c, uint64_t x[static 9]); | 160 | extern void bignum_cmul_p521 (uint64_t z[S2N_BIGNUM_STATIC 9], uint64_t c, const uint64_t x[S2N_BIGNUM_STATIC 9]); |
| 148 | extern void bignum_cmul_p521_alt (uint64_t z[static 9], uint64_t c, uint64_t x[static 9]); | 161 | extern void bignum_cmul_p521_alt (uint64_t z[S2N_BIGNUM_STATIC 9], uint64_t c, const uint64_t x[S2N_BIGNUM_STATIC 9]); |
| 162 | |||
| 163 | // Multiply by a single word modulo p_sm2, z := (c * x) mod p_sm2, assuming x reduced | ||
| 164 | // Inputs c, x[4]; output z[4] | ||
| 165 | extern void bignum_cmul_sm2 (uint64_t z[S2N_BIGNUM_STATIC 4], uint64_t c, const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 166 | extern void bignum_cmul_sm2_alt (uint64_t z[S2N_BIGNUM_STATIC 4], uint64_t c, const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 149 | 167 | ||
| 150 | // Test bignums for coprimality, gcd(x,y) = 1 | 168 | // Test bignums for coprimality, gcd(x,y) = 1 |
| 151 | // Inputs x[m], y[n]; output function return; temporary buffer t[>=2*max(m,n)] | 169 | // Inputs x[m], y[n]; output function return; temporary buffer t[>=2*max(m,n)] |
| 152 | extern uint64_t bignum_coprime (uint64_t m, uint64_t *x, uint64_t n, uint64_t *y, uint64_t *t); | 170 | extern uint64_t bignum_coprime (uint64_t m, const uint64_t *x, uint64_t n, const uint64_t *y, uint64_t *t); |
| 153 | 171 | ||
| 154 | // Copy bignum with zero-extension or truncation, z := x | 172 | // Copy bignum with zero-extension or truncation, z := x |
| 155 | // Input x[n]; output z[k] | 173 | // Input x[n]; output z[k] |
| 156 | extern void bignum_copy (uint64_t k, uint64_t *z, uint64_t n, uint64_t *x); | 174 | extern void bignum_copy (uint64_t k, uint64_t *z, uint64_t n, const uint64_t *x); |
| 175 | |||
| 176 | // Given table: uint64_t[height*width], copy table[idx*width...(idx+1)*width-1] | ||
| 177 | // into z[0..width-1]. | ||
| 178 | // This function is constant-time with respect to the value of `idx`. This is | ||
| 179 | // achieved by reading the whole table and using the bit-masking to get the | ||
| 180 | // `idx`-th row. | ||
| 181 | // Input table[height*width]; output z[width] | ||
| 182 | extern void bignum_copy_row_from_table (uint64_t *z, const uint64_t *table, uint64_t height, | ||
| 183 | uint64_t width, uint64_t idx); | ||
| 184 | |||
| 185 | // Given table: uint64_t[height*width], copy table[idx*width...(idx+1)*width-1] | ||
| 186 | // into z[0..width-1]. width must be a multiple of 8. | ||
| 187 | // This function is constant-time with respect to the value of `idx`. This is | ||
| 188 | // achieved by reading the whole table and using the bit-masking to get the | ||
| 189 | // `idx`-th row. | ||
| 190 | // Input table[height*width]; output z[width] | ||
| 191 | extern void bignum_copy_row_from_table_8n (uint64_t *z, const uint64_t *table, | ||
| 192 | uint64_t height, uint64_t width, uint64_t idx); | ||
| 193 | |||
| 194 | // Given table: uint64_t[height*16], copy table[idx*16...(idx+1)*16-1] into z[0..row-1]. | ||
| 195 | // This function is constant-time with respect to the value of `idx`. This is | ||
| 196 | // achieved by reading the whole table and using the bit-masking to get the | ||
| 197 | // `idx`-th row. | ||
| 198 | // Input table[height*16]; output z[16] | ||
| 199 | extern void bignum_copy_row_from_table_16 (uint64_t *z, const uint64_t *table, | ||
| 200 | uint64_t height, uint64_t idx); | ||
| 201 | |||
| 202 | // Given table: uint64_t[height*32], copy table[idx*32...(idx+1)*32-1] into z[0..row-1]. | ||
| 203 | // This function is constant-time with respect to the value of `idx`. This is | ||
| 204 | // achieved by reading the whole table and using the bit-masking to get the | ||
| 205 | // `idx`-th row. | ||
| 206 | // Input table[height*32]; output z[32] | ||
| 207 | extern void bignum_copy_row_from_table_32 (uint64_t *z, const uint64_t *table, | ||
| 208 | uint64_t height, uint64_t idx); | ||
| 157 | 209 | ||
| 158 | // Count trailing zero digits (64-bit words) | 210 | // Count trailing zero digits (64-bit words) |
| 159 | // Input x[k]; output function return | 211 | // Input x[k]; output function return |
| 160 | extern uint64_t bignum_ctd (uint64_t k, uint64_t *x); | 212 | extern uint64_t bignum_ctd (uint64_t k, const uint64_t *x); |
| 161 | 213 | ||
| 162 | // Count trailing zero bits | 214 | // Count trailing zero bits |
| 163 | // Input x[k]; output function return | 215 | // Input x[k]; output function return |
| 164 | extern uint64_t bignum_ctz (uint64_t k, uint64_t *x); | 216 | extern uint64_t bignum_ctz (uint64_t k, const uint64_t *x); |
| 165 | 217 | ||
| 166 | // Convert from almost-Montgomery form, z := (x / 2^256) mod p_256 | 218 | // Convert from almost-Montgomery form, z := (x / 2^256) mod p_256 |
| 167 | // Input x[4]; output z[4] | 219 | // Input x[4]; output z[4] |
| 168 | extern void bignum_deamont_p256 (uint64_t z[static 4], uint64_t x[static 4]); | 220 | extern void bignum_deamont_p256 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 169 | extern void bignum_deamont_p256_alt (uint64_t z[static 4], uint64_t x[static 4]); | 221 | extern void bignum_deamont_p256_alt (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 170 | 222 | ||
| 171 | // Convert from almost-Montgomery form, z := (x / 2^256) mod p_256k1 | 223 | // Convert from almost-Montgomery form, z := (x / 2^256) mod p_256k1 |
| 172 | // Input x[4]; output z[4] | 224 | // Input x[4]; output z[4] |
| 173 | extern void bignum_deamont_p256k1 (uint64_t z[static 4], uint64_t x[static 4]); | 225 | extern void bignum_deamont_p256k1 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 174 | 226 | ||
| 175 | // Convert from almost-Montgomery form, z := (x / 2^384) mod p_384 | 227 | // Convert from almost-Montgomery form, z := (x / 2^384) mod p_384 |
| 176 | // Input x[6]; output z[6] | 228 | // Input x[6]; output z[6] |
| 177 | extern void bignum_deamont_p384 (uint64_t z[static 6], uint64_t x[static 6]); | 229 | extern void bignum_deamont_p384 (uint64_t z[S2N_BIGNUM_STATIC 6], const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 178 | extern void bignum_deamont_p384_alt (uint64_t z[static 6], uint64_t x[static 6]); | 230 | extern void bignum_deamont_p384_alt (uint64_t z[S2N_BIGNUM_STATIC 6], const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 179 | 231 | ||
| 180 | // Convert from almost-Montgomery form z := (x / 2^576) mod p_521 | 232 | // Convert from almost-Montgomery form z := (x / 2^576) mod p_521 |
| 181 | // Input x[9]; output z[9] | 233 | // Input x[9]; output z[9] |
| 182 | extern void bignum_deamont_p521 (uint64_t z[static 9], uint64_t x[static 9]); | 234 | extern void bignum_deamont_p521 (uint64_t z[S2N_BIGNUM_STATIC 9], const uint64_t x[S2N_BIGNUM_STATIC 9]); |
| 235 | |||
| 236 | // Convert from almost-Montgomery form z := (x / 2^256) mod p_sm2 | ||
| 237 | // Input x[4]; output z[4] | ||
| 238 | extern void bignum_deamont_sm2 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 183 | 239 | ||
| 184 | // Convert from (almost-)Montgomery form z := (x / 2^{64k}) mod m | 240 | // Convert from (almost-)Montgomery form z := (x / 2^{64k}) mod m |
| 185 | // Inputs x[k], m[k]; output z[k] | 241 | // Inputs x[k], m[k]; output z[k] |
| 186 | extern void bignum_demont (uint64_t k, uint64_t *z, uint64_t *x, uint64_t *m); | 242 | extern void bignum_demont (uint64_t k, uint64_t *z, const uint64_t *x, const uint64_t *m); |
| 187 | 243 | ||
| 188 | // Convert from Montgomery form z := (x / 2^256) mod p_256, assuming x reduced | 244 | // Convert from Montgomery form z := (x / 2^256) mod p_256, assuming x reduced |
| 189 | // Input x[4]; output z[4] | 245 | // Input x[4]; output z[4] |
| 190 | extern void bignum_demont_p256 (uint64_t z[static 4], uint64_t x[static 4]); | 246 | extern void bignum_demont_p256 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 191 | extern void bignum_demont_p256_alt (uint64_t z[static 4], uint64_t x[static 4]); | 247 | extern void bignum_demont_p256_alt (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 192 | 248 | ||
| 193 | // Convert from Montgomery form z := (x / 2^256) mod p_256k1, assuming x reduced | 249 | // Convert from Montgomery form z := (x / 2^256) mod p_256k1, assuming x reduced |
| 194 | // Input x[4]; output z[4] | 250 | // Input x[4]; output z[4] |
| 195 | extern void bignum_demont_p256k1 (uint64_t z[static 4], uint64_t x[static 4]); | 251 | extern void bignum_demont_p256k1 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 196 | 252 | ||
| 197 | // Convert from Montgomery form z := (x / 2^384) mod p_384, assuming x reduced | 253 | // Convert from Montgomery form z := (x / 2^384) mod p_384, assuming x reduced |
| 198 | // Input x[6]; output z[6] | 254 | // Input x[6]; output z[6] |
| 199 | extern void bignum_demont_p384 (uint64_t z[static 6], uint64_t x[static 6]); | 255 | extern void bignum_demont_p384 (uint64_t z[S2N_BIGNUM_STATIC 6], const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 200 | extern void bignum_demont_p384_alt (uint64_t z[static 6], uint64_t x[static 6]); | 256 | extern void bignum_demont_p384_alt (uint64_t z[S2N_BIGNUM_STATIC 6], const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 201 | 257 | ||
| 202 | // Convert from Montgomery form z := (x / 2^576) mod p_521, assuming x reduced | 258 | // Convert from Montgomery form z := (x / 2^576) mod p_521, assuming x reduced |
| 203 | // Input x[9]; output z[9] | 259 | // Input x[9]; output z[9] |
| 204 | extern void bignum_demont_p521 (uint64_t z[static 9], uint64_t x[static 9]); | 260 | extern void bignum_demont_p521 (uint64_t z[S2N_BIGNUM_STATIC 9], const uint64_t x[S2N_BIGNUM_STATIC 9]); |
| 261 | |||
| 262 | // Convert from Montgomery form z := (x / 2^256) mod p_sm2, assuming x reduced | ||
| 263 | // Input x[4]; output z[4] | ||
| 264 | extern void bignum_demont_sm2 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 205 | 265 | ||
| 206 | // Select digit x[n] | 266 | // Select digit x[n] |
| 207 | // Inputs x[k], n; output function return | 267 | // Inputs x[k], n; output function return |
| 208 | extern uint64_t bignum_digit (uint64_t k, uint64_t *x, uint64_t n); | 268 | extern uint64_t bignum_digit (uint64_t k, const uint64_t *x, uint64_t n); |
| 209 | 269 | ||
| 210 | // Return size of bignum in digits (64-bit word) | 270 | // Return size of bignum in digits (64-bit word) |
| 211 | // Input x[k]; output function return | 271 | // Input x[k]; output function return |
| 212 | extern uint64_t bignum_digitsize (uint64_t k, uint64_t *x); | 272 | extern uint64_t bignum_digitsize (uint64_t k, const uint64_t *x); |
| 213 | 273 | ||
| 214 | // Divide bignum by 10: z' := z div 10, returning remainder z mod 10 | 274 | // Divide bignum by 10: z' := z div 10, returning remainder z mod 10 |
| 215 | // Inputs z[k]; outputs function return (remainder) and z[k] | 275 | // Inputs z[k]; outputs function return (remainder) and z[k] |
| @@ -217,294 +277,391 @@ extern uint64_t bignum_divmod10 (uint64_t k, uint64_t *z); | |||
| 217 | 277 | ||
| 218 | // Double modulo p_25519, z := (2 * x) mod p_25519, assuming x reduced | 278 | // Double modulo p_25519, z := (2 * x) mod p_25519, assuming x reduced |
| 219 | // Input x[4]; output z[4] | 279 | // Input x[4]; output z[4] |
| 220 | extern void bignum_double_p25519 (uint64_t z[static 4], uint64_t x[static 4]); | 280 | extern void bignum_double_p25519 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 221 | 281 | ||
| 222 | // Double modulo p_256, z := (2 * x) mod p_256, assuming x reduced | 282 | // Double modulo p_256, z := (2 * x) mod p_256, assuming x reduced |
| 223 | // Input x[4]; output z[4] | 283 | // Input x[4]; output z[4] |
| 224 | extern void bignum_double_p256 (uint64_t z[static 4], uint64_t x[static 4]); | 284 | extern void bignum_double_p256 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 225 | 285 | ||
| 226 | // Double modulo p_256k1, z := (2 * x) mod p_256k1, assuming x reduced | 286 | // Double modulo p_256k1, z := (2 * x) mod p_256k1, assuming x reduced |
| 227 | // Input x[4]; output z[4] | 287 | // Input x[4]; output z[4] |
| 228 | extern void bignum_double_p256k1 (uint64_t z[static 4], uint64_t x[static 4]); | 288 | extern void bignum_double_p256k1 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 229 | 289 | ||
| 230 | // Double modulo p_384, z := (2 * x) mod p_384, assuming x reduced | 290 | // Double modulo p_384, z := (2 * x) mod p_384, assuming x reduced |
| 231 | // Input x[6]; output z[6] | 291 | // Input x[6]; output z[6] |
| 232 | extern void bignum_double_p384 (uint64_t z[static 6], uint64_t x[static 6]); | 292 | extern void bignum_double_p384 (uint64_t z[S2N_BIGNUM_STATIC 6], const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 233 | 293 | ||
| 234 | // Double modulo p_521, z := (2 * x) mod p_521, assuming x reduced | 294 | // Double modulo p_521, z := (2 * x) mod p_521, assuming x reduced |
| 235 | // Input x[9]; output z[9] | 295 | // Input x[9]; output z[9] |
| 236 | extern void bignum_double_p521 (uint64_t z[static 9], uint64_t x[static 9]); | 296 | extern void bignum_double_p521 (uint64_t z[S2N_BIGNUM_STATIC 9], const uint64_t x[S2N_BIGNUM_STATIC 9]); |
| 297 | |||
| 298 | // Double modulo p_sm2, z := (2 * x) mod p_sm2, assuming x reduced | ||
| 299 | // Input x[4]; output z[4] | ||
| 300 | extern void bignum_double_sm2 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 237 | 301 | ||
| 238 | // Extended Montgomery reduce, returning results in input-output buffer | 302 | // Extended Montgomery reduce, returning results in input-output buffer |
| 239 | // Inputs z[2*k], m[k], w; outputs function return (extra result bit) and z[2*k] | 303 | // Inputs z[2*k], m[k], w; outputs function return (extra result bit) and z[2*k] |
| 240 | extern uint64_t bignum_emontredc (uint64_t k, uint64_t *z, uint64_t *m, uint64_t w); | 304 | extern uint64_t bignum_emontredc (uint64_t k, uint64_t *z, const uint64_t *m, uint64_t w); |
| 241 | 305 | ||
| 242 | // Extended Montgomery reduce in 8-digit blocks, results in input-output buffer | 306 | // Extended Montgomery reduce in 8-digit blocks, results in input-output buffer |
| 243 | // Inputs z[2*k], m[k], w; outputs function return (extra result bit) and z[2*k] | 307 | // Inputs z[2*k], m[k], w; outputs function return (extra result bit) and z[2*k] |
| 244 | extern uint64_t bignum_emontredc_8n (uint64_t k, uint64_t *z, uint64_t *m, uint64_t w); | 308 | extern uint64_t bignum_emontredc_8n (uint64_t k, uint64_t *z, const uint64_t *m, uint64_t w); |
| 309 | // Inputs z[2*k], m[k], w; outputs function return (extra result bit) and z[2*k] | ||
| 310 | // Temporary buffer m_precalc[12*(k/4-1)] | ||
| 311 | extern uint64_t bignum_emontredc_8n_cdiff (uint64_t k, uint64_t *z, const uint64_t *m, | ||
| 312 | uint64_t w, uint64_t *m_precalc); | ||
| 245 | 313 | ||
| 246 | // Test bignums for equality, x = y | 314 | // Test bignums for equality, x = y |
| 247 | // Inputs x[m], y[n]; output function return | 315 | // Inputs x[m], y[n]; output function return |
| 248 | extern uint64_t bignum_eq (uint64_t m, uint64_t *x, uint64_t n, uint64_t *y); | 316 | extern uint64_t bignum_eq (uint64_t m, const uint64_t *x, uint64_t n, const uint64_t *y); |
| 249 | 317 | ||
| 250 | // Test bignum for even-ness | 318 | // Test bignum for even-ness |
| 251 | // Input x[k]; output function return | 319 | // Input x[k]; output function return |
| 252 | extern uint64_t bignum_even (uint64_t k, uint64_t *x); | 320 | extern uint64_t bignum_even (uint64_t k, const uint64_t *x); |
| 253 | 321 | ||
| 254 | // Convert 4-digit (256-bit) bignum from big-endian bytes | 322 | // Convert 4-digit (256-bit) bignum from big-endian bytes |
| 255 | // Input x[32] (bytes); output z[4] | 323 | // Input x[32] (bytes); output z[4] |
| 256 | extern void bignum_frombebytes_4 (uint64_t z[static 4], uint8_t x[static 32]); | 324 | extern void bignum_frombebytes_4 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint8_t x[S2N_BIGNUM_STATIC 32]); |
| 257 | 325 | ||
| 258 | // Convert 6-digit (384-bit) bignum from big-endian bytes | 326 | // Convert 6-digit (384-bit) bignum from big-endian bytes |
| 259 | // Input x[48] (bytes); output z[6] | 327 | // Input x[48] (bytes); output z[6] |
| 260 | extern void bignum_frombebytes_6 (uint64_t z[static 6], uint8_t x[static 48]); | 328 | extern void bignum_frombebytes_6 (uint64_t z[S2N_BIGNUM_STATIC 6], const uint8_t x[S2N_BIGNUM_STATIC 48]); |
| 261 | 329 | ||
| 262 | // Convert 4-digit (256-bit) bignum from little-endian bytes | 330 | // Convert 4-digit (256-bit) bignum from little-endian bytes |
| 263 | // Input x[32] (bytes); output z[4] | 331 | // Input x[32] (bytes); output z[4] |
| 264 | extern void bignum_fromlebytes_4 (uint64_t z[static 4], uint8_t x[static 32]); | 332 | extern void bignum_fromlebytes_4 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint8_t x[S2N_BIGNUM_STATIC 32]); |
| 265 | 333 | ||
| 266 | // Convert 6-digit (384-bit) bignum from little-endian bytes | 334 | // Convert 6-digit (384-bit) bignum from little-endian bytes |
| 267 | // Input x[48] (bytes); output z[6] | 335 | // Input x[48] (bytes); output z[6] |
| 268 | extern void bignum_fromlebytes_6 (uint64_t z[static 6], uint8_t x[static 48]); | 336 | extern void bignum_fromlebytes_6 (uint64_t z[S2N_BIGNUM_STATIC 6], const uint8_t x[S2N_BIGNUM_STATIC 48]); |
| 269 | 337 | ||
| 270 | // Convert little-endian bytes to 9-digit 528-bit bignum | 338 | // Convert little-endian bytes to 9-digit 528-bit bignum |
| 271 | // Input x[66] (bytes); output z[9] | 339 | // Input x[66] (bytes); output z[9] |
| 272 | extern void bignum_fromlebytes_p521 (uint64_t z[static 9],uint8_t x[static 66]); | 340 | extern void bignum_fromlebytes_p521 (uint64_t z[S2N_BIGNUM_STATIC 9],const uint8_t x[S2N_BIGNUM_STATIC 66]); |
| 273 | 341 | ||
| 274 | // Compare bignums, x >= y | 342 | // Compare bignums, x >= y |
| 275 | // Inputs x[m], y[n]; output function return | 343 | // Inputs x[m], y[n]; output function return |
| 276 | extern uint64_t bignum_ge (uint64_t m, uint64_t *x, uint64_t n, uint64_t *y); | 344 | extern uint64_t bignum_ge (uint64_t m, const uint64_t *x, uint64_t n, const uint64_t *y); |
| 277 | 345 | ||
| 278 | // Compare bignums, x > y | 346 | // Compare bignums, x > y |
| 279 | // Inputs x[m], y[n]; output function return | 347 | // Inputs x[m], y[n]; output function return |
| 280 | extern uint64_t bignum_gt (uint64_t m, uint64_t *x, uint64_t n, uint64_t *y); | 348 | extern uint64_t bignum_gt (uint64_t m, const uint64_t *x, uint64_t n, const uint64_t *y); |
| 281 | 349 | ||
| 282 | // Halve modulo p_256, z := (x / 2) mod p_256, assuming x reduced | 350 | // Halve modulo p_256, z := (x / 2) mod p_256, assuming x reduced |
| 283 | // Input x[4]; output z[4] | 351 | // Input x[4]; output z[4] |
| 284 | extern void bignum_half_p256 (uint64_t z[static 4], uint64_t x[static 4]); | 352 | extern void bignum_half_p256 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 285 | 353 | ||
| 286 | // Halve modulo p_256k1, z := (x / 2) mod p_256k1, assuming x reduced | 354 | // Halve modulo p_256k1, z := (x / 2) mod p_256k1, assuming x reduced |
| 287 | // Input x[4]; output z[4] | 355 | // Input x[4]; output z[4] |
| 288 | extern void bignum_half_p256k1 (uint64_t z[static 4], uint64_t x[static 4]); | 356 | extern void bignum_half_p256k1 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 289 | 357 | ||
| 290 | // Halve modulo p_384, z := (x / 2) mod p_384, assuming x reduced | 358 | // Halve modulo p_384, z := (x / 2) mod p_384, assuming x reduced |
| 291 | // Input x[6]; output z[6] | 359 | // Input x[6]; output z[6] |
| 292 | extern void bignum_half_p384 (uint64_t z[static 6], uint64_t x[static 6]); | 360 | extern void bignum_half_p384 (uint64_t z[S2N_BIGNUM_STATIC 6], const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 293 | 361 | ||
| 294 | // Halve modulo p_521, z := (x / 2) mod p_521, assuming x reduced | 362 | // Halve modulo p_521, z := (x / 2) mod p_521, assuming x reduced |
| 295 | // Input x[9]; output z[9] | 363 | // Input x[9]; output z[9] |
| 296 | extern void bignum_half_p521 (uint64_t z[static 9], uint64_t x[static 9]); | 364 | extern void bignum_half_p521 (uint64_t z[S2N_BIGNUM_STATIC 9], const uint64_t x[S2N_BIGNUM_STATIC 9]); |
| 365 | |||
| 366 | // Halve modulo p_sm2, z := (x / 2) mod p_sm2, assuming x reduced | ||
| 367 | // Input x[4]; output z[4] | ||
| 368 | extern void bignum_half_sm2 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 369 | |||
| 370 | // Modular inverse modulo p_25519 = 2^255 - 19 | ||
| 371 | // Input x[4]; output z[4] | ||
| 372 | extern void bignum_inv_p25519(uint64_t z[S2N_BIGNUM_STATIC 4],const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 373 | |||
| 374 | // Modular inverse modulo p_256 = 2^256 - 2^224 + 2^192 + 2^96 - 1 | ||
| 375 | // Input x[4]; output z[4] | ||
| 376 | extern void bignum_inv_p256(uint64_t z[S2N_BIGNUM_STATIC 4],const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 377 | |||
| 378 | // Modular inverse modulo p_384 = 2^384 - 2^128 - 2^96 + 2^32 - 1 | ||
| 379 | // Input x[6]; output z[6] | ||
| 380 | extern void bignum_inv_p384(uint64_t z[S2N_BIGNUM_STATIC 6],const uint64_t x[S2N_BIGNUM_STATIC 6]); | ||
| 381 | |||
| 382 | // Modular inverse modulo p_521 = 2^521 - 1 | ||
| 383 | // Input x[9]; output z[9] | ||
| 384 | extern void bignum_inv_p521(uint64_t z[S2N_BIGNUM_STATIC 9],const uint64_t x[S2N_BIGNUM_STATIC 9]); | ||
| 385 | |||
| 386 | // Modular inverse modulo p_sm2 = 2^256 - 2^224 - 2^96 + 2^64 - 1 | ||
| 387 | // Input x[4]; output z[4] | ||
| 388 | extern void bignum_inv_sm2(uint64_t z[S2N_BIGNUM_STATIC 4],const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 389 | |||
| 390 | // Inverse square root modulo p_25519 | ||
| 391 | // Input x[4]; output function return (Legendre symbol) and z[4] | ||
| 392 | extern int64_t bignum_invsqrt_p25519(uint64_t z[S2N_BIGNUM_STATIC 4],const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 393 | extern int64_t bignum_invsqrt_p25519_alt(uint64_t z[S2N_BIGNUM_STATIC 4],const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 297 | 394 | ||
| 298 | // Test bignum for zero-ness, x = 0 | 395 | // Test bignum for zero-ness, x = 0 |
| 299 | // Input x[k]; output function return | 396 | // Input x[k]; output function return |
| 300 | extern uint64_t bignum_iszero (uint64_t k, uint64_t *x); | 397 | extern uint64_t bignum_iszero (uint64_t k, const uint64_t *x); |
| 301 | 398 | ||
| 302 | // Multiply z := x * y | 399 | // Multiply z := x * y |
| 303 | // Inputs x[16], y[16]; output z[32]; temporary buffer t[>=32] | 400 | // Inputs x[16], y[16]; output z[32]; temporary buffer t[>=32] |
| 304 | extern void bignum_kmul_16_32 (uint64_t z[static 32], uint64_t x[static 16], uint64_t y[static 16], uint64_t t[static 32]); | 401 | extern void bignum_kmul_16_32 (uint64_t z[S2N_BIGNUM_STATIC 32], const uint64_t x[S2N_BIGNUM_STATIC 16], const uint64_t y[S2N_BIGNUM_STATIC 16], uint64_t t[S2N_BIGNUM_STATIC 32]); |
| 305 | 402 | ||
| 306 | // Multiply z := x * y | 403 | // Multiply z := x * y |
| 307 | // Inputs x[32], y[32]; output z[64]; temporary buffer t[>=96] | 404 | // Inputs x[32], y[32]; output z[64]; temporary buffer t[>=96] |
| 308 | extern void bignum_kmul_32_64 (uint64_t z[static 64], uint64_t x[static 32], uint64_t y[static 32], uint64_t t[static 96]); | 405 | extern void bignum_kmul_32_64 (uint64_t z[S2N_BIGNUM_STATIC 64], const uint64_t x[S2N_BIGNUM_STATIC 32], const uint64_t y[S2N_BIGNUM_STATIC 32], uint64_t t[S2N_BIGNUM_STATIC 96]); |
| 309 | 406 | ||
| 310 | // Square, z := x^2 | 407 | // Square, z := x^2 |
| 311 | // Input x[16]; output z[32]; temporary buffer t[>=24] | 408 | // Input x[16]; output z[32]; temporary buffer t[>=24] |
| 312 | extern void bignum_ksqr_16_32 (uint64_t z[static 32], uint64_t x[static 16], uint64_t t[static 24]); | 409 | extern void bignum_ksqr_16_32 (uint64_t z[S2N_BIGNUM_STATIC 32], const uint64_t x[S2N_BIGNUM_STATIC 16], uint64_t t[S2N_BIGNUM_STATIC 24]); |
| 313 | 410 | ||
| 314 | // Square, z := x^2 | 411 | // Square, z := x^2 |
| 315 | // Input x[32]; output z[64]; temporary buffer t[>=72] | 412 | // Input x[32]; output z[64]; temporary buffer t[>=72] |
| 316 | extern void bignum_ksqr_32_64 (uint64_t z[static 64], uint64_t x[static 32], uint64_t t[static 72]); | 413 | extern void bignum_ksqr_32_64 (uint64_t z[S2N_BIGNUM_STATIC 64], const uint64_t x[S2N_BIGNUM_STATIC 32], uint64_t t[S2N_BIGNUM_STATIC 72]); |
| 317 | 414 | ||
| 318 | // Compare bignums, x <= y | 415 | // Compare bignums, x <= y |
| 319 | // Inputs x[m], y[n]; output function return | 416 | // Inputs x[m], y[n]; output function return |
| 320 | extern uint64_t bignum_le (uint64_t m, uint64_t *x, uint64_t n, uint64_t *y); | 417 | extern uint64_t bignum_le (uint64_t m, const uint64_t *x, uint64_t n, const uint64_t *y); |
| 321 | 418 | ||
| 322 | // Convert 4-digit (256-bit) bignum to/from little-endian form | 419 | // Convert 4-digit (256-bit) bignum to/from little-endian form |
| 323 | // Input x[4]; output z[4] | 420 | // Input x[4]; output z[4] |
| 324 | extern void bignum_littleendian_4 (uint64_t z[static 4], uint64_t x[static 4]); | 421 | extern void bignum_littleendian_4 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 325 | 422 | ||
| 326 | // Convert 6-digit (384-bit) bignum to/from little-endian form | 423 | // Convert 6-digit (384-bit) bignum to/from little-endian form |
| 327 | // Input x[6]; output z[6] | 424 | // Input x[6]; output z[6] |
| 328 | extern void bignum_littleendian_6 (uint64_t z[static 6], uint64_t x[static 6]); | 425 | extern void bignum_littleendian_6 (uint64_t z[S2N_BIGNUM_STATIC 6], const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 329 | 426 | ||
| 330 | // Compare bignums, x < y | 427 | // Compare bignums, x < y |
| 331 | // Inputs x[m], y[n]; output function return | 428 | // Inputs x[m], y[n]; output function return |
| 332 | extern uint64_t bignum_lt (uint64_t m, uint64_t *x, uint64_t n, uint64_t *y); | 429 | extern uint64_t bignum_lt (uint64_t m, const uint64_t *x, uint64_t n, const uint64_t *y); |
| 333 | 430 | ||
| 334 | // Multiply-add, z := z + x * y | 431 | // Multiply-add, z := z + x * y |
| 335 | // Inputs x[m], y[n]; outputs function return (carry-out) and z[k] | 432 | // Inputs x[m], y[n]; outputs function return (carry-out) and z[k] |
| 336 | extern uint64_t bignum_madd (uint64_t k, uint64_t *z, uint64_t m, uint64_t *x, uint64_t n, uint64_t *y); | 433 | extern uint64_t bignum_madd (uint64_t k, uint64_t *z, uint64_t m, const uint64_t *x, uint64_t n, const uint64_t *y); |
| 434 | |||
| 435 | // Multiply-add modulo the order of the curve25519/edwards25519 basepoint | ||
| 436 | // Inputs x[4], y[4], c[4]; output z[4] | ||
| 437 | extern void bignum_madd_n25519 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4], const uint64_t c[S2N_BIGNUM_STATIC 4]); | ||
| 438 | extern void bignum_madd_n25519_alt (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4], const uint64_t c[S2N_BIGNUM_STATIC 4]); | ||
| 439 | |||
| 440 | // Reduce modulo group order, z := x mod m_25519 | ||
| 441 | // Input x[4]; output z[4] | ||
| 442 | extern void bignum_mod_m25519_4 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 443 | |||
| 444 | // Reduce modulo basepoint order, z := x mod n_25519 | ||
| 445 | // Input x[k]; output z[4] | ||
| 446 | extern void bignum_mod_n25519 (uint64_t z[S2N_BIGNUM_STATIC 4], uint64_t k, const uint64_t *x); | ||
| 447 | |||
| 448 | // Reduce modulo basepoint order, z := x mod n_25519 | ||
| 449 | // Input x[4]; output z[4] | ||
| 450 | extern void bignum_mod_n25519_4 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 337 | 451 | ||
| 338 | // Reduce modulo group order, z := x mod n_256 | 452 | // Reduce modulo group order, z := x mod n_256 |
| 339 | // Input x[k]; output z[4] | 453 | // Input x[k]; output z[4] |
| 340 | extern void bignum_mod_n256 (uint64_t z[static 4], uint64_t k, uint64_t *x); | 454 | extern void bignum_mod_n256 (uint64_t z[S2N_BIGNUM_STATIC 4], uint64_t k, const uint64_t *x); |
| 341 | extern void bignum_mod_n256_alt (uint64_t z[static 4], uint64_t k, uint64_t *x); | 455 | extern void bignum_mod_n256_alt (uint64_t z[S2N_BIGNUM_STATIC 4], uint64_t k, const uint64_t *x); |
| 342 | 456 | ||
| 343 | // Reduce modulo group order, z := x mod n_256 | 457 | // Reduce modulo group order, z := x mod n_256 |
| 344 | // Input x[4]; output z[4] | 458 | // Input x[4]; output z[4] |
| 345 | extern void bignum_mod_n256_4 (uint64_t z[static 4], uint64_t x[static 4]); | 459 | extern void bignum_mod_n256_4 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 346 | 460 | ||
| 347 | // Reduce modulo group order, z := x mod n_256k1 | 461 | // Reduce modulo group order, z := x mod n_256k1 |
| 348 | // Input x[4]; output z[4] | 462 | // Input x[4]; output z[4] |
| 349 | extern void bignum_mod_n256k1_4 (uint64_t z[static 4], uint64_t x[static 4]); | 463 | extern void bignum_mod_n256k1_4 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 350 | 464 | ||
| 351 | // Reduce modulo group order, z := x mod n_384 | 465 | // Reduce modulo group order, z := x mod n_384 |
| 352 | // Input x[k]; output z[6] | 466 | // Input x[k]; output z[6] |
| 353 | extern void bignum_mod_n384 (uint64_t z[static 6], uint64_t k, uint64_t *x); | 467 | extern void bignum_mod_n384 (uint64_t z[S2N_BIGNUM_STATIC 6], uint64_t k, const uint64_t *x); |
| 354 | extern void bignum_mod_n384_alt (uint64_t z[static 6], uint64_t k, uint64_t *x); | 468 | extern void bignum_mod_n384_alt (uint64_t z[S2N_BIGNUM_STATIC 6], uint64_t k, const uint64_t *x); |
| 355 | 469 | ||
| 356 | // Reduce modulo group order, z := x mod n_384 | 470 | // Reduce modulo group order, z := x mod n_384 |
| 357 | // Input x[6]; output z[6] | 471 | // Input x[6]; output z[6] |
| 358 | extern void bignum_mod_n384_6 (uint64_t z[static 6], uint64_t x[static 6]); | 472 | extern void bignum_mod_n384_6 (uint64_t z[S2N_BIGNUM_STATIC 6], const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 359 | 473 | ||
| 360 | // Reduce modulo group order, z := x mod n_521 | 474 | // Reduce modulo group order, z := x mod n_521 |
| 361 | // Input x[9]; output z[9] | 475 | // Input x[9]; output z[9] |
| 362 | extern void bignum_mod_n521_9 (uint64_t z[static 9], uint64_t x[static 9]); | 476 | extern void bignum_mod_n521_9 (uint64_t z[S2N_BIGNUM_STATIC 9], const uint64_t x[S2N_BIGNUM_STATIC 9]); |
| 363 | extern void bignum_mod_n521_9_alt (uint64_t z[static 9], uint64_t x[static 9]); | 477 | extern void bignum_mod_n521_9_alt (uint64_t z[S2N_BIGNUM_STATIC 9], const uint64_t x[S2N_BIGNUM_STATIC 9]); |
| 478 | |||
| 479 | // Reduce modulo group order, z := x mod n_sm2 | ||
| 480 | // Input x[k]; output z[4] | ||
| 481 | extern void bignum_mod_nsm2 (uint64_t z[S2N_BIGNUM_STATIC 4], uint64_t k, const uint64_t *x); | ||
| 482 | extern void bignum_mod_nsm2_alt (uint64_t z[S2N_BIGNUM_STATIC 4], uint64_t k, const uint64_t *x); | ||
| 483 | |||
| 484 | // Reduce modulo group order, z := x mod n_sm2 | ||
| 485 | // Input x[4]; output z[4] | ||
| 486 | extern void bignum_mod_nsm2_4 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 364 | 487 | ||
| 365 | // Reduce modulo field characteristic, z := x mod p_25519 | 488 | // Reduce modulo field characteristic, z := x mod p_25519 |
| 366 | // Input x[4]; output z[4] | 489 | // Input x[4]; output z[4] |
| 367 | extern void bignum_mod_p25519_4 (uint64_t z[static 4], uint64_t x[static 4]); | 490 | extern void bignum_mod_p25519_4 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 368 | 491 | ||
| 369 | // Reduce modulo field characteristic, z := x mod p_256 | 492 | // Reduce modulo field characteristic, z := x mod p_256 |
| 370 | // Input x[k]; output z[4] | 493 | // Input x[k]; output z[4] |
| 371 | extern void bignum_mod_p256 (uint64_t z[static 4], uint64_t k, uint64_t *x); | 494 | extern void bignum_mod_p256 (uint64_t z[S2N_BIGNUM_STATIC 4], uint64_t k, const uint64_t *x); |
| 372 | extern void bignum_mod_p256_alt (uint64_t z[static 4], uint64_t k, uint64_t *x); | 495 | extern void bignum_mod_p256_alt (uint64_t z[S2N_BIGNUM_STATIC 4], uint64_t k, const uint64_t *x); |
| 373 | 496 | ||
| 374 | // Reduce modulo field characteristic, z := x mod p_256 | 497 | // Reduce modulo field characteristic, z := x mod p_256 |
| 375 | // Input x[4]; output z[4] | 498 | // Input x[4]; output z[4] |
| 376 | extern void bignum_mod_p256_4 (uint64_t z[static 4], uint64_t x[static 4]); | 499 | extern void bignum_mod_p256_4 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 377 | 500 | ||
| 378 | // Reduce modulo field characteristic, z := x mod p_256k1 | 501 | // Reduce modulo field characteristic, z := x mod p_256k1 |
| 379 | // Input x[4]; output z[4] | 502 | // Input x[4]; output z[4] |
| 380 | extern void bignum_mod_p256k1_4 (uint64_t z[static 4], uint64_t x[static 4]); | 503 | extern void bignum_mod_p256k1_4 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 381 | 504 | ||
| 382 | // Reduce modulo field characteristic, z := x mod p_384 | 505 | // Reduce modulo field characteristic, z := x mod p_384 |
| 383 | // Input x[k]; output z[6] | 506 | // Input x[k]; output z[6] |
| 384 | extern void bignum_mod_p384 (uint64_t z[static 6], uint64_t k, uint64_t *x); | 507 | extern void bignum_mod_p384 (uint64_t z[S2N_BIGNUM_STATIC 6], uint64_t k, const uint64_t *x); |
| 385 | extern void bignum_mod_p384_alt (uint64_t z[static 6], uint64_t k, uint64_t *x); | 508 | extern void bignum_mod_p384_alt (uint64_t z[S2N_BIGNUM_STATIC 6], uint64_t k, const uint64_t *x); |
| 386 | 509 | ||
| 387 | // Reduce modulo field characteristic, z := x mod p_384 | 510 | // Reduce modulo field characteristic, z := x mod p_384 |
| 388 | // Input x[6]; output z[6] | 511 | // Input x[6]; output z[6] |
| 389 | extern void bignum_mod_p384_6 (uint64_t z[static 6], uint64_t x[static 6]); | 512 | extern void bignum_mod_p384_6 (uint64_t z[S2N_BIGNUM_STATIC 6], const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 390 | 513 | ||
| 391 | // Reduce modulo field characteristic, z := x mod p_521 | 514 | // Reduce modulo field characteristic, z := x mod p_521 |
| 392 | // Input x[9]; output z[9] | 515 | // Input x[9]; output z[9] |
| 393 | extern void bignum_mod_p521_9 (uint64_t z[static 9], uint64_t x[static 9]); | 516 | extern void bignum_mod_p521_9 (uint64_t z[S2N_BIGNUM_STATIC 9], const uint64_t x[S2N_BIGNUM_STATIC 9]); |
| 517 | |||
| 518 | // Reduce modulo field characteristic, z := x mod p_sm2 | ||
| 519 | // Input x[k]; output z[4] | ||
| 520 | extern void bignum_mod_sm2 (uint64_t z[S2N_BIGNUM_STATIC 4], uint64_t k, const uint64_t *x); | ||
| 521 | |||
| 522 | // Reduce modulo field characteristic, z := x mod p_sm2 | ||
| 523 | // Input x[4]; output z[4] | ||
| 524 | extern void bignum_mod_sm2_4 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 394 | 525 | ||
| 395 | // Add modulo m, z := (x + y) mod m, assuming x and y reduced | 526 | // Add modulo m, z := (x + y) mod m, assuming x and y reduced |
| 396 | // Inputs x[k], y[k], m[k]; output z[k] | 527 | // Inputs x[k], y[k], m[k]; output z[k] |
| 397 | extern void bignum_modadd (uint64_t k, uint64_t *z, uint64_t *x, uint64_t *y, uint64_t *m); | 528 | extern void bignum_modadd (uint64_t k, uint64_t *z, const uint64_t *x, const uint64_t *y, const uint64_t *m); |
| 398 | 529 | ||
| 399 | // Double modulo m, z := (2 * x) mod m, assuming x reduced | 530 | // Double modulo m, z := (2 * x) mod m, assuming x reduced |
| 400 | // Inputs x[k], m[k]; output z[k] | 531 | // Inputs x[k], m[k]; output z[k] |
| 401 | extern void bignum_moddouble (uint64_t k, uint64_t *z, uint64_t *x, uint64_t *m); | 532 | extern void bignum_moddouble (uint64_t k, uint64_t *z, const uint64_t *x, const uint64_t *m); |
| 533 | |||
| 534 | // Modular exponentiation for arbitrary odd modulus, z := (a^p) mod m | ||
| 535 | // Inputs a[k], p[k], m[k]; output z[k], temporary buffer t[>=3*k] | ||
| 536 | extern void bignum_modexp(uint64_t k,uint64_t *z, const uint64_t *a,const uint64_t *p,const uint64_t *m,uint64_t *t); | ||
| 402 | 537 | ||
| 403 | // Compute "modification" constant z := 2^{64k} mod m | 538 | // Compute "modification" constant z := 2^{64k} mod m |
| 404 | // Input m[k]; output z[k]; temporary buffer t[>=k] | 539 | // Input m[k]; output z[k]; temporary buffer t[>=k] |
| 405 | extern void bignum_modifier (uint64_t k, uint64_t *z, uint64_t *m, uint64_t *t); | 540 | extern void bignum_modifier (uint64_t k, uint64_t *z, const uint64_t *m, uint64_t *t); |
| 406 | 541 | ||
| 407 | // Invert modulo m, z = (1/a) mod b, assuming b is an odd number > 1, a coprime to b | 542 | // Invert modulo m, z = (1/a) mod b, assuming b is an odd number > 1, a coprime to b |
| 408 | // Inputs a[k], b[k]; output z[k]; temporary buffer t[>=3*k] | 543 | // Inputs a[k], b[k]; output z[k]; temporary buffer t[>=3*k] |
| 409 | extern void bignum_modinv (uint64_t k, uint64_t *z, uint64_t *a, uint64_t *b, uint64_t *t); | 544 | extern void bignum_modinv (uint64_t k, uint64_t *z, const uint64_t *a, const uint64_t *b, uint64_t *t); |
| 410 | 545 | ||
| 411 | // Optionally negate modulo m, z := (-x) mod m (if p nonzero) or z := x (if p zero), assuming x reduced | 546 | // Optionally negate modulo m, z := (-x) mod m (if p nonzero) or z := x (if p zero), assuming x reduced |
| 412 | // Inputs p, x[k], m[k]; output z[k] | 547 | // Inputs p, x[k], m[k]; output z[k] |
| 413 | extern void bignum_modoptneg (uint64_t k, uint64_t *z, uint64_t p, uint64_t *x, uint64_t *m); | 548 | extern void bignum_modoptneg (uint64_t k, uint64_t *z, uint64_t p, const uint64_t *x, const uint64_t *m); |
| 414 | 549 | ||
| 415 | // Subtract modulo m, z := (x - y) mod m, assuming x and y reduced | 550 | // Subtract modulo m, z := (x - y) mod m, assuming x and y reduced |
| 416 | // Inputs x[k], y[k], m[k]; output z[k] | 551 | // Inputs x[k], y[k], m[k]; output z[k] |
| 417 | extern void bignum_modsub (uint64_t k, uint64_t *z, uint64_t *x, uint64_t *y, uint64_t *m); | 552 | extern void bignum_modsub (uint64_t k, uint64_t *z, const uint64_t *x, const uint64_t *y, const uint64_t *m); |
| 418 | 553 | ||
| 419 | // Compute "montification" constant z := 2^{128k} mod m | 554 | // Compute "montification" constant z := 2^{128k} mod m |
| 420 | // Input m[k]; output z[k]; temporary buffer t[>=k] | 555 | // Input m[k]; output z[k]; temporary buffer t[>=k] |
| 421 | extern void bignum_montifier (uint64_t k, uint64_t *z, uint64_t *m, uint64_t *t); | 556 | extern void bignum_montifier (uint64_t k, uint64_t *z, const uint64_t *m, uint64_t *t); |
| 557 | |||
| 558 | // Montgomery inverse modulo p_256 = 2^256 - 2^224 + 2^192 + 2^96 - 1 | ||
| 559 | // Input x[4]; output z[4] | ||
| 560 | extern void bignum_montinv_p256(uint64_t z[S2N_BIGNUM_STATIC 4],const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 561 | |||
| 562 | // Montgomery inverse modulo p_384 = 2^384 - 2^128 - 2^96 + 2^32 - 1 | ||
| 563 | // Input x[6]; output z[6] | ||
| 564 | extern void bignum_montinv_p384(uint64_t z[S2N_BIGNUM_STATIC 6],const uint64_t x[S2N_BIGNUM_STATIC 6]); | ||
| 565 | |||
| 566 | // Montgomery inverse modulo p_sm2 = 2^256 - 2^224 - 2^96 + 2^64 - 1 | ||
| 567 | // Input x[4]; output z[4] | ||
| 568 | extern void bignum_montinv_sm2(uint64_t z[S2N_BIGNUM_STATIC 4],const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 422 | 569 | ||
| 423 | // Montgomery multiply, z := (x * y / 2^{64k}) mod m | 570 | // Montgomery multiply, z := (x * y / 2^{64k}) mod m |
| 424 | // Inputs x[k], y[k], m[k]; output z[k] | 571 | // Inputs x[k], y[k], m[k]; output z[k] |
| 425 | extern void bignum_montmul (uint64_t k, uint64_t *z, uint64_t *x, uint64_t *y, uint64_t *m); | 572 | extern void bignum_montmul (uint64_t k, uint64_t *z, const uint64_t *x, const uint64_t *y, const uint64_t *m); |
| 426 | 573 | ||
| 427 | // Montgomery multiply, z := (x * y / 2^256) mod p_256 | 574 | // Montgomery multiply, z := (x * y / 2^256) mod p_256 |
| 428 | // Inputs x[4], y[4]; output z[4] | 575 | // Inputs x[4], y[4]; output z[4] |
| 429 | extern void bignum_montmul_p256 (uint64_t z[static 4], uint64_t x[static 4], uint64_t y[static 4]); | 576 | extern void bignum_montmul_p256 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4]); |
| 430 | extern void bignum_montmul_p256_alt (uint64_t z[static 4], uint64_t x[static 4], uint64_t y[static 4]); | 577 | extern void bignum_montmul_p256_alt (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4]); |
| 431 | 578 | ||
| 432 | // Montgomery multiply, z := (x * y / 2^256) mod p_256k1 | 579 | // Montgomery multiply, z := (x * y / 2^256) mod p_256k1 |
| 433 | // Inputs x[4], y[4]; output z[4] | 580 | // Inputs x[4], y[4]; output z[4] |
| 434 | extern void bignum_montmul_p256k1 (uint64_t z[static 4], uint64_t x[static 4], uint64_t y[static 4]); | 581 | extern void bignum_montmul_p256k1 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4]); |
| 435 | extern void bignum_montmul_p256k1_alt (uint64_t z[static 4], uint64_t x[static 4], uint64_t y[static 4]); | 582 | extern void bignum_montmul_p256k1_alt (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4]); |
| 436 | 583 | ||
| 437 | // Montgomery multiply, z := (x * y / 2^384) mod p_384 | 584 | // Montgomery multiply, z := (x * y / 2^384) mod p_384 |
| 438 | // Inputs x[6], y[6]; output z[6] | 585 | // Inputs x[6], y[6]; output z[6] |
| 439 | extern void bignum_montmul_p384 (uint64_t z[static 6], uint64_t x[static 6], uint64_t y[static 6]); | 586 | extern void bignum_montmul_p384 (uint64_t z[S2N_BIGNUM_STATIC 6], const uint64_t x[S2N_BIGNUM_STATIC 6], const uint64_t y[S2N_BIGNUM_STATIC 6]); |
| 440 | extern void bignum_montmul_p384_alt (uint64_t z[static 6], uint64_t x[static 6], uint64_t y[static 6]); | 587 | extern void bignum_montmul_p384_alt (uint64_t z[S2N_BIGNUM_STATIC 6], const uint64_t x[S2N_BIGNUM_STATIC 6], const uint64_t y[S2N_BIGNUM_STATIC 6]); |
| 441 | 588 | ||
| 442 | // Montgomery multiply, z := (x * y / 2^576) mod p_521 | 589 | // Montgomery multiply, z := (x * y / 2^576) mod p_521 |
| 443 | // Inputs x[9], y[9]; output z[9] | 590 | // Inputs x[9], y[9]; output z[9] |
| 444 | extern void bignum_montmul_p521 (uint64_t z[static 9], uint64_t x[static 9], uint64_t y[static 9]); | 591 | extern void bignum_montmul_p521 (uint64_t z[S2N_BIGNUM_STATIC 9], const uint64_t x[S2N_BIGNUM_STATIC 9], const uint64_t y[S2N_BIGNUM_STATIC 9]); |
| 445 | extern void bignum_montmul_p521_alt (uint64_t z[static 9], uint64_t x[static 9], uint64_t y[static 9]); | 592 | extern void bignum_montmul_p521_alt (uint64_t z[S2N_BIGNUM_STATIC 9], const uint64_t x[S2N_BIGNUM_STATIC 9], const uint64_t y[S2N_BIGNUM_STATIC 9]); |
| 593 | |||
| 594 | // Montgomery multiply, z := (x * y / 2^256) mod p_sm2 | ||
| 595 | // Inputs x[4], y[4]; output z[4] | ||
| 596 | extern void bignum_montmul_sm2 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4]); | ||
| 597 | extern void bignum_montmul_sm2_alt (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4]); | ||
| 446 | 598 | ||
| 447 | // Montgomery reduce, z := (x' / 2^{64p}) MOD m | 599 | // Montgomery reduce, z := (x' / 2^{64p}) MOD m |
| 448 | // Inputs x[n], m[k], p; output z[k] | 600 | // Inputs x[n], m[k], p; output z[k] |
| 449 | extern void bignum_montredc (uint64_t k, uint64_t *z, uint64_t n, uint64_t *x, uint64_t *m, uint64_t p); | 601 | extern void bignum_montredc (uint64_t k, uint64_t *z, uint64_t n, const uint64_t *x, const uint64_t *m, uint64_t p); |
| 450 | 602 | ||
| 451 | // Montgomery square, z := (x^2 / 2^{64k}) mod m | 603 | // Montgomery square, z := (x^2 / 2^{64k}) mod m |
| 452 | // Inputs x[k], m[k]; output z[k] | 604 | // Inputs x[k], m[k]; output z[k] |
| 453 | extern void bignum_montsqr (uint64_t k, uint64_t *z, uint64_t *x, uint64_t *m); | 605 | extern void bignum_montsqr (uint64_t k, uint64_t *z, const uint64_t *x, const uint64_t *m); |
| 454 | 606 | ||
| 455 | // Montgomery square, z := (x^2 / 2^256) mod p_256 | 607 | // Montgomery square, z := (x^2 / 2^256) mod p_256 |
| 456 | // Input x[4]; output z[4] | 608 | // Input x[4]; output z[4] |
| 457 | extern void bignum_montsqr_p256 (uint64_t z[static 4], uint64_t x[static 4]); | 609 | extern void bignum_montsqr_p256 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 458 | extern void bignum_montsqr_p256_alt (uint64_t z[static 4], uint64_t x[static 4]); | 610 | extern void bignum_montsqr_p256_alt (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 459 | 611 | ||
| 460 | // Montgomery square, z := (x^2 / 2^256) mod p_256k1 | 612 | // Montgomery square, z := (x^2 / 2^256) mod p_256k1 |
| 461 | // Input x[4]; output z[4] | 613 | // Input x[4]; output z[4] |
| 462 | extern void bignum_montsqr_p256k1 (uint64_t z[static 4], uint64_t x[static 4]); | 614 | extern void bignum_montsqr_p256k1 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 463 | extern void bignum_montsqr_p256k1_alt (uint64_t z[static 4], uint64_t x[static 4]); | 615 | extern void bignum_montsqr_p256k1_alt (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 464 | 616 | ||
| 465 | // Montgomery square, z := (x^2 / 2^384) mod p_384 | 617 | // Montgomery square, z := (x^2 / 2^384) mod p_384 |
| 466 | // Input x[6]; output z[6] | 618 | // Input x[6]; output z[6] |
| 467 | extern void bignum_montsqr_p384 (uint64_t z[static 6], uint64_t x[static 6]); | 619 | extern void bignum_montsqr_p384 (uint64_t z[S2N_BIGNUM_STATIC 6], const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 468 | extern void bignum_montsqr_p384_alt (uint64_t z[static 6], uint64_t x[static 6]); | 620 | extern void bignum_montsqr_p384_alt (uint64_t z[S2N_BIGNUM_STATIC 6], const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 469 | 621 | ||
| 470 | // Montgomery square, z := (x^2 / 2^576) mod p_521 | 622 | // Montgomery square, z := (x^2 / 2^576) mod p_521 |
| 471 | // Input x[9]; output z[9] | 623 | // Input x[9]; output z[9] |
| 472 | extern void bignum_montsqr_p521 (uint64_t z[static 9], uint64_t x[static 9]); | 624 | extern void bignum_montsqr_p521 (uint64_t z[S2N_BIGNUM_STATIC 9], const uint64_t x[S2N_BIGNUM_STATIC 9]); |
| 473 | extern void bignum_montsqr_p521_alt (uint64_t z[static 9], uint64_t x[static 9]); | 625 | extern void bignum_montsqr_p521_alt (uint64_t z[S2N_BIGNUM_STATIC 9], const uint64_t x[S2N_BIGNUM_STATIC 9]); |
| 626 | |||
| 627 | // Montgomery square, z := (x^2 / 2^256) mod p_sm2 | ||
| 628 | // Input x[4]; output z[4] | ||
| 629 | extern void bignum_montsqr_sm2 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 630 | extern void bignum_montsqr_sm2_alt (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 474 | 631 | ||
| 475 | // Multiply z := x * y | 632 | // Multiply z := x * y |
| 476 | // Inputs x[m], y[n]; output z[k] | 633 | // Inputs x[m], y[n]; output z[k] |
| 477 | extern void bignum_mul (uint64_t k, uint64_t *z, uint64_t m, uint64_t *x, uint64_t n, uint64_t *y); | 634 | extern void bignum_mul (uint64_t k, uint64_t *z, uint64_t m, const uint64_t *x, uint64_t n, const uint64_t *y); |
| 478 | 635 | ||
| 479 | // Multiply z := x * y | 636 | // Multiply z := x * y |
| 480 | // Inputs x[4], y[4]; output z[8] | 637 | // Inputs x[4], y[4]; output z[8] |
| 481 | extern void bignum_mul_4_8 (uint64_t z[static 8], uint64_t x[static 4], uint64_t y[static 4]); | 638 | extern void bignum_mul_4_8 (uint64_t z[S2N_BIGNUM_STATIC 8], const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4]); |
| 482 | extern void bignum_mul_4_8_alt (uint64_t z[static 8], uint64_t x[static 4], uint64_t y[static 4]); | 639 | extern void bignum_mul_4_8_alt (uint64_t z[S2N_BIGNUM_STATIC 8], const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4]); |
| 483 | 640 | ||
| 484 | // Multiply z := x * y | 641 | // Multiply z := x * y |
| 485 | // Inputs x[6], y[6]; output z[12] | 642 | // Inputs x[6], y[6]; output z[12] |
| 486 | extern void bignum_mul_6_12 (uint64_t z[static 12], uint64_t x[static 6], uint64_t y[static 6]); | 643 | extern void bignum_mul_6_12 (uint64_t z[S2N_BIGNUM_STATIC 12], const uint64_t x[S2N_BIGNUM_STATIC 6], const uint64_t y[S2N_BIGNUM_STATIC 6]); |
| 487 | extern void bignum_mul_6_12_alt (uint64_t z[static 12], uint64_t x[static 6], uint64_t y[static 6]); | 644 | extern void bignum_mul_6_12_alt (uint64_t z[S2N_BIGNUM_STATIC 12], const uint64_t x[S2N_BIGNUM_STATIC 6], const uint64_t y[S2N_BIGNUM_STATIC 6]); |
| 488 | 645 | ||
| 489 | // Multiply z := x * y | 646 | // Multiply z := x * y |
| 490 | // Inputs x[8], y[8]; output z[16] | 647 | // Inputs x[8], y[8]; output z[16] |
| 491 | extern void bignum_mul_8_16 (uint64_t z[static 16], uint64_t x[static 8], uint64_t y[static 8]); | 648 | extern void bignum_mul_8_16 (uint64_t z[S2N_BIGNUM_STATIC 16], const uint64_t x[S2N_BIGNUM_STATIC 8], const uint64_t y[S2N_BIGNUM_STATIC 8]); |
| 492 | extern void bignum_mul_8_16_alt (uint64_t z[static 16], uint64_t x[static 8], uint64_t y[static 8]); | 649 | extern void bignum_mul_8_16_alt (uint64_t z[S2N_BIGNUM_STATIC 16], const uint64_t x[S2N_BIGNUM_STATIC 8], const uint64_t y[S2N_BIGNUM_STATIC 8]); |
| 493 | 650 | ||
| 494 | // Multiply modulo p_25519, z := (x * y) mod p_25519 | 651 | // Multiply modulo p_25519, z := (x * y) mod p_25519 |
| 495 | // Inputs x[4], y[4]; output z[4] | 652 | // Inputs x[4], y[4]; output z[4] |
| 496 | extern void bignum_mul_p25519 (uint64_t z[static 4], uint64_t x[static 4], uint64_t y[static 4]); | 653 | extern void bignum_mul_p25519 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4]); |
| 497 | extern void bignum_mul_p25519_alt (uint64_t z[static 4], uint64_t x[static 4], uint64_t y[static 4]); | 654 | extern void bignum_mul_p25519_alt (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4]); |
| 498 | 655 | ||
| 499 | // Multiply modulo p_256k1, z := (x * y) mod p_256k1 | 656 | // Multiply modulo p_256k1, z := (x * y) mod p_256k1 |
| 500 | // Inputs x[4], y[4]; output z[4] | 657 | // Inputs x[4], y[4]; output z[4] |
| 501 | extern void bignum_mul_p256k1 (uint64_t z[static 4], uint64_t x[static 4], uint64_t y[static 4]); | 658 | extern void bignum_mul_p256k1 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4]); |
| 502 | extern void bignum_mul_p256k1_alt (uint64_t z[static 4], uint64_t x[static 4], uint64_t y[static 4]); | 659 | extern void bignum_mul_p256k1_alt (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4]); |
| 503 | 660 | ||
| 504 | // Multiply modulo p_521, z := (x * y) mod p_521, assuming x and y reduced | 661 | // Multiply modulo p_521, z := (x * y) mod p_521, assuming x and y reduced |
| 505 | // Inputs x[9], y[9]; output z[9] | 662 | // Inputs x[9], y[9]; output z[9] |
| 506 | extern void bignum_mul_p521 (uint64_t z[static 9], uint64_t x[static 9], uint64_t y[static 9]); | 663 | extern void bignum_mul_p521 (uint64_t z[S2N_BIGNUM_STATIC 9], const uint64_t x[S2N_BIGNUM_STATIC 9], const uint64_t y[S2N_BIGNUM_STATIC 9]); |
| 507 | extern void bignum_mul_p521_alt (uint64_t z[static 9], uint64_t x[static 9], uint64_t y[static 9]); | 664 | extern void bignum_mul_p521_alt (uint64_t z[S2N_BIGNUM_STATIC 9], const uint64_t x[S2N_BIGNUM_STATIC 9], const uint64_t y[S2N_BIGNUM_STATIC 9]); |
| 508 | 665 | ||
| 509 | // Multiply bignum by 10 and add word: z := 10 * z + d | 666 | // Multiply bignum by 10 and add word: z := 10 * z + d |
| 510 | // Inputs z[k], d; outputs function return (carry) and z[k] | 667 | // Inputs z[k], d; outputs function return (carry) and z[k] |
| @@ -512,55 +669,59 @@ extern uint64_t bignum_muladd10 (uint64_t k, uint64_t *z, uint64_t d); | |||
| 512 | 669 | ||
| 513 | // Multiplex/select z := x (if p nonzero) or z := y (if p zero) | 670 | // Multiplex/select z := x (if p nonzero) or z := y (if p zero) |
| 514 | // Inputs p, x[k], y[k]; output z[k] | 671 | // Inputs p, x[k], y[k]; output z[k] |
| 515 | extern void bignum_mux (uint64_t p, uint64_t k, uint64_t *z, uint64_t *x, uint64_t *y); | 672 | extern void bignum_mux (uint64_t p, uint64_t k, uint64_t *z, const uint64_t *x, const uint64_t *y); |
| 516 | 673 | ||
| 517 | // 256-bit multiplex/select z := x (if p nonzero) or z := y (if p zero) | 674 | // 256-bit multiplex/select z := x (if p nonzero) or z := y (if p zero) |
| 518 | // Inputs p, x[4], y[4]; output z[4] | 675 | // Inputs p, x[4], y[4]; output z[4] |
| 519 | extern void bignum_mux_4 (uint64_t p, uint64_t z[static 4],uint64_t x[static 4], uint64_t y[static 4]); | 676 | extern void bignum_mux_4 (uint64_t p, uint64_t z[S2N_BIGNUM_STATIC 4],const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4]); |
| 520 | 677 | ||
| 521 | // 384-bit multiplex/select z := x (if p nonzero) or z := y (if p zero) | 678 | // 384-bit multiplex/select z := x (if p nonzero) or z := y (if p zero) |
| 522 | // Inputs p, x[6], y[6]; output z[6] | 679 | // Inputs p, x[6], y[6]; output z[6] |
| 523 | extern void bignum_mux_6 (uint64_t p, uint64_t z[static 6],uint64_t x[static 6], uint64_t y[static 6]); | 680 | extern void bignum_mux_6 (uint64_t p, uint64_t z[S2N_BIGNUM_STATIC 6],const uint64_t x[S2N_BIGNUM_STATIC 6], const uint64_t y[S2N_BIGNUM_STATIC 6]); |
| 524 | 681 | ||
| 525 | // Select element from 16-element table, z := xs[k*i] | 682 | // Select element from 16-element table, z := xs[k*i] |
| 526 | // Inputs xs[16*k], i; output z[k] | 683 | // Inputs xs[16*k], i; output z[k] |
| 527 | extern void bignum_mux16 (uint64_t k, uint64_t *z, uint64_t *xs, uint64_t i); | 684 | extern void bignum_mux16 (uint64_t k, uint64_t *z, const uint64_t *xs, uint64_t i); |
| 528 | 685 | ||
| 529 | // Negate modulo p_25519, z := (-x) mod p_25519, assuming x reduced | 686 | // Negate modulo p_25519, z := (-x) mod p_25519, assuming x reduced |
| 530 | // Input x[4]; output z[4] | 687 | // Input x[4]; output z[4] |
| 531 | extern void bignum_neg_p25519 (uint64_t z[static 4], uint64_t x[static 4]); | 688 | extern void bignum_neg_p25519 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 532 | 689 | ||
| 533 | // Negate modulo p_256, z := (-x) mod p_256, assuming x reduced | 690 | // Negate modulo p_256, z := (-x) mod p_256, assuming x reduced |
| 534 | // Input x[4]; output z[4] | 691 | // Input x[4]; output z[4] |
| 535 | extern void bignum_neg_p256 (uint64_t z[static 4], uint64_t x[static 4]); | 692 | extern void bignum_neg_p256 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 536 | 693 | ||
| 537 | // Negate modulo p_256k1, z := (-x) mod p_256k1, assuming x reduced | 694 | // Negate modulo p_256k1, z := (-x) mod p_256k1, assuming x reduced |
| 538 | // Input x[4]; output z[4] | 695 | // Input x[4]; output z[4] |
| 539 | extern void bignum_neg_p256k1 (uint64_t z[static 4], uint64_t x[static 4]); | 696 | extern void bignum_neg_p256k1 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 540 | 697 | ||
| 541 | // Negate modulo p_384, z := (-x) mod p_384, assuming x reduced | 698 | // Negate modulo p_384, z := (-x) mod p_384, assuming x reduced |
| 542 | // Input x[6]; output z[6] | 699 | // Input x[6]; output z[6] |
| 543 | extern void bignum_neg_p384 (uint64_t z[static 6], uint64_t x[static 6]); | 700 | extern void bignum_neg_p384 (uint64_t z[S2N_BIGNUM_STATIC 6], const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 544 | 701 | ||
| 545 | // Negate modulo p_521, z := (-x) mod p_521, assuming x reduced | 702 | // Negate modulo p_521, z := (-x) mod p_521, assuming x reduced |
| 546 | // Input x[9]; output z[9] | 703 | // Input x[9]; output z[9] |
| 547 | extern void bignum_neg_p521 (uint64_t z[static 9], uint64_t x[static 9]); | 704 | extern void bignum_neg_p521 (uint64_t z[S2N_BIGNUM_STATIC 9], const uint64_t x[S2N_BIGNUM_STATIC 9]); |
| 705 | |||
| 706 | // Negate modulo p_sm2, z := (-x) mod p_sm2, assuming x reduced | ||
| 707 | // Input x[4]; output z[4] | ||
| 708 | extern void bignum_neg_sm2 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 548 | 709 | ||
| 549 | // Negated modular inverse, z := (-1/x) mod 2^{64k} | 710 | // Negated modular inverse, z := (-1/x) mod 2^{64k} |
| 550 | // Input x[k]; output z[k] | 711 | // Input x[k]; output z[k] |
| 551 | extern void bignum_negmodinv (uint64_t k, uint64_t *z, uint64_t *x); | 712 | extern void bignum_negmodinv (uint64_t k, uint64_t *z, const uint64_t *x); |
| 552 | 713 | ||
| 553 | // Test bignum for nonzero-ness x =/= 0 | 714 | // Test bignum for nonzero-ness x =/= 0 |
| 554 | // Input x[k]; output function return | 715 | // Input x[k]; output function return |
| 555 | extern uint64_t bignum_nonzero (uint64_t k, uint64_t *x); | 716 | extern uint64_t bignum_nonzero (uint64_t k, const uint64_t *x); |
| 556 | 717 | ||
| 557 | // Test 256-bit bignum for nonzero-ness x =/= 0 | 718 | // Test 256-bit bignum for nonzero-ness x =/= 0 |
| 558 | // Input x[4]; output function return | 719 | // Input x[4]; output function return |
| 559 | extern uint64_t bignum_nonzero_4(uint64_t x[static 4]); | 720 | extern uint64_t bignum_nonzero_4(const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 560 | 721 | ||
| 561 | // Test 384-bit bignum for nonzero-ness x =/= 0 | 722 | // Test 384-bit bignum for nonzero-ness x =/= 0 |
| 562 | // Input x[6]; output function return | 723 | // Input x[6]; output function return |
| 563 | extern uint64_t bignum_nonzero_6(uint64_t x[static 6]); | 724 | extern uint64_t bignum_nonzero_6(const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 564 | 725 | ||
| 565 | // Normalize bignum in-place by shifting left till top bit is 1 | 726 | // Normalize bignum in-place by shifting left till top bit is 1 |
| 566 | // Input z[k]; outputs function return (bits shifted left) and z[k] | 727 | // Input z[k]; outputs function return (bits shifted left) and z[k] |
| @@ -568,7 +729,7 @@ extern uint64_t bignum_normalize (uint64_t k, uint64_t *z); | |||
| 568 | 729 | ||
| 569 | // Test bignum for odd-ness | 730 | // Test bignum for odd-ness |
| 570 | // Input x[k]; output function return | 731 | // Input x[k]; output function return |
| 571 | extern uint64_t bignum_odd (uint64_t k, uint64_t *x); | 732 | extern uint64_t bignum_odd (uint64_t k, const uint64_t *x); |
| 572 | 733 | ||
| 573 | // Convert single digit to bignum, z := n | 734 | // Convert single digit to bignum, z := n |
| 574 | // Input n; output z[k] | 735 | // Input n; output z[k] |
| @@ -576,39 +737,43 @@ extern void bignum_of_word (uint64_t k, uint64_t *z, uint64_t n); | |||
| 576 | 737 | ||
| 577 | // Optionally add, z := x + y (if p nonzero) or z := x (if p zero) | 738 | // Optionally add, z := x + y (if p nonzero) or z := x (if p zero) |
| 578 | // Inputs x[k], p, y[k]; outputs function return (carry-out) and z[k] | 739 | // Inputs x[k], p, y[k]; outputs function return (carry-out) and z[k] |
| 579 | extern uint64_t bignum_optadd (uint64_t k, uint64_t *z, uint64_t *x, uint64_t p, uint64_t *y); | 740 | extern uint64_t bignum_optadd (uint64_t k, uint64_t *z, const uint64_t *x, uint64_t p, const uint64_t *y); |
| 580 | 741 | ||
| 581 | // Optionally negate, z := -x (if p nonzero) or z := x (if p zero) | 742 | // Optionally negate, z := -x (if p nonzero) or z := x (if p zero) |
| 582 | // Inputs p, x[k]; outputs function return (nonzero input) and z[k] | 743 | // Inputs p, x[k]; outputs function return (nonzero input) and z[k] |
| 583 | extern uint64_t bignum_optneg (uint64_t k, uint64_t *z, uint64_t p, uint64_t *x); | 744 | extern uint64_t bignum_optneg (uint64_t k, uint64_t *z, uint64_t p, const uint64_t *x); |
| 584 | 745 | ||
| 585 | // Optionally negate modulo p_25519, z := (-x) mod p_25519 (if p nonzero) or z := x (if p zero), assuming x reduced | 746 | // Optionally negate modulo p_25519, z := (-x) mod p_25519 (if p nonzero) or z := x (if p zero), assuming x reduced |
| 586 | // Inputs p, x[4]; output z[4] | 747 | // Inputs p, x[4]; output z[4] |
| 587 | extern void bignum_optneg_p25519 (uint64_t z[static 4], uint64_t p, uint64_t x[static 4]); | 748 | extern void bignum_optneg_p25519 (uint64_t z[S2N_BIGNUM_STATIC 4], uint64_t p, const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 588 | 749 | ||
| 589 | // Optionally negate modulo p_256, z := (-x) mod p_256 (if p nonzero) or z := x (if p zero), assuming x reduced | 750 | // Optionally negate modulo p_256, z := (-x) mod p_256 (if p nonzero) or z := x (if p zero), assuming x reduced |
| 590 | // Inputs p, x[4]; output z[4] | 751 | // Inputs p, x[4]; output z[4] |
| 591 | extern void bignum_optneg_p256 (uint64_t z[static 4], uint64_t p, uint64_t x[static 4]); | 752 | extern void bignum_optneg_p256 (uint64_t z[S2N_BIGNUM_STATIC 4], uint64_t p, const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 592 | 753 | ||
| 593 | // Optionally negate modulo p_256k1, z := (-x) mod p_256k1 (if p nonzero) or z := x (if p zero), assuming x reduced | 754 | // Optionally negate modulo p_256k1, z := (-x) mod p_256k1 (if p nonzero) or z := x (if p zero), assuming x reduced |
| 594 | // Inputs p, x[4]; output z[4] | 755 | // Inputs p, x[4]; output z[4] |
| 595 | extern void bignum_optneg_p256k1 (uint64_t z[static 4], uint64_t p, uint64_t x[static 4]); | 756 | extern void bignum_optneg_p256k1 (uint64_t z[S2N_BIGNUM_STATIC 4], uint64_t p, const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 596 | 757 | ||
| 597 | // Optionally negate modulo p_384, z := (-x) mod p_384 (if p nonzero) or z := x (if p zero), assuming x reduced | 758 | // Optionally negate modulo p_384, z := (-x) mod p_384 (if p nonzero) or z := x (if p zero), assuming x reduced |
| 598 | // Inputs p, x[6]; output z[6] | 759 | // Inputs p, x[6]; output z[6] |
| 599 | extern void bignum_optneg_p384 (uint64_t z[static 6], uint64_t p, uint64_t x[static 6]); | 760 | extern void bignum_optneg_p384 (uint64_t z[S2N_BIGNUM_STATIC 6], uint64_t p, const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 600 | 761 | ||
| 601 | // Optionally negate modulo p_521, z := (-x) mod p_521 (if p nonzero) or z := x (if p zero), assuming x reduced | 762 | // Optionally negate modulo p_521, z := (-x) mod p_521 (if p nonzero) or z := x (if p zero), assuming x reduced |
| 602 | // Inputs p, x[9]; output z[9] | 763 | // Inputs p, x[9]; output z[9] |
| 603 | extern void bignum_optneg_p521 (uint64_t z[static 9], uint64_t p, uint64_t x[static 9]); | 764 | extern void bignum_optneg_p521 (uint64_t z[S2N_BIGNUM_STATIC 9], uint64_t p, const uint64_t x[S2N_BIGNUM_STATIC 9]); |
| 765 | |||
| 766 | // Optionally negate modulo p_sm2, z := (-x) mod p_sm2 (if p nonzero) or z := x (if p zero), assuming x reduced | ||
| 767 | // Inputs p, x[4]; output z[4] | ||
| 768 | extern void bignum_optneg_sm2 (uint64_t z[S2N_BIGNUM_STATIC 4], uint64_t p, const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 604 | 769 | ||
| 605 | // Optionally subtract, z := x - y (if p nonzero) or z := x (if p zero) | 770 | // Optionally subtract, z := x - y (if p nonzero) or z := x (if p zero) |
| 606 | // Inputs x[k], p, y[k]; outputs function return (carry-out) and z[k] | 771 | // Inputs x[k], p, y[k]; outputs function return (carry-out) and z[k] |
| 607 | extern uint64_t bignum_optsub (uint64_t k, uint64_t *z, uint64_t *x, uint64_t p, uint64_t *y); | 772 | extern uint64_t bignum_optsub (uint64_t k, uint64_t *z, const uint64_t *x, uint64_t p, const uint64_t *y); |
| 608 | 773 | ||
| 609 | // Optionally subtract or add, z := x + sgn(p) * y interpreting p as signed | 774 | // Optionally subtract or add, z := x + sgn(p) * y interpreting p as signed |
| 610 | // Inputs x[k], p, y[k]; outputs function return (carry-out) and z[k] | 775 | // Inputs x[k], p, y[k]; outputs function return (carry-out) and z[k] |
| 611 | extern uint64_t bignum_optsubadd (uint64_t k, uint64_t *z, uint64_t *x, uint64_t p, uint64_t *y); | 776 | extern uint64_t bignum_optsubadd (uint64_t k, uint64_t *z, const uint64_t *x, uint64_t p, const uint64_t *y); |
| 612 | 777 | ||
| 613 | // Return bignum of power of 2, z := 2^n | 778 | // Return bignum of power of 2, z := 2^n |
| 614 | // Input n; output z[k] | 779 | // Input n; output z[k] |
| @@ -616,216 +781,376 @@ extern void bignum_pow2 (uint64_t k, uint64_t *z, uint64_t n); | |||
| 616 | 781 | ||
| 617 | // Shift bignum left by c < 64 bits z := x * 2^c | 782 | // Shift bignum left by c < 64 bits z := x * 2^c |
| 618 | // Inputs x[n], c; outputs function return (carry-out) and z[k] | 783 | // Inputs x[n], c; outputs function return (carry-out) and z[k] |
| 619 | extern uint64_t bignum_shl_small (uint64_t k, uint64_t *z, uint64_t n, uint64_t *x, uint64_t c); | 784 | extern uint64_t bignum_shl_small (uint64_t k, uint64_t *z, uint64_t n, const uint64_t *x, uint64_t c); |
| 620 | 785 | ||
| 621 | // Shift bignum right by c < 64 bits z := floor(x / 2^c) | 786 | // Shift bignum right by c < 64 bits z := floor(x / 2^c) |
| 622 | // Inputs x[n], c; outputs function return (bits shifted out) and z[k] | 787 | // Inputs x[n], c; outputs function return (bits shifted out) and z[k] |
| 623 | extern uint64_t bignum_shr_small (uint64_t k, uint64_t *z, uint64_t n, uint64_t *x, uint64_t c); | 788 | extern uint64_t bignum_shr_small (uint64_t k, uint64_t *z, uint64_t n, const uint64_t *x, uint64_t c); |
| 624 | 789 | ||
| 625 | // Square, z := x^2 | 790 | // Square, z := x^2 |
| 626 | // Input x[n]; output z[k] | 791 | // Input x[n]; output z[k] |
| 627 | extern void bignum_sqr (uint64_t k, uint64_t *z, uint64_t n, uint64_t *x); | 792 | extern void bignum_sqr (uint64_t k, uint64_t *z, uint64_t n, const uint64_t *x); |
| 628 | 793 | ||
| 629 | // Square, z := x^2 | 794 | // Square, z := x^2 |
| 630 | // Input x[4]; output z[8] | 795 | // Input x[4]; output z[8] |
| 631 | extern void bignum_sqr_4_8 (uint64_t z[static 8], uint64_t x[static 4]); | 796 | extern void bignum_sqr_4_8 (uint64_t z[S2N_BIGNUM_STATIC 8], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 632 | extern void bignum_sqr_4_8_alt (uint64_t z[static 8], uint64_t x[static 4]); | 797 | extern void bignum_sqr_4_8_alt (uint64_t z[S2N_BIGNUM_STATIC 8], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 633 | 798 | ||
| 634 | // Square, z := x^2 | 799 | // Square, z := x^2 |
| 635 | // Input x[6]; output z[12] | 800 | // Input x[6]; output z[12] |
| 636 | extern void bignum_sqr_6_12 (uint64_t z[static 12], uint64_t x[static 6]); | 801 | extern void bignum_sqr_6_12 (uint64_t z[S2N_BIGNUM_STATIC 12], const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 637 | extern void bignum_sqr_6_12_alt (uint64_t z[static 12], uint64_t x[static 6]); | 802 | extern void bignum_sqr_6_12_alt (uint64_t z[S2N_BIGNUM_STATIC 12], const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 638 | 803 | ||
| 639 | // Square, z := x^2 | 804 | // Square, z := x^2 |
| 640 | // Input x[8]; output z[16] | 805 | // Input x[8]; output z[16] |
| 641 | extern void bignum_sqr_8_16 (uint64_t z[static 16], uint64_t x[static 8]); | 806 | extern void bignum_sqr_8_16 (uint64_t z[S2N_BIGNUM_STATIC 16], const uint64_t x[S2N_BIGNUM_STATIC 8]); |
| 642 | extern void bignum_sqr_8_16_alt (uint64_t z[static 16], uint64_t x[static 8]); | 807 | extern void bignum_sqr_8_16_alt (uint64_t z[S2N_BIGNUM_STATIC 16], const uint64_t x[S2N_BIGNUM_STATIC 8]); |
| 643 | 808 | ||
| 644 | // Square modulo p_25519, z := (x^2) mod p_25519 | 809 | // Square modulo p_25519, z := (x^2) mod p_25519 |
| 645 | // Input x[4]; output z[4] | 810 | // Input x[4]; output z[4] |
| 646 | extern void bignum_sqr_p25519 (uint64_t z[static 4], uint64_t x[static 4]); | 811 | extern void bignum_sqr_p25519 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 647 | extern void bignum_sqr_p25519_alt (uint64_t z[static 4], uint64_t x[static 4]); | 812 | extern void bignum_sqr_p25519_alt (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 648 | 813 | ||
| 649 | // Square modulo p_256k1, z := (x^2) mod p_256k1 | 814 | // Square modulo p_256k1, z := (x^2) mod p_256k1 |
| 650 | // Input x[4]; output z[4] | 815 | // Input x[4]; output z[4] |
| 651 | extern void bignum_sqr_p256k1 (uint64_t z[static 4], uint64_t x[static 4]); | 816 | extern void bignum_sqr_p256k1 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 652 | extern void bignum_sqr_p256k1_alt (uint64_t z[static 4], uint64_t x[static 4]); | 817 | extern void bignum_sqr_p256k1_alt (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 653 | 818 | ||
| 654 | // Square modulo p_521, z := (x^2) mod p_521, assuming x reduced | 819 | // Square modulo p_521, z := (x^2) mod p_521, assuming x reduced |
| 655 | // Input x[9]; output z[9] | 820 | // Input x[9]; output z[9] |
| 656 | extern void bignum_sqr_p521 (uint64_t z[static 9], uint64_t x[static 9]); | 821 | extern void bignum_sqr_p521 (uint64_t z[S2N_BIGNUM_STATIC 9], const uint64_t x[S2N_BIGNUM_STATIC 9]); |
| 657 | extern void bignum_sqr_p521_alt (uint64_t z[static 9], uint64_t x[static 9]); | 822 | extern void bignum_sqr_p521_alt (uint64_t z[S2N_BIGNUM_STATIC 9], const uint64_t x[S2N_BIGNUM_STATIC 9]); |
| 823 | |||
| 824 | // Square root modulo p_25519 | ||
| 825 | // Input x[4]; output function return (Legendre symbol) and z[4] | ||
| 826 | extern int64_t bignum_sqrt_p25519(uint64_t z[S2N_BIGNUM_STATIC 4],const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 827 | extern int64_t bignum_sqrt_p25519_alt(uint64_t z[S2N_BIGNUM_STATIC 4],const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 658 | 828 | ||
| 659 | // Subtract, z := x - y | 829 | // Subtract, z := x - y |
| 660 | // Inputs x[m], y[n]; outputs function return (carry-out) and z[p] | 830 | // Inputs x[m], y[n]; outputs function return (carry-out) and z[p] |
| 661 | extern uint64_t bignum_sub (uint64_t p, uint64_t *z, uint64_t m, uint64_t *x, uint64_t n, uint64_t *y); | 831 | extern uint64_t bignum_sub (uint64_t p, uint64_t *z, uint64_t m, const uint64_t *x, uint64_t n, const uint64_t *y); |
| 662 | 832 | ||
| 663 | // Subtract modulo p_25519, z := (x - y) mod p_25519, assuming x and y reduced | 833 | // Subtract modulo p_25519, z := (x - y) mod p_25519, assuming x and y reduced |
| 664 | // Inputs x[4], y[4]; output z[4] | 834 | // Inputs x[4], y[4]; output z[4] |
| 665 | extern void bignum_sub_p25519 (uint64_t z[static 4], uint64_t x[static 4], uint64_t y[static 4]); | 835 | extern void bignum_sub_p25519 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4]); |
| 666 | 836 | ||
| 667 | // Subtract modulo p_256, z := (x - y) mod p_256, assuming x and y reduced | 837 | // Subtract modulo p_256, z := (x - y) mod p_256, assuming x and y reduced |
| 668 | // Inputs x[4], y[4]; output z[4] | 838 | // Inputs x[4], y[4]; output z[4] |
| 669 | extern void bignum_sub_p256 (uint64_t z[static 4], uint64_t x[static 4], uint64_t y[static 4]); | 839 | extern void bignum_sub_p256 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4]); |
| 670 | 840 | ||
| 671 | // Subtract modulo p_256k1, z := (x - y) mod p_256k1, assuming x and y reduced | 841 | // Subtract modulo p_256k1, z := (x - y) mod p_256k1, assuming x and y reduced |
| 672 | // Inputs x[4], y[4]; output z[4] | 842 | // Inputs x[4], y[4]; output z[4] |
| 673 | extern void bignum_sub_p256k1 (uint64_t z[static 4], uint64_t x[static 4], uint64_t y[static 4]); | 843 | extern void bignum_sub_p256k1 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4]); |
| 674 | 844 | ||
| 675 | // Subtract modulo p_384, z := (x - y) mod p_384, assuming x and y reduced | 845 | // Subtract modulo p_384, z := (x - y) mod p_384, assuming x and y reduced |
| 676 | // Inputs x[6], y[6]; output z[6] | 846 | // Inputs x[6], y[6]; output z[6] |
| 677 | extern void bignum_sub_p384 (uint64_t z[static 6], uint64_t x[static 6], uint64_t y[static 6]); | 847 | extern void bignum_sub_p384 (uint64_t z[S2N_BIGNUM_STATIC 6], const uint64_t x[S2N_BIGNUM_STATIC 6], const uint64_t y[S2N_BIGNUM_STATIC 6]); |
| 678 | 848 | ||
| 679 | // Subtract modulo p_521, z := (x - y) mod p_521, assuming x and y reduced | 849 | // Subtract modulo p_521, z := (x - y) mod p_521, assuming x and y reduced |
| 680 | // Inputs x[9], y[9]; output z[9] | 850 | // Inputs x[9], y[9]; output z[9] |
| 681 | extern void bignum_sub_p521 (uint64_t z[static 9], uint64_t x[static 9], uint64_t y[static 9]); | 851 | extern void bignum_sub_p521 (uint64_t z[S2N_BIGNUM_STATIC 9], const uint64_t x[S2N_BIGNUM_STATIC 9], const uint64_t y[S2N_BIGNUM_STATIC 9]); |
| 852 | |||
| 853 | // Subtract modulo p_sm2, z := (x - y) mod p_sm2, assuming x and y reduced | ||
| 854 | // Inputs x[4], y[4]; output z[4] | ||
| 855 | extern void bignum_sub_sm2 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4], const uint64_t y[S2N_BIGNUM_STATIC 4]); | ||
| 682 | 856 | ||
| 683 | // Convert 4-digit (256-bit) bignum to big-endian bytes | 857 | // Convert 4-digit (256-bit) bignum to big-endian bytes |
| 684 | // Input x[4]; output z[32] (bytes) | 858 | // Input x[4]; output z[32] (bytes) |
| 685 | extern void bignum_tobebytes_4 (uint8_t z[static 32], uint64_t x[static 4]); | 859 | extern void bignum_tobebytes_4 (uint8_t z[S2N_BIGNUM_STATIC 32], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 686 | 860 | ||
| 687 | // Convert 6-digit (384-bit) bignum to big-endian bytes | 861 | // Convert 6-digit (384-bit) bignum to big-endian bytes |
| 688 | // Input x[6]; output z[48] (bytes) | 862 | // Input x[6]; output z[48] (bytes) |
| 689 | extern void bignum_tobebytes_6 (uint8_t z[static 48], uint64_t x[static 6]); | 863 | extern void bignum_tobebytes_6 (uint8_t z[S2N_BIGNUM_STATIC 48], const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 690 | 864 | ||
| 691 | // Convert 4-digit (256-bit) bignum to little-endian bytes | 865 | // Convert 4-digit (256-bit) bignum to little-endian bytes |
| 692 | // Input x[4]; output z[32] (bytes) | 866 | // Input x[4]; output z[32] (bytes) |
| 693 | extern void bignum_tolebytes_4 (uint8_t z[static 32], uint64_t x[static 4]); | 867 | extern void bignum_tolebytes_4 (uint8_t z[S2N_BIGNUM_STATIC 32], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 694 | 868 | ||
| 695 | // Convert 6-digit (384-bit) bignum to little-endian bytes | 869 | // Convert 6-digit (384-bit) bignum to little-endian bytes |
| 696 | // Input x[6]; output z[48] (bytes) | 870 | // Input x[6]; output z[48] (bytes) |
| 697 | extern void bignum_tolebytes_6 (uint8_t z[static 48], uint64_t x[static 6]); | 871 | extern void bignum_tolebytes_6 (uint8_t z[S2N_BIGNUM_STATIC 48], const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 698 | 872 | ||
| 699 | // Convert 9-digit 528-bit bignum to little-endian bytes | 873 | // Convert 9-digit 528-bit bignum to little-endian bytes |
| 700 | // Input x[6]; output z[66] (bytes) | 874 | // Input x[6]; output z[66] (bytes) |
| 701 | extern void bignum_tolebytes_p521 (uint8_t z[static 66], uint64_t x[static 9]); | 875 | extern void bignum_tolebytes_p521 (uint8_t z[S2N_BIGNUM_STATIC 66], const uint64_t x[S2N_BIGNUM_STATIC 9]); |
| 702 | 876 | ||
| 703 | // Convert to Montgomery form z := (2^256 * x) mod p_256 | 877 | // Convert to Montgomery form z := (2^256 * x) mod p_256 |
| 704 | // Input x[4]; output z[4] | 878 | // Input x[4]; output z[4] |
| 705 | extern void bignum_tomont_p256 (uint64_t z[static 4], uint64_t x[static 4]); | 879 | extern void bignum_tomont_p256 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 706 | extern void bignum_tomont_p256_alt (uint64_t z[static 4], uint64_t x[static 4]); | 880 | extern void bignum_tomont_p256_alt (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 707 | 881 | ||
| 708 | // Convert to Montgomery form z := (2^256 * x) mod p_256k1 | 882 | // Convert to Montgomery form z := (2^256 * x) mod p_256k1 |
| 709 | // Input x[4]; output z[4] | 883 | // Input x[4]; output z[4] |
| 710 | extern void bignum_tomont_p256k1 (uint64_t z[static 4], uint64_t x[static 4]); | 884 | extern void bignum_tomont_p256k1 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 711 | extern void bignum_tomont_p256k1_alt (uint64_t z[static 4], uint64_t x[static 4]); | 885 | extern void bignum_tomont_p256k1_alt (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 712 | 886 | ||
| 713 | // Convert to Montgomery form z := (2^384 * x) mod p_384 | 887 | // Convert to Montgomery form z := (2^384 * x) mod p_384 |
| 714 | // Input x[6]; output z[6] | 888 | // Input x[6]; output z[6] |
| 715 | extern void bignum_tomont_p384 (uint64_t z[static 6], uint64_t x[static 6]); | 889 | extern void bignum_tomont_p384 (uint64_t z[S2N_BIGNUM_STATIC 6], const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 716 | extern void bignum_tomont_p384_alt (uint64_t z[static 6], uint64_t x[static 6]); | 890 | extern void bignum_tomont_p384_alt (uint64_t z[S2N_BIGNUM_STATIC 6], const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 717 | 891 | ||
| 718 | // Convert to Montgomery form z := (2^576 * x) mod p_521 | 892 | // Convert to Montgomery form z := (2^576 * x) mod p_521 |
| 719 | // Input x[9]; output z[9] | 893 | // Input x[9]; output z[9] |
| 720 | extern void bignum_tomont_p521 (uint64_t z[static 9], uint64_t x[static 9]); | 894 | extern void bignum_tomont_p521 (uint64_t z[S2N_BIGNUM_STATIC 9], const uint64_t x[S2N_BIGNUM_STATIC 9]); |
| 895 | |||
| 896 | // Convert to Montgomery form z := (2^256 * x) mod p_sm2 | ||
| 897 | // Input x[4]; output z[4] | ||
| 898 | extern void bignum_tomont_sm2 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 721 | 899 | ||
| 722 | // Triple modulo p_256, z := (3 * x) mod p_256 | 900 | // Triple modulo p_256, z := (3 * x) mod p_256 |
| 723 | // Input x[4]; output z[4] | 901 | // Input x[4]; output z[4] |
| 724 | extern void bignum_triple_p256 (uint64_t z[static 4], uint64_t x[static 4]); | 902 | extern void bignum_triple_p256 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 725 | extern void bignum_triple_p256_alt (uint64_t z[static 4], uint64_t x[static 4]); | 903 | extern void bignum_triple_p256_alt (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 726 | 904 | ||
| 727 | // Triple modulo p_256k1, z := (3 * x) mod p_256k1 | 905 | // Triple modulo p_256k1, z := (3 * x) mod p_256k1 |
| 728 | // Input x[4]; output z[4] | 906 | // Input x[4]; output z[4] |
| 729 | extern void bignum_triple_p256k1 (uint64_t z[static 4], uint64_t x[static 4]); | 907 | extern void bignum_triple_p256k1 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 730 | extern void bignum_triple_p256k1_alt (uint64_t z[static 4], uint64_t x[static 4]); | 908 | extern void bignum_triple_p256k1_alt (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); |
| 731 | 909 | ||
| 732 | // Triple modulo p_384, z := (3 * x) mod p_384 | 910 | // Triple modulo p_384, z := (3 * x) mod p_384 |
| 733 | // Input x[6]; output z[6] | 911 | // Input x[6]; output z[6] |
| 734 | extern void bignum_triple_p384 (uint64_t z[static 6], uint64_t x[static 6]); | 912 | extern void bignum_triple_p384 (uint64_t z[S2N_BIGNUM_STATIC 6], const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 735 | extern void bignum_triple_p384_alt (uint64_t z[static 6], uint64_t x[static 6]); | 913 | extern void bignum_triple_p384_alt (uint64_t z[S2N_BIGNUM_STATIC 6], const uint64_t x[S2N_BIGNUM_STATIC 6]); |
| 736 | 914 | ||
| 737 | // Triple modulo p_521, z := (3 * x) mod p_521, assuming x reduced | 915 | // Triple modulo p_521, z := (3 * x) mod p_521, assuming x reduced |
| 738 | // Input x[9]; output z[9] | 916 | // Input x[9]; output z[9] |
| 739 | extern void bignum_triple_p521 (uint64_t z[static 9], uint64_t x[static 9]); | 917 | extern void bignum_triple_p521 (uint64_t z[S2N_BIGNUM_STATIC 9], const uint64_t x[S2N_BIGNUM_STATIC 9]); |
| 740 | extern void bignum_triple_p521_alt (uint64_t z[static 9], uint64_t x[static 9]); | 918 | extern void bignum_triple_p521_alt (uint64_t z[S2N_BIGNUM_STATIC 9], const uint64_t x[S2N_BIGNUM_STATIC 9]); |
| 919 | |||
| 920 | // Triple modulo p_sm2, z := (3 * x) mod p_sm2 | ||
| 921 | // Input x[4]; output z[4] | ||
| 922 | extern void bignum_triple_sm2 (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 923 | extern void bignum_triple_sm2_alt (uint64_t z[S2N_BIGNUM_STATIC 4], const uint64_t x[S2N_BIGNUM_STATIC 4]); | ||
| 741 | 924 | ||
| 742 | // Montgomery ladder step for curve25519 | 925 | // Montgomery ladder step for curve25519 |
| 743 | // Inputs point[8], pp[16], b; output rr[16] | 926 | // Inputs point[8], pp[16], b; output rr[16] |
| 744 | extern void curve25519_ladderstep(uint64_t rr[16],uint64_t point[8],uint64_t pp[16],uint64_t b); | 927 | extern void curve25519_ladderstep(uint64_t rr[16],const uint64_t point[8],const uint64_t pp[16],uint64_t b); |
| 745 | extern void curve25519_ladderstep_alt(uint64_t rr[16],uint64_t point[8],uint64_t pp[16],uint64_t b); | 928 | extern void curve25519_ladderstep_alt(uint64_t rr[16],const uint64_t point[8],const uint64_t pp[16],uint64_t b); |
| 746 | 929 | ||
| 747 | // Projective scalar multiplication, x coordinate only, for curve25519 | 930 | // Projective scalar multiplication, x coordinate only, for curve25519 |
| 748 | // Inputs scalar[4], point[4]; output res[8] | 931 | // Inputs scalar[4], point[4]; output res[8] |
| 749 | extern void curve25519_pxscalarmul(uint64_t res[static 8],uint64_t scalar[static 4],uint64_t point[static 4]); | 932 | extern void curve25519_pxscalarmul(uint64_t res[S2N_BIGNUM_STATIC 8],const uint64_t scalar[S2N_BIGNUM_STATIC 4],const uint64_t point[S2N_BIGNUM_STATIC 4]); |
| 750 | extern void curve25519_pxscalarmul_alt(uint64_t res[static 8],uint64_t scalar[static 4],uint64_t point[static 4]); | 933 | extern void curve25519_pxscalarmul_alt(uint64_t res[S2N_BIGNUM_STATIC 8],const uint64_t scalar[S2N_BIGNUM_STATIC 4],const uint64_t point[S2N_BIGNUM_STATIC 4]); |
| 751 | 934 | ||
| 752 | // x25519 function for curve25519 | 935 | // x25519 function for curve25519 |
| 753 | // Inputs scalar[4], point[4]; output res[4] | 936 | // Inputs scalar[4], point[4]; output res[4] |
| 754 | extern void curve25519_x25519(uint64_t res[static 4],uint64_t scalar[static 4],uint64_t point[static 4]); | 937 | extern void curve25519_x25519(uint64_t res[S2N_BIGNUM_STATIC 4],const uint64_t scalar[S2N_BIGNUM_STATIC 4],const uint64_t point[S2N_BIGNUM_STATIC 4]); |
| 755 | extern void curve25519_x25519_alt(uint64_t res[static 4],uint64_t scalar[static 4],uint64_t point[static 4]); | 938 | extern void curve25519_x25519_alt(uint64_t res[S2N_BIGNUM_STATIC 4],const uint64_t scalar[S2N_BIGNUM_STATIC 4],const uint64_t point[S2N_BIGNUM_STATIC 4]); |
| 939 | |||
| 940 | // x25519 function for curve25519 (byte array arguments) | ||
| 941 | // Inputs scalar[32] (bytes), point[32] (bytes); output res[32] (bytes) | ||
| 942 | extern void curve25519_x25519_byte(uint8_t res[S2N_BIGNUM_STATIC 32],const uint8_t scalar[S2N_BIGNUM_STATIC 32],const uint8_t point[S2N_BIGNUM_STATIC 32]); | ||
| 943 | extern void curve25519_x25519_byte_alt(uint8_t res[S2N_BIGNUM_STATIC 32],const uint8_t scalar[S2N_BIGNUM_STATIC 32],const uint8_t point[S2N_BIGNUM_STATIC 32]); | ||
| 756 | 944 | ||
| 757 | // x25519 function for curve25519 on base element 9 | 945 | // x25519 function for curve25519 on base element 9 |
| 758 | // Input scalar[4]; output res[4] | 946 | // Input scalar[4]; output res[4] |
| 759 | extern void curve25519_x25519base(uint64_t res[static 4],uint64_t scalar[static 4]); | 947 | extern void curve25519_x25519base(uint64_t res[S2N_BIGNUM_STATIC 4],const uint64_t scalar[S2N_BIGNUM_STATIC 4]); |
| 760 | extern void curve25519_x25519base_alt(uint64_t res[static 4],uint64_t scalar[static 4]); | 948 | extern void curve25519_x25519base_alt(uint64_t res[S2N_BIGNUM_STATIC 4],const uint64_t scalar[S2N_BIGNUM_STATIC 4]); |
| 949 | |||
| 950 | // x25519 function for curve25519 on base element 9 (byte array arguments) | ||
| 951 | // Input scalar[32] (bytes); output res[32] (bytes) | ||
| 952 | extern void curve25519_x25519base_byte(uint8_t res[S2N_BIGNUM_STATIC 32],const uint8_t scalar[S2N_BIGNUM_STATIC 32]); | ||
| 953 | extern void curve25519_x25519base_byte_alt(uint8_t res[S2N_BIGNUM_STATIC 32],const uint8_t scalar[S2N_BIGNUM_STATIC 32]); | ||
| 954 | |||
| 955 | // Decode compressed 256-bit form of edwards25519 point | ||
| 956 | // Input c[32] (bytes); output function return and z[8] | ||
| 957 | extern uint64_t edwards25519_decode(uint64_t z[S2N_BIGNUM_STATIC 8], const uint8_t c[S2N_BIGNUM_STATIC 32]); | ||
| 958 | extern uint64_t edwards25519_decode_alt(uint64_t z[S2N_BIGNUM_STATIC 8], const uint8_t c[S2N_BIGNUM_STATIC 32]); | ||
| 959 | |||
| 960 | // Encode edwards25519 point into compressed form as 256-bit number | ||
| 961 | // Input p[8]; output z[32] (bytes) | ||
| 962 | extern void edwards25519_encode(uint8_t z[S2N_BIGNUM_STATIC 32], const uint64_t p[S2N_BIGNUM_STATIC 8]); | ||
| 761 | 963 | ||
| 762 | // Extended projective addition for edwards25519 | 964 | // Extended projective addition for edwards25519 |
| 763 | // Inputs p1[16], p2[16]; output p3[16] | 965 | // Inputs p1[16], p2[16]; output p3[16] |
| 764 | extern void edwards25519_epadd(uint64_t p3[static 16],uint64_t p1[static 16],uint64_t p2[static 16]); | 966 | extern void edwards25519_epadd(uint64_t p3[S2N_BIGNUM_STATIC 16],const uint64_t p1[S2N_BIGNUM_STATIC 16],const uint64_t p2[S2N_BIGNUM_STATIC 16]); |
| 765 | extern void edwards25519_epadd_alt(uint64_t p3[static 16],uint64_t p1[static 16],uint64_t p2[static 16]); | 967 | extern void edwards25519_epadd_alt(uint64_t p3[S2N_BIGNUM_STATIC 16],const uint64_t p1[S2N_BIGNUM_STATIC 16],const uint64_t p2[S2N_BIGNUM_STATIC 16]); |
| 766 | 968 | ||
| 767 | // Extended projective doubling for edwards25519 | 969 | // Extended projective doubling for edwards25519 |
| 768 | // Inputs p1[12]; output p3[16] | 970 | // Inputs p1[12]; output p3[16] |
| 769 | extern void edwards25519_epdouble(uint64_t p3[static 16],uint64_t p1[static 12]); | 971 | extern void edwards25519_epdouble(uint64_t p3[S2N_BIGNUM_STATIC 16],const uint64_t p1[S2N_BIGNUM_STATIC 12]); |
| 770 | extern void edwards25519_epdouble_alt(uint64_t p3[static 16],uint64_t p1[static 12]); | 972 | extern void edwards25519_epdouble_alt(uint64_t p3[S2N_BIGNUM_STATIC 16],const uint64_t p1[S2N_BIGNUM_STATIC 12]); |
| 771 | 973 | ||
| 772 | // Projective doubling for edwards25519 | 974 | // Projective doubling for edwards25519 |
| 773 | // Inputs p1[12]; output p3[12] | 975 | // Inputs p1[12]; output p3[12] |
| 774 | extern void edwards25519_pdouble(uint64_t p3[static 12],uint64_t p1[static 12]); | 976 | extern void edwards25519_pdouble(uint64_t p3[S2N_BIGNUM_STATIC 12],const uint64_t p1[S2N_BIGNUM_STATIC 12]); |
| 775 | extern void edwards25519_pdouble_alt(uint64_t p3[static 12],uint64_t p1[static 12]); | 977 | extern void edwards25519_pdouble_alt(uint64_t p3[S2N_BIGNUM_STATIC 12],const uint64_t p1[S2N_BIGNUM_STATIC 12]); |
| 776 | 978 | ||
| 777 | // Extended projective + precomputed mixed addition for edwards25519 | 979 | // Extended projective + precomputed mixed addition for edwards25519 |
| 778 | // Inputs p1[16], p2[12]; output p3[16] | 980 | // Inputs p1[16], p2[12]; output p3[16] |
| 779 | extern void edwards25519_pepadd(uint64_t p3[static 16],uint64_t p1[static 16],uint64_t p2[static 12]); | 981 | extern void edwards25519_pepadd(uint64_t p3[S2N_BIGNUM_STATIC 16],const uint64_t p1[S2N_BIGNUM_STATIC 16],const uint64_t p2[S2N_BIGNUM_STATIC 12]); |
| 780 | extern void edwards25519_pepadd_alt(uint64_t p3[static 16],uint64_t p1[static 16],uint64_t p2[static 12]); | 982 | extern void edwards25519_pepadd_alt(uint64_t p3[S2N_BIGNUM_STATIC 16],const uint64_t p1[S2N_BIGNUM_STATIC 16],const uint64_t p2[S2N_BIGNUM_STATIC 12]); |
| 983 | |||
| 984 | // Scalar multiplication by standard basepoint for edwards25519 (Ed25519) | ||
| 985 | // Input scalar[4]; output res[8] | ||
| 986 | extern void edwards25519_scalarmulbase(uint64_t res[S2N_BIGNUM_STATIC 8],const uint64_t scalar[S2N_BIGNUM_STATIC 4]); | ||
| 987 | extern void edwards25519_scalarmulbase_alt(uint64_t res[S2N_BIGNUM_STATIC 8],const uint64_t scalar[S2N_BIGNUM_STATIC 4]); | ||
| 988 | |||
| 989 | // Double scalar multiplication for edwards25519, fresh and base point | ||
| 990 | // Input scalar[4], point[8], bscalar[4]; output res[8] | ||
| 991 | extern void edwards25519_scalarmuldouble(uint64_t res[S2N_BIGNUM_STATIC 8],const uint64_t scalar[S2N_BIGNUM_STATIC 4], const uint64_t point[S2N_BIGNUM_STATIC 8],const uint64_t bscalar[S2N_BIGNUM_STATIC 4]); | ||
| 992 | extern void edwards25519_scalarmuldouble_alt(uint64_t res[S2N_BIGNUM_STATIC 8],const uint64_t scalar[S2N_BIGNUM_STATIC 4], const uint64_t point[S2N_BIGNUM_STATIC 8],const uint64_t bscalar[S2N_BIGNUM_STATIC 4]); | ||
| 993 | |||
| 994 | // Scalar product of 2-element polynomial vectors in NTT domain, with mulcache | ||
| 995 | // Inputs a[512], b[512], bt[256] (signed 16-bit words); output r[256] (signed 16-bit words) | ||
| 996 | extern void mlkem_basemul_k2(int16_t r[S2N_BIGNUM_STATIC 256],const int16_t a[S2N_BIGNUM_STATIC 512],const int16_t b[S2N_BIGNUM_STATIC 512],const int16_t bt[S2N_BIGNUM_STATIC 256]); | ||
| 997 | |||
| 998 | // Scalar product of 3-element polynomial vectors in NTT domain, with mulcache | ||
| 999 | // Inputs a[768], b[768], bt[384] (signed 16-bit words); output r[256] (signed 16-bit words) | ||
| 1000 | extern void mlkem_basemul_k3(int16_t r[S2N_BIGNUM_STATIC 256],const int16_t a[S2N_BIGNUM_STATIC 768],const int16_t b[S2N_BIGNUM_STATIC 768],const int16_t bt[S2N_BIGNUM_STATIC 384]); | ||
| 1001 | |||
| 1002 | // Scalar product of 4-element polynomial vectors in NTT domain, with mulcache | ||
| 1003 | // Inputs a[1024], b[1024], bt[512] (signed 16-bit words); output r[256] (signed 16-bit words) | ||
| 1004 | extern void mlkem_basemul_k4(int16_t r[S2N_BIGNUM_STATIC 256],const int16_t a[S2N_BIGNUM_STATIC 1024],const int16_t b[S2N_BIGNUM_STATIC 1024],const int16_t bt[S2N_BIGNUM_STATIC 512]); | ||
| 1005 | |||
| 1006 | // Inverse number-theoretic transform from ML-KEM | ||
| 1007 | // Input a[256] (signed 16-bit words), z_01234[80] (signed 16-bit words), z_56[384] (signed 16-bit words); output a[256] (signed 16-bit words) | ||
| 1008 | extern void mlkem_intt(int16_t a[S2N_BIGNUM_STATIC 256],const int16_t z_01234[S2N_BIGNUM_STATIC 80],const int16_t z_56[S2N_BIGNUM_STATIC 384]); | ||
| 1009 | |||
| 1010 | // Precompute the mulcache data for a polynomial in the NTT domain | ||
| 1011 | // Inputs a[256], z[128] and t[128] (signed 16-bit words); output x[128] (signed 16-bit words) | ||
| 1012 | extern void mlkem_mulcache_compute(int16_t x[S2N_BIGNUM_STATIC 128],const int16_t a[S2N_BIGNUM_STATIC 256],const int16_t z[S2N_BIGNUM_STATIC 128],const int16_t t[S2N_BIGNUM_STATIC 128]); | ||
| 1013 | |||
| 1014 | // Forward number-theoretic transform from ML-KEM | ||
| 1015 | // Input a[256] (signed 16-bit words), z_01234[80] (signed 16-bit words), z_56[384] (signed 16-bit words); output a[256] (signed 16-bit words) | ||
| 1016 | extern void mlkem_ntt(int16_t a[S2N_BIGNUM_STATIC 256],const int16_t z_01234[S2N_BIGNUM_STATIC 80],const int16_t z_56[S2N_BIGNUM_STATIC 384]); | ||
| 1017 | |||
| 1018 | // Canonical modular reduction of polynomial coefficients for ML-KEM | ||
| 1019 | // Input a[256] (signed 16-bit words); output a[256] (signed 16-bit words) | ||
| 1020 | extern void mlkem_reduce(int16_t a[S2N_BIGNUM_STATIC 256]); | ||
| 1021 | |||
| 1022 | // Pack ML-KEM polynomial coefficients as 12-bit numbers | ||
| 1023 | // Input a[256] (signed 16-bit words); output r[384] (bytes) | ||
| 1024 | extern void mlkem_tobytes(uint8_t r[S2N_BIGNUM_STATIC 384],const int16_t a[S2N_BIGNUM_STATIC 256]); | ||
| 1025 | |||
| 1026 | // Conversion of ML-KEM polynomial coefficients to Montgomery form | ||
| 1027 | // Input a[256] (signed 16-bit words); output a[256] (signed 16-bit words) | ||
| 1028 | extern void mlkem_tomont(int16_t a[S2N_BIGNUM_STATIC 256]); | ||
| 1029 | |||
| 1030 | // Uniform rejection sampling for ML-KEM | ||
| 1031 | // Inputs *buf (unsigned bytes), buflen, table (unsigned bytes); output r[256] (signed 16-bit words), return | ||
| 1032 | extern uint64_t mlkem_rej_uniform_VARIABLE_TIME(int16_t r[S2N_BIGNUM_STATIC 256],const uint8_t *buf,uint64_t buflen,const uint8_t *table); | ||
| 781 | 1033 | ||
| 782 | // Point addition on NIST curve P-256 in Montgomery-Jacobian coordinates | 1034 | // Point addition on NIST curve P-256 in Montgomery-Jacobian coordinates |
| 783 | // Inputs p1[12], p2[12]; output p3[12] | 1035 | // Inputs p1[12], p2[12]; output p3[12] |
| 784 | extern void p256_montjadd(uint64_t p3[static 12],uint64_t p1[static 12],uint64_t p2[static 12]); | 1036 | extern void p256_montjadd(uint64_t p3[S2N_BIGNUM_STATIC 12],const uint64_t p1[S2N_BIGNUM_STATIC 12],const uint64_t p2[S2N_BIGNUM_STATIC 12]); |
| 1037 | extern void p256_montjadd_alt(uint64_t p3[S2N_BIGNUM_STATIC 12],const uint64_t p1[S2N_BIGNUM_STATIC 12],const uint64_t p2[S2N_BIGNUM_STATIC 12]); | ||
| 785 | 1038 | ||
| 786 | // Point doubling on NIST curve P-256 in Montgomery-Jacobian coordinates | 1039 | // Point doubling on NIST curve P-256 in Montgomery-Jacobian coordinates |
| 787 | // Inputs p1[12]; output p3[12] | 1040 | // Inputs p1[12]; output p3[12] |
| 788 | extern void p256_montjdouble(uint64_t p3[static 12],uint64_t p1[static 12]); | 1041 | extern void p256_montjdouble(uint64_t p3[S2N_BIGNUM_STATIC 12],const uint64_t p1[S2N_BIGNUM_STATIC 12]); |
| 1042 | extern void p256_montjdouble_alt(uint64_t p3[S2N_BIGNUM_STATIC 12],const uint64_t p1[S2N_BIGNUM_STATIC 12]); | ||
| 789 | 1043 | ||
| 790 | // Point mixed addition on NIST curve P-256 in Montgomery-Jacobian coordinates | 1044 | // Point mixed addition on NIST curve P-256 in Montgomery-Jacobian coordinates |
| 791 | // Inputs p1[12], p2[8]; output p3[12] | 1045 | // Inputs p1[12], p2[8]; output p3[12] |
| 792 | extern void p256_montjmixadd(uint64_t p3[static 12],uint64_t p1[static 12],uint64_t p2[static 8]); | 1046 | extern void p256_montjmixadd(uint64_t p3[S2N_BIGNUM_STATIC 12],const uint64_t p1[S2N_BIGNUM_STATIC 12],const uint64_t p2[S2N_BIGNUM_STATIC 8]); |
| 1047 | extern void p256_montjmixadd_alt(uint64_t p3[S2N_BIGNUM_STATIC 12],const uint64_t p1[S2N_BIGNUM_STATIC 12],const uint64_t p2[S2N_BIGNUM_STATIC 8]); | ||
| 1048 | |||
| 1049 | // Montgomery-Jacobian form scalar multiplication for P-256 | ||
| 1050 | // Input scalar[4], point[12]; output res[12] | ||
| 1051 | extern void p256_montjscalarmul(uint64_t res[S2N_BIGNUM_STATIC 12],const uint64_t scalar[S2N_BIGNUM_STATIC 4],const uint64_t point[S2N_BIGNUM_STATIC 12]); | ||
| 1052 | extern void p256_montjscalarmul_alt(uint64_t res[S2N_BIGNUM_STATIC 12],const uint64_t scalar[S2N_BIGNUM_STATIC 4],const uint64_t point[S2N_BIGNUM_STATIC 12]); | ||
| 1053 | |||
| 1054 | // Scalar multiplication for NIST curve P-256 | ||
| 1055 | // Input scalar[4], point[8]; output res[8] | ||
| 1056 | extern void p256_scalarmul(uint64_t res[S2N_BIGNUM_STATIC 8],const uint64_t scalar[S2N_BIGNUM_STATIC 4],const uint64_t point[S2N_BIGNUM_STATIC 8]); | ||
| 1057 | extern void p256_scalarmul_alt(uint64_t res[S2N_BIGNUM_STATIC 8],const uint64_t scalar[S2N_BIGNUM_STATIC 4],const uint64_t point[S2N_BIGNUM_STATIC 8]); | ||
| 1058 | |||
| 1059 | // Scalar multiplication for precomputed point on NIST curve P-256 | ||
| 1060 | // Input scalar[4], blocksize, table[]; output res[8] | ||
| 1061 | extern void p256_scalarmulbase(uint64_t res[S2N_BIGNUM_STATIC 8],const uint64_t scalar[S2N_BIGNUM_STATIC 4],uint64_t blocksize,const uint64_t *table); | ||
| 1062 | extern void p256_scalarmulbase_alt(uint64_t res[S2N_BIGNUM_STATIC 8],const uint64_t scalar[S2N_BIGNUM_STATIC 4],uint64_t blocksize,const uint64_t *table); | ||
| 793 | 1063 | ||
| 794 | // Point addition on NIST curve P-384 in Montgomery-Jacobian coordinates | 1064 | // Point addition on NIST curve P-384 in Montgomery-Jacobian coordinates |
| 795 | // Inputs p1[18], p2[18]; output p3[18] | 1065 | // Inputs p1[18], p2[18]; output p3[18] |
| 796 | extern void p384_montjadd(uint64_t p3[static 18],uint64_t p1[static 18],uint64_t p2[static 18]); | 1066 | extern void p384_montjadd(uint64_t p3[S2N_BIGNUM_STATIC 18],const uint64_t p1[S2N_BIGNUM_STATIC 18],const uint64_t p2[S2N_BIGNUM_STATIC 18]); |
| 1067 | extern void p384_montjadd_alt(uint64_t p3[S2N_BIGNUM_STATIC 18],const uint64_t p1[S2N_BIGNUM_STATIC 18],const uint64_t p2[S2N_BIGNUM_STATIC 18]); | ||
| 797 | 1068 | ||
| 798 | // Point doubling on NIST curve P-384 in Montgomery-Jacobian coordinates | 1069 | // Point doubling on NIST curve P-384 in Montgomery-Jacobian coordinates |
| 799 | // Inputs p1[18]; output p3[18] | 1070 | // Inputs p1[18]; output p3[18] |
| 800 | extern void p384_montjdouble(uint64_t p3[static 18],uint64_t p1[static 18]); | 1071 | extern void p384_montjdouble(uint64_t p3[S2N_BIGNUM_STATIC 18],const uint64_t p1[S2N_BIGNUM_STATIC 18]); |
| 1072 | extern void p384_montjdouble_alt(uint64_t p3[S2N_BIGNUM_STATIC 18],const uint64_t p1[S2N_BIGNUM_STATIC 18]); | ||
| 801 | 1073 | ||
| 802 | // Point mixed addition on NIST curve P-384 in Montgomery-Jacobian coordinates | 1074 | // Point mixed addition on NIST curve P-384 in Montgomery-Jacobian coordinates |
| 803 | // Inputs p1[18], p2[12]; output p3[18] | 1075 | // Inputs p1[18], p2[12]; output p3[18] |
| 804 | extern void p384_montjmixadd(uint64_t p3[static 18],uint64_t p1[static 18],uint64_t p2[static 12]); | 1076 | extern void p384_montjmixadd(uint64_t p3[S2N_BIGNUM_STATIC 18],const uint64_t p1[S2N_BIGNUM_STATIC 18],const uint64_t p2[S2N_BIGNUM_STATIC 12]); |
| 1077 | extern void p384_montjmixadd_alt(uint64_t p3[S2N_BIGNUM_STATIC 18],const uint64_t p1[S2N_BIGNUM_STATIC 18],const uint64_t p2[S2N_BIGNUM_STATIC 12]); | ||
| 1078 | |||
| 1079 | // Montgomery-Jacobian form scalar multiplication for P-384 | ||
| 1080 | // Input scalar[6], point[18]; output res[18] | ||
| 1081 | extern void p384_montjscalarmul(uint64_t res[S2N_BIGNUM_STATIC 18],const uint64_t scalar[S2N_BIGNUM_STATIC 6],const uint64_t point[S2N_BIGNUM_STATIC 18]); | ||
| 1082 | extern void p384_montjscalarmul_alt(uint64_t res[S2N_BIGNUM_STATIC 18],const uint64_t scalar[S2N_BIGNUM_STATIC 6],const uint64_t point[S2N_BIGNUM_STATIC 18]); | ||
| 805 | 1083 | ||
| 806 | // Point addition on NIST curve P-521 in Jacobian coordinates | 1084 | // Point addition on NIST curve P-521 in Jacobian coordinates |
| 807 | // Inputs p1[27], p2[27]; output p3[27] | 1085 | // Inputs p1[27], p2[27]; output p3[27] |
| 808 | extern void p521_jadd(uint64_t p3[static 27],uint64_t p1[static 27],uint64_t p2[static 27]); | 1086 | extern void p521_jadd(uint64_t p3[S2N_BIGNUM_STATIC 27],const uint64_t p1[S2N_BIGNUM_STATIC 27],const uint64_t p2[S2N_BIGNUM_STATIC 27]); |
| 1087 | extern void p521_jadd_alt(uint64_t p3[S2N_BIGNUM_STATIC 27],const uint64_t p1[S2N_BIGNUM_STATIC 27],const uint64_t p2[S2N_BIGNUM_STATIC 27]); | ||
| 809 | 1088 | ||
| 810 | // Point doubling on NIST curve P-521 in Jacobian coordinates | 1089 | // Point doubling on NIST curve P-521 in Jacobian coordinates |
| 811 | // Input p1[27]; output p3[27] | 1090 | // Input p1[27]; output p3[27] |
| 812 | extern void p521_jdouble(uint64_t p3[static 27],uint64_t p1[static 27]); | 1091 | extern void p521_jdouble(uint64_t p3[S2N_BIGNUM_STATIC 27],const uint64_t p1[S2N_BIGNUM_STATIC 27]); |
| 1092 | extern void p521_jdouble_alt(uint64_t p3[S2N_BIGNUM_STATIC 27],const uint64_t p1[S2N_BIGNUM_STATIC 27]); | ||
| 813 | 1093 | ||
| 814 | // Point mixed addition on NIST curve P-521 in Jacobian coordinates | 1094 | // Point mixed addition on NIST curve P-521 in Jacobian coordinates |
| 815 | // Inputs p1[27], p2[18]; output p3[27] | 1095 | // Inputs p1[27], p2[18]; output p3[27] |
| 816 | extern void p521_jmixadd(uint64_t p3[static 27],uint64_t p1[static 27],uint64_t p2[static 18]); | 1096 | extern void p521_jmixadd(uint64_t p3[S2N_BIGNUM_STATIC 27],const uint64_t p1[S2N_BIGNUM_STATIC 27],const uint64_t p2[S2N_BIGNUM_STATIC 18]); |
| 1097 | extern void p521_jmixadd_alt(uint64_t p3[S2N_BIGNUM_STATIC 27],const uint64_t p1[S2N_BIGNUM_STATIC 27],const uint64_t p2[S2N_BIGNUM_STATIC 18]); | ||
| 1098 | |||
| 1099 | // Jacobian form scalar multiplication for P-521 | ||
| 1100 | // Input scalar[9], point[27]; output res[27] | ||
| 1101 | extern void p521_jscalarmul(uint64_t res[S2N_BIGNUM_STATIC 27],const uint64_t scalar[S2N_BIGNUM_STATIC 9],const uint64_t point[S2N_BIGNUM_STATIC 27]); | ||
| 1102 | extern void p521_jscalarmul_alt(uint64_t res[S2N_BIGNUM_STATIC 27],const uint64_t scalar[S2N_BIGNUM_STATIC 9],const uint64_t point[S2N_BIGNUM_STATIC 27]); | ||
| 817 | 1103 | ||
| 818 | // Point addition on SECG curve secp256k1 in Jacobian coordinates | 1104 | // Point addition on SECG curve secp256k1 in Jacobian coordinates |
| 819 | // Inputs p1[12], p2[12]; output p3[12] | 1105 | // Inputs p1[12], p2[12]; output p3[12] |
| 820 | extern void secp256k1_jadd(uint64_t p3[static 12],uint64_t p1[static 12],uint64_t p2[static 12]); | 1106 | extern void secp256k1_jadd(uint64_t p3[S2N_BIGNUM_STATIC 12],const uint64_t p1[S2N_BIGNUM_STATIC 12],const uint64_t p2[S2N_BIGNUM_STATIC 12]); |
| 1107 | extern void secp256k1_jadd_alt(uint64_t p3[S2N_BIGNUM_STATIC 12],const uint64_t p1[S2N_BIGNUM_STATIC 12],const uint64_t p2[S2N_BIGNUM_STATIC 12]); | ||
| 821 | 1108 | ||
| 822 | // Point doubling on SECG curve secp256k1 in Jacobian coordinates | 1109 | // Point doubling on SECG curve secp256k1 in Jacobian coordinates |
| 823 | // Input p1[12]; output p3[12] | 1110 | // Input p1[12]; output p3[12] |
| 824 | extern void secp256k1_jdouble(uint64_t p3[static 12],uint64_t p1[static 12]); | 1111 | extern void secp256k1_jdouble(uint64_t p3[S2N_BIGNUM_STATIC 12],const uint64_t p1[S2N_BIGNUM_STATIC 12]); |
| 1112 | extern void secp256k1_jdouble_alt(uint64_t p3[S2N_BIGNUM_STATIC 12],const uint64_t p1[S2N_BIGNUM_STATIC 12]); | ||
| 825 | 1113 | ||
| 826 | // Point mixed addition on SECG curve secp256k1 in Jacobian coordinates | 1114 | // Point mixed addition on SECG curve secp256k1 in Jacobian coordinates |
| 827 | // Inputs p1[12], p2[8]; output p3[12] | 1115 | // Inputs p1[12], p2[8]; output p3[12] |
| 828 | extern void secp256k1_jmixadd(uint64_t p3[static 12],uint64_t p1[static 12],uint64_t p2[static 8]); | 1116 | extern void secp256k1_jmixadd(uint64_t p3[S2N_BIGNUM_STATIC 12],const uint64_t p1[S2N_BIGNUM_STATIC 12],const uint64_t p2[S2N_BIGNUM_STATIC 8]); |
| 1117 | extern void secp256k1_jmixadd_alt(uint64_t p3[S2N_BIGNUM_STATIC 12],const uint64_t p1[S2N_BIGNUM_STATIC 12],const uint64_t p2[S2N_BIGNUM_STATIC 8]); | ||
| 1118 | |||
| 1119 | // Keccak-f1600 permutation for SHA3 | ||
| 1120 | // Inputs a[25], rc[24]; output a[25] | ||
| 1121 | extern void sha3_keccak_f1600(uint64_t a[S2N_BIGNUM_STATIC 25],const uint64_t rc[S2N_BIGNUM_STATIC 24]); | ||
| 1122 | extern void sha3_keccak_f1600_alt(uint64_t a[S2N_BIGNUM_STATIC 25],const uint64_t rc[S2N_BIGNUM_STATIC 24]); | ||
| 1123 | |||
| 1124 | // Batched 2-way Keccak-f1600 permutation for SHA3 | ||
| 1125 | // Inputs a[50], rc[24]; output a[50] | ||
| 1126 | extern void sha3_keccak2_f1600(uint64_t a[S2N_BIGNUM_STATIC 50],const uint64_t rc[S2N_BIGNUM_STATIC 24]); | ||
| 1127 | extern void sha3_keccak2_f1600_alt(uint64_t a[S2N_BIGNUM_STATIC 50],const uint64_t rc[S2N_BIGNUM_STATIC 24]); | ||
| 1128 | |||
| 1129 | // Batched 4-way Keccak-f1600 permutation for SHA3 | ||
| 1130 | // Inputs a[100], rc[24]; output a[100] | ||
| 1131 | extern void sha3_keccak4_f1600(uint64_t a[S2N_BIGNUM_STATIC 100],const uint64_t rc[S2N_BIGNUM_STATIC 24]); | ||
| 1132 | extern void sha3_keccak4_f1600_alt(uint64_t a[S2N_BIGNUM_STATIC 100],const uint64_t rc[S2N_BIGNUM_STATIC 24]); | ||
| 1133 | extern void sha3_keccak4_f1600_alt2(uint64_t a[S2N_BIGNUM_STATIC 100],const uint64_t rc[S2N_BIGNUM_STATIC 24]); | ||
| 1134 | |||
| 1135 | // Point addition on CC curve SM2 in Montgomery-Jacobian coordinates | ||
| 1136 | // Inputs p1[12], p2[12]; output p3[12] | ||
| 1137 | extern void sm2_montjadd(uint64_t p3[S2N_BIGNUM_STATIC 12],const uint64_t p1[S2N_BIGNUM_STATIC 12],const uint64_t p2[S2N_BIGNUM_STATIC 12]); | ||
| 1138 | extern void sm2_montjadd_alt(uint64_t p3[S2N_BIGNUM_STATIC 12],const uint64_t p1[S2N_BIGNUM_STATIC 12],const uint64_t p2[S2N_BIGNUM_STATIC 12]); | ||
| 1139 | |||
| 1140 | // Point doubling on CC curve SM2 in Montgomery-Jacobian coordinates | ||
| 1141 | // Inputs p1[12]; output p3[12] | ||
| 1142 | extern void sm2_montjdouble(uint64_t p3[S2N_BIGNUM_STATIC 12],const uint64_t p1[S2N_BIGNUM_STATIC 12]); | ||
| 1143 | extern void sm2_montjdouble_alt(uint64_t p3[S2N_BIGNUM_STATIC 12],const uint64_t p1[S2N_BIGNUM_STATIC 12]); | ||
| 1144 | |||
| 1145 | // Point mixed addition on CC curve SM2 in Montgomery-Jacobian coordinates | ||
| 1146 | // Inputs p1[12], p2[8]; output p3[12] | ||
| 1147 | extern void sm2_montjmixadd(uint64_t p3[S2N_BIGNUM_STATIC 12],const uint64_t p1[S2N_BIGNUM_STATIC 12],const uint64_t p2[S2N_BIGNUM_STATIC 8]); | ||
| 1148 | extern void sm2_montjmixadd_alt(uint64_t p3[S2N_BIGNUM_STATIC 12],const uint64_t p1[S2N_BIGNUM_STATIC 12],const uint64_t p2[S2N_BIGNUM_STATIC 8]); | ||
| 1149 | |||
| 1150 | // Montgomery-Jacobian form scalar multiplication for CC curve SM2 | ||
| 1151 | // Input scalar[4], point[12]; output res[12] | ||
| 1152 | extern void sm2_montjscalarmul(uint64_t res[S2N_BIGNUM_STATIC 12],const uint64_t scalar[S2N_BIGNUM_STATIC 4],const uint64_t point[S2N_BIGNUM_STATIC 12]); | ||
| 1153 | extern void sm2_montjscalarmul_alt(uint64_t res[S2N_BIGNUM_STATIC 12],const uint64_t scalar[S2N_BIGNUM_STATIC 4],const uint64_t point[S2N_BIGNUM_STATIC 12]); | ||
| 829 | 1154 | ||
| 830 | // Reverse the bytes in a single word | 1155 | // Reverse the bytes in a single word |
| 831 | // Input a; output function return | 1156 | // Input a; output function return |
| @@ -839,6 +1164,10 @@ extern uint64_t word_clz (uint64_t a); | |||
| 839 | // Input a; output function return | 1164 | // Input a; output function return |
| 840 | extern uint64_t word_ctz (uint64_t a); | 1165 | extern uint64_t word_ctz (uint64_t a); |
| 841 | 1166 | ||
| 1167 | // Perform 59 "divstep" iterations and return signed matrix of updates | ||
| 1168 | // Inputs d, f, g; output m[2][2] and function return | ||
| 1169 | extern int64_t word_divstep59(int64_t m[2][2],int64_t d,uint64_t f,uint64_t g); | ||
| 1170 | |||
| 842 | // Return maximum of two unsigned 64-bit words | 1171 | // Return maximum of two unsigned 64-bit words |
| 843 | // Inputs a, b; output function return | 1172 | // Inputs a, b; output function return |
| 844 | extern uint64_t word_max (uint64_t a, uint64_t b); | 1173 | extern uint64_t word_max (uint64_t a, uint64_t b); |
| @@ -851,6 +1180,10 @@ extern uint64_t word_min (uint64_t a, uint64_t b); | |||
| 851 | // Input a; output function return | 1180 | // Input a; output function return |
| 852 | extern uint64_t word_negmodinv (uint64_t a); | 1181 | extern uint64_t word_negmodinv (uint64_t a); |
| 853 | 1182 | ||
| 1183 | // Count number of set bits in a single 64-bit word (population count) | ||
| 1184 | // Input a; output function return | ||
| 1185 | extern uint64_t word_popcount (uint64_t a); | ||
| 1186 | |||
| 854 | // Single-word reciprocal, 2^64 + ret = ceil(2^128/a) - 1 if MSB of "a" is set | 1187 | // Single-word reciprocal, 2^64 + ret = ceil(2^128/a) - 1 if MSB of "a" is set |
| 855 | // Input a; output function return | 1188 | // Input a; output function return |
| 856 | extern uint64_t word_recip (uint64_t a); | 1189 | extern uint64_t word_recip (uint64_t a); |
diff --git a/src/lib/libcrypto/bn/s2n_bignum_internal.h b/src/lib/libcrypto/bn/s2n_bignum_internal.h index b82db7d019..37eebb4fd6 100644 --- a/src/lib/libcrypto/bn/s2n_bignum_internal.h +++ b/src/lib/libcrypto/bn/s2n_bignum_internal.h | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | // $OpenBSD: s2n_bignum_internal.h,v 1.5 2025/08/12 10:01:37 jsing Exp $ | ||
| 2 | // | ||
| 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | 3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | // | 4 | // |
| 3 | // Permission to use, copy, modify, and/or distribute this software for any | 5 | // Permission to use, copy, modify, and/or distribute this software for any |
| @@ -14,14 +16,14 @@ | |||
| 14 | 16 | ||
| 15 | #ifdef __APPLE__ | 17 | #ifdef __APPLE__ |
| 16 | # define S2N_BN_SYMBOL(NAME) _##NAME | 18 | # define S2N_BN_SYMBOL(NAME) _##NAME |
| 19 | # if defined(__AARCH64EL__) || defined(__ARMEL__) | ||
| 20 | # define __LF %% | ||
| 21 | # else | ||
| 22 | # define __LF ; | ||
| 23 | # endif | ||
| 17 | #else | 24 | #else |
| 18 | # define S2N_BN_SYMBOL(name) name | 25 | # define S2N_BN_SYMBOL(name) name |
| 19 | #endif | 26 | # define __LF ; |
| 20 | |||
| 21 | #ifdef __CET__ | ||
| 22 | # include <cet.h> | ||
| 23 | #else | ||
| 24 | # define _CET_ENDBR | ||
| 25 | #endif | 27 | #endif |
| 26 | 28 | ||
| 27 | #define S2N_BN_SYM_VISIBILITY_DIRECTIVE(name) .globl S2N_BN_SYMBOL(name) | 29 | #define S2N_BN_SYM_VISIBILITY_DIRECTIVE(name) .globl S2N_BN_SYMBOL(name) |
| @@ -34,3 +36,24 @@ | |||
| 34 | #else | 36 | #else |
| 35 | # define S2N_BN_SYM_PRIVACY_DIRECTIVE(name) /* NO-OP: S2N_BN_SYM_PRIVACY_DIRECTIVE */ | 37 | # define S2N_BN_SYM_PRIVACY_DIRECTIVE(name) /* NO-OP: S2N_BN_SYM_PRIVACY_DIRECTIVE */ |
| 36 | #endif | 38 | #endif |
| 39 | |||
| 40 | // Enable indirect branch tracking support unless explicitly disabled | ||
| 41 | // with -DNO_IBT. If the platform supports CET, simply inherit this from | ||
| 42 | // the usual header. Otherwise manually define _CET_ENDBR, used at each | ||
| 43 | // x86 entry point, to be the ENDBR64 instruction, with an explicit byte | ||
| 44 | // sequence for compilers/assemblers that don't know about it. Note that | ||
| 45 | // it is safe to use ENDBR64 on all platforms, since the encoding is by | ||
| 46 | // design interpreted as a NOP on all pre-CET x86_64 processors. The only | ||
| 47 | // downside is a small increase in code size and potentially a modest | ||
| 48 | // slowdown from executing one more instruction. | ||
| 49 | |||
| 50 | #if NO_IBT | ||
| 51 | # if defined(_CET_ENDBR) | ||
| 52 | # error "The s2n-bignum build option NO_IBT was configured, but _CET_ENDBR is defined in this compilation unit. That is weird, so failing the build." | ||
| 53 | # endif | ||
| 54 | # define _CET_ENDBR | ||
| 55 | #elif defined(__CET__) | ||
| 56 | # include <cet.h> | ||
| 57 | #elif !defined(_CET_ENDBR) | ||
| 58 | # define _CET_ENDBR .byte 0xf3,0x0f,0x1e,0xfa | ||
| 59 | #endif | ||
diff --git a/src/lib/libcrypto/buffer/buffer.c b/src/lib/libcrypto/buffer/buffer.c index 51ce90ff80..4a0c17c598 100644 --- a/src/lib/libcrypto/buffer/buffer.c +++ b/src/lib/libcrypto/buffer/buffer.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: buffer.c,v 1.28 2023/07/08 08:26:26 beck Exp $ */ | 1 | /* $OpenBSD: buffer.c,v 1.29 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -61,7 +61,8 @@ | |||
| 61 | #include <string.h> | 61 | #include <string.h> |
| 62 | 62 | ||
| 63 | #include <openssl/buffer.h> | 63 | #include <openssl/buffer.h> |
| 64 | #include <openssl/err.h> | 64 | |
| 65 | #include "err_local.h" | ||
| 65 | 66 | ||
| 66 | /* | 67 | /* |
| 67 | * LIMIT_BEFORE_EXPANSION is the maximum n such that (n + 3) / 3 * 4 < 2**31. | 68 | * LIMIT_BEFORE_EXPANSION is the maximum n such that (n + 3) / 3 * 4 < 2**31. |
diff --git a/src/lib/libcrypto/cast/cast_local.h b/src/lib/libcrypto/cast/cast_local.h index 5fb9911105..c8b89071c5 100644 --- a/src/lib/libcrypto/cast/cast_local.h +++ b/src/lib/libcrypto/cast/cast_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cast_local.h,v 1.2 2023/07/08 07:25:43 jsing Exp $ */ | 1 | /* $OpenBSD: cast_local.h,v 1.3 2025/11/26 10:19:57 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -56,6 +56,9 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #ifndef HEADER_CAST_LOCAL_H | ||
| 60 | #define HEADER_CAST_LOCAL_H | ||
| 61 | |||
| 59 | #undef c2l | 62 | #undef c2l |
| 60 | #define c2l(c,l) (l =((unsigned long)(*((c)++))) , \ | 63 | #define c2l(c,l) (l =((unsigned long)(*((c)++))) , \ |
| 61 | l|=((unsigned long)(*((c)++)))<< 8L, \ | 64 | l|=((unsigned long)(*((c)++)))<< 8L, \ |
| @@ -214,3 +217,5 @@ extern const CAST_LONG CAST_S_table4[256]; | |||
| 214 | extern const CAST_LONG CAST_S_table5[256]; | 217 | extern const CAST_LONG CAST_S_table5[256]; |
| 215 | extern const CAST_LONG CAST_S_table6[256]; | 218 | extern const CAST_LONG CAST_S_table6[256]; |
| 216 | extern const CAST_LONG CAST_S_table7[256]; | 219 | extern const CAST_LONG CAST_S_table7[256]; |
| 220 | |||
| 221 | #endif /* HEADER_CAST_LOCAL_H */ | ||
diff --git a/src/lib/libcrypto/cert.pem b/src/lib/libcrypto/cert.pem index a7fd3519fb..7031ac8fe8 100644 --- a/src/lib/libcrypto/cert.pem +++ b/src/lib/libcrypto/cert.pem | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: cert.pem,v 1.31 2025/03/16 07:44:35 tb Exp $ | 1 | # $OpenBSD: cert.pem,v 1.33 2025/11/17 20:15:35 sthen Exp $ |
| 2 | ### /C=ES/CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 | 2 | ### /C=ES/CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 |
| 3 | 3 | ||
| 4 | === /C=ES/CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 | 4 | === /C=ES/CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 |
| @@ -960,49 +960,6 @@ AgEGMAoGCCqGSM49BAMDA2gAMGUCMBq8W9f+qdJUDkpd0m2xQNz0Q9XSSpkZElaA | |||
| 960 | 43j4ptZLvZuHjw/l1lOWqzzIQNph91Oj9w== | 960 | 43j4ptZLvZuHjw/l1lOWqzzIQNph91Oj9w== |
| 961 | -----END CERTIFICATE----- | 961 | -----END CERTIFICATE----- |
| 962 | 962 | ||
| 963 | ### Baltimore | ||
| 964 | |||
| 965 | === /C=IE/O=Baltimore/OU=CyberTrust/CN=Baltimore CyberTrust Root | ||
| 966 | Certificate: | ||
| 967 | Data: | ||
| 968 | Version: 3 (0x2) | ||
| 969 | Serial Number: 33554617 (0x20000b9) | ||
| 970 | Signature Algorithm: sha1WithRSAEncryption | ||
| 971 | Validity | ||
| 972 | Not Before: May 12 18:46:00 2000 GMT | ||
| 973 | Not After : May 12 23:59:00 2025 GMT | ||
| 974 | Subject: C=IE, O=Baltimore, OU=CyberTrust, CN=Baltimore CyberTrust Root | ||
| 975 | X509v3 extensions: | ||
| 976 | X509v3 Subject Key Identifier: | ||
| 977 | E5:9D:59:30:82:47:58:CC:AC:FA:08:54:36:86:7B:3A:B5:04:4D:F0 | ||
| 978 | X509v3 Basic Constraints: critical | ||
| 979 | CA:TRUE, pathlen:3 | ||
| 980 | X509v3 Key Usage: critical | ||
| 981 | Certificate Sign, CRL Sign | ||
| 982 | SHA1 Fingerprint=D4:DE:20:D0:5E:66:FC:53:FE:1A:50:88:2C:78:DB:28:52:CA:E4:74 | ||
| 983 | SHA256 Fingerprint=16:AF:57:A9:F6:76:B0:AB:12:60:95:AA:5E:BA:DE:F2:2A:B3:11:19:D6:44:AC:95:CD:4B:93:DB:F3:F2:6A:EB | ||
| 984 | -----BEGIN CERTIFICATE----- | ||
| 985 | MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJ | ||
| 986 | RTESMBAGA1UEChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYD | ||
| 987 | VQQDExlCYWx0aW1vcmUgQ3liZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoX | ||
| 988 | DTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMCSUUxEjAQBgNVBAoTCUJhbHRpbW9y | ||
| 989 | ZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFsdGltb3JlIEN5YmVy | ||
| 990 | VHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKMEuyKr | ||
| 991 | mD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjr | ||
| 992 | IZ3AQSsBUnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeK | ||
| 993 | mpYcqWe4PwzV9/lSEy/CG9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSu | ||
| 994 | XmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9XbIGevOF6uvUA65ehD5f/xXtabz5OTZy | ||
| 995 | dc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjprl3RjM71oGDHweI12v/ye | ||
| 996 | jl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoIVDaGezq1 | ||
| 997 | BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3 | ||
| 998 | DQEBBQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT92 | ||
| 999 | 9hkTI7gQCvlYpNRhcL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3Wgx | ||
| 1000 | jkzSswF07r51XgdIGn9w/xZchMB5hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0 | ||
| 1001 | Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsaY71k5h+3zvDyny67G7fyUIhz | ||
| 1002 | ksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9HRCwBXbsdtTLS | ||
| 1003 | R9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp | ||
| 1004 | -----END CERTIFICATE----- | ||
| 1005 | |||
| 1006 | ### Buypass AS-983163327 | 963 | ### Buypass AS-983163327 |
| 1007 | 964 | ||
| 1008 | === /C=NO/O=Buypass AS-983163327/CN=Buypass Class 2 Root CA | 965 | === /C=NO/O=Buypass AS-983163327/CN=Buypass Class 2 Root CA |
| @@ -1728,61 +1685,6 @@ v64fG9PiO/yzcnMcmyiQiRM9HcEARwmWmjgb3bHPDcK0RPOWlc4yOo80nOAXx17O | |||
| 1728 | rg3bhzjlP1v9mxnhMUF6cKojawHhRUzNlM47ni3niAIi9G7oyOzWPPO5std3eqx7 | 1685 | rg3bhzjlP1v9mxnhMUF6cKojawHhRUzNlM47ni3niAIi9G7oyOzWPPO5std3eqx7 |
| 1729 | -----END CERTIFICATE----- | 1686 | -----END CERTIFICATE----- |
| 1730 | 1687 | ||
| 1731 | ### Comodo CA Limited | ||
| 1732 | |||
| 1733 | === /C=GB/ST=Greater Manchester/L=Salford/O=Comodo CA Limited/CN=AAA Certificate Services | ||
| 1734 | Certificate: | ||
| 1735 | Data: | ||
| 1736 | Version: 3 (0x2) | ||
| 1737 | Serial Number: 1 (0x1) | ||
| 1738 | Signature Algorithm: sha1WithRSAEncryption | ||
| 1739 | Validity | ||
| 1740 | Not Before: Jan 1 00:00:00 2004 GMT | ||
| 1741 | Not After : Dec 31 23:59:59 2028 GMT | ||
| 1742 | Subject: C=GB, ST=Greater Manchester, L=Salford, O=Comodo CA Limited, CN=AAA Certificate Services | ||
| 1743 | X509v3 extensions: | ||
| 1744 | X509v3 Subject Key Identifier: | ||
| 1745 | A0:11:0A:23:3E:96:F1:07:EC:E2:AF:29:EF:82:A5:7F:D0:30:A4:B4 | ||
| 1746 | X509v3 Key Usage: critical | ||
| 1747 | Certificate Sign, CRL Sign | ||
| 1748 | X509v3 Basic Constraints: critical | ||
| 1749 | CA:TRUE | ||
| 1750 | X509v3 CRL Distribution Points: | ||
| 1751 | |||
| 1752 | Full Name: | ||
| 1753 | URI:http://crl.comodoca.com/AAACertificateServices.crl | ||
| 1754 | |||
| 1755 | Full Name: | ||
| 1756 | URI:http://crl.comodo.net/AAACertificateServices.crl | ||
| 1757 | |||
| 1758 | SHA1 Fingerprint=D1:EB:23:A4:6D:17:D6:8F:D9:25:64:C2:F1:F1:60:17:64:D8:E3:49 | ||
| 1759 | SHA256 Fingerprint=D7:A7:A0:FB:5D:7E:27:31:D7:71:E9:48:4E:BC:DE:F7:1D:5F:0C:3E:0A:29:48:78:2B:C8:3E:E0:EA:69:9E:F4 | ||
| 1760 | -----BEGIN CERTIFICATE----- | ||
| 1761 | MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEb | ||
| 1762 | MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow | ||
| 1763 | GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmlj | ||
| 1764 | YXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAwMFoXDTI4MTIzMTIzNTk1OVowezEL | ||
| 1765 | MAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE | ||
| 1766 | BwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNVBAMM | ||
| 1767 | GEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP | ||
| 1768 | ADCCAQoCggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQua | ||
| 1769 | BtDFcCLNSS1UY8y2bmhGC1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe | ||
| 1770 | 3M/vg4aijJRPn2jymJBGhCfHdr/jzDUsi14HZGWCwEiwqJH5YZ92IFCokcdmtet4 | ||
| 1771 | YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszWY19zjNoFmag4qMsXeDZR | ||
| 1772 | rOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjHYpy+g8cm | ||
| 1773 | ez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQU | ||
| 1774 | oBEKIz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF | ||
| 1775 | MAMBAf8wewYDVR0fBHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20v | ||
| 1776 | QUFBQ2VydGlmaWNhdGVTZXJ2aWNlcy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29t | ||
| 1777 | b2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2VzLmNybDANBgkqhkiG9w0BAQUF | ||
| 1778 | AAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm7l3sAg9g1o1Q | ||
| 1779 | GE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz | ||
| 1780 | Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2 | ||
| 1781 | G9w84FoVxp7Z8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsi | ||
| 1782 | l2D4kF501KKaU73yqWjgom7C12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3 | ||
| 1783 | smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg== | ||
| 1784 | -----END CERTIFICATE----- | ||
| 1785 | |||
| 1786 | ### Cybertrust Japan Co., Ltd. | 1688 | ### Cybertrust Japan Co., Ltd. |
| 1787 | 1689 | ||
| 1788 | === /C=JP/O=Cybertrust Japan Co., Ltd./CN=SecureSign Root CA12 | 1690 | === /C=JP/O=Cybertrust Japan Co., Ltd./CN=SecureSign Root CA12 |
| @@ -3070,53 +2972,6 @@ eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0tHuu2guQOHXvgR1m | |||
| 3070 | 0vdXcDazv/wor3ElhVsT/h5/WrQ8 | 2972 | 0vdXcDazv/wor3ElhVsT/h5/WrQ8 |
| 3071 | -----END CERTIFICATE----- | 2973 | -----END CERTIFICATE----- |
| 3072 | 2974 | ||
| 3073 | ### Entrust.net | ||
| 3074 | |||
| 3075 | === /O=Entrust.net/OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)/OU=(c) 1999 Entrust.net Limited/CN=Entrust.net Certification Authority (2048) | ||
| 3076 | Certificate: | ||
| 3077 | Data: | ||
| 3078 | Version: 3 (0x2) | ||
| 3079 | Serial Number: 946069240 (0x3863def8) | ||
| 3080 | Signature Algorithm: sha1WithRSAEncryption | ||
| 3081 | Validity | ||
| 3082 | Not Before: Dec 24 17:50:51 1999 GMT | ||
| 3083 | Not After : Jul 24 14:15:12 2029 GMT | ||
| 3084 | Subject: O=Entrust.net, OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.), OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Certification Authority (2048) | ||
| 3085 | X509v3 extensions: | ||
| 3086 | X509v3 Key Usage: critical | ||
| 3087 | Certificate Sign, CRL Sign | ||
| 3088 | X509v3 Basic Constraints: critical | ||
| 3089 | CA:TRUE | ||
| 3090 | X509v3 Subject Key Identifier: | ||
| 3091 | 55:E4:81:D1:11:80:BE:D8:89:B9:08:A3:31:F9:A1:24:09:16:B9:70 | ||
| 3092 | SHA1 Fingerprint=50:30:06:09:1D:97:D4:F5:AE:39:F7:CB:E7:92:7D:7D:65:2D:34:31 | ||
| 3093 | SHA256 Fingerprint=6D:C4:71:72:E0:1C:BC:B0:BF:62:58:0D:89:5F:E2:B8:AC:9A:D4:F8:73:80:1E:0C:10:B9:C8:37:D2:1E:B1:77 | ||
| 3094 | -----BEGIN CERTIFICATE----- | ||
| 3095 | MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChML | ||
| 3096 | RW50cnVzdC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBp | ||
| 3097 | bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5 | ||
| 3098 | IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNVBAMTKkVudHJ1c3QubmV0IENlcnRp | ||
| 3099 | ZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQxNzUwNTFaFw0yOTA3 | ||
| 3100 | MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3d3d3 | ||
| 3101 | LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxp | ||
| 3102 | YWIuKTElMCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEG | ||
| 3103 | A1UEAxMqRW50cnVzdC5uZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgp | ||
| 3104 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArU1LqRKGsuqjIAcVFmQq | ||
| 3105 | K0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOLGp18EzoOH1u3Hs/lJBQe | ||
| 3106 | sYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSrhRSGlVuX | ||
| 3107 | MlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVT | ||
| 3108 | XTzWnLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/ | ||
| 3109 | HoZdenoVve8AjhUiVBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH | ||
| 3110 | 4QIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV | ||
| 3111 | HQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJKoZIhvcNAQEFBQADggEBADub | ||
| 3112 | j1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPyT/4xmf3IDExo | ||
| 3113 | U8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf | ||
| 3114 | zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5b | ||
| 3115 | u/8j72gZyxKTJ1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+ | ||
| 3116 | bYQLCIt+jerXmCHG8+c8eS9enNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/Er | ||
| 3117 | fF6adulZkMV8gzURZVE= | ||
| 3118 | -----END CERTIFICATE----- | ||
| 3119 | |||
| 3120 | ### FNMT-RCM | 2975 | ### FNMT-RCM |
| 3121 | 2976 | ||
| 3122 | === /C=ES/O=FNMT-RCM/OU=AC RAIZ FNMT-RCM | 2977 | === /C=ES/O=FNMT-RCM/OU=AC RAIZ FNMT-RCM |
| @@ -3559,47 +3414,6 @@ u+YfjyW6hY0XHgL+XVAEV8/+LbzvXMAaq7afJMbfc2hIkCwU9D9SGuTSyxTDYWnP | |||
| 3559 | N3ec592kD3ZDZopD8p/7DEJ4Y9HiD2971KE9dJeFt0g5QdYg/NA6s/rob8SKunE3 | 3414 | N3ec592kD3ZDZopD8p/7DEJ4Y9HiD2971KE9dJeFt0g5QdYg/NA6s/rob8SKunE3 |
| 3560 | vouXsXgxT7PntgMTzlSdriVZzH81Xwj3QEUxeCp6 | 3415 | vouXsXgxT7PntgMTzlSdriVZzH81Xwj3QEUxeCp6 |
| 3561 | -----END CERTIFICATE----- | 3416 | -----END CERTIFICATE----- |
| 3562 | === /C=BE/O=GlobalSign nv-sa/OU=Root CA/CN=GlobalSign Root CA | ||
| 3563 | Certificate: | ||
| 3564 | Data: | ||
| 3565 | Version: 3 (0x2) | ||
| 3566 | Serial Number: | ||
| 3567 | 04:00:00:00:00:01:15:4b:5a:c3:94 | ||
| 3568 | Signature Algorithm: sha1WithRSAEncryption | ||
| 3569 | Validity | ||
| 3570 | Not Before: Sep 1 12:00:00 1998 GMT | ||
| 3571 | Not After : Jan 28 12:00:00 2028 GMT | ||
| 3572 | Subject: C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA | ||
| 3573 | X509v3 extensions: | ||
| 3574 | X509v3 Key Usage: critical | ||
| 3575 | Certificate Sign, CRL Sign | ||
| 3576 | X509v3 Basic Constraints: critical | ||
| 3577 | CA:TRUE | ||
| 3578 | X509v3 Subject Key Identifier: | ||
| 3579 | 60:7B:66:1A:45:0D:97:CA:89:50:2F:7D:04:CD:34:A8:FF:FC:FD:4B | ||
| 3580 | SHA1 Fingerprint=B1:BC:96:8B:D4:F4:9D:62:2A:A8:9A:81:F2:15:01:52:A4:1D:82:9C | ||
| 3581 | SHA256 Fingerprint=EB:D4:10:40:E4:BB:3E:C7:42:C9:E3:81:D3:1E:F2:A4:1A:48:B6:68:5C:96:E7:CE:F3:C1:DF:6C:D4:33:1C:99 | ||
| 3582 | -----BEGIN CERTIFICATE----- | ||
| 3583 | MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG | ||
| 3584 | A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv | ||
| 3585 | b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw | ||
| 3586 | MDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i | ||
| 3587 | YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT | ||
| 3588 | aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ | ||
| 3589 | jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp | ||
| 3590 | xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp | ||
| 3591 | 1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG | ||
| 3592 | snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ | ||
| 3593 | U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8 | ||
| 3594 | 9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E | ||
| 3595 | BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B | ||
| 3596 | AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz | ||
| 3597 | yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE | ||
| 3598 | 38NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP | ||
| 3599 | AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad | ||
| 3600 | DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME | ||
| 3601 | HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A== | ||
| 3602 | -----END CERTIFICATE----- | ||
| 3603 | 3417 | ||
| 3604 | ### GoDaddy.com, Inc. | 3418 | ### GoDaddy.com, Inc. |
| 3605 | 3419 | ||
| @@ -4644,6 +4458,101 @@ uLjbvrW5KfnaNwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2 | |||
| 4644 | XjG4Kvte9nHfRCaexOYNkbQudZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E= | 4458 | XjG4Kvte9nHfRCaexOYNkbQudZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E= |
| 4645 | -----END CERTIFICATE----- | 4459 | -----END CERTIFICATE----- |
| 4646 | 4460 | ||
| 4461 | ### OISTE Foundation | ||
| 4462 | |||
| 4463 | === /C=CH/O=OISTE Foundation/CN=OISTE Server Root ECC G1 | ||
| 4464 | Certificate: | ||
| 4465 | Data: | ||
| 4466 | Version: 3 (0x2) | ||
| 4467 | Serial Number: | ||
| 4468 | 23:f9:c3:d6:35:af:8f:28:4b:1f:f0:54:ea:7e:97:9d | ||
| 4469 | Signature Algorithm: ecdsa-with-SHA384 | ||
| 4470 | Validity | ||
| 4471 | Not Before: May 31 14:42:28 2023 GMT | ||
| 4472 | Not After : May 24 14:42:27 2048 GMT | ||
| 4473 | Subject: C=CH, O=OISTE Foundation, CN=OISTE Server Root ECC G1 | ||
| 4474 | X509v3 extensions: | ||
| 4475 | X509v3 Basic Constraints: critical | ||
| 4476 | CA:TRUE | ||
| 4477 | X509v3 Authority Key Identifier: | ||
| 4478 | keyid:37:4D:88:65:CF:FC:3D:8A:D5:A3:F1:49:C0:4E:0C:10:6F:42:B4:9C | ||
| 4479 | |||
| 4480 | X509v3 Subject Key Identifier: | ||
| 4481 | 37:4D:88:65:CF:FC:3D:8A:D5:A3:F1:49:C0:4E:0C:10:6F:42:B4:9C | ||
| 4482 | X509v3 Key Usage: critical | ||
| 4483 | Digital Signature, Certificate Sign, CRL Sign | ||
| 4484 | SHA1 Fingerprint=3B:F6:8B:09:AE:2A:92:7B:BA:E3:8D:3F:11:95:D9:E6:44:0C:45:E2 | ||
| 4485 | SHA256 Fingerprint=EE:C9:97:C0:C3:0F:21:6F:7E:3B:8B:30:7D:2B:AE:42:41:2D:75:3F:C8:21:9D:AF:D1:52:0B:25:72:85:0F:49 | ||
| 4486 | -----BEGIN CERTIFICATE----- | ||
| 4487 | MIICNTCCAbqgAwIBAgIQI/nD1jWvjyhLH/BU6n6XnTAKBggqhkjOPQQDAzBLMQsw | ||
| 4488 | CQYDVQQGEwJDSDEZMBcGA1UECgwQT0lTVEUgRm91bmRhdGlvbjEhMB8GA1UEAwwY | ||
| 4489 | T0lTVEUgU2VydmVyIFJvb3QgRUNDIEcxMB4XDTIzMDUzMTE0NDIyOFoXDTQ4MDUy | ||
| 4490 | NDE0NDIyN1owSzELMAkGA1UEBhMCQ0gxGTAXBgNVBAoMEE9JU1RFIEZvdW5kYXRp | ||
| 4491 | b24xITAfBgNVBAMMGE9JU1RFIFNlcnZlciBSb290IEVDQyBHMTB2MBAGByqGSM49 | ||
| 4492 | AgEGBSuBBAAiA2IABBcv+hK8rBjzCvRE1nZCnrPoH7d5qVi2+GXROiFPqOujvqQy | ||
| 4493 | cvO2Ackr/XeFblPdreqqLiWStukhEaivtUwL85Zgmjvn6hp4LrQ95SjeHIC6XG4N | ||
| 4494 | 2xml4z+cKrhAS93mT6NjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBQ3 | ||
| 4495 | TYhlz/w9itWj8UnATgwQb0K0nDAdBgNVHQ4EFgQUN02IZc/8PYrVo/FJwE4MEG9C | ||
| 4496 | tJwwDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMDA2kAMGYCMQCpKjAd0MKfkFFR | ||
| 4497 | QD6VVCHNFmb3U2wIFjnQEnx/Yxvf4zgAOdktUyBFCxxgZzFDJe0CMQCSia7pXGKD | ||
| 4498 | YmH5LVerVrkR3SW+ak5KGoJr3M/TvEqzPNcum9v4KGm8ay3sMaE641c= | ||
| 4499 | -----END CERTIFICATE----- | ||
| 4500 | === /C=CH/O=OISTE Foundation/CN=OISTE Server Root RSA G1 | ||
| 4501 | Certificate: | ||
| 4502 | Data: | ||
| 4503 | Version: 3 (0x2) | ||
| 4504 | Serial Number: | ||
| 4505 | 55:a5:d9:67:94:28:c6:ed:0c:fa:27:dd:5b:01:4d:18 | ||
| 4506 | Signature Algorithm: sha384WithRSAEncryption | ||
| 4507 | Validity | ||
| 4508 | Not Before: May 31 14:37:16 2023 GMT | ||
| 4509 | Not After : May 24 14:37:15 2048 GMT | ||
| 4510 | Subject: C=CH, O=OISTE Foundation, CN=OISTE Server Root RSA G1 | ||
| 4511 | X509v3 extensions: | ||
| 4512 | X509v3 Basic Constraints: critical | ||
| 4513 | CA:TRUE | ||
| 4514 | X509v3 Authority Key Identifier: | ||
| 4515 | keyid:F2:C9:C1:0F:0D:63:00:BB:EC:45:0E:4A:1F:B5:B1:B3:36:CD:0E:8D | ||
| 4516 | |||
| 4517 | X509v3 Subject Key Identifier: | ||
| 4518 | F2:C9:C1:0F:0D:63:00:BB:EC:45:0E:4A:1F:B5:B1:B3:36:CD:0E:8D | ||
| 4519 | X509v3 Key Usage: critical | ||
| 4520 | Digital Signature, Certificate Sign, CRL Sign | ||
| 4521 | SHA1 Fingerprint=F7:00:34:25:94:88:68:31:E4:34:87:3F:70:FE:86:B3:86:9F:F0:6E | ||
| 4522 | SHA256 Fingerprint=9A:E3:62:32:A5:18:9F:FD:DB:35:3D:FD:26:52:0C:01:53:95:D2:27:77:DA:C5:9D:B5:7B:98:C0:89:A6:51:E6 | ||
| 4523 | -----BEGIN CERTIFICATE----- | ||
| 4524 | MIIFgzCCA2ugAwIBAgIQVaXZZ5Qoxu0M+ifdWwFNGDANBgkqhkiG9w0BAQwFADBL | ||
| 4525 | MQswCQYDVQQGEwJDSDEZMBcGA1UECgwQT0lTVEUgRm91bmRhdGlvbjEhMB8GA1UE | ||
| 4526 | AwwYT0lTVEUgU2VydmVyIFJvb3QgUlNBIEcxMB4XDTIzMDUzMTE0MzcxNloXDTQ4 | ||
| 4527 | MDUyNDE0MzcxNVowSzELMAkGA1UEBhMCQ0gxGTAXBgNVBAoMEE9JU1RFIEZvdW5k | ||
| 4528 | YXRpb24xITAfBgNVBAMMGE9JU1RFIFNlcnZlciBSb290IFJTQSBHMTCCAiIwDQYJ | ||
| 4529 | KoZIhvcNAQEBBQADggIPADCCAgoCggIBAKqu9KuCz/vlNwvn1ZatkOhLKdxVYOPM | ||
| 4530 | vLO8LZK55KN68YG0nnJyQ98/qwsmtO57Gmn7KNByXEptaZnwYx4M0rH/1ow00O7b | ||
| 4531 | rEi56rAUjtgHqSSY3ekJvqgiG1k50SeH3BzN+Puz6+mTeO0Pzjd8JnduodgsIUzk | ||
| 4532 | ik/HEzxux9UTl7Ko2yRpg1bTacuCErudG/L4NPKYKyqOBGf244ehHa1uzjZ0Dl4z | ||
| 4533 | O8vbUZeUapU8zhhabkvG/AePLhq5SvdkNCncpo1Q4Y2LS+VIG24ugBA/5J8bZT8R | ||
| 4534 | tOpXaZ+0AOuFJJkk9SGdl6r7NH8CaxWQrbueWhl/pIzY+m0o/DjH40ytas7ZTpOS | ||
| 4535 | jswMZ78LS5bOZmdTaMsXEY5Z96ycG7mOaES3GK/m5Q9l3JUJsJMStR8+lKXHiHUh | ||
| 4536 | sd4JJCpM4rzsTGdHwimIuQq6+cF0zowYJmXa92/GjHtoXAvuY8BeS/FOzJ8vD+Ho | ||
| 4537 | mnqT8eDI278n5mUpezbgMxVz8p1rhAhoKzYHKyfMeNhqhw5HdPSqoBNdZH702xSu | ||
| 4538 | +zrkL8Fl47l6QGzwBrd7KJvX4V84c5Ss2XCTLdyEr0YconosP4EmQufU2MVshGYR | ||
| 4539 | i3drVByjtdgQ8K4p92cIiBdcuJd5z+orKu5YM+Vt6SmqZQENghPsJQtdLEByFSnT | ||
| 4540 | kCz3GkPVavBpAgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAU | ||
| 4541 | 8snBDw1jALvsRQ5KH7WxszbNDo0wHQYDVR0OBBYEFPLJwQ8NYwC77EUOSh+1sbM2 | ||
| 4542 | zQ6NMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQwFAAOCAgEANGd5sjrG5T33 | ||
| 4543 | I3K5Ce+SrScfoE4KsvXaFwyihdJ+klH9FWXXXGtkFu6KRcoMQzZENdl//nk6HOjG | ||
| 4544 | 5D1rd9QhEOP28yBOqb6J8xycqd+8MDoX0TJD0KqKchxRKEzdNsjkLWd9kYccnbz8 | ||
| 4545 | qyiWXmFcuCIzGEgWUOrKL+mlSdx/PKQZvDatkuK59EvV6wit53j+F8Bdh3foZ3dP | ||
| 4546 | AGav9LEDOr4SfEE15fSmG0eLy3n31r8Xbk5l8PjaV8GUgeV6Vg27Rn9vkf195hfk | ||
| 4547 | gSe7BYhW3SCl95gtkRlpMV+bMPKZrXJAlszYd2abtNUOshD+FKrDgHGdPY3ofRRs | ||
| 4548 | YWSGRqbXVMW215AWRqWFyp464+YTFrYVI8ypKVL9AMb2kI5Wj4kI3Zaq5tNqqYY1 | ||
| 4549 | 9tVFeEJKRvwDyF7YZvZFZSS0vod7VSCd9521Kvy5YhnLbDuv0204bKt7ph6N/Ome | ||
| 4550 | /msVuduCmsuY33OhkKCgxeDoAaijFJzIwZqsFVAzje18KotzlUBDJvyBpCpfOZC3 | ||
| 4551 | J8tRd/iWkx7P8nd9H0aTolkelUTFLXVksNb54Dxp6gS1HAviRkRNQzuXSXERvSS2 | ||
| 4552 | wq1yVAb+axj5d9spLFKebXd7Yv0PTY6YMjAwcRLWJTXjn/hvnLXrahut6hDTlhZy | ||
| 4553 | BiElxky8j3C7DOReIoMt0r7+hVu05L0= | ||
| 4554 | -----END CERTIFICATE----- | ||
| 4555 | |||
| 4647 | ### QuoVadis Limited | 4556 | ### QuoVadis Limited |
| 4648 | 4557 | ||
| 4649 | === /C=BM/O=QuoVadis Limited/CN=QuoVadis Root CA 1 G3 | 4558 | === /C=BM/O=QuoVadis Limited/CN=QuoVadis Root CA 1 G3 |
| @@ -5481,52 +5390,6 @@ CPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR | |||
| 5481 | 5390 | ||
| 5482 | ### Starfield Technologies, Inc. | 5391 | ### Starfield Technologies, Inc. |
| 5483 | 5392 | ||
| 5484 | === /C=US/O=Starfield Technologies, Inc./OU=Starfield Class 2 Certification Authority | ||
| 5485 | Certificate: | ||
| 5486 | Data: | ||
| 5487 | Version: 3 (0x2) | ||
| 5488 | Serial Number: 0 (0x0) | ||
| 5489 | Signature Algorithm: sha1WithRSAEncryption | ||
| 5490 | Validity | ||
| 5491 | Not Before: Jun 29 17:39:16 2004 GMT | ||
| 5492 | Not After : Jun 29 17:39:16 2034 GMT | ||
| 5493 | Subject: C=US, O=Starfield Technologies, Inc., OU=Starfield Class 2 Certification Authority | ||
| 5494 | X509v3 extensions: | ||
| 5495 | X509v3 Subject Key Identifier: | ||
| 5496 | BF:5F:B7:D1:CE:DD:1F:86:F4:5B:55:AC:DC:D7:10:C2:0E:A9:88:E7 | ||
| 5497 | X509v3 Authority Key Identifier: | ||
| 5498 | keyid:BF:5F:B7:D1:CE:DD:1F:86:F4:5B:55:AC:DC:D7:10:C2:0E:A9:88:E7 | ||
| 5499 | DirName:/C=US/O=Starfield Technologies, Inc./OU=Starfield Class 2 Certification Authority | ||
| 5500 | serial:00 | ||
| 5501 | |||
| 5502 | X509v3 Basic Constraints: | ||
| 5503 | CA:TRUE | ||
| 5504 | SHA1 Fingerprint=AD:7E:1C:28:B0:64:EF:8F:60:03:40:20:14:C3:D0:E3:37:0E:B5:8A | ||
| 5505 | SHA256 Fingerprint=14:65:FA:20:53:97:B8:76:FA:A6:F0:A9:95:8E:55:90:E4:0F:CC:7F:AA:4F:B7:C2:C8:67:75:21:FB:5F:B6:58 | ||
| 5506 | -----BEGIN CERTIFICATE----- | ||
| 5507 | MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzEl | ||
| 5508 | MCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMp | ||
| 5509 | U3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQw | ||
| 5510 | NjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBoMQswCQYDVQQGEwJVUzElMCMGA1UE | ||
| 5511 | ChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZp | ||
| 5512 | ZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqGSIb3 | ||
| 5513 | DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf | ||
| 5514 | 8MOh2tTYbitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN | ||
| 5515 | +lq2cwQlZut3f+dZxkqZJRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0 | ||
| 5516 | X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVmepsZGD3/cVE8MC5fvj13c7JdBmzDI1aa | ||
| 5517 | K4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSNF4Azbl5KXZnJHoe0nRrA | ||
| 5518 | 1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HFMIHCMB0G | ||
| 5519 | A1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fR | ||
| 5520 | zt0fhvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0 | ||
| 5521 | YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBD | ||
| 5522 | bGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8w | ||
| 5523 | DQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGsafPzWdqbAYcaT1epoXkJKtv3 | ||
| 5524 | L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLMPUxA2IGvd56D | ||
| 5525 | eruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl | ||
| 5526 | xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynp | ||
| 5527 | VSJYACPq4xJDKVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEY | ||
| 5528 | WQPJIrSPnNVeKtelttQKbfi3QBFGmh95DmK/D5fs4C8fF5Q= | ||
| 5529 | -----END CERTIFICATE----- | ||
| 5530 | === /C=US/ST=Arizona/L=Scottsdale/O=Starfield Technologies, Inc./CN=Starfield Root Certificate Authority - G2 | 5393 | === /C=US/ST=Arizona/L=Scottsdale/O=Starfield Technologies, Inc./CN=Starfield Root Certificate Authority - G2 |
| 5531 | Certificate: | 5394 | Certificate: |
| 5532 | Data: | 5395 | Data: |
| @@ -5675,6 +5538,61 @@ Ld6leNcG2mqeSz53OiATIgHQv2ieY2BrNU0LbbqhPcCT4H8js1WtciVORvnSFu+w | |||
| 5675 | ZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6LqjviOvrv1vA+ACOzB2+htt | 5538 | ZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6LqjviOvrv1vA+ACOzB2+htt |
| 5676 | Qc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ | 5539 | Qc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ |
| 5677 | -----END CERTIFICATE----- | 5540 | -----END CERTIFICATE----- |
| 5541 | === /C=CH/O=SwissSign AG/CN=SwissSign RSA TLS Root CA 2022 - 1 | ||
| 5542 | Certificate: | ||
| 5543 | Data: | ||
| 5544 | Version: 3 (0x2) | ||
| 5545 | Serial Number: | ||
| 5546 | 43:fa:0c:5f:4e:1b:80:18:44:ef:d1:b4:4f:35:1f:44:f4:80:ed:cb | ||
| 5547 | Signature Algorithm: sha256WithRSAEncryption | ||
| 5548 | Validity | ||
| 5549 | Not Before: Jun 8 11:08:22 2022 GMT | ||
| 5550 | Not After : Jun 8 11:08:22 2047 GMT | ||
| 5551 | Subject: C=CH, O=SwissSign AG, CN=SwissSign RSA TLS Root CA 2022 - 1 | ||
| 5552 | X509v3 extensions: | ||
| 5553 | X509v3 Basic Constraints: critical | ||
| 5554 | CA:TRUE | ||
| 5555 | X509v3 Key Usage: critical | ||
| 5556 | Certificate Sign, CRL Sign | ||
| 5557 | X509v3 Authority Key Identifier: | ||
| 5558 | keyid:6F:8E:62:8B:93:43:B0:E1:40:F6:A7:C3:FD:F1:0F:B8:0F:15:38:A5 | ||
| 5559 | |||
| 5560 | X509v3 Subject Key Identifier: | ||
| 5561 | 6F:8E:62:8B:93:43:B0:E1:40:F6:A7:C3:FD:F1:0F:B8:0F:15:38:A5 | ||
| 5562 | SHA1 Fingerprint=81:34:0A:BE:4C:CD:CE:CC:E7:7D:CC:8A:D4:57:E2:45:A0:77:5D:CE | ||
| 5563 | SHA256 Fingerprint=19:31:44:F4:31:E0:FD:DB:74:07:17:D4:DE:92:6A:57:11:33:88:4B:43:60:D3:0E:27:29:13:CB:E6:60:CE:41 | ||
| 5564 | -----BEGIN CERTIFICATE----- | ||
| 5565 | MIIFkzCCA3ugAwIBAgIUQ/oMX04bgBhE79G0TzUfRPSA7cswDQYJKoZIhvcNAQEL | ||
| 5566 | BQAwUTELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzErMCkGA1UE | ||
| 5567 | AxMiU3dpc3NTaWduIFJTQSBUTFMgUm9vdCBDQSAyMDIyIC0gMTAeFw0yMjA2MDgx | ||
| 5568 | MTA4MjJaFw00NzA2MDgxMTA4MjJaMFExCzAJBgNVBAYTAkNIMRUwEwYDVQQKEwxT | ||
| 5569 | d2lzc1NpZ24gQUcxKzApBgNVBAMTIlN3aXNzU2lnbiBSU0EgVExTIFJvb3QgQ0Eg | ||
| 5570 | MjAyMiAtIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDLKmjiC8NX | ||
| 5571 | vDVjvHClO/OMPE5Xlm7DTjak9gLKHqquuN6orx122ro10JFwB9+zBvKK8i5VUXu7 | ||
| 5572 | LCTLf5ImgKO0lPaCoaTo+nUdWfMHamFk4saMla+ju45vVs9xzF6BYQ1t8qsCLqSX | ||
| 5573 | 5XH8irCRIFucdFJtrhUnWXjyCcplDn/L9Ovn3KlMd/YrFgSVrpxxpT8q2kFC5zyE | ||
| 5574 | EPThPYxr4iuRR1VPuFa+Rd4iUU1OKNlfGUEGjw5NBuBwQCMBauTLE5tzrE0USJIt | ||
| 5575 | /m2n+IdreXXhvhCxqohAWVTXz8TQm0SzOGlkjIHRI36qOTw7D59Ke4LKa2/KIj4x | ||
| 5576 | 0LDQKhySio/YGZxH5D4MucLNvkEM+KRHBdvBFzA4OmnczcNpI/2aDwLOEGrOyvi5 | ||
| 5577 | KaM2iYauC8BPY7kGWUleDsFpswrzd34unYyzJ5jSmY0lpx+Gs6ZUcDj8fV3oT4MM | ||
| 5578 | 0ZPlEuRU2j7yrTrePjxF8CgPBrnh25d7mUWe3f6VWQQvdT/TromZhqwUtKiE+shd | ||
| 5579 | OxtYk8EXlFXIC+OCeYSf8wCENO7cMdWP8vpPlkwGqnj73mSiI80fPsWMvDdUDrta | ||
| 5580 | clXvyFu1cvh43zcgTFeRc5JzrBh3Q4IgaezprClG5QtO+DdziZaKHG29777YtvTK | ||
| 5581 | wP1H8K4LWCDFyB02rpeNUIMmJCn3nTsPBQIDAQABo2MwYTAPBgNVHRMBAf8EBTAD | ||
| 5582 | AQH/MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBRvjmKLk0Ow4UD2p8P98Q+4 | ||
| 5583 | DxU4pTAdBgNVHQ4EFgQUb45ii5NDsOFA9qfD/fEPuA8VOKUwDQYJKoZIhvcNAQEL | ||
| 5584 | BQADggIBAKwsKUF9+lz1GpUYvyypiqkkVHX1uECry6gkUSsYP2OprphWKwVDIqO3 | ||
| 5585 | 10aewCoSPY6WlkDfDDOLazeROpW7OSltwAJsipQLBwJNGD77+3v1dj2b9l4wBlgz | ||
| 5586 | Hqp41eZUBDqyggmNzhYzWUUo8aWjlw5DI/0LIICQ/+Mmz7hkkeUFjxOgdg3XNwwQ | ||
| 5587 | iJb0Pr6VvfHDffCjw3lHC1ySFWPtUnWK50Zpy1FVCypM9fJkT6lc/2cyjlUtMoIc | ||
| 5588 | gC9qkfjLvH4YoiaoLqNTKIftV+Vlek4ASltOU8liNr3CjlvrzG4ngRhZi0Rjn9UM | ||
| 5589 | ZfQpZX+RLOV/fuiJz48gy20HQhFRJjKKLjpHE7iNvUcNCfAWpO2Whi4Z2L6MOuhF | ||
| 5590 | LhG6rlrnub+xzI/goP+4s9GFe3lmozm1O2bYQL7Pt2eLSMkZJVX8vY3PXtpOpvJp | ||
| 5591 | zv1/THfQwUY1mFwjmwJFQ5Ra3bxHrSL+ul4vkSkphnsh3m5kt8sNjzdbowhq6/Td | ||
| 5592 | Ao9QAwKxuDdollDruF/UKIqlIgyKhPBZLtU30WHlQnNYKoH3dtvi4k0NX/a3vgW0 | ||
| 5593 | rk4N3hY9A4GzJl5LuEsAz/+MF7psYC0nhzck5npgL7XTgwSqT0N1osGDsieYK7EO | ||
| 5594 | gLrAhV5Cud+xYJHT6xh+cHiudoO+cVrQkOPKwRYlZ0rwtnu64ZzZ | ||
| 5595 | -----END CERTIFICATE----- | ||
| 5678 | 5596 | ||
| 5679 | ### T-Systems Enterprise Services GmbH | 5597 | ### T-Systems Enterprise Services GmbH |
| 5680 | 5598 | ||
| @@ -6020,55 +5938,6 @@ HL/EVlP6Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVx | |||
| 6020 | SK236thZiNSQvxaz2emsWWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY= | 5938 | SK236thZiNSQvxaz2emsWWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY= |
| 6021 | -----END CERTIFICATE----- | 5939 | -----END CERTIFICATE----- |
| 6022 | 5940 | ||
| 6023 | ### The Go Daddy Group, Inc. | ||
| 6024 | |||
| 6025 | === /C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority | ||
| 6026 | Certificate: | ||
| 6027 | Data: | ||
| 6028 | Version: 3 (0x2) | ||
| 6029 | Serial Number: 0 (0x0) | ||
| 6030 | Signature Algorithm: sha1WithRSAEncryption | ||
| 6031 | Validity | ||
| 6032 | Not Before: Jun 29 17:06:20 2004 GMT | ||
| 6033 | Not After : Jun 29 17:06:20 2034 GMT | ||
| 6034 | Subject: C=US, O=The Go Daddy Group, Inc., OU=Go Daddy Class 2 Certification Authority | ||
| 6035 | X509v3 extensions: | ||
| 6036 | X509v3 Subject Key Identifier: | ||
| 6037 | D2:C4:B0:D2:91:D4:4C:11:71:B3:61:CB:3D:A1:FE:DD:A8:6A:D4:E3 | ||
| 6038 | X509v3 Authority Key Identifier: | ||
| 6039 | keyid:D2:C4:B0:D2:91:D4:4C:11:71:B3:61:CB:3D:A1:FE:DD:A8:6A:D4:E3 | ||
| 6040 | DirName:/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority | ||
| 6041 | serial:00 | ||
| 6042 | |||
| 6043 | X509v3 Basic Constraints: | ||
| 6044 | CA:TRUE | ||
| 6045 | SHA1 Fingerprint=27:96:BA:E6:3F:18:01:E2:77:26:1B:A0:D7:77:70:02:8F:20:EE:E4 | ||
| 6046 | SHA256 Fingerprint=C3:84:6B:F2:4B:9E:93:CA:64:27:4C:0E:C6:7C:1E:CC:5E:02:4F:FC:AC:D2:D7:40:19:35:0E:81:FE:54:6A:E4 | ||
| 6047 | -----BEGIN CERTIFICATE----- | ||
| 6048 | MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEh | ||
| 6049 | MB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBE | ||
| 6050 | YWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3 | ||
| 6051 | MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkGA1UEBhMCVVMxITAfBgNVBAoTGFRo | ||
| 6052 | ZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28gRGFkZHkgQ2xhc3Mg | ||
| 6053 | MiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQADggEN | ||
| 6054 | ADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCA | ||
| 6055 | PVYYYwhv2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6w | ||
| 6056 | wdhFJ2+qN1j3hybX2C32qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXi | ||
| 6057 | EqITLdiOr18SPaAIBQi2XKVlOARFmR6jYGB0xUGlcmIbYsUfb18aQr4CUWWoriMY | ||
| 6058 | avx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmYvLEHZ6IVDd2gWMZEewo+ | ||
| 6059 | YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0OBBYEFNLE | ||
| 6060 | sNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h | ||
| 6061 | /t2oatTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5 | ||
| 6062 | IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmlj | ||
| 6063 | YXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQAD | ||
| 6064 | ggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wimPQoZ+YeAEW5p5JYXMP80kWNy | ||
| 6065 | OO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKtI3lpjbi2Tc7P | ||
| 6066 | TMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ | ||
| 6067 | HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mER | ||
| 6068 | dEr/VxqHD3VILs9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5Cuf | ||
| 6069 | ReYNnyicsbkqWletNw+vHX/bvZ8= | ||
| 6070 | -----END CERTIFICATE----- | ||
| 6071 | |||
| 6072 | ### The USERTRUST Network | 5941 | ### The USERTRUST Network |
| 6073 | 5942 | ||
| 6074 | === /C=US/ST=New Jersey/L=Jersey City/O=The USERTRUST Network/CN=USERTrust ECC Certification Authority | 5943 | === /C=US/ST=New Jersey/L=Jersey City/O=The USERTRUST Network/CN=USERTrust ECC Certification Authority |
| @@ -6258,6 +6127,92 @@ AwIBBjAKBggqhkjOPQQDAwNnADBkAjBe8usGzEkxn0AAbbd+NvBNEU/zy4k6LHiR | |||
| 6258 | UKNbwMp1JvK/kF0LgoxgKJ/GcJpo5PECMFxYDlZ2z1jD1xCMuo6u47xkdUfFVZDj | 6127 | UKNbwMp1JvK/kF0LgoxgKJ/GcJpo5PECMFxYDlZ2z1jD1xCMuo6u47xkdUfFVZDj |
| 6259 | /bpV6wfEU6s3qe4hsiFbYI89MvHVI5TWWA== | 6128 | /bpV6wfEU6s3qe4hsiFbYI89MvHVI5TWWA== |
| 6260 | -----END CERTIFICATE----- | 6129 | -----END CERTIFICATE----- |
| 6130 | === /C=CN/O=TrustAsia Technologies, Inc./CN=TrustAsia TLS ECC Root CA | ||
| 6131 | Certificate: | ||
| 6132 | Data: | ||
| 6133 | Version: 3 (0x2) | ||
| 6134 | Serial Number: | ||
| 6135 | 36:74:e1:4d:7c:65:13:c9:ac:83:55:25:a0:3e:52:7e:2f:50:68:c7 | ||
| 6136 | Signature Algorithm: ecdsa-with-SHA384 | ||
| 6137 | Validity | ||
| 6138 | Not Before: May 15 05:41:56 2024 GMT | ||
| 6139 | Not After : May 15 05:41:55 2044 GMT | ||
| 6140 | Subject: C=CN, O=TrustAsia Technologies, Inc., CN=TrustAsia TLS ECC Root CA | ||
| 6141 | X509v3 extensions: | ||
| 6142 | X509v3 Basic Constraints: critical | ||
| 6143 | CA:TRUE | ||
| 6144 | X509v3 Subject Key Identifier: | ||
| 6145 | 2C:85:53:BB:B1:43:CD:32:EA:9E:A3:87:FE:A2:98:A8:A6:93:E9:10 | ||
| 6146 | X509v3 Key Usage: critical | ||
| 6147 | Certificate Sign, CRL Sign | ||
| 6148 | SHA1 Fingerprint=B5:EC:39:F3:A1:66:37:AE:C3:05:94:57:E2:BE:11:BE:B7:A1:7F:36 | ||
| 6149 | SHA256 Fingerprint=C0:07:6B:9E:F0:53:1F:B1:A6:56:D6:7C:4E:BE:97:CD:5D:BA:A4:1E:F4:45:98:AC:C2:48:98:78:C9:2D:87:11 | ||
| 6150 | -----BEGIN CERTIFICATE----- | ||
| 6151 | MIICMTCCAbegAwIBAgIUNnThTXxlE8msg1UloD5Sfi9QaMcwCgYIKoZIzj0EAwMw | ||
| 6152 | WDELMAkGA1UEBhMCQ04xJTAjBgNVBAoTHFRydXN0QXNpYSBUZWNobm9sb2dpZXMs | ||
| 6153 | IEluYy4xIjAgBgNVBAMTGVRydXN0QXNpYSBUTFMgRUNDIFJvb3QgQ0EwHhcNMjQw | ||
| 6154 | NTE1MDU0MTU2WhcNNDQwNTE1MDU0MTU1WjBYMQswCQYDVQQGEwJDTjElMCMGA1UE | ||
| 6155 | ChMcVHJ1c3RBc2lhIFRlY2hub2xvZ2llcywgSW5jLjEiMCAGA1UEAxMZVHJ1c3RB | ||
| 6156 | c2lhIFRMUyBFQ0MgUm9vdCBDQTB2MBAGByqGSM49AgEGBSuBBAAiA2IABLh/pVs/ | ||
| 6157 | AT598IhtrimY4ZtcU5nb9wj/1WrgjstEpvDBjL1P1M7UiFPoXlfXTr4sP/MSpwDp | ||
| 6158 | guMqWzJ8S5sUKZ74LYO1644xST0mYekdcouJtgq7nDM1D9rs3qlKH8kzsaNCMEAw | ||
| 6159 | DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQULIVTu7FDzTLqnqOH/qKYqKaT6RAw | ||
| 6160 | DgYDVR0PAQH/BAQDAgEGMAoGCCqGSM49BAMDA2gAMGUCMFRH18MtYYZI9HlaVQ01 | ||
| 6161 | L18N9mdsd0AaRuf4aFtOJx24mH1/k78ITcTaRTChD15KeAIxAKORh/IRM4PDwYqR | ||
| 6162 | OkwrULG9IpRdNYlzg8WbGf60oenUoWa2AaU2+dhoYSi3dOGiMQ== | ||
| 6163 | -----END CERTIFICATE----- | ||
| 6164 | === /C=CN/O=TrustAsia Technologies, Inc./CN=TrustAsia TLS RSA Root CA | ||
| 6165 | Certificate: | ||
| 6166 | Data: | ||
| 6167 | Version: 3 (0x2) | ||
| 6168 | Serial Number: | ||
| 6169 | 1c:18:d8:cf:e5:53:3f:22:35:46:53:54:24:3c:6c:47:d1:5c:4a:9c | ||
| 6170 | Signature Algorithm: sha384WithRSAEncryption | ||
| 6171 | Validity | ||
| 6172 | Not Before: May 15 05:41:57 2024 GMT | ||
| 6173 | Not After : May 15 05:41:56 2044 GMT | ||
| 6174 | Subject: C=CN, O=TrustAsia Technologies, Inc., CN=TrustAsia TLS RSA Root CA | ||
| 6175 | X509v3 extensions: | ||
| 6176 | X509v3 Basic Constraints: critical | ||
| 6177 | CA:TRUE | ||
| 6178 | X509v3 Subject Key Identifier: | ||
| 6179 | B8:07:91:79:5C:06:F4:46:FD:7B:59:CA:5A:26:91:A7:45:2B:F8:53 | ||
| 6180 | X509v3 Key Usage: critical | ||
| 6181 | Certificate Sign, CRL Sign | ||
| 6182 | SHA1 Fingerprint=A5:46:50:C5:62:EA:95:9A:1A:A7:04:6F:17:58:C7:29:53:3D:03:FA | ||
| 6183 | SHA256 Fingerprint=06:C0:8D:7D:AF:D8:76:97:1E:B1:12:4F:E6:7F:84:7E:C0:C7:A1:58:D3:EA:53:CB:E9:40:E2:EA:97:91:F4:C3 | ||
| 6184 | -----BEGIN CERTIFICATE----- | ||
| 6185 | MIIFgDCCA2igAwIBAgIUHBjYz+VTPyI1RlNUJDxsR9FcSpwwDQYJKoZIhvcNAQEM | ||
| 6186 | BQAwWDELMAkGA1UEBhMCQ04xJTAjBgNVBAoTHFRydXN0QXNpYSBUZWNobm9sb2dp | ||
| 6187 | ZXMsIEluYy4xIjAgBgNVBAMTGVRydXN0QXNpYSBUTFMgUlNBIFJvb3QgQ0EwHhcN | ||
| 6188 | MjQwNTE1MDU0MTU3WhcNNDQwNTE1MDU0MTU2WjBYMQswCQYDVQQGEwJDTjElMCMG | ||
| 6189 | A1UEChMcVHJ1c3RBc2lhIFRlY2hub2xvZ2llcywgSW5jLjEiMCAGA1UEAxMZVHJ1 | ||
| 6190 | c3RBc2lhIFRMUyBSU0EgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCC | ||
| 6191 | AgoCggIBAMMWuBtqpERz5dZO9LnPWwvB0ZqB9WOwj0PBuwhaGnrhB3YmH49pVr7+ | ||
| 6192 | NmDQDIPNlOrnxS1cLwUWAp4KqC/lYCZUlviYQB2srp10Zy9U+5RjmOMmSoPGlbYJ | ||
| 6193 | Q1DNDX3eRA5gEk9bNb2/mThtfWza4mhzH/kxpRkQcwUqwzIZheo0qt1CHjCNP561 | ||
| 6194 | HmHVb70AcnKtEj+qpklz8oYVlQwQX1Fkzv93uMltrOXVmPGZLmzjyUT5tUMnCE32 | ||
| 6195 | ft5EebuyjBza00tsLtbDeLdM1aTk2tyKjg7/D8OmYCYozza/+lcK7Fs/6TAWe8Tb | ||
| 6196 | xNRkoDD75f0dcZLdKY9BWN4ArTr9PXwaqLEX8E40eFgl1oUh63kd0Nyrz2I8sMeX | ||
| 6197 | i9bQn9P+PN7F4/w6g3CEIR0JwqH8uyghZVNgepBtljhb//HXeltt08lwSUq6HTrQ | ||
| 6198 | UNoyIBnkiz/r1RYmNzz7dZ6wB3C4FGB33PYPXFIKvF1tjVEK2sUYyJtt3LCDs3+j | ||
| 6199 | TnhMmCWr8n4uIF6CFabW2I+s5c0yhsj55NqJ4js+k8UTav/H9xj8Z7XvGCxUq0DT | ||
| 6200 | bE3txci3OE9kxJRMT6DNrqXGJyV1J23G2pyOsAWZ1SgRxSHUuPzHlqtKZFlhaxP8 | ||
| 6201 | S8ySpg+kUb8OWJDZgoM5pl+z+m6Ss80zDoWo8SnTq1mt1tve1CuBAgMBAAGjQjBA | ||
| 6202 | MA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFLgHkXlcBvRG/XtZylomkadFK/hT | ||
| 6203 | MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQwFAAOCAgEAIZtqBSBdGBanEqT3 | ||
| 6204 | Rz/NyjuujsCCztxIJXgXbODgcMTWltnZ9r96nBO7U5WS/8+S4PPFJzVXqDuiGev4 | ||
| 6205 | iqME3mmL5Dw8veWv0BIb5Ylrc5tvJQJLkIKvQMKtuppgJFqBTQUYo+IzeXoLH5Pt | ||
| 6206 | 7DlK9RME7I10nYEKqG/odv6LTytpEoYKNDbdgptvT+Bz3Ul/KD7JO6NXBNiT2Twp | ||
| 6207 | 2xIQaOHEibgGIOcberyxk2GaGUARtWqFVwHxtlotJnMnlvm5P1vQiJ3koP26TpUJ | ||
| 6208 | g3933FEFlJ0gcXax7PqJtZwuhfG5WyRasQmr2soaB82G39tp27RIGAAtvKLEiUUj | ||
| 6209 | pQ7hRGU+isFqMB3iYPg6qocJQrmBktwliJiJ8Xw18WLK7nn4GS/+X/jbh87qqA8M | ||
| 6210 | pugLoDzga5SYnH+tBuYc6kIQX+ImFTw3OffXvO645e8D7r0i+yiGNFjEWn9hongP | ||
| 6211 | XvPKnbwbPKfILfanIhHKA9jnZwqKDss1jjQ52MjqjZ9k4DewbNfFj8GQYSbbJIwe | ||
| 6212 | SsCI3zWQzj8C9GRh3sfIB5XeMhg6j6JCQCTl1jNdfK7vsU1P1FeQNWrcrgSXSYk0 | ||
| 6213 | ly4wBOeY99sLAZDBHwo/+ML+TvrbmnNzFrwFuHnYWa8G5z9nODmxfKuU4CkUpijy | ||
| 6214 | 323imttUQ/hHWKNddBWcwauwxzQ= | ||
| 6215 | -----END CERTIFICATE----- | ||
| 6261 | 6216 | ||
| 6262 | ### Trustwave Holdings, Inc. | 6217 | ### Trustwave Holdings, Inc. |
| 6263 | 6218 | ||
| @@ -6669,63 +6624,6 @@ rYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0EAwMDaAAwZQIwJsdpW9zV | |||
| 6669 | Mgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9 | 6624 | Mgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9 |
| 6670 | -----END CERTIFICATE----- | 6625 | -----END CERTIFICATE----- |
| 6671 | 6626 | ||
| 6672 | ### XRamp Security Services Inc | ||
| 6673 | |||
| 6674 | === /C=US/OU=www.xrampsecurity.com/O=XRamp Security Services Inc/CN=XRamp Global Certification Authority | ||
| 6675 | Certificate: | ||
| 6676 | Data: | ||
| 6677 | Version: 3 (0x2) | ||
| 6678 | Serial Number: | ||
| 6679 | 50:94:6c:ec:18:ea:d5:9c:4d:d5:97:ef:75:8f:a0:ad | ||
| 6680 | Signature Algorithm: sha1WithRSAEncryption | ||
| 6681 | Validity | ||
| 6682 | Not Before: Nov 1 17:14:04 2004 GMT | ||
| 6683 | Not After : Jan 1 05:37:19 2035 GMT | ||
| 6684 | Subject: C=US, OU=www.xrampsecurity.com, O=XRamp Security Services Inc, CN=XRamp Global Certification Authority | ||
| 6685 | X509v3 extensions: | ||
| 6686 | 1.3.6.1.4.1.311.20.2: | ||
| 6687 | ...C.A | ||
| 6688 | X509v3 Key Usage: | ||
| 6689 | Digital Signature, Certificate Sign, CRL Sign | ||
| 6690 | X509v3 Basic Constraints: critical | ||
| 6691 | CA:TRUE | ||
| 6692 | X509v3 Subject Key Identifier: | ||
| 6693 | C6:4F:A2:3D:06:63:84:09:9C:CE:62:E4:04:AC:8D:5C:B5:E9:B6:1B | ||
| 6694 | X509v3 CRL Distribution Points: | ||
| 6695 | |||
| 6696 | Full Name: | ||
| 6697 | URI:http://crl.xrampsecurity.com/XGCA.crl | ||
| 6698 | |||
| 6699 | 1.3.6.1.4.1.311.21.1: | ||
| 6700 | ... | ||
| 6701 | SHA1 Fingerprint=B8:01:86:D1:EB:9C:86:A5:41:04:CF:30:54:F3:4C:52:B7:E5:58:C6 | ||
| 6702 | SHA256 Fingerprint=CE:CD:DC:90:50:99:D8:DA:DF:C5:B1:D2:09:B7:37:CB:E2:C1:8C:FB:2C:10:C0:FF:0B:CF:0D:32:86:FC:1A:A2 | ||
| 6703 | -----BEGIN CERTIFICATE----- | ||
| 6704 | MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCB | ||
| 6705 | gjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEk | ||
| 6706 | MCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRY | ||
| 6707 | UmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQxMTAxMTcx | ||
| 6708 | NDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3 | ||
| 6709 | dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2Vy | ||
| 6710 | dmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB | ||
| 6711 | dXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS6 | ||
| 6712 | 38eMpSe2OAtp87ZOqCwuIR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCP | ||
| 6713 | KZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMxfoArtYzAQDsRhtDLooY2YKTVMIJt2W7Q | ||
| 6714 | DxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FEzG+gSqmUsE3a56k0enI4 | ||
| 6715 | qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqsAxcZZPRa | ||
| 6716 | JSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNVi | ||
| 6717 | PvryxS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0P | ||
| 6718 | BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASs | ||
| 6719 | jVy16bYbMDYGA1UdHwQvMC0wK6ApoCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0 | ||
| 6720 | eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQEwDQYJKoZIhvcNAQEFBQAD | ||
| 6721 | ggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc/Kh4ZzXxHfAR | ||
| 6722 | vbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt | ||
| 6723 | qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLa | ||
| 6724 | IR9NmXmd4c8nnxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSy | ||
| 6725 | i6mx5O+aGtA9aZnuqCij4Tyz8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQ | ||
| 6726 | O+7ETPTsJ3xCwnR8gooJybQDJbw= | ||
| 6727 | -----END CERTIFICATE----- | ||
| 6728 | |||
| 6729 | ### certSIGN | 6627 | ### certSIGN |
| 6730 | 6628 | ||
| 6731 | === /C=RO/O=certSIGN/OU=certSIGN ROOT CA | 6629 | === /C=RO/O=certSIGN/OU=certSIGN ROOT CA |
diff --git a/src/lib/libcrypto/cms/cms_dd.c b/src/lib/libcrypto/cms/cms_dd.c index 0a357094c5..daccbcd988 100644 --- a/src/lib/libcrypto/cms/cms_dd.c +++ b/src/lib/libcrypto/cms/cms_dd.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_dd.c,v 1.17 2023/10/26 09:08:57 tb Exp $ */ | 1 | /* $OpenBSD: cms_dd.c,v 1.18 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 4 | * project. | 4 | * project. |
| @@ -56,11 +56,11 @@ | |||
| 56 | 56 | ||
| 57 | #include <openssl/asn1.h> | 57 | #include <openssl/asn1.h> |
| 58 | #include <openssl/cms.h> | 58 | #include <openssl/cms.h> |
| 59 | #include <openssl/err.h> | ||
| 60 | #include <openssl/evp.h> | 59 | #include <openssl/evp.h> |
| 61 | #include <openssl/objects.h> | 60 | #include <openssl/objects.h> |
| 62 | 61 | ||
| 63 | #include "cms_local.h" | 62 | #include "cms_local.h" |
| 63 | #include "err_local.h" | ||
| 64 | #include "x509_local.h" | 64 | #include "x509_local.h" |
| 65 | 65 | ||
| 66 | /* CMS DigestedData Utilities */ | 66 | /* CMS DigestedData Utilities */ |
diff --git a/src/lib/libcrypto/cms/cms_enc.c b/src/lib/libcrypto/cms/cms_enc.c index ef6925dbd6..928b396815 100644 --- a/src/lib/libcrypto/cms/cms_enc.c +++ b/src/lib/libcrypto/cms/cms_enc.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_enc.c,v 1.25 2024/11/01 18:34:06 tb Exp $ */ | 1 | /* $OpenBSD: cms_enc.c,v 1.26 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 4 | * project. | 4 | * project. |
| @@ -58,12 +58,12 @@ | |||
| 58 | #include <openssl/asn1.h> | 58 | #include <openssl/asn1.h> |
| 59 | #include <openssl/bio.h> | 59 | #include <openssl/bio.h> |
| 60 | #include <openssl/cms.h> | 60 | #include <openssl/cms.h> |
| 61 | #include <openssl/err.h> | ||
| 62 | #include <openssl/evp.h> | 61 | #include <openssl/evp.h> |
| 63 | #include <openssl/objects.h> | 62 | #include <openssl/objects.h> |
| 64 | #include <openssl/x509.h> | 63 | #include <openssl/x509.h> |
| 65 | 64 | ||
| 66 | #include "cms_local.h" | 65 | #include "cms_local.h" |
| 66 | #include "err_local.h" | ||
| 67 | #include "evp_local.h" | 67 | #include "evp_local.h" |
| 68 | 68 | ||
| 69 | /* CMS EncryptedData Utilities */ | 69 | /* CMS EncryptedData Utilities */ |
diff --git a/src/lib/libcrypto/cms/cms_env.c b/src/lib/libcrypto/cms/cms_env.c index 629d23215e..7fa578466d 100644 --- a/src/lib/libcrypto/cms/cms_env.c +++ b/src/lib/libcrypto/cms/cms_env.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_env.c,v 1.28 2024/11/01 18:42:10 tb Exp $ */ | 1 | /* $OpenBSD: cms_env.c,v 1.29 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 4 | * project. | 4 | * project. |
| @@ -59,12 +59,12 @@ | |||
| 59 | #include <openssl/asn1.h> | 59 | #include <openssl/asn1.h> |
| 60 | #include <openssl/bio.h> | 60 | #include <openssl/bio.h> |
| 61 | #include <openssl/cms.h> | 61 | #include <openssl/cms.h> |
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
| 64 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
| 65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
| 66 | 65 | ||
| 67 | #include "cms_local.h" | 66 | #include "cms_local.h" |
| 67 | #include "err_local.h" | ||
| 68 | #include "evp_local.h" | 68 | #include "evp_local.h" |
| 69 | 69 | ||
| 70 | /* CMS EnvelopedData Utilities */ | 70 | /* CMS EnvelopedData Utilities */ |
diff --git a/src/lib/libcrypto/cms/cms_ess.c b/src/lib/libcrypto/cms/cms_ess.c index f01dcf73ed..5435fa404c 100644 --- a/src/lib/libcrypto/cms/cms_ess.c +++ b/src/lib/libcrypto/cms/cms_ess.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_ess.c,v 1.26 2024/11/01 18:53:35 tb Exp $ */ | 1 | /* $OpenBSD: cms_ess.c,v 1.27 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 4 | * project. | 4 | * project. |
| @@ -57,13 +57,13 @@ | |||
| 57 | 57 | ||
| 58 | #include <openssl/asn1.h> | 58 | #include <openssl/asn1.h> |
| 59 | #include <openssl/cms.h> | 59 | #include <openssl/cms.h> |
| 60 | #include <openssl/err.h> | ||
| 61 | #include <openssl/evp.h> | 60 | #include <openssl/evp.h> |
| 62 | #include <openssl/objects.h> | 61 | #include <openssl/objects.h> |
| 63 | #include <openssl/x509.h> | 62 | #include <openssl/x509.h> |
| 64 | #include <openssl/x509v3.h> | 63 | #include <openssl/x509v3.h> |
| 65 | 64 | ||
| 66 | #include "cms_local.h" | 65 | #include "cms_local.h" |
| 66 | #include "err_local.h" | ||
| 67 | 67 | ||
| 68 | CMS_ReceiptRequest * | 68 | CMS_ReceiptRequest * |
| 69 | d2i_CMS_ReceiptRequest(CMS_ReceiptRequest **a, const unsigned char **in, long len) | 69 | d2i_CMS_ReceiptRequest(CMS_ReceiptRequest **a, const unsigned char **in, long len) |
diff --git a/src/lib/libcrypto/cms/cms_io.c b/src/lib/libcrypto/cms/cms_io.c index 84ada47c49..a9be5461a3 100644 --- a/src/lib/libcrypto/cms/cms_io.c +++ b/src/lib/libcrypto/cms/cms_io.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_io.c,v 1.21 2024/03/30 01:53:05 joshua Exp $ */ | 1 | /* $OpenBSD: cms_io.c,v 1.22 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 4 | * project. | 4 | * project. |
| @@ -54,12 +54,12 @@ | |||
| 54 | 54 | ||
| 55 | #include <openssl/asn1t.h> | 55 | #include <openssl/asn1t.h> |
| 56 | #include <openssl/cms.h> | 56 | #include <openssl/cms.h> |
| 57 | #include <openssl/err.h> | ||
| 58 | #include <openssl/pem.h> | 57 | #include <openssl/pem.h> |
| 59 | #include <openssl/x509.h> | 58 | #include <openssl/x509.h> |
| 60 | 59 | ||
| 61 | #include "asn1_local.h" | 60 | #include "asn1_local.h" |
| 62 | #include "cms_local.h" | 61 | #include "cms_local.h" |
| 62 | #include "err_local.h" | ||
| 63 | 63 | ||
| 64 | int | 64 | int |
| 65 | CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms) | 65 | CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms) |
diff --git a/src/lib/libcrypto/cms/cms_kari.c b/src/lib/libcrypto/cms/cms_kari.c index 86b1ad9e83..c23da18058 100644 --- a/src/lib/libcrypto/cms/cms_kari.c +++ b/src/lib/libcrypto/cms/cms_kari.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_kari.c,v 1.17 2024/11/01 18:34:06 tb Exp $ */ | 1 | /* $OpenBSD: cms_kari.c,v 1.18 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 4 | * project. | 4 | * project. |
| @@ -57,10 +57,10 @@ | |||
| 57 | 57 | ||
| 58 | #include <openssl/asn1.h> | 58 | #include <openssl/asn1.h> |
| 59 | #include <openssl/cms.h> | 59 | #include <openssl/cms.h> |
| 60 | #include <openssl/err.h> | ||
| 61 | #include <openssl/evp.h> | 60 | #include <openssl/evp.h> |
| 62 | 61 | ||
| 63 | #include "cms_local.h" | 62 | #include "cms_local.h" |
| 63 | #include "err_local.h" | ||
| 64 | 64 | ||
| 65 | /* Key Agreement Recipient Info (KARI) routines */ | 65 | /* Key Agreement Recipient Info (KARI) routines */ |
| 66 | 66 | ||
diff --git a/src/lib/libcrypto/cms/cms_lib.c b/src/lib/libcrypto/cms/cms_lib.c index 2d7a8d9f21..b9fc5c21c7 100644 --- a/src/lib/libcrypto/cms/cms_lib.c +++ b/src/lib/libcrypto/cms/cms_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_lib.c,v 1.26 2024/11/01 18:53:35 tb Exp $ */ | 1 | /* $OpenBSD: cms_lib.c,v 1.27 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 4 | * project. | 4 | * project. |
| @@ -57,13 +57,13 @@ | |||
| 57 | #include <openssl/asn1.h> | 57 | #include <openssl/asn1.h> |
| 58 | #include <openssl/bio.h> | 58 | #include <openssl/bio.h> |
| 59 | #include <openssl/cms.h> | 59 | #include <openssl/cms.h> |
| 60 | #include <openssl/err.h> | ||
| 61 | #include <openssl/evp.h> | 60 | #include <openssl/evp.h> |
| 62 | #include <openssl/objects.h> | 61 | #include <openssl/objects.h> |
| 63 | #include <openssl/x509.h> | 62 | #include <openssl/x509.h> |
| 64 | #include <openssl/x509v3.h> | 63 | #include <openssl/x509v3.h> |
| 65 | 64 | ||
| 66 | #include "cms_local.h" | 65 | #include "cms_local.h" |
| 66 | #include "err_local.h" | ||
| 67 | #include "x509_local.h" | 67 | #include "x509_local.h" |
| 68 | 68 | ||
| 69 | CMS_ContentInfo * | 69 | CMS_ContentInfo * |
diff --git a/src/lib/libcrypto/cms/cms_pwri.c b/src/lib/libcrypto/cms/cms_pwri.c index b6fe5df961..f64f4ab68c 100644 --- a/src/lib/libcrypto/cms/cms_pwri.c +++ b/src/lib/libcrypto/cms/cms_pwri.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_pwri.c,v 1.31 2024/01/14 18:40:24 tb Exp $ */ | 1 | /* $OpenBSD: cms_pwri.c,v 1.35 2025/09/30 12:51:16 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 4 | * project. | 4 | * project. |
| @@ -58,13 +58,13 @@ | |||
| 58 | #include <string.h> | 58 | #include <string.h> |
| 59 | 59 | ||
| 60 | #include <openssl/asn1.h> | 60 | #include <openssl/asn1.h> |
| 61 | #include <openssl/err.h> | ||
| 62 | #include <openssl/evp.h> | 61 | #include <openssl/evp.h> |
| 63 | #include <openssl/cms.h> | 62 | #include <openssl/cms.h> |
| 64 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
| 65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
| 66 | 65 | ||
| 67 | #include "cms_local.h" | 66 | #include "cms_local.h" |
| 67 | #include "err_local.h" | ||
| 68 | #include "evp_local.h" | 68 | #include "evp_local.h" |
| 69 | #include "x509_local.h" | 69 | #include "x509_local.h" |
| 70 | 70 | ||
| @@ -267,7 +267,7 @@ kek_unwrap_key(unsigned char *out, size_t *outlen, const unsigned char *in, | |||
| 267 | /* Check byte failure */ | 267 | /* Check byte failure */ |
| 268 | goto err; | 268 | goto err; |
| 269 | } | 269 | } |
| 270 | if (inlen < (size_t)(tmp[0] - 4)) { | 270 | if (inlen < 4 + (size_t)tmp[0]) { |
| 271 | /* Invalid length value */ | 271 | /* Invalid length value */ |
| 272 | goto err; | 272 | goto err; |
| 273 | } | 273 | } |
| @@ -368,13 +368,13 @@ cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri, | |||
| 368 | kekcipher = EVP_get_cipherbyobj(kekalg->algorithm); | 368 | kekcipher = EVP_get_cipherbyobj(kekalg->algorithm); |
| 369 | if (!kekcipher) { | 369 | if (!kekcipher) { |
| 370 | CMSerror(CMS_R_UNKNOWN_CIPHER); | 370 | CMSerror(CMS_R_UNKNOWN_CIPHER); |
| 371 | return 0; | 371 | goto err; |
| 372 | } | 372 | } |
| 373 | 373 | ||
| 374 | kekctx = EVP_CIPHER_CTX_new(); | 374 | kekctx = EVP_CIPHER_CTX_new(); |
| 375 | if (kekctx == NULL) { | 375 | if (kekctx == NULL) { |
| 376 | CMSerror(ERR_R_MALLOC_FAILURE); | 376 | CMSerror(ERR_R_MALLOC_FAILURE); |
| 377 | return 0; | 377 | goto err; |
| 378 | } | 378 | } |
| 379 | /* Fixup cipher based on AlgorithmIdentifier to set IV etc */ | 379 | /* Fixup cipher based on AlgorithmIdentifier to set IV etc */ |
| 380 | if (!EVP_CipherInit_ex(kekctx, kekcipher, NULL, NULL, NULL, en_de)) | 380 | if (!EVP_CipherInit_ex(kekctx, kekcipher, NULL, NULL, NULL, en_de)) |
| @@ -389,8 +389,8 @@ cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri, | |||
| 389 | 389 | ||
| 390 | /* Finish password based key derivation to setup key in "ctx" */ | 390 | /* Finish password based key derivation to setup key in "ctx" */ |
| 391 | 391 | ||
| 392 | if (EVP_PBE_CipherInit(algtmp->algorithm, (char *)pwri->pass, | 392 | if (!EVP_PBE_CipherInit(algtmp->algorithm, (char *)pwri->pass, |
| 393 | pwri->passlen, algtmp->parameter, kekctx, en_de) < 0) { | 393 | pwri->passlen, algtmp->parameter, kekctx, en_de)) { |
| 394 | CMSerror(ERR_R_EVP_LIB); | 394 | CMSerror(ERR_R_EVP_LIB); |
| 395 | goto err; | 395 | goto err; |
| 396 | } | 396 | } |
diff --git a/src/lib/libcrypto/cms/cms_sd.c b/src/lib/libcrypto/cms/cms_sd.c index 9cdd4ce143..abcac83e47 100644 --- a/src/lib/libcrypto/cms/cms_sd.c +++ b/src/lib/libcrypto/cms/cms_sd.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_sd.c,v 1.33 2024/04/20 10:11:55 tb Exp $ */ | 1 | /* $OpenBSD: cms_sd.c,v 1.36 2025/07/31 02:24:21 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 4 | * project. | 4 | * project. |
| @@ -57,7 +57,6 @@ | |||
| 57 | 57 | ||
| 58 | #include <openssl/asn1.h> | 58 | #include <openssl/asn1.h> |
| 59 | #include <openssl/bio.h> | 59 | #include <openssl/bio.h> |
| 60 | #include <openssl/err.h> | ||
| 61 | #include <openssl/evp.h> | 60 | #include <openssl/evp.h> |
| 62 | #include <openssl/cms.h> | 61 | #include <openssl/cms.h> |
| 63 | #include <openssl/objects.h> | 62 | #include <openssl/objects.h> |
| @@ -66,6 +65,7 @@ | |||
| 66 | 65 | ||
| 67 | #include "asn1_local.h" | 66 | #include "asn1_local.h" |
| 68 | #include "cms_local.h" | 67 | #include "cms_local.h" |
| 68 | #include "err_local.h" | ||
| 69 | #include "evp_local.h" | 69 | #include "evp_local.h" |
| 70 | #include "x509_local.h" | 70 | #include "x509_local.h" |
| 71 | 71 | ||
| @@ -484,35 +484,6 @@ CMS_add1_signer(CMS_ContentInfo *cms, X509 *signer, EVP_PKEY *pk, | |||
| 484 | } | 484 | } |
| 485 | LCRYPTO_ALIAS(CMS_add1_signer); | 485 | LCRYPTO_ALIAS(CMS_add1_signer); |
| 486 | 486 | ||
| 487 | static int | ||
| 488 | cms_add1_signingTime(CMS_SignerInfo *si, ASN1_TIME *t) | ||
| 489 | { | ||
| 490 | ASN1_TIME *tt; | ||
| 491 | int r = 0; | ||
| 492 | |||
| 493 | if (t) | ||
| 494 | tt = t; | ||
| 495 | else | ||
| 496 | tt = X509_gmtime_adj(NULL, 0); | ||
| 497 | |||
| 498 | if (!tt) | ||
| 499 | goto merr; | ||
| 500 | |||
| 501 | if (CMS_signed_add1_attr_by_NID(si, NID_pkcs9_signingTime, | ||
| 502 | tt->type, tt, -1) <= 0) | ||
| 503 | goto merr; | ||
| 504 | |||
| 505 | r = 1; | ||
| 506 | |||
| 507 | merr: | ||
| 508 | if (!t) | ||
| 509 | ASN1_TIME_free(tt); | ||
| 510 | if (!r) | ||
| 511 | CMSerror(ERR_R_MALLOC_FAILURE); | ||
| 512 | |||
| 513 | return r; | ||
| 514 | } | ||
| 515 | |||
| 516 | EVP_PKEY_CTX * | 487 | EVP_PKEY_CTX * |
| 517 | CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si) | 488 | CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si) |
| 518 | { | 489 | { |
| @@ -778,6 +749,7 @@ cms_SignedData_final(CMS_ContentInfo *cms, BIO *chain) | |||
| 778 | int | 749 | int |
| 779 | CMS_SignerInfo_sign(CMS_SignerInfo *si) | 750 | CMS_SignerInfo_sign(CMS_SignerInfo *si) |
| 780 | { | 751 | { |
| 752 | ASN1_TIME *at = NULL; | ||
| 781 | const EVP_MD *md; | 753 | const EVP_MD *md; |
| 782 | unsigned char *buf = NULL, *sig = NULL; | 754 | unsigned char *buf = NULL, *sig = NULL; |
| 783 | int buf_len = 0; | 755 | int buf_len = 0; |
| @@ -788,7 +760,12 @@ CMS_SignerInfo_sign(CMS_SignerInfo *si) | |||
| 788 | goto err; | 760 | goto err; |
| 789 | 761 | ||
| 790 | if (CMS_signed_get_attr_by_NID(si, NID_pkcs9_signingTime, -1) < 0) { | 762 | if (CMS_signed_get_attr_by_NID(si, NID_pkcs9_signingTime, -1) < 0) { |
| 791 | if (!cms_add1_signingTime(si, NULL)) | 763 | if ((at = X509_gmtime_adj(NULL, 0)) == NULL) { |
| 764 | CMSerror(ERR_R_MALLOC_FAILURE); | ||
| 765 | goto err; | ||
| 766 | } | ||
| 767 | if (!CMS_signed_add1_attr_by_NID(si, NID_pkcs9_signingTime, | ||
| 768 | at->type, at, -1)) | ||
| 792 | goto err; | 769 | goto err; |
| 793 | } | 770 | } |
| 794 | 771 | ||
| @@ -828,6 +805,7 @@ CMS_SignerInfo_sign(CMS_SignerInfo *si) | |||
| 828 | ret = 1; | 805 | ret = 1; |
| 829 | 806 | ||
| 830 | err: | 807 | err: |
| 808 | ASN1_TIME_free(at); | ||
| 831 | (void)EVP_MD_CTX_reset(si->mctx); | 809 | (void)EVP_MD_CTX_reset(si->mctx); |
| 832 | freezero(buf, buf_len); | 810 | freezero(buf, buf_len); |
| 833 | freezero(sig, sig_len); | 811 | freezero(sig, sig_len); |
| @@ -1012,6 +990,8 @@ LCRYPTO_ALIAS(CMS_add_smimecap); | |||
| 1012 | * Add AlgorithmIdentifier OID of type |nid| to the SMIMECapability attribute | 990 | * Add AlgorithmIdentifier OID of type |nid| to the SMIMECapability attribute |
| 1013 | * set |*out_algs| (see RFC 3851, section 2.5.2). If keysize > 0, the OID has | 991 | * set |*out_algs| (see RFC 3851, section 2.5.2). If keysize > 0, the OID has |
| 1014 | * an integer parameter of value |keysize|, otherwise parameters are omitted. | 992 | * an integer parameter of value |keysize|, otherwise parameters are omitted. |
| 993 | * | ||
| 994 | * See also PKCS7_simple_smimecap(). | ||
| 1015 | */ | 995 | */ |
| 1016 | int | 996 | int |
| 1017 | CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **out_algs, int nid, int keysize) | 997 | CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **out_algs, int nid, int keysize) |
diff --git a/src/lib/libcrypto/cms/cms_smime.c b/src/lib/libcrypto/cms/cms_smime.c index 5a194748d9..a4918643d2 100644 --- a/src/lib/libcrypto/cms/cms_smime.c +++ b/src/lib/libcrypto/cms/cms_smime.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_smime.c,v 1.28 2023/12/22 10:23:11 tb Exp $ */ | 1 | /* $OpenBSD: cms_smime.c,v 1.31 2025/11/28 06:07:09 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 4 | * project. | 4 | * project. |
| @@ -59,7 +59,6 @@ | |||
| 59 | #include <openssl/asn1.h> | 59 | #include <openssl/asn1.h> |
| 60 | #include <openssl/bio.h> | 60 | #include <openssl/bio.h> |
| 61 | #include <openssl/cms.h> | 61 | #include <openssl/cms.h> |
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
| 64 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
| 65 | #include <openssl/pkcs7.h> | 64 | #include <openssl/pkcs7.h> |
| @@ -67,6 +66,7 @@ | |||
| 67 | #include <openssl/x509_vfy.h> | 66 | #include <openssl/x509_vfy.h> |
| 68 | 67 | ||
| 69 | #include "cms_local.h" | 68 | #include "cms_local.h" |
| 69 | #include "err_local.h" | ||
| 70 | 70 | ||
| 71 | static BIO * | 71 | static BIO * |
| 72 | cms_get_text_bio(BIO *out, unsigned int flags) | 72 | cms_get_text_bio(BIO *out, unsigned int flags) |
| @@ -277,25 +277,32 @@ CMS_ContentInfo * | |||
| 277 | CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher, | 277 | CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher, |
| 278 | const unsigned char *key, size_t keylen, unsigned int flags) | 278 | const unsigned char *key, size_t keylen, unsigned int flags) |
| 279 | { | 279 | { |
| 280 | CMS_ContentInfo *cms; | 280 | CMS_ContentInfo *cms = NULL; |
| 281 | 281 | ||
| 282 | if (!cipher) { | 282 | if (cipher == NULL) { |
| 283 | CMSerror(CMS_R_NO_CIPHER); | 283 | CMSerror(CMS_R_NO_CIPHER); |
| 284 | return NULL; | 284 | goto err; |
| 285 | } | 285 | } |
| 286 | cms = CMS_ContentInfo_new(); | 286 | |
| 287 | if (cms == NULL) | 287 | if ((cms = CMS_ContentInfo_new()) == NULL) |
| 288 | return NULL; | 288 | goto err; |
| 289 | |||
| 289 | if (!CMS_EncryptedData_set1_key(cms, cipher, key, keylen)) | 290 | if (!CMS_EncryptedData_set1_key(cms, cipher, key, keylen)) |
| 290 | return NULL; | 291 | goto err; |
| 291 | 292 | ||
| 292 | if (!(flags & CMS_DETACHED)) | 293 | if ((flags & CMS_DETACHED) == 0) { |
| 293 | CMS_set_detached(cms, 0); | 294 | if (!CMS_set_detached(cms, 0)) |
| 295 | goto err; | ||
| 296 | } | ||
| 294 | 297 | ||
| 295 | if ((flags & (CMS_STREAM | CMS_PARTIAL)) || | 298 | if ((flags & (CMS_STREAM | CMS_PARTIAL)) == 0) { |
| 296 | CMS_final(cms, in, NULL, flags)) | 299 | if (!CMS_final(cms, in, NULL, flags)) |
| 297 | return cms; | 300 | goto err; |
| 301 | } | ||
| 298 | 302 | ||
| 303 | return cms; | ||
| 304 | |||
| 305 | err: | ||
| 299 | CMS_ContentInfo_free(cms); | 306 | CMS_ContentInfo_free(cms); |
| 300 | 307 | ||
| 301 | return NULL; | 308 | return NULL; |
diff --git a/src/lib/libcrypto/conf/README b/src/lib/libcrypto/conf/README deleted file mode 100644 index 96e53b34ed..0000000000 --- a/src/lib/libcrypto/conf/README +++ /dev/null | |||
| @@ -1,73 +0,0 @@ | |||
| 1 | Configuration modules. These are a set of modules which can perform | ||
| 2 | various configuration functions. | ||
| 3 | |||
| 4 | Currently the routines should be called at most once when an application | ||
| 5 | starts up: that is before it starts any threads. | ||
| 6 | |||
| 7 | The routines read a configuration file set up like this: | ||
| 8 | |||
| 9 | ----- | ||
| 10 | #default section | ||
| 11 | openssl_conf=init_section | ||
| 12 | |||
| 13 | [init_section] | ||
| 14 | |||
| 15 | module1=value1 | ||
| 16 | #Second instance of module1 | ||
| 17 | module1.1=valueX | ||
| 18 | module2=value2 | ||
| 19 | module3=dso_literal | ||
| 20 | module4=dso_section | ||
| 21 | |||
| 22 | [dso_section] | ||
| 23 | |||
| 24 | path=/some/path/to/some/dso.so | ||
| 25 | other_stuff=other_value | ||
| 26 | ---- | ||
| 27 | |||
| 28 | When this file is loaded a configuration module with the specified string | ||
| 29 | (module* in the above example) is looked up and its init function called as: | ||
| 30 | |||
| 31 | int conf_init_func(CONF_IMODULE *md, CONF *cnf); | ||
| 32 | |||
| 33 | The function can then take whatever action is appropriate, for example further | ||
| 34 | lookups based on the value. Multiple instances of the same config module can be | ||
| 35 | loaded. | ||
| 36 | |||
| 37 | When the application closes down the modules are cleaned up by calling an | ||
| 38 | optional finish function: | ||
| 39 | |||
| 40 | void conf_finish_func(CONF_IMODULE *md); | ||
| 41 | |||
| 42 | The finish functions are called in reverse order: that is the last module | ||
| 43 | loaded is the first one cleaned up. | ||
| 44 | |||
| 45 | If no module exists with a given name then an attempt is made to load a DSO | ||
| 46 | with the supplied name. This might mean that "module3" attempts to load a DSO | ||
| 47 | called libmodule3.so or module3.dll for example. An explicit DSO name can be | ||
| 48 | given by including a separate section as in the module4 example above. | ||
| 49 | |||
| 50 | The DSO is expected to at least contain an initialization function: | ||
| 51 | |||
| 52 | int OPENSSL_init(CONF_IMODULE *md, CONF *cnf); | ||
| 53 | |||
| 54 | and may also include a finish function: | ||
| 55 | |||
| 56 | void OPENSSL_finish(CONF_IMODULE *md); | ||
| 57 | |||
| 58 | Static modules can also be added using, | ||
| 59 | |||
| 60 | int CONF_module_add(char *name, dso_mod_init_func *ifunc, dso_mod_finish_func | ||
| 61 | *ffunc); | ||
| 62 | |||
| 63 | where "name" is the name in the configuration file this function corresponds | ||
| 64 | to. | ||
| 65 | |||
| 66 | A set of builtin modules (currently only an ASN1 non functional test module) | ||
| 67 | can be added by calling OPENSSL_load_builtin_modules(). | ||
| 68 | |||
| 69 | The function OPENSSL_config() is intended as a simple configuration function | ||
| 70 | that any application can call to perform various default configuration tasks. | ||
| 71 | It uses the file openssl.cnf in the usual locations. | ||
| 72 | |||
| 73 | |||
diff --git a/src/lib/libcrypto/conf/conf_api.c b/src/lib/libcrypto/conf/conf_api.c index f986243b65..0d5a67d9a5 100644 --- a/src/lib/libcrypto/conf/conf_api.c +++ b/src/lib/libcrypto/conf/conf_api.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: conf_api.c,v 1.26 2025/03/08 09:35:53 tb Exp $ */ | 1 | /* $OpenBSD: conf_api.c,v 1.29 2025/12/21 07:31:22 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -56,16 +56,10 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | /* Part of the code in here was originally in conf.c, which is now removed */ | ||
| 60 | |||
| 61 | #ifndef CONF_DEBUG | ||
| 62 | # undef NDEBUG /* avoid conflicting definitions */ | ||
| 63 | # define NDEBUG | ||
| 64 | #endif | ||
| 65 | |||
| 66 | #include <stdlib.h> | 59 | #include <stdlib.h> |
| 67 | #include <string.h> | 60 | #include <string.h> |
| 68 | #include <unistd.h> | 61 | #include <unistd.h> |
| 62 | |||
| 69 | #include <openssl/conf.h> | 63 | #include <openssl/conf.h> |
| 70 | 64 | ||
| 71 | #include "conf_local.h" | 65 | #include "conf_local.h" |
| @@ -77,7 +71,6 @@ static IMPLEMENT_LHASH_DOALL_ARG_FN(value_free_hash, CONF_VALUE, | |||
| 77 | LHASH_OF(CONF_VALUE)) | 71 | LHASH_OF(CONF_VALUE)) |
| 78 | static IMPLEMENT_LHASH_DOALL_FN(value_free_stack, CONF_VALUE) | 72 | static IMPLEMENT_LHASH_DOALL_FN(value_free_stack, CONF_VALUE) |
| 79 | 73 | ||
| 80 | /* Up until OpenSSL 0.9.5a, this was get_section */ | ||
| 81 | CONF_VALUE * | 74 | CONF_VALUE * |
| 82 | _CONF_get_section(const CONF *conf, const char *section) | 75 | _CONF_get_section(const CONF *conf, const char *section) |
| 83 | { | 76 | { |
| @@ -229,7 +222,6 @@ value_free_stack_doall(CONF_VALUE *a) | |||
| 229 | free(a); | 222 | free(a); |
| 230 | } | 223 | } |
| 231 | 224 | ||
| 232 | /* Up until OpenSSL 0.9.5a, this was new_section */ | ||
| 233 | CONF_VALUE * | 225 | CONF_VALUE * |
| 234 | _CONF_new_section(CONF *conf, const char *section) | 226 | _CONF_new_section(CONF *conf, const char *section) |
| 235 | { | 227 | { |
diff --git a/src/lib/libcrypto/conf/conf_def.c b/src/lib/libcrypto/conf/conf_def.c index 0173a7117c..fe9391685d 100644 --- a/src/lib/libcrypto/conf/conf_def.c +++ b/src/lib/libcrypto/conf/conf_def.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: conf_def.c,v 1.44 2024/08/31 09:46:17 tb Exp $ */ | 1 | /* $OpenBSD: conf_def.c,v 1.45 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -63,12 +63,12 @@ | |||
| 63 | 63 | ||
| 64 | #include <openssl/buffer.h> | 64 | #include <openssl/buffer.h> |
| 65 | #include <openssl/conf.h> | 65 | #include <openssl/conf.h> |
| 66 | #include <openssl/err.h> | ||
| 67 | #include <openssl/lhash.h> | 66 | #include <openssl/lhash.h> |
| 68 | #include <openssl/stack.h> | 67 | #include <openssl/stack.h> |
| 69 | 68 | ||
| 70 | #include "conf_def.h" | 69 | #include "conf_def.h" |
| 71 | #include "conf_local.h" | 70 | #include "conf_local.h" |
| 71 | #include "err_local.h" | ||
| 72 | 72 | ||
| 73 | #define MAX_CONF_VALUE_LENGTH 65536 | 73 | #define MAX_CONF_VALUE_LENGTH 65536 |
| 74 | 74 | ||
diff --git a/src/lib/libcrypto/conf/conf_lib.c b/src/lib/libcrypto/conf/conf_lib.c index 863e1c9475..84b4f8b0a7 100644 --- a/src/lib/libcrypto/conf/conf_lib.c +++ b/src/lib/libcrypto/conf/conf_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: conf_lib.c,v 1.25 2025/03/08 09:35:53 tb Exp $ */ | 1 | /* $OpenBSD: conf_lib.c,v 1.26 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | 2 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -58,11 +58,11 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <openssl/crypto.h> | 60 | #include <openssl/crypto.h> |
| 61 | #include <openssl/err.h> | ||
| 62 | #include <openssl/conf.h> | 61 | #include <openssl/conf.h> |
| 63 | #include <openssl/lhash.h> | 62 | #include <openssl/lhash.h> |
| 64 | 63 | ||
| 65 | #include "conf_local.h" | 64 | #include "conf_local.h" |
| 65 | #include "err_local.h" | ||
| 66 | 66 | ||
| 67 | static const CONF_METHOD *default_CONF_method = NULL; | 67 | static const CONF_METHOD *default_CONF_method = NULL; |
| 68 | 68 | ||
diff --git a/src/lib/libcrypto/conf/conf_mod.c b/src/lib/libcrypto/conf/conf_mod.c index 0e07bb3ea5..6e697cc478 100644 --- a/src/lib/libcrypto/conf/conf_mod.c +++ b/src/lib/libcrypto/conf/conf_mod.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: conf_mod.c,v 1.40 2024/10/10 06:51:22 tb Exp $ */ | 1 | /* $OpenBSD: conf_mod.c,v 1.41 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Stephen Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Stephen Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2001. | 3 | * project 2001. |
| 4 | */ | 4 | */ |
| @@ -63,9 +63,10 @@ | |||
| 63 | 63 | ||
| 64 | #include <openssl/conf.h> | 64 | #include <openssl/conf.h> |
| 65 | #include <openssl/crypto.h> | 65 | #include <openssl/crypto.h> |
| 66 | #include <openssl/err.h> | ||
| 67 | #include <openssl/x509.h> | 66 | #include <openssl/x509.h> |
| 68 | 67 | ||
| 68 | #include "err_local.h" | ||
| 69 | |||
| 69 | /* This structure contains data about supported modules. */ | 70 | /* This structure contains data about supported modules. */ |
| 70 | struct conf_module_st { | 71 | struct conf_module_st { |
| 71 | /* Name of the module */ | 72 | /* Name of the module */ |
diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h index b4230f1b28..9fcf868403 100644 --- a/src/lib/libcrypto/crypto.h +++ b/src/lib/libcrypto/crypto.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto.h,v 1.79 2025/03/09 15:29:56 tb Exp $ */ | 1 | /* $OpenBSD: crypto.h,v 1.80 2025/09/28 07:52:53 tb Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -197,15 +197,15 @@ extern "C" { | |||
| 197 | 197 | ||
| 198 | #ifndef CRYPTO_w_lock | 198 | #ifndef CRYPTO_w_lock |
| 199 | #define CRYPTO_w_lock(type) \ | 199 | #define CRYPTO_w_lock(type) \ |
| 200 | CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,OPENSSL_FILE,OPENSSL_LINE) | 200 | CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,NULL,0) |
| 201 | #define CRYPTO_w_unlock(type) \ | 201 | #define CRYPTO_w_unlock(type) \ |
| 202 | CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,OPENSSL_FILE,OPENSSL_LINE) | 202 | CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,NULL,0) |
| 203 | #define CRYPTO_r_lock(type) \ | 203 | #define CRYPTO_r_lock(type) \ |
| 204 | CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,OPENSSL_FILE,OPENSSL_LINE) | 204 | CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,NULL,0) |
| 205 | #define CRYPTO_r_unlock(type) \ | 205 | #define CRYPTO_r_unlock(type) \ |
| 206 | CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,OPENSSL_FILE,OPENSSL_LINE) | 206 | CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,NULL,0) |
| 207 | #define CRYPTO_add(addr,amount,type) \ | 207 | #define CRYPTO_add(addr,amount,type) \ |
| 208 | CRYPTO_add_lock(addr,amount,type,OPENSSL_FILE,OPENSSL_LINE) | 208 | CRYPTO_add_lock(addr,amount,type,NULL,0) |
| 209 | #endif | 209 | #endif |
| 210 | 210 | ||
| 211 | /* Some applications as well as some parts of OpenSSL need to allocate | 211 | /* Some applications as well as some parts of OpenSSL need to allocate |
| @@ -275,9 +275,9 @@ DECLARE_STACK_OF(void) | |||
| 275 | 275 | ||
| 276 | int CRYPTO_mem_ctrl(int mode); | 276 | int CRYPTO_mem_ctrl(int mode); |
| 277 | 277 | ||
| 278 | #define OPENSSL_malloc(num) CRYPTO_malloc((num),OPENSSL_FILE,OPENSSL_LINE) | 278 | #define OPENSSL_malloc(num) CRYPTO_malloc((num),NULL,0) |
| 279 | #define OPENSSL_strdup(str) CRYPTO_strdup((str),OPENSSL_FILE,OPENSSL_LINE) | 279 | #define OPENSSL_strdup(str) CRYPTO_strdup((str),NULL,0) |
| 280 | #define OPENSSL_free(addr) CRYPTO_free((addr),OPENSSL_FILE,OPENSSL_LINE) | 280 | #define OPENSSL_free(addr) CRYPTO_free((addr),NULL,0) |
| 281 | 281 | ||
| 282 | const char *OpenSSL_version(int type); | 282 | const char *OpenSSL_version(int type); |
| 283 | #define OPENSSL_VERSION 0 | 283 | #define OPENSSL_VERSION 0 |
diff --git a/src/lib/libcrypto/crypto_ex_data.c b/src/lib/libcrypto/crypto_ex_data.c index ceb3a92e51..233905f888 100644 --- a/src/lib/libcrypto/crypto_ex_data.c +++ b/src/lib/libcrypto/crypto_ex_data.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_ex_data.c,v 1.4 2024/08/03 07:45:26 tb Exp $ */ | 1 | /* $OpenBSD: crypto_ex_data.c,v 1.6 2025/06/15 15:58:56 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -52,7 +52,7 @@ crypto_ex_data_classes_init(void) | |||
| 52 | return 1; | 52 | return 1; |
| 53 | 53 | ||
| 54 | if ((classes_new = calloc(CRYPTO_EX_INDEX__COUNT, | 54 | if ((classes_new = calloc(CRYPTO_EX_INDEX__COUNT, |
| 55 | sizeof(struct crypto_ex_data_index))) == NULL) | 55 | sizeof(*classes_new))) == NULL) |
| 56 | return 0; | 56 | return 0; |
| 57 | 57 | ||
| 58 | CRYPTO_w_lock(CRYPTO_LOCK_EX_DATA); | 58 | CRYPTO_w_lock(CRYPTO_LOCK_EX_DATA); |
| @@ -100,11 +100,10 @@ CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, | |||
| 100 | goto err; | 100 | goto err; |
| 101 | 101 | ||
| 102 | if ((class = classes[class_index]) == NULL) { | 102 | if ((class = classes[class_index]) == NULL) { |
| 103 | if ((new_class = calloc(1, | 103 | if ((new_class = calloc(1, sizeof(*new_class))) == NULL) |
| 104 | sizeof(struct crypto_ex_data_class))) == NULL) | ||
| 105 | goto err; | 104 | goto err; |
| 106 | if ((new_class->indexes = calloc(CRYPTO_EX_DATA_MAX_INDEX, | 105 | if ((new_class->indexes = calloc(CRYPTO_EX_DATA_MAX_INDEX, |
| 107 | sizeof(struct crypto_ex_data_index *))) == NULL) | 106 | sizeof(*new_class->indexes))) == NULL) |
| 108 | goto err; | 107 | goto err; |
| 109 | new_class->indexes_len = CRYPTO_EX_DATA_MAX_INDEX; | 108 | new_class->indexes_len = CRYPTO_EX_DATA_MAX_INDEX; |
| 110 | new_class->next_index = 1; | 109 | new_class->next_index = 1; |
| @@ -119,7 +118,7 @@ CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, | |||
| 119 | class = classes[class_index]; | 118 | class = classes[class_index]; |
| 120 | } | 119 | } |
| 121 | 120 | ||
| 122 | if ((index = calloc(1, sizeof(struct crypto_ex_data_index))) == NULL) | 121 | if ((index = calloc(1, sizeof(*index))) == NULL) |
| 123 | goto err; | 122 | goto err; |
| 124 | 123 | ||
| 125 | index->new_func = new_func; | 124 | index->new_func = new_func; |
| @@ -200,12 +199,12 @@ crypto_ex_data_init(CRYPTO_EX_DATA *exdata) | |||
| 200 | if (exdata->sk != NULL) | 199 | if (exdata->sk != NULL) |
| 201 | goto err; | 200 | goto err; |
| 202 | 201 | ||
| 203 | if ((ced = calloc(1, sizeof(struct crypto_ex_data))) == NULL) | 202 | if ((ced = calloc(1, sizeof(*ced))) == NULL) |
| 204 | goto err; | 203 | goto err; |
| 205 | 204 | ||
| 206 | ced->class_index = -1; | 205 | ced->class_index = -1; |
| 207 | 206 | ||
| 208 | if ((ced->slots = calloc(CRYPTO_EX_DATA_MAX_INDEX, sizeof(void *))) == NULL) | 207 | if ((ced->slots = calloc(CRYPTO_EX_DATA_MAX_INDEX, sizeof(*ced->slots))) == NULL) |
| 209 | goto err; | 208 | goto err; |
| 210 | ced->slots_len = CRYPTO_EX_DATA_MAX_INDEX; | 209 | ced->slots_len = CRYPTO_EX_DATA_MAX_INDEX; |
| 211 | 210 | ||
diff --git a/src/lib/libcrypto/crypto_init.c b/src/lib/libcrypto/crypto_init.c index 6016d1ae40..ae4914e358 100644 --- a/src/lib/libcrypto/crypto_init.c +++ b/src/lib/libcrypto/crypto_init.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_init.c,v 1.22 2024/10/17 14:27:57 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_init.c,v 1.26 2025/06/11 07:41:12 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2018 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2018 Bob Beck <beck@openbsd.org> |
| 4 | * | 4 | * |
| @@ -22,12 +22,12 @@ | |||
| 22 | 22 | ||
| 23 | #include <openssl/asn1.h> | 23 | #include <openssl/asn1.h> |
| 24 | #include <openssl/conf.h> | 24 | #include <openssl/conf.h> |
| 25 | #include <openssl/err.h> | ||
| 26 | #include <openssl/evp.h> | 25 | #include <openssl/evp.h> |
| 27 | #include <openssl/objects.h> | 26 | #include <openssl/objects.h> |
| 28 | #include <openssl/x509v3.h> | 27 | #include <openssl/x509v3.h> |
| 29 | 28 | ||
| 30 | #include "crypto_internal.h" | 29 | #include "crypto_internal.h" |
| 30 | #include "err_local.h" | ||
| 31 | #include "x509_issuer_cache.h" | 31 | #include "x509_issuer_cache.h" |
| 32 | 32 | ||
| 33 | int OpenSSL_config(const char *); | 33 | int OpenSSL_config(const char *); |
| @@ -37,6 +37,30 @@ static pthread_once_t crypto_init_once = PTHREAD_ONCE_INIT; | |||
| 37 | static pthread_t crypto_init_thread; | 37 | static pthread_t crypto_init_thread; |
| 38 | static int crypto_init_cleaned_up; | 38 | static int crypto_init_cleaned_up; |
| 39 | 39 | ||
| 40 | void openssl_init_crypto_constructor(void) __attribute__((constructor)); | ||
| 41 | |||
| 42 | #ifndef HAVE_CRYPTO_CPU_CAPS_INIT | ||
| 43 | void | ||
| 44 | crypto_cpu_caps_init(void) | ||
| 45 | { | ||
| 46 | } | ||
| 47 | #endif | ||
| 48 | |||
| 49 | /* | ||
| 50 | * This function is invoked as a constructor when the library is loaded. The | ||
| 51 | * code run from here must not allocate memory or trigger signals. The only | ||
| 52 | * safe code is to read data and update global variables. | ||
| 53 | */ | ||
| 54 | void | ||
| 55 | openssl_init_crypto_constructor(void) | ||
| 56 | { | ||
| 57 | crypto_cpu_caps_init(); | ||
| 58 | } | ||
| 59 | |||
| 60 | /* | ||
| 61 | * This is used by various configure scripts to check availability of libcrypto, | ||
| 62 | * so we need to keep it. | ||
| 63 | */ | ||
| 40 | void | 64 | void |
| 41 | OPENSSL_init(void) | 65 | OPENSSL_init(void) |
| 42 | { | 66 | { |
| @@ -48,8 +72,6 @@ OPENSSL_init_crypto_internal(void) | |||
| 48 | { | 72 | { |
| 49 | crypto_init_thread = pthread_self(); | 73 | crypto_init_thread = pthread_self(); |
| 50 | 74 | ||
| 51 | crypto_cpu_caps_init(); | ||
| 52 | |||
| 53 | ERR_load_crypto_strings(); | 75 | ERR_load_crypto_strings(); |
| 54 | } | 76 | } |
| 55 | 77 | ||
diff --git a/src/lib/libcrypto/crypto_internal.h b/src/lib/libcrypto/crypto_internal.h index 09ae7fa466..058245e95e 100644 --- a/src/lib/libcrypto/crypto_internal.h +++ b/src/lib/libcrypto/crypto_internal.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_internal.h,v 1.15 2025/01/19 07:51:41 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_internal.h,v 1.16 2025/07/22 09:18:02 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -300,6 +300,4 @@ crypto_ror_u64(uint64_t v, size_t shift) | |||
| 300 | 300 | ||
| 301 | void crypto_cpu_caps_init(void); | 301 | void crypto_cpu_caps_init(void); |
| 302 | 302 | ||
| 303 | uint64_t crypto_cpu_caps_ia32(void); | ||
| 304 | |||
| 305 | #endif | 303 | #endif |
diff --git a/src/lib/libcrypto/crypto_legacy.c b/src/lib/libcrypto/crypto_legacy.c index d864fc4c3f..dcaa63236c 100644 --- a/src/lib/libcrypto/crypto_legacy.c +++ b/src/lib/libcrypto/crypto_legacy.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_legacy.c,v 1.6 2024/11/06 04:18:42 tb Exp $ */ | 1 | /* $OpenBSD: crypto_legacy.c,v 1.9 2025/07/22 09:18:02 jsing Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -123,10 +123,10 @@ | |||
| 123 | 123 | ||
| 124 | #include <openssl/opensslconf.h> | 124 | #include <openssl/opensslconf.h> |
| 125 | #include <openssl/crypto.h> | 125 | #include <openssl/crypto.h> |
| 126 | #include <openssl/err.h> | ||
| 127 | 126 | ||
| 128 | #include "crypto_internal.h" | 127 | #include "crypto_internal.h" |
| 129 | #include "crypto_local.h" | 128 | #include "crypto_local.h" |
| 129 | #include "err_local.h" | ||
| 130 | #include "x86_arch.h" | 130 | #include "x86_arch.h" |
| 131 | 131 | ||
| 132 | /* Machine independent capabilities. */ | 132 | /* Machine independent capabilities. */ |
| @@ -306,29 +306,6 @@ void | |||
| 306 | } | 306 | } |
| 307 | LCRYPTO_ALIAS(CRYPTO_get_dynlock_destroy_callback); | 307 | LCRYPTO_ALIAS(CRYPTO_get_dynlock_destroy_callback); |
| 308 | 308 | ||
| 309 | #if !defined(OPENSSL_CPUID_SETUP) && !defined(OPENSSL_CPUID_OBJ) | ||
| 310 | void | ||
| 311 | OPENSSL_cpuid_setup(void) | ||
| 312 | { | ||
| 313 | } | ||
| 314 | #endif | ||
| 315 | |||
| 316 | #ifndef HAVE_CRYPTO_CPU_CAPS_INIT | ||
| 317 | void | ||
| 318 | crypto_cpu_caps_init(void) | ||
| 319 | { | ||
| 320 | OPENSSL_cpuid_setup(); | ||
| 321 | } | ||
| 322 | #endif | ||
| 323 | |||
| 324 | #ifndef HAVE_CRYPTO_CPU_CAPS_IA32 | ||
| 325 | uint64_t | ||
| 326 | crypto_cpu_caps_ia32(void) | ||
| 327 | { | ||
| 328 | return 0; | ||
| 329 | } | ||
| 330 | #endif | ||
| 331 | |||
| 332 | uint64_t | 309 | uint64_t |
| 333 | OPENSSL_cpu_caps(void) | 310 | OPENSSL_cpu_caps(void) |
| 334 | { | 311 | { |
diff --git a/src/lib/libcrypto/crypto_local.h b/src/lib/libcrypto/crypto_local.h index 2b4c74552f..606f17cefb 100644 --- a/src/lib/libcrypto/crypto_local.h +++ b/src/lib/libcrypto/crypto_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_local.h,v 1.4 2024/11/05 10:11:58 tb Exp $ */ | 1 | /* $OpenBSD: crypto_local.h,v 1.6 2025/06/09 14:37:48 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -65,6 +65,10 @@ | |||
| 65 | extern "C" { | 65 | extern "C" { |
| 66 | #endif | 66 | #endif |
| 67 | 67 | ||
| 68 | #ifndef OPENSSLDIR | ||
| 69 | #define OPENSSLDIR "/etc/ssl" | ||
| 70 | #endif | ||
| 71 | |||
| 68 | #define X509_CERT_AREA OPENSSLDIR | 72 | #define X509_CERT_AREA OPENSSLDIR |
| 69 | #define X509_CERT_DIR OPENSSLDIR "/certs" | 73 | #define X509_CERT_DIR OPENSSLDIR "/certs" |
| 70 | #define X509_CERT_FILE OPENSSLDIR "/cert.pem" | 74 | #define X509_CERT_FILE OPENSSLDIR "/cert.pem" |
| @@ -75,8 +79,6 @@ extern "C" { | |||
| 75 | #define CTLOG_FILE OPENSSLDIR "/ct_log_list.cnf" | 79 | #define CTLOG_FILE OPENSSLDIR "/ct_log_list.cnf" |
| 76 | #define CTLOG_FILE_EVP "CTLOG_FILE" | 80 | #define CTLOG_FILE_EVP "CTLOG_FILE" |
| 77 | 81 | ||
| 78 | void OPENSSL_cpuid_setup(void); | ||
| 79 | |||
| 80 | #ifdef __cplusplus | 82 | #ifdef __cplusplus |
| 81 | } | 83 | } |
| 82 | #endif | 84 | #endif |
diff --git a/src/lib/libcrypto/ct/ct_b64.c b/src/lib/libcrypto/ct/ct_b64.c index 101cd1e2b1..e6e0532add 100644 --- a/src/lib/libcrypto/ct/ct_b64.c +++ b/src/lib/libcrypto/ct/ct_b64.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ct_b64.c,v 1.7 2023/07/08 07:22:58 beck Exp $ */ | 1 | /* $OpenBSD: ct_b64.c,v 1.8 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Rob Stradling (rob@comodo.com) and Stephen Henson | 3 | * Written by Rob Stradling (rob@comodo.com) and Stephen Henson |
| 4 | * (steve@openssl.org) for the OpenSSL project 2014. | 4 | * (steve@openssl.org) for the OpenSSL project 2014. |
| @@ -61,11 +61,11 @@ | |||
| 61 | #include <string.h> | 61 | #include <string.h> |
| 62 | 62 | ||
| 63 | #include <openssl/ct.h> | 63 | #include <openssl/ct.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | #include <openssl/evp.h> | 64 | #include <openssl/evp.h> |
| 66 | 65 | ||
| 67 | #include "bytestring.h" | 66 | #include "bytestring.h" |
| 68 | #include "ct_local.h" | 67 | #include "ct_local.h" |
| 68 | #include "err_local.h" | ||
| 69 | 69 | ||
| 70 | /* | 70 | /* |
| 71 | * Decodes the base64 string |in| into |out|. | 71 | * Decodes the base64 string |in| into |out|. |
diff --git a/src/lib/libcrypto/ct/ct_local.h b/src/lib/libcrypto/ct/ct_local.h index cd19ed096a..152ab9d8c4 100644 --- a/src/lib/libcrypto/ct/ct_local.h +++ b/src/lib/libcrypto/ct/ct_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ct_local.h,v 1.8 2021/12/20 17:19:19 jsing Exp $ */ | 1 | /* $OpenBSD: ct_local.h,v 1.9 2025/11/26 10:19:57 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Rob Percival (robpercival@google.com) for the OpenSSL project. | 3 | * Written by Rob Percival (robpercival@google.com) for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -51,6 +51,9 @@ | |||
| 51 | * ==================================================================== | 51 | * ==================================================================== |
| 52 | */ | 52 | */ |
| 53 | 53 | ||
| 54 | #ifndef HEADER_CT_LOCAL_H | ||
| 55 | #define HEADER_CT_LOCAL_H | ||
| 56 | |||
| 54 | #include <stddef.h> | 57 | #include <stddef.h> |
| 55 | 58 | ||
| 56 | #include <openssl/ct.h> | 59 | #include <openssl/ct.h> |
| @@ -258,3 +261,5 @@ int o2i_SCT_signature(SCT *sct, CBS *cbs); | |||
| 258 | * Handlers for Certificate Transparency X509v3/OCSP extensions | 261 | * Handlers for Certificate Transparency X509v3/OCSP extensions |
| 259 | */ | 262 | */ |
| 260 | extern const X509V3_EXT_METHOD v3_ct_scts[3]; | 263 | extern const X509V3_EXT_METHOD v3_ct_scts[3]; |
| 264 | |||
| 265 | #endif /* HEADER_CT_LOCAL_H */ | ||
diff --git a/src/lib/libcrypto/ct/ct_log.c b/src/lib/libcrypto/ct/ct_log.c index 72045477ac..48611df979 100644 --- a/src/lib/libcrypto/ct/ct_log.c +++ b/src/lib/libcrypto/ct/ct_log.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ct_log.c,v 1.9 2024/11/05 09:35:40 tb Exp $ */ | 1 | /* $OpenBSD: ct_log.c,v 1.10 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Author: Adam Eijdenberg <adam.eijdenberg@gmail.com>. */ | 2 | /* Author: Adam Eijdenberg <adam.eijdenberg@gmail.com>. */ |
| 3 | /* ==================================================================== | 3 | /* ==================================================================== |
| 4 | * Copyright (c) 1998-2016 The OpenSSL Project. All rights reserved. | 4 | * Copyright (c) 1998-2016 The OpenSSL Project. All rights reserved. |
| @@ -65,13 +65,13 @@ | |||
| 65 | #include <openssl/asn1.h> | 65 | #include <openssl/asn1.h> |
| 66 | #include <openssl/conf.h> | 66 | #include <openssl/conf.h> |
| 67 | #include <openssl/ct.h> | 67 | #include <openssl/ct.h> |
| 68 | #include <openssl/err.h> | ||
| 69 | #include <openssl/evp.h> | 68 | #include <openssl/evp.h> |
| 70 | #include <openssl/sha.h> | 69 | #include <openssl/sha.h> |
| 71 | #include <openssl/x509.h> | 70 | #include <openssl/x509.h> |
| 72 | 71 | ||
| 73 | #include "conf_local.h" | 72 | #include "conf_local.h" |
| 74 | #include "crypto_local.h" | 73 | #include "crypto_local.h" |
| 74 | #include "err_local.h" | ||
| 75 | 75 | ||
| 76 | 76 | ||
| 77 | /* | 77 | /* |
diff --git a/src/lib/libcrypto/ct/ct_oct.c b/src/lib/libcrypto/ct/ct_oct.c index 1f5e5c75d0..686d845f11 100644 --- a/src/lib/libcrypto/ct/ct_oct.c +++ b/src/lib/libcrypto/ct/ct_oct.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ct_oct.c,v 1.9 2023/07/08 07:22:58 beck Exp $ */ | 1 | /* $OpenBSD: ct_oct.c,v 1.10 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Rob Stradling (rob@comodo.com) and Stephen Henson | 3 | * Written by Rob Stradling (rob@comodo.com) and Stephen Henson |
| 4 | * (steve@openssl.org) for the OpenSSL project 2014. | 4 | * (steve@openssl.org) for the OpenSSL project 2014. |
| @@ -67,10 +67,10 @@ | |||
| 67 | #include <openssl/asn1.h> | 67 | #include <openssl/asn1.h> |
| 68 | #include <openssl/buffer.h> | 68 | #include <openssl/buffer.h> |
| 69 | #include <openssl/ct.h> | 69 | #include <openssl/ct.h> |
| 70 | #include <openssl/err.h> | ||
| 71 | 70 | ||
| 72 | #include "bytestring.h" | 71 | #include "bytestring.h" |
| 73 | #include "ct_local.h" | 72 | #include "ct_local.h" |
| 73 | #include "err_local.h" | ||
| 74 | 74 | ||
| 75 | int | 75 | int |
| 76 | o2i_SCT_signature(SCT *sct, CBS *cbs) | 76 | o2i_SCT_signature(SCT *sct, CBS *cbs) |
diff --git a/src/lib/libcrypto/ct/ct_policy.c b/src/lib/libcrypto/ct/ct_policy.c index eb2b312019..a242b0d8f8 100644 --- a/src/lib/libcrypto/ct/ct_policy.c +++ b/src/lib/libcrypto/ct/ct_policy.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ct_policy.c,v 1.6 2023/07/08 07:22:58 beck Exp $ */ | 1 | /* $OpenBSD: ct_policy.c,v 1.7 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Implementations of Certificate Transparency SCT policies. | 3 | * Implementations of Certificate Transparency SCT policies. |
| 4 | * Written by Rob Percival (robpercival@google.com) for the OpenSSL project. | 4 | * Written by Rob Percival (robpercival@google.com) for the OpenSSL project. |
| @@ -56,11 +56,12 @@ | |||
| 56 | # error "CT is disabled" | 56 | # error "CT is disabled" |
| 57 | #endif | 57 | #endif |
| 58 | 58 | ||
| 59 | #include <openssl/ct.h> | ||
| 60 | #include <openssl/err.h> | ||
| 61 | #include <time.h> | 59 | #include <time.h> |
| 62 | 60 | ||
| 61 | #include <openssl/ct.h> | ||
| 62 | |||
| 63 | #include "ct_local.h" | 63 | #include "ct_local.h" |
| 64 | #include "err_local.h" | ||
| 64 | 65 | ||
| 65 | /* | 66 | /* |
| 66 | * Number of seconds in the future that an SCT timestamp can be, by default, | 67 | * Number of seconds in the future that an SCT timestamp can be, by default, |
diff --git a/src/lib/libcrypto/ct/ct_sct.c b/src/lib/libcrypto/ct/ct_sct.c index 4b2716e734..d647e34d92 100644 --- a/src/lib/libcrypto/ct/ct_sct.c +++ b/src/lib/libcrypto/ct/ct_sct.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ct_sct.c,v 1.10 2023/07/22 17:02:49 tb Exp $ */ | 1 | /* $OpenBSD: ct_sct.c,v 1.11 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Rob Stradling (rob@comodo.com), Stephen Henson (steve@openssl.org) | 3 | * Written by Rob Stradling (rob@comodo.com), Stephen Henson (steve@openssl.org) |
| 4 | * and Adam Eijdenberg (adam.eijdenberg@gmail.com) for the OpenSSL project 2016. | 4 | * and Adam Eijdenberg (adam.eijdenberg@gmail.com) for the OpenSSL project 2016. |
| @@ -67,11 +67,11 @@ | |||
| 67 | 67 | ||
| 68 | #include <openssl/asn1.h> | 68 | #include <openssl/asn1.h> |
| 69 | #include <openssl/ct.h> | 69 | #include <openssl/ct.h> |
| 70 | #include <openssl/err.h> | ||
| 71 | #include <openssl/objects.h> | 70 | #include <openssl/objects.h> |
| 72 | #include <openssl/x509.h> | 71 | #include <openssl/x509.h> |
| 73 | 72 | ||
| 74 | #include "ct_local.h" | 73 | #include "ct_local.h" |
| 74 | #include "err_local.h" | ||
| 75 | 75 | ||
| 76 | SCT * | 76 | SCT * |
| 77 | SCT_new(void) | 77 | SCT_new(void) |
diff --git a/src/lib/libcrypto/ct/ct_sct_ctx.c b/src/lib/libcrypto/ct/ct_sct_ctx.c index b2b6d4e269..930c7df59b 100644 --- a/src/lib/libcrypto/ct/ct_sct_ctx.c +++ b/src/lib/libcrypto/ct/ct_sct_ctx.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ct_sct_ctx.c,v 1.6 2022/06/30 11:14:47 tb Exp $ */ | 1 | /* $OpenBSD: ct_sct_ctx.c,v 1.7 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Rob Stradling (rob@comodo.com) and Stephen Henson | 3 | * Written by Rob Stradling (rob@comodo.com) and Stephen Henson |
| 4 | * (steve@openssl.org) for the OpenSSL project 2014. | 4 | * (steve@openssl.org) for the OpenSSL project 2014. |
| @@ -64,11 +64,11 @@ | |||
| 64 | #include <stddef.h> | 64 | #include <stddef.h> |
| 65 | #include <string.h> | 65 | #include <string.h> |
| 66 | 66 | ||
| 67 | #include <openssl/err.h> | ||
| 68 | #include <openssl/objects.h> | 67 | #include <openssl/objects.h> |
| 69 | #include <openssl/x509.h> | 68 | #include <openssl/x509.h> |
| 70 | 69 | ||
| 71 | #include "ct_local.h" | 70 | #include "ct_local.h" |
| 71 | #include "err_local.h" | ||
| 72 | 72 | ||
| 73 | SCT_CTX * | 73 | SCT_CTX * |
| 74 | SCT_CTX_new(void) | 74 | SCT_CTX_new(void) |
diff --git a/src/lib/libcrypto/ct/ct_vfy.c b/src/lib/libcrypto/ct/ct_vfy.c index 424117263a..5dbb2096e1 100644 --- a/src/lib/libcrypto/ct/ct_vfy.c +++ b/src/lib/libcrypto/ct/ct_vfy.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ct_vfy.c,v 1.6 2022/01/06 14:34:40 jsing Exp $ */ | 1 | /* $OpenBSD: ct_vfy.c,v 1.7 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Rob Stradling (rob@comodo.com) and Stephen Henson | 3 | * Written by Rob Stradling (rob@comodo.com) and Stephen Henson |
| 4 | * (steve@openssl.org) for the OpenSSL project 2014. | 4 | * (steve@openssl.org) for the OpenSSL project 2014. |
| @@ -60,11 +60,11 @@ | |||
| 60 | #include <string.h> | 60 | #include <string.h> |
| 61 | 61 | ||
| 62 | #include <openssl/ct.h> | 62 | #include <openssl/ct.h> |
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/evp.h> | 63 | #include <openssl/evp.h> |
| 65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
| 66 | 65 | ||
| 67 | #include "ct_local.h" | 66 | #include "ct_local.h" |
| 67 | #include "err_local.h" | ||
| 68 | 68 | ||
| 69 | typedef enum sct_signature_type_t { | 69 | typedef enum sct_signature_type_t { |
| 70 | SIGNATURE_TYPE_NOT_SET = -1, | 70 | SIGNATURE_TYPE_NOT_SET = -1, |
diff --git a/src/lib/libcrypto/curve25519/curve25519.c b/src/lib/libcrypto/curve25519/curve25519.c index 4e644c4280..0aa3d2855b 100644 --- a/src/lib/libcrypto/curve25519/curve25519.c +++ b/src/lib/libcrypto/curve25519/curve25519.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: curve25519.c,v 1.16 2023/07/08 15:12:49 beck Exp $ */ | 1 | /* $OpenBSD: curve25519.c,v 1.18 2025/07/29 10:52:20 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2015, Google Inc. | 3 | * Copyright (c) 2015, Google Inc. |
| 4 | * | 4 | * |
| @@ -3781,6 +3781,17 @@ ge_double_scalarmult_vartime(ge_p2 *r, const uint8_t *a, | |||
| 3781 | } | 3781 | } |
| 3782 | } | 3782 | } |
| 3783 | 3783 | ||
| 3784 | /* | ||
| 3785 | * int64_lshift21 returns |a << 21| but is defined when shifting bits into the | ||
| 3786 | * sign bit. This works around a language flaw in C. | ||
| 3787 | * | ||
| 3788 | * XXX: This is a hack to avoid undefined behavior when shifting into the sign bit. | ||
| 3789 | * We match BoringSSL's implementation here. | ||
| 3790 | */ | ||
| 3791 | static inline int64_t int64_lshift21(int64_t a) { | ||
| 3792 | return (int64_t)((uint64_t)a << 21); | ||
| 3793 | } | ||
| 3794 | |||
| 3784 | /* The set of scalars is \Z/l | 3795 | /* The set of scalars is \Z/l |
| 3785 | * where l = 2^252 + 27742317777372353535851937790883648493. */ | 3796 | * where l = 2^252 + 27742317777372353535851937790883648493. */ |
| 3786 | 3797 | ||
| @@ -3885,38 +3896,38 @@ x25519_sc_reduce(uint8_t *s) { | |||
| 3885 | 3896 | ||
| 3886 | carry6 = (s6 + (1 << 20)) >> 21; | 3897 | carry6 = (s6 + (1 << 20)) >> 21; |
| 3887 | s7 += carry6; | 3898 | s7 += carry6; |
| 3888 | s6 -= carry6 << 21; | 3899 | s6 -= int64_lshift21(carry6); |
| 3889 | carry8 = (s8 + (1 << 20)) >> 21; | 3900 | carry8 = (s8 + (1 << 20)) >> 21; |
| 3890 | s9 += carry8; | 3901 | s9 += carry8; |
| 3891 | s8 -= carry8 << 21; | 3902 | s8 -= int64_lshift21(carry8); |
| 3892 | carry10 = (s10 + (1 << 20)) >> 21; | 3903 | carry10 = (s10 + (1 << 20)) >> 21; |
| 3893 | s11 += carry10; | 3904 | s11 += carry10; |
| 3894 | s10 -= carry10 << 21; | 3905 | s10 -= int64_lshift21(carry10); |
| 3895 | carry12 = (s12 + (1 << 20)) >> 21; | 3906 | carry12 = (s12 + (1 << 20)) >> 21; |
| 3896 | s13 += carry12; | 3907 | s13 += carry12; |
| 3897 | s12 -= carry12 << 21; | 3908 | s12 -= int64_lshift21(carry12); |
| 3898 | carry14 = (s14 + (1 << 20)) >> 21; | 3909 | carry14 = (s14 + (1 << 20)) >> 21; |
| 3899 | s15 += carry14; | 3910 | s15 += carry14; |
| 3900 | s14 -= carry14 << 21; | 3911 | s14 -= int64_lshift21(carry14); |
| 3901 | carry16 = (s16 + (1 << 20)) >> 21; | 3912 | carry16 = (s16 + (1 << 20)) >> 21; |
| 3902 | s17 += carry16; | 3913 | s17 += carry16; |
| 3903 | s16 -= carry16 << 21; | 3914 | s16 -= int64_lshift21(carry16); |
| 3904 | 3915 | ||
| 3905 | carry7 = (s7 + (1 << 20)) >> 21; | 3916 | carry7 = (s7 + (1 << 20)) >> 21; |
| 3906 | s8 += carry7; | 3917 | s8 += carry7; |
| 3907 | s7 -= carry7 << 21; | 3918 | s7 -= int64_lshift21(carry7); |
| 3908 | carry9 = (s9 + (1 << 20)) >> 21; | 3919 | carry9 = (s9 + (1 << 20)) >> 21; |
| 3909 | s10 += carry9; | 3920 | s10 += carry9; |
| 3910 | s9 -= carry9 << 21; | 3921 | s9 -= int64_lshift21(carry9); |
| 3911 | carry11 = (s11 + (1 << 20)) >> 21; | 3922 | carry11 = (s11 + (1 << 20)) >> 21; |
| 3912 | s12 += carry11; | 3923 | s12 += carry11; |
| 3913 | s11 -= carry11 << 21; | 3924 | s11 -= int64_lshift21(carry11); |
| 3914 | carry13 = (s13 + (1 << 20)) >> 21; | 3925 | carry13 = (s13 + (1 << 20)) >> 21; |
| 3915 | s14 += carry13; | 3926 | s14 += carry13; |
| 3916 | s13 -= carry13 << 21; | 3927 | s13 -= int64_lshift21(carry13); |
| 3917 | carry15 = (s15 + (1 << 20)) >> 21; | 3928 | carry15 = (s15 + (1 << 20)) >> 21; |
| 3918 | s16 += carry15; | 3929 | s16 += carry15; |
| 3919 | s15 -= carry15 << 21; | 3930 | s15 -= int64_lshift21(carry15); |
| 3920 | 3931 | ||
| 3921 | s5 += s17 * 666643; | 3932 | s5 += s17 * 666643; |
| 3922 | s6 += s17 * 470296; | 3933 | s6 += s17 * 470296; |
| @@ -3968,41 +3979,41 @@ x25519_sc_reduce(uint8_t *s) { | |||
| 3968 | 3979 | ||
| 3969 | carry0 = (s0 + (1 << 20)) >> 21; | 3980 | carry0 = (s0 + (1 << 20)) >> 21; |
| 3970 | s1 += carry0; | 3981 | s1 += carry0; |
| 3971 | s0 -= carry0 << 21; | 3982 | s0 -= int64_lshift21(carry0); |
| 3972 | carry2 = (s2 + (1 << 20)) >> 21; | 3983 | carry2 = (s2 + (1 << 20)) >> 21; |
| 3973 | s3 += carry2; | 3984 | s3 += carry2; |
| 3974 | s2 -= carry2 << 21; | 3985 | s2 -= int64_lshift21(carry2); |
| 3975 | carry4 = (s4 + (1 << 20)) >> 21; | 3986 | carry4 = (s4 + (1 << 20)) >> 21; |
| 3976 | s5 += carry4; | 3987 | s5 += carry4; |
| 3977 | s4 -= carry4 << 21; | 3988 | s4 -= int64_lshift21(carry4); |
| 3978 | carry6 = (s6 + (1 << 20)) >> 21; | 3989 | carry6 = (s6 + (1 << 20)) >> 21; |
| 3979 | s7 += carry6; | 3990 | s7 += carry6; |
| 3980 | s6 -= carry6 << 21; | 3991 | s6 -= int64_lshift21(carry6); |
| 3981 | carry8 = (s8 + (1 << 20)) >> 21; | 3992 | carry8 = (s8 + (1 << 20)) >> 21; |
| 3982 | s9 += carry8; | 3993 | s9 += carry8; |
| 3983 | s8 -= carry8 << 21; | 3994 | s8 -= int64_lshift21(carry8); |
| 3984 | carry10 = (s10 + (1 << 20)) >> 21; | 3995 | carry10 = (s10 + (1 << 20)) >> 21; |
| 3985 | s11 += carry10; | 3996 | s11 += carry10; |
| 3986 | s10 -= carry10 << 21; | 3997 | s10 -= int64_lshift21(carry10); |
| 3987 | 3998 | ||
| 3988 | carry1 = (s1 + (1 << 20)) >> 21; | 3999 | carry1 = (s1 + (1 << 20)) >> 21; |
| 3989 | s2 += carry1; | 4000 | s2 += carry1; |
| 3990 | s1 -= carry1 << 21; | 4001 | s1 -= int64_lshift21(carry1); |
| 3991 | carry3 = (s3 + (1 << 20)) >> 21; | 4002 | carry3 = (s3 + (1 << 20)) >> 21; |
| 3992 | s4 += carry3; | 4003 | s4 += carry3; |
| 3993 | s3 -= carry3 << 21; | 4004 | s3 -= int64_lshift21(carry3); |
| 3994 | carry5 = (s5 + (1 << 20)) >> 21; | 4005 | carry5 = (s5 + (1 << 20)) >> 21; |
| 3995 | s6 += carry5; | 4006 | s6 += carry5; |
| 3996 | s5 -= carry5 << 21; | 4007 | s5 -= int64_lshift21(carry5); |
| 3997 | carry7 = (s7 + (1 << 20)) >> 21; | 4008 | carry7 = (s7 + (1 << 20)) >> 21; |
| 3998 | s8 += carry7; | 4009 | s8 += carry7; |
| 3999 | s7 -= carry7 << 21; | 4010 | s7 -= int64_lshift21(carry7); |
| 4000 | carry9 = (s9 + (1 << 20)) >> 21; | 4011 | carry9 = (s9 + (1 << 20)) >> 21; |
| 4001 | s10 += carry9; | 4012 | s10 += carry9; |
| 4002 | s9 -= carry9 << 21; | 4013 | s9 -= int64_lshift21(carry9); |
| 4003 | carry11 = (s11 + (1 << 20)) >> 21; | 4014 | carry11 = (s11 + (1 << 20)) >> 21; |
| 4004 | s12 += carry11; | 4015 | s12 += carry11; |
| 4005 | s11 -= carry11 << 21; | 4016 | s11 -= int64_lshift21(carry11); |
| 4006 | 4017 | ||
| 4007 | s0 += s12 * 666643; | 4018 | s0 += s12 * 666643; |
| 4008 | s1 += s12 * 470296; | 4019 | s1 += s12 * 470296; |
| @@ -4014,40 +4025,40 @@ x25519_sc_reduce(uint8_t *s) { | |||
| 4014 | 4025 | ||
| 4015 | carry0 = s0 >> 21; | 4026 | carry0 = s0 >> 21; |
| 4016 | s1 += carry0; | 4027 | s1 += carry0; |
| 4017 | s0 -= carry0 << 21; | 4028 | s0 -= int64_lshift21(carry0); |
| 4018 | carry1 = s1 >> 21; | 4029 | carry1 = s1 >> 21; |
| 4019 | s2 += carry1; | 4030 | s2 += carry1; |
| 4020 | s1 -= carry1 << 21; | 4031 | s1 -= int64_lshift21(carry1); |
| 4021 | carry2 = s2 >> 21; | 4032 | carry2 = s2 >> 21; |
| 4022 | s3 += carry2; | 4033 | s3 += carry2; |
| 4023 | s2 -= carry2 << 21; | 4034 | s2 -= int64_lshift21(carry2); |
| 4024 | carry3 = s3 >> 21; | 4035 | carry3 = s3 >> 21; |
| 4025 | s4 += carry3; | 4036 | s4 += carry3; |
| 4026 | s3 -= carry3 << 21; | 4037 | s3 -= int64_lshift21(carry3); |
| 4027 | carry4 = s4 >> 21; | 4038 | carry4 = s4 >> 21; |
| 4028 | s5 += carry4; | 4039 | s5 += carry4; |
| 4029 | s4 -= carry4 << 21; | 4040 | s4 -= int64_lshift21(carry4); |
| 4030 | carry5 = s5 >> 21; | 4041 | carry5 = s5 >> 21; |
| 4031 | s6 += carry5; | 4042 | s6 += carry5; |
| 4032 | s5 -= carry5 << 21; | 4043 | s5 -= int64_lshift21(carry5); |
| 4033 | carry6 = s6 >> 21; | 4044 | carry6 = s6 >> 21; |
| 4034 | s7 += carry6; | 4045 | s7 += carry6; |
| 4035 | s6 -= carry6 << 21; | 4046 | s6 -= int64_lshift21(carry6); |
| 4036 | carry7 = s7 >> 21; | 4047 | carry7 = s7 >> 21; |
| 4037 | s8 += carry7; | 4048 | s8 += carry7; |
| 4038 | s7 -= carry7 << 21; | 4049 | s7 -= int64_lshift21(carry7); |
| 4039 | carry8 = s8 >> 21; | 4050 | carry8 = s8 >> 21; |
| 4040 | s9 += carry8; | 4051 | s9 += carry8; |
| 4041 | s8 -= carry8 << 21; | 4052 | s8 -= int64_lshift21(carry8); |
| 4042 | carry9 = s9 >> 21; | 4053 | carry9 = s9 >> 21; |
| 4043 | s10 += carry9; | 4054 | s10 += carry9; |
| 4044 | s9 -= carry9 << 21; | 4055 | s9 -= int64_lshift21(carry9); |
| 4045 | carry10 = s10 >> 21; | 4056 | carry10 = s10 >> 21; |
| 4046 | s11 += carry10; | 4057 | s11 += carry10; |
| 4047 | s10 -= carry10 << 21; | 4058 | s10 -= int64_lshift21(carry10); |
| 4048 | carry11 = s11 >> 21; | 4059 | carry11 = s11 >> 21; |
| 4049 | s12 += carry11; | 4060 | s12 += carry11; |
| 4050 | s11 -= carry11 << 21; | 4061 | s11 -= int64_lshift21(carry11); |
| 4051 | 4062 | ||
| 4052 | s0 += s12 * 666643; | 4063 | s0 += s12 * 666643; |
| 4053 | s1 += s12 * 470296; | 4064 | s1 += s12 * 470296; |
| @@ -4059,37 +4070,37 @@ x25519_sc_reduce(uint8_t *s) { | |||
| 4059 | 4070 | ||
| 4060 | carry0 = s0 >> 21; | 4071 | carry0 = s0 >> 21; |
| 4061 | s1 += carry0; | 4072 | s1 += carry0; |
| 4062 | s0 -= carry0 << 21; | 4073 | s0 -= int64_lshift21(carry0); |
| 4063 | carry1 = s1 >> 21; | 4074 | carry1 = s1 >> 21; |
| 4064 | s2 += carry1; | 4075 | s2 += carry1; |
| 4065 | s1 -= carry1 << 21; | 4076 | s1 -= int64_lshift21(carry1); |
| 4066 | carry2 = s2 >> 21; | 4077 | carry2 = s2 >> 21; |
| 4067 | s3 += carry2; | 4078 | s3 += carry2; |
| 4068 | s2 -= carry2 << 21; | 4079 | s2 -= int64_lshift21(carry2); |
| 4069 | carry3 = s3 >> 21; | 4080 | carry3 = s3 >> 21; |
| 4070 | s4 += carry3; | 4081 | s4 += carry3; |
| 4071 | s3 -= carry3 << 21; | 4082 | s3 -= int64_lshift21(carry3); |
| 4072 | carry4 = s4 >> 21; | 4083 | carry4 = s4 >> 21; |
| 4073 | s5 += carry4; | 4084 | s5 += carry4; |
| 4074 | s4 -= carry4 << 21; | 4085 | s4 -= int64_lshift21(carry4); |
| 4075 | carry5 = s5 >> 21; | 4086 | carry5 = s5 >> 21; |
| 4076 | s6 += carry5; | 4087 | s6 += carry5; |
| 4077 | s5 -= carry5 << 21; | 4088 | s5 -= int64_lshift21(carry5); |
| 4078 | carry6 = s6 >> 21; | 4089 | carry6 = s6 >> 21; |
| 4079 | s7 += carry6; | 4090 | s7 += carry6; |
| 4080 | s6 -= carry6 << 21; | 4091 | s6 -= int64_lshift21(carry6); |
| 4081 | carry7 = s7 >> 21; | 4092 | carry7 = s7 >> 21; |
| 4082 | s8 += carry7; | 4093 | s8 += carry7; |
| 4083 | s7 -= carry7 << 21; | 4094 | s7 -= int64_lshift21(carry7); |
| 4084 | carry8 = s8 >> 21; | 4095 | carry8 = s8 >> 21; |
| 4085 | s9 += carry8; | 4096 | s9 += carry8; |
| 4086 | s8 -= carry8 << 21; | 4097 | s8 -= int64_lshift21(carry8); |
| 4087 | carry9 = s9 >> 21; | 4098 | carry9 = s9 >> 21; |
| 4088 | s10 += carry9; | 4099 | s10 += carry9; |
| 4089 | s9 -= carry9 << 21; | 4100 | s9 -= int64_lshift21(carry9); |
| 4090 | carry10 = s10 >> 21; | 4101 | carry10 = s10 >> 21; |
| 4091 | s11 += carry10; | 4102 | s11 += carry10; |
| 4092 | s10 -= carry10 << 21; | 4103 | s10 -= int64_lshift21(carry10); |
| 4093 | 4104 | ||
| 4094 | s[0] = s0 >> 0; | 4105 | s[0] = s0 >> 0; |
| 4095 | s[1] = s0 >> 8; | 4106 | s[1] = s0 >> 8; |
| @@ -4257,74 +4268,74 @@ sc_muladd(uint8_t *s, const uint8_t *a, const uint8_t *b, | |||
| 4257 | 4268 | ||
| 4258 | carry0 = (s0 + (1 << 20)) >> 21; | 4269 | carry0 = (s0 + (1 << 20)) >> 21; |
| 4259 | s1 += carry0; | 4270 | s1 += carry0; |
| 4260 | s0 -= carry0 << 21; | 4271 | s0 -= int64_lshift21(carry0); |
| 4261 | carry2 = (s2 + (1 << 20)) >> 21; | 4272 | carry2 = (s2 + (1 << 20)) >> 21; |
| 4262 | s3 += carry2; | 4273 | s3 += carry2; |
| 4263 | s2 -= carry2 << 21; | 4274 | s2 -= int64_lshift21(carry2); |
| 4264 | carry4 = (s4 + (1 << 20)) >> 21; | 4275 | carry4 = (s4 + (1 << 20)) >> 21; |
| 4265 | s5 += carry4; | 4276 | s5 += carry4; |
| 4266 | s4 -= carry4 << 21; | 4277 | s4 -= int64_lshift21(carry4); |
| 4267 | carry6 = (s6 + (1 << 20)) >> 21; | 4278 | carry6 = (s6 + (1 << 20)) >> 21; |
| 4268 | s7 += carry6; | 4279 | s7 += carry6; |
| 4269 | s6 -= carry6 << 21; | 4280 | s6 -= int64_lshift21(carry6); |
| 4270 | carry8 = (s8 + (1 << 20)) >> 21; | 4281 | carry8 = (s8 + (1 << 20)) >> 21; |
| 4271 | s9 += carry8; | 4282 | s9 += carry8; |
| 4272 | s8 -= carry8 << 21; | 4283 | s8 -= int64_lshift21(carry8); |
| 4273 | carry10 = (s10 + (1 << 20)) >> 21; | 4284 | carry10 = (s10 + (1 << 20)) >> 21; |
| 4274 | s11 += carry10; | 4285 | s11 += carry10; |
| 4275 | s10 -= carry10 << 21; | 4286 | s10 -= int64_lshift21(carry10); |
| 4276 | carry12 = (s12 + (1 << 20)) >> 21; | 4287 | carry12 = (s12 + (1 << 20)) >> 21; |
| 4277 | s13 += carry12; | 4288 | s13 += carry12; |
| 4278 | s12 -= carry12 << 21; | 4289 | s12 -= int64_lshift21(carry12); |
| 4279 | carry14 = (s14 + (1 << 20)) >> 21; | 4290 | carry14 = (s14 + (1 << 20)) >> 21; |
| 4280 | s15 += carry14; | 4291 | s15 += carry14; |
| 4281 | s14 -= carry14 << 21; | 4292 | s14 -= int64_lshift21(carry14); |
| 4282 | carry16 = (s16 + (1 << 20)) >> 21; | 4293 | carry16 = (s16 + (1 << 20)) >> 21; |
| 4283 | s17 += carry16; | 4294 | s17 += carry16; |
| 4284 | s16 -= carry16 << 21; | 4295 | s16 -= int64_lshift21(carry16); |
| 4285 | carry18 = (s18 + (1 << 20)) >> 21; | 4296 | carry18 = (s18 + (1 << 20)) >> 21; |
| 4286 | s19 += carry18; | 4297 | s19 += carry18; |
| 4287 | s18 -= carry18 << 21; | 4298 | s18 -= int64_lshift21(carry18); |
| 4288 | carry20 = (s20 + (1 << 20)) >> 21; | 4299 | carry20 = (s20 + (1 << 20)) >> 21; |
| 4289 | s21 += carry20; | 4300 | s21 += carry20; |
| 4290 | s20 -= carry20 << 21; | 4301 | s20 -= int64_lshift21(carry20); |
| 4291 | carry22 = (s22 + (1 << 20)) >> 21; | 4302 | carry22 = (s22 + (1 << 20)) >> 21; |
| 4292 | s23 += carry22; | 4303 | s23 += carry22; |
| 4293 | s22 -= carry22 << 21; | 4304 | s22 -= int64_lshift21(carry22); |
| 4294 | 4305 | ||
| 4295 | carry1 = (s1 + (1 << 20)) >> 21; | 4306 | carry1 = (s1 + (1 << 20)) >> 21; |
| 4296 | s2 += carry1; | 4307 | s2 += carry1; |
| 4297 | s1 -= carry1 << 21; | 4308 | s1 -= int64_lshift21(carry1); |
| 4298 | carry3 = (s3 + (1 << 20)) >> 21; | 4309 | carry3 = (s3 + (1 << 20)) >> 21; |
| 4299 | s4 += carry3; | 4310 | s4 += carry3; |
| 4300 | s3 -= carry3 << 21; | 4311 | s3 -= int64_lshift21(carry3); |
| 4301 | carry5 = (s5 + (1 << 20)) >> 21; | 4312 | carry5 = (s5 + (1 << 20)) >> 21; |
| 4302 | s6 += carry5; | 4313 | s6 += carry5; |
| 4303 | s5 -= carry5 << 21; | 4314 | s5 -= int64_lshift21(carry5); |
| 4304 | carry7 = (s7 + (1 << 20)) >> 21; | 4315 | carry7 = (s7 + (1 << 20)) >> 21; |
| 4305 | s8 += carry7; | 4316 | s8 += carry7; |
| 4306 | s7 -= carry7 << 21; | 4317 | s7 -= int64_lshift21(carry7); |
| 4307 | carry9 = (s9 + (1 << 20)) >> 21; | 4318 | carry9 = (s9 + (1 << 20)) >> 21; |
| 4308 | s10 += carry9; | 4319 | s10 += carry9; |
| 4309 | s9 -= carry9 << 21; | 4320 | s9 -= int64_lshift21(carry9); |
| 4310 | carry11 = (s11 + (1 << 20)) >> 21; | 4321 | carry11 = (s11 + (1 << 20)) >> 21; |
| 4311 | s12 += carry11; | 4322 | s12 += carry11; |
| 4312 | s11 -= carry11 << 21; | 4323 | s11 -= int64_lshift21(carry11); |
| 4313 | carry13 = (s13 + (1 << 20)) >> 21; | 4324 | carry13 = (s13 + (1 << 20)) >> 21; |
| 4314 | s14 += carry13; | 4325 | s14 += carry13; |
| 4315 | s13 -= carry13 << 21; | 4326 | s13 -= int64_lshift21(carry13); |
| 4316 | carry15 = (s15 + (1 << 20)) >> 21; | 4327 | carry15 = (s15 + (1 << 20)) >> 21; |
| 4317 | s16 += carry15; | 4328 | s16 += carry15; |
| 4318 | s15 -= carry15 << 21; | 4329 | s15 -= int64_lshift21(carry15); |
| 4319 | carry17 = (s17 + (1 << 20)) >> 21; | 4330 | carry17 = (s17 + (1 << 20)) >> 21; |
| 4320 | s18 += carry17; | 4331 | s18 += carry17; |
| 4321 | s17 -= carry17 << 21; | 4332 | s17 -= int64_lshift21(carry17); |
| 4322 | carry19 = (s19 + (1 << 20)) >> 21; | 4333 | carry19 = (s19 + (1 << 20)) >> 21; |
| 4323 | s20 += carry19; | 4334 | s20 += carry19; |
| 4324 | s19 -= carry19 << 21; | 4335 | s19 -= int64_lshift21(carry19); |
| 4325 | carry21 = (s21 + (1 << 20)) >> 21; | 4336 | carry21 = (s21 + (1 << 20)) >> 21; |
| 4326 | s22 += carry21; | 4337 | s22 += carry21; |
| 4327 | s21 -= carry21 << 21; | 4338 | s21 -= int64_lshift21(carry21); |
| 4328 | 4339 | ||
| 4329 | s11 += s23 * 666643; | 4340 | s11 += s23 * 666643; |
| 4330 | s12 += s23 * 470296; | 4341 | s12 += s23 * 470296; |
| @@ -4376,38 +4387,38 @@ sc_muladd(uint8_t *s, const uint8_t *a, const uint8_t *b, | |||
| 4376 | 4387 | ||
| 4377 | carry6 = (s6 + (1 << 20)) >> 21; | 4388 | carry6 = (s6 + (1 << 20)) >> 21; |
| 4378 | s7 += carry6; | 4389 | s7 += carry6; |
| 4379 | s6 -= carry6 << 21; | 4390 | s6 -= int64_lshift21(carry6); |
| 4380 | carry8 = (s8 + (1 << 20)) >> 21; | 4391 | carry8 = (s8 + (1 << 20)) >> 21; |
| 4381 | s9 += carry8; | 4392 | s9 += carry8; |
| 4382 | s8 -= carry8 << 21; | 4393 | s8 -= int64_lshift21(carry8); |
| 4383 | carry10 = (s10 + (1 << 20)) >> 21; | 4394 | carry10 = (s10 + (1 << 20)) >> 21; |
| 4384 | s11 += carry10; | 4395 | s11 += carry10; |
| 4385 | s10 -= carry10 << 21; | 4396 | s10 -= int64_lshift21(carry10); |
| 4386 | carry12 = (s12 + (1 << 20)) >> 21; | 4397 | carry12 = (s12 + (1 << 20)) >> 21; |
| 4387 | s13 += carry12; | 4398 | s13 += carry12; |
| 4388 | s12 -= carry12 << 21; | 4399 | s12 -= int64_lshift21(carry12); |
| 4389 | carry14 = (s14 + (1 << 20)) >> 21; | 4400 | carry14 = (s14 + (1 << 20)) >> 21; |
| 4390 | s15 += carry14; | 4401 | s15 += carry14; |
| 4391 | s14 -= carry14 << 21; | 4402 | s14 -= int64_lshift21(carry14); |
| 4392 | carry16 = (s16 + (1 << 20)) >> 21; | 4403 | carry16 = (s16 + (1 << 20)) >> 21; |
| 4393 | s17 += carry16; | 4404 | s17 += carry16; |
| 4394 | s16 -= carry16 << 21; | 4405 | s16 -= int64_lshift21(carry16); |
| 4395 | 4406 | ||
| 4396 | carry7 = (s7 + (1 << 20)) >> 21; | 4407 | carry7 = (s7 + (1 << 20)) >> 21; |
| 4397 | s8 += carry7; | 4408 | s8 += carry7; |
| 4398 | s7 -= carry7 << 21; | 4409 | s7 -= int64_lshift21(carry7); |
| 4399 | carry9 = (s9 + (1 << 20)) >> 21; | 4410 | carry9 = (s9 + (1 << 20)) >> 21; |
| 4400 | s10 += carry9; | 4411 | s10 += carry9; |
| 4401 | s9 -= carry9 << 21; | 4412 | s9 -= int64_lshift21(carry9); |
| 4402 | carry11 = (s11 + (1 << 20)) >> 21; | 4413 | carry11 = (s11 + (1 << 20)) >> 21; |
| 4403 | s12 += carry11; | 4414 | s12 += carry11; |
| 4404 | s11 -= carry11 << 21; | 4415 | s11 -= int64_lshift21(carry11); |
| 4405 | carry13 = (s13 + (1 << 20)) >> 21; | 4416 | carry13 = (s13 + (1 << 20)) >> 21; |
| 4406 | s14 += carry13; | 4417 | s14 += carry13; |
| 4407 | s13 -= carry13 << 21; | 4418 | s13 -= int64_lshift21(carry13); |
| 4408 | carry15 = (s15 + (1 << 20)) >> 21; | 4419 | carry15 = (s15 + (1 << 20)) >> 21; |
| 4409 | s16 += carry15; | 4420 | s16 += carry15; |
| 4410 | s15 -= carry15 << 21; | 4421 | s15 -= int64_lshift21(carry15); |
| 4411 | 4422 | ||
| 4412 | s5 += s17 * 666643; | 4423 | s5 += s17 * 666643; |
| 4413 | s6 += s17 * 470296; | 4424 | s6 += s17 * 470296; |
| @@ -4459,41 +4470,41 @@ sc_muladd(uint8_t *s, const uint8_t *a, const uint8_t *b, | |||
| 4459 | 4470 | ||
| 4460 | carry0 = (s0 + (1 << 20)) >> 21; | 4471 | carry0 = (s0 + (1 << 20)) >> 21; |
| 4461 | s1 += carry0; | 4472 | s1 += carry0; |
| 4462 | s0 -= carry0 << 21; | 4473 | s0 -= int64_lshift21(carry0); |
| 4463 | carry2 = (s2 + (1 << 20)) >> 21; | 4474 | carry2 = (s2 + (1 << 20)) >> 21; |
| 4464 | s3 += carry2; | 4475 | s3 += carry2; |
| 4465 | s2 -= carry2 << 21; | 4476 | s2 -= int64_lshift21(carry2); |
| 4466 | carry4 = (s4 + (1 << 20)) >> 21; | 4477 | carry4 = (s4 + (1 << 20)) >> 21; |
| 4467 | s5 += carry4; | 4478 | s5 += carry4; |
| 4468 | s4 -= carry4 << 21; | 4479 | s4 -= int64_lshift21(carry4); |
| 4469 | carry6 = (s6 + (1 << 20)) >> 21; | 4480 | carry6 = (s6 + (1 << 20)) >> 21; |
| 4470 | s7 += carry6; | 4481 | s7 += carry6; |
| 4471 | s6 -= carry6 << 21; | 4482 | s6 -= int64_lshift21(carry6); |
| 4472 | carry8 = (s8 + (1 << 20)) >> 21; | 4483 | carry8 = (s8 + (1 << 20)) >> 21; |
| 4473 | s9 += carry8; | 4484 | s9 += carry8; |
| 4474 | s8 -= carry8 << 21; | 4485 | s8 -= int64_lshift21(carry8); |
| 4475 | carry10 = (s10 + (1 << 20)) >> 21; | 4486 | carry10 = (s10 + (1 << 20)) >> 21; |
| 4476 | s11 += carry10; | 4487 | s11 += carry10; |
| 4477 | s10 -= carry10 << 21; | 4488 | s10 -= int64_lshift21(carry10); |
| 4478 | 4489 | ||
| 4479 | carry1 = (s1 + (1 << 20)) >> 21; | 4490 | carry1 = (s1 + (1 << 20)) >> 21; |
| 4480 | s2 += carry1; | 4491 | s2 += carry1; |
| 4481 | s1 -= carry1 << 21; | 4492 | s1 -= int64_lshift21(carry1); |
| 4482 | carry3 = (s3 + (1 << 20)) >> 21; | 4493 | carry3 = (s3 + (1 << 20)) >> 21; |
| 4483 | s4 += carry3; | 4494 | s4 += carry3; |
| 4484 | s3 -= carry3 << 21; | 4495 | s3 -= int64_lshift21(carry3); |
| 4485 | carry5 = (s5 + (1 << 20)) >> 21; | 4496 | carry5 = (s5 + (1 << 20)) >> 21; |
| 4486 | s6 += carry5; | 4497 | s6 += carry5; |
| 4487 | s5 -= carry5 << 21; | 4498 | s5 -= int64_lshift21(carry5); |
| 4488 | carry7 = (s7 + (1 << 20)) >> 21; | 4499 | carry7 = (s7 + (1 << 20)) >> 21; |
| 4489 | s8 += carry7; | 4500 | s8 += carry7; |
| 4490 | s7 -= carry7 << 21; | 4501 | s7 -= int64_lshift21(carry7); |
| 4491 | carry9 = (s9 + (1 << 20)) >> 21; | 4502 | carry9 = (s9 + (1 << 20)) >> 21; |
| 4492 | s10 += carry9; | 4503 | s10 += carry9; |
| 4493 | s9 -= carry9 << 21; | 4504 | s9 -= int64_lshift21(carry9); |
| 4494 | carry11 = (s11 + (1 << 20)) >> 21; | 4505 | carry11 = (s11 + (1 << 20)) >> 21; |
| 4495 | s12 += carry11; | 4506 | s12 += carry11; |
| 4496 | s11 -= carry11 << 21; | 4507 | s11 -= int64_lshift21(carry11); |
| 4497 | 4508 | ||
| 4498 | s0 += s12 * 666643; | 4509 | s0 += s12 * 666643; |
| 4499 | s1 += s12 * 470296; | 4510 | s1 += s12 * 470296; |
| @@ -4505,40 +4516,40 @@ sc_muladd(uint8_t *s, const uint8_t *a, const uint8_t *b, | |||
| 4505 | 4516 | ||
| 4506 | carry0 = s0 >> 21; | 4517 | carry0 = s0 >> 21; |
| 4507 | s1 += carry0; | 4518 | s1 += carry0; |
| 4508 | s0 -= carry0 << 21; | 4519 | s0 -= int64_lshift21(carry0); |
| 4509 | carry1 = s1 >> 21; | 4520 | carry1 = s1 >> 21; |
| 4510 | s2 += carry1; | 4521 | s2 += carry1; |
| 4511 | s1 -= carry1 << 21; | 4522 | s1 -= int64_lshift21(carry1); |
| 4512 | carry2 = s2 >> 21; | 4523 | carry2 = s2 >> 21; |
| 4513 | s3 += carry2; | 4524 | s3 += carry2; |
| 4514 | s2 -= carry2 << 21; | 4525 | s2 -= int64_lshift21(carry2); |
| 4515 | carry3 = s3 >> 21; | 4526 | carry3 = s3 >> 21; |
| 4516 | s4 += carry3; | 4527 | s4 += carry3; |
| 4517 | s3 -= carry3 << 21; | 4528 | s3 -= int64_lshift21(carry3); |
| 4518 | carry4 = s4 >> 21; | 4529 | carry4 = s4 >> 21; |
| 4519 | s5 += carry4; | 4530 | s5 += carry4; |
| 4520 | s4 -= carry4 << 21; | 4531 | s4 -= int64_lshift21(carry4); |
| 4521 | carry5 = s5 >> 21; | 4532 | carry5 = s5 >> 21; |
| 4522 | s6 += carry5; | 4533 | s6 += carry5; |
| 4523 | s5 -= carry5 << 21; | 4534 | s5 -= int64_lshift21(carry5); |
| 4524 | carry6 = s6 >> 21; | 4535 | carry6 = s6 >> 21; |
| 4525 | s7 += carry6; | 4536 | s7 += carry6; |
| 4526 | s6 -= carry6 << 21; | 4537 | s6 -= int64_lshift21(carry6); |
| 4527 | carry7 = s7 >> 21; | 4538 | carry7 = s7 >> 21; |
| 4528 | s8 += carry7; | 4539 | s8 += carry7; |
| 4529 | s7 -= carry7 << 21; | 4540 | s7 -= int64_lshift21(carry7); |
| 4530 | carry8 = s8 >> 21; | 4541 | carry8 = s8 >> 21; |
| 4531 | s9 += carry8; | 4542 | s9 += carry8; |
| 4532 | s8 -= carry8 << 21; | 4543 | s8 -= int64_lshift21(carry8); |
| 4533 | carry9 = s9 >> 21; | 4544 | carry9 = s9 >> 21; |
| 4534 | s10 += carry9; | 4545 | s10 += carry9; |
| 4535 | s9 -= carry9 << 21; | 4546 | s9 -= int64_lshift21(carry9); |
| 4536 | carry10 = s10 >> 21; | 4547 | carry10 = s10 >> 21; |
| 4537 | s11 += carry10; | 4548 | s11 += carry10; |
| 4538 | s10 -= carry10 << 21; | 4549 | s10 -= int64_lshift21(carry10); |
| 4539 | carry11 = s11 >> 21; | 4550 | carry11 = s11 >> 21; |
| 4540 | s12 += carry11; | 4551 | s12 += carry11; |
| 4541 | s11 -= carry11 << 21; | 4552 | s11 -= int64_lshift21(carry11); |
| 4542 | 4553 | ||
| 4543 | s0 += s12 * 666643; | 4554 | s0 += s12 * 666643; |
| 4544 | s1 += s12 * 470296; | 4555 | s1 += s12 * 470296; |
| @@ -4550,37 +4561,37 @@ sc_muladd(uint8_t *s, const uint8_t *a, const uint8_t *b, | |||
| 4550 | 4561 | ||
| 4551 | carry0 = s0 >> 21; | 4562 | carry0 = s0 >> 21; |
| 4552 | s1 += carry0; | 4563 | s1 += carry0; |
| 4553 | s0 -= carry0 << 21; | 4564 | s0 -= int64_lshift21(carry0); |
| 4554 | carry1 = s1 >> 21; | 4565 | carry1 = s1 >> 21; |
| 4555 | s2 += carry1; | 4566 | s2 += carry1; |
| 4556 | s1 -= carry1 << 21; | 4567 | s1 -= int64_lshift21(carry1); |
| 4557 | carry2 = s2 >> 21; | 4568 | carry2 = s2 >> 21; |
| 4558 | s3 += carry2; | 4569 | s3 += carry2; |
| 4559 | s2 -= carry2 << 21; | 4570 | s2 -= int64_lshift21(carry2); |
| 4560 | carry3 = s3 >> 21; | 4571 | carry3 = s3 >> 21; |
| 4561 | s4 += carry3; | 4572 | s4 += carry3; |
| 4562 | s3 -= carry3 << 21; | 4573 | s3 -= int64_lshift21(carry3); |
| 4563 | carry4 = s4 >> 21; | 4574 | carry4 = s4 >> 21; |
| 4564 | s5 += carry4; | 4575 | s5 += carry4; |
| 4565 | s4 -= carry4 << 21; | 4576 | s4 -= int64_lshift21(carry4); |
| 4566 | carry5 = s5 >> 21; | 4577 | carry5 = s5 >> 21; |
| 4567 | s6 += carry5; | 4578 | s6 += carry5; |
| 4568 | s5 -= carry5 << 21; | 4579 | s5 -= int64_lshift21(carry5); |
| 4569 | carry6 = s6 >> 21; | 4580 | carry6 = s6 >> 21; |
| 4570 | s7 += carry6; | 4581 | s7 += carry6; |
| 4571 | s6 -= carry6 << 21; | 4582 | s6 -= int64_lshift21(carry6); |
| 4572 | carry7 = s7 >> 21; | 4583 | carry7 = s7 >> 21; |
| 4573 | s8 += carry7; | 4584 | s8 += carry7; |
| 4574 | s7 -= carry7 << 21; | 4585 | s7 -= int64_lshift21(carry7); |
| 4575 | carry8 = s8 >> 21; | 4586 | carry8 = s8 >> 21; |
| 4576 | s9 += carry8; | 4587 | s9 += carry8; |
| 4577 | s8 -= carry8 << 21; | 4588 | s8 -= int64_lshift21(carry8); |
| 4578 | carry9 = s9 >> 21; | 4589 | carry9 = s9 >> 21; |
| 4579 | s10 += carry9; | 4590 | s10 += carry9; |
| 4580 | s9 -= carry9 << 21; | 4591 | s9 -= int64_lshift21(carry9); |
| 4581 | carry10 = s10 >> 21; | 4592 | carry10 = s10 >> 21; |
| 4582 | s11 += carry10; | 4593 | s11 += carry10; |
| 4583 | s10 -= carry10 << 21; | 4594 | s10 -= int64_lshift21(carry10); |
| 4584 | 4595 | ||
| 4585 | s[0] = s0 >> 0; | 4596 | s[0] = s0 >> 0; |
| 4586 | s[1] = s0 >> 8; | 4597 | s[1] = s0 >> 8; |
diff --git a/src/lib/libcrypto/des/des.h b/src/lib/libcrypto/des/des.h index 2d957a192c..ad7a418c01 100644 --- a/src/lib/libcrypto/des/des.h +++ b/src/lib/libcrypto/des/des.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: des.h,v 1.23 2025/01/25 17:59:44 tb Exp $ */ | 1 | /* $OpenBSD: des.h,v 1.26 2025/06/09 17:49:45 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -56,11 +56,20 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #ifndef HEADER_NEW_DES_H | 59 | #ifndef HEADER_DES_H |
| 60 | #define HEADER_NEW_DES_H | 60 | #define HEADER_DES_H |
| 61 | 61 | ||
| 62 | #include <openssl/opensslconf.h> | 62 | #include <openssl/opensslconf.h> |
| 63 | 63 | ||
| 64 | #ifndef DES_LONG | ||
| 65 | /* XXX - typedef to unsigned int everywhere. */ | ||
| 66 | #ifdef __i386__ | ||
| 67 | #define DES_LONG unsigned long | ||
| 68 | #else | ||
| 69 | #define DES_LONG unsigned int | ||
| 70 | #endif | ||
| 71 | #endif | ||
| 72 | |||
| 64 | #ifdef __cplusplus | 73 | #ifdef __cplusplus |
| 65 | extern "C" { | 74 | extern "C" { |
| 66 | #endif | 75 | #endif |
diff --git a/src/lib/libcrypto/des/des_enc.c b/src/lib/libcrypto/des/des_enc.c index deec50bffb..cb89784fb0 100644 --- a/src/lib/libcrypto/des/des_enc.c +++ b/src/lib/libcrypto/des/des_enc.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: des_enc.c,v 1.20 2024/08/31 16:17:13 jsing Exp $ */ | 1 | /* $OpenBSD: des_enc.c,v 1.21 2025/07/27 13:26:24 jsing Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -210,10 +210,8 @@ void | |||
| 210 | DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) | 210 | DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) |
| 211 | { | 211 | { |
| 212 | DES_LONG l, r, t, u; | 212 | DES_LONG l, r, t, u; |
| 213 | #ifndef DES_UNROLL | ||
| 214 | int i; | ||
| 215 | #endif | ||
| 216 | DES_LONG *s; | 213 | DES_LONG *s; |
| 214 | int i; | ||
| 217 | 215 | ||
| 218 | r = data[0]; | 216 | r = data[0]; |
| 219 | l = data[1]; | 217 | l = data[1]; |
| @@ -231,56 +229,21 @@ DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) | |||
| 231 | l = ROTATE(l, 29) & 0xffffffffL; | 229 | l = ROTATE(l, 29) & 0xffffffffL; |
| 232 | 230 | ||
| 233 | s = ks->ks->deslong; | 231 | s = ks->ks->deslong; |
| 234 | /* I don't know if it is worth the effort of loop unrolling the | 232 | |
| 235 | * inner loop */ | ||
| 236 | if (enc) { | 233 | if (enc) { |
| 237 | #ifdef DES_UNROLL | 234 | for (i = 0; i < 32; i += 8) { |
| 238 | D_ENCRYPT(l, r, 0); /* 1 */ | 235 | D_ENCRYPT(l, r, i + 0); |
| 239 | D_ENCRYPT(r, l, 2); /* 2 */ | 236 | D_ENCRYPT(r, l, i + 2); |
| 240 | D_ENCRYPT(l, r, 4); /* 3 */ | 237 | D_ENCRYPT(l, r, i + 4); |
| 241 | D_ENCRYPT(r, l, 6); /* 4 */ | 238 | D_ENCRYPT(r, l, i + 6); |
| 242 | D_ENCRYPT(l, r, 8); /* 5 */ | ||
| 243 | D_ENCRYPT(r, l, 10); /* 6 */ | ||
| 244 | D_ENCRYPT(l, r, 12); /* 7 */ | ||
| 245 | D_ENCRYPT(r, l, 14); /* 8 */ | ||
| 246 | D_ENCRYPT(l, r, 16); /* 9 */ | ||
| 247 | D_ENCRYPT(r, l, 18); /* 10 */ | ||
| 248 | D_ENCRYPT(l, r, 20); /* 11 */ | ||
| 249 | D_ENCRYPT(r, l, 22); /* 12 */ | ||
| 250 | D_ENCRYPT(l, r, 24); /* 13 */ | ||
| 251 | D_ENCRYPT(r, l, 26); /* 14 */ | ||
| 252 | D_ENCRYPT(l, r, 28); /* 15 */ | ||
| 253 | D_ENCRYPT(r, l, 30); /* 16 */ | ||
| 254 | #else | ||
| 255 | for (i = 0; i < 32; i += 4) { | ||
| 256 | D_ENCRYPT(l, r, i + 0); /* 1 */ | ||
| 257 | D_ENCRYPT(r, l, i + 2); /* 2 */ | ||
| 258 | } | 239 | } |
| 259 | #endif | ||
| 260 | } else { | 240 | } else { |
| 261 | #ifdef DES_UNROLL | 241 | for (i = 32; i > 0; i -= 8) { |
| 262 | D_ENCRYPT(l, r, 30); /* 16 */ | 242 | D_ENCRYPT(l, r, i - 2); |
| 263 | D_ENCRYPT(r, l, 28); /* 15 */ | 243 | D_ENCRYPT(r, l, i - 4); |
| 264 | D_ENCRYPT(l, r, 26); /* 14 */ | 244 | D_ENCRYPT(l, r, i - 6); |
| 265 | D_ENCRYPT(r, l, 24); /* 13 */ | 245 | D_ENCRYPT(r, l, i - 8); |
| 266 | D_ENCRYPT(l, r, 22); /* 12 */ | ||
| 267 | D_ENCRYPT(r, l, 20); /* 11 */ | ||
| 268 | D_ENCRYPT(l, r, 18); /* 10 */ | ||
| 269 | D_ENCRYPT(r, l, 16); /* 9 */ | ||
| 270 | D_ENCRYPT(l, r, 14); /* 8 */ | ||
| 271 | D_ENCRYPT(r, l, 12); /* 7 */ | ||
| 272 | D_ENCRYPT(l, r, 10); /* 6 */ | ||
| 273 | D_ENCRYPT(r, l, 8); /* 5 */ | ||
| 274 | D_ENCRYPT(l, r, 6); /* 4 */ | ||
| 275 | D_ENCRYPT(r, l, 4); /* 3 */ | ||
| 276 | D_ENCRYPT(l, r, 2); /* 2 */ | ||
| 277 | D_ENCRYPT(r, l, 0); /* 1 */ | ||
| 278 | #else | ||
| 279 | for (i = 30; i > 0; i -= 4) { | ||
| 280 | D_ENCRYPT(l, r, i - 0); /* 16 */ | ||
| 281 | D_ENCRYPT(r, l, i - 2); /* 15 */ | ||
| 282 | } | 246 | } |
| 283 | #endif | ||
| 284 | } | 247 | } |
| 285 | 248 | ||
| 286 | /* rotate and clear the top bits on machines with 8byte longs */ | 249 | /* rotate and clear the top bits on machines with 8byte longs */ |
| @@ -298,10 +261,8 @@ void | |||
| 298 | DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc) | 261 | DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc) |
| 299 | { | 262 | { |
| 300 | DES_LONG l, r, t, u; | 263 | DES_LONG l, r, t, u; |
| 301 | #ifndef DES_UNROLL | ||
| 302 | int i; | ||
| 303 | #endif | ||
| 304 | DES_LONG *s; | 264 | DES_LONG *s; |
| 265 | int i; | ||
| 305 | 266 | ||
| 306 | r = data[0]; | 267 | r = data[0]; |
| 307 | l = data[1]; | 268 | l = data[1]; |
| @@ -320,53 +281,19 @@ DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc) | |||
| 320 | /* I don't know if it is worth the effort of loop unrolling the | 281 | /* I don't know if it is worth the effort of loop unrolling the |
| 321 | * inner loop */ | 282 | * inner loop */ |
| 322 | if (enc) { | 283 | if (enc) { |
| 323 | #ifdef DES_UNROLL | 284 | for (i = 0; i < 32; i += 8) { |
| 324 | D_ENCRYPT(l, r, 0); /* 1 */ | 285 | D_ENCRYPT(l, r, i + 0); |
| 325 | D_ENCRYPT(r, l, 2); /* 2 */ | 286 | D_ENCRYPT(r, l, i + 2); |
| 326 | D_ENCRYPT(l, r, 4); /* 3 */ | 287 | D_ENCRYPT(l, r, i + 4); |
| 327 | D_ENCRYPT(r, l, 6); /* 4 */ | 288 | D_ENCRYPT(r, l, i + 6); |
| 328 | D_ENCRYPT(l, r, 8); /* 5 */ | ||
| 329 | D_ENCRYPT(r, l, 10); /* 6 */ | ||
| 330 | D_ENCRYPT(l, r, 12); /* 7 */ | ||
| 331 | D_ENCRYPT(r, l, 14); /* 8 */ | ||
| 332 | D_ENCRYPT(l, r, 16); /* 9 */ | ||
| 333 | D_ENCRYPT(r, l, 18); /* 10 */ | ||
| 334 | D_ENCRYPT(l, r, 20); /* 11 */ | ||
| 335 | D_ENCRYPT(r, l, 22); /* 12 */ | ||
| 336 | D_ENCRYPT(l, r, 24); /* 13 */ | ||
| 337 | D_ENCRYPT(r, l, 26); /* 14 */ | ||
| 338 | D_ENCRYPT(l, r, 28); /* 15 */ | ||
| 339 | D_ENCRYPT(r, l, 30); /* 16 */ | ||
| 340 | #else | ||
| 341 | for (i = 0; i < 32; i += 4) { | ||
| 342 | D_ENCRYPT(l, r, i + 0); /* 1 */ | ||
| 343 | D_ENCRYPT(r, l, i + 2); /* 2 */ | ||
| 344 | } | 289 | } |
| 345 | #endif | ||
| 346 | } else { | 290 | } else { |
| 347 | #ifdef DES_UNROLL | 291 | for (i = 32; i > 0; i -= 8) { |
| 348 | D_ENCRYPT(l, r, 30); /* 16 */ | 292 | D_ENCRYPT(l, r, i - 2); |
| 349 | D_ENCRYPT(r, l, 28); /* 15 */ | 293 | D_ENCRYPT(r, l, i - 4); |
| 350 | D_ENCRYPT(l, r, 26); /* 14 */ | 294 | D_ENCRYPT(l, r, i - 6); |
| 351 | D_ENCRYPT(r, l, 24); /* 13 */ | 295 | D_ENCRYPT(r, l, i - 8); |
| 352 | D_ENCRYPT(l, r, 22); /* 12 */ | ||
| 353 | D_ENCRYPT(r, l, 20); /* 11 */ | ||
| 354 | D_ENCRYPT(l, r, 18); /* 10 */ | ||
| 355 | D_ENCRYPT(r, l, 16); /* 9 */ | ||
| 356 | D_ENCRYPT(l, r, 14); /* 8 */ | ||
| 357 | D_ENCRYPT(r, l, 12); /* 7 */ | ||
| 358 | D_ENCRYPT(l, r, 10); /* 6 */ | ||
| 359 | D_ENCRYPT(r, l, 8); /* 5 */ | ||
| 360 | D_ENCRYPT(l, r, 6); /* 4 */ | ||
| 361 | D_ENCRYPT(r, l, 4); /* 3 */ | ||
| 362 | D_ENCRYPT(l, r, 2); /* 2 */ | ||
| 363 | D_ENCRYPT(r, l, 0); /* 1 */ | ||
| 364 | #else | ||
| 365 | for (i = 30; i > 0; i -= 4) { | ||
| 366 | D_ENCRYPT(l, r, i - 0); /* 16 */ | ||
| 367 | D_ENCRYPT(r, l, i - 2); /* 15 */ | ||
| 368 | } | 296 | } |
| 369 | #endif | ||
| 370 | } | 297 | } |
| 371 | /* rotate and clear the top bits on machines with 8byte longs */ | 298 | /* rotate and clear the top bits on machines with 8byte longs */ |
| 372 | data[0] = ROTATE(l, 3) & 0xffffffffL; | 299 | data[0] = ROTATE(l, 3) & 0xffffffffL; |
diff --git a/src/lib/libcrypto/des/des_fcrypt.c b/src/lib/libcrypto/des/des_fcrypt.c index b33b1240c2..2dd071f5d0 100644 --- a/src/lib/libcrypto/des/des_fcrypt.c +++ b/src/lib/libcrypto/des/des_fcrypt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: des_fcrypt.c,v 1.4 2024/08/31 16:22:18 jsing Exp $ */ | 1 | /* $OpenBSD: des_fcrypt.c,v 1.5 2025/07/27 13:26:24 jsing Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -90,8 +90,8 @@ fcrypt_body(DES_LONG *out, DES_key_schedule *ks, DES_LONG Eswap0, | |||
| 90 | { | 90 | { |
| 91 | DES_LONG l, r, t, u; | 91 | DES_LONG l, r, t, u; |
| 92 | DES_LONG *s; | 92 | DES_LONG *s; |
| 93 | int j; | ||
| 94 | DES_LONG E0, E1; | 93 | DES_LONG E0, E1; |
| 94 | int i, j; | ||
| 95 | 95 | ||
| 96 | l = 0; | 96 | l = 0; |
| 97 | r = 0; | 97 | r = 0; |
| @@ -101,32 +101,12 @@ fcrypt_body(DES_LONG *out, DES_key_schedule *ks, DES_LONG Eswap0, | |||
| 101 | E1 = Eswap1; | 101 | E1 = Eswap1; |
| 102 | 102 | ||
| 103 | for (j = 0; j < 25; j++) { | 103 | for (j = 0; j < 25; j++) { |
| 104 | #ifndef DES_UNROLL | 104 | for (i = 0; i < 32; i += 8) { |
| 105 | int i; | 105 | D_ENCRYPT(l, r, i + 0); |
| 106 | 106 | D_ENCRYPT(r, l, i + 2); | |
| 107 | for (i = 0; i < 32; i += 4) { | 107 | D_ENCRYPT(l, r, i + 4); |
| 108 | D_ENCRYPT(l, r, i + 0); /* 1 */ | 108 | D_ENCRYPT(r, l, i + 6); |
| 109 | D_ENCRYPT(r, l, i + 2); /* 2 */ | ||
| 110 | } | 109 | } |
| 111 | #else | ||
| 112 | D_ENCRYPT(l, r, 0); /* 1 */ | ||
| 113 | D_ENCRYPT(r, l, 2); /* 2 */ | ||
| 114 | D_ENCRYPT(l, r, 4); /* 3 */ | ||
| 115 | D_ENCRYPT(r, l, 6); /* 4 */ | ||
| 116 | D_ENCRYPT(l, r, 8); /* 5 */ | ||
| 117 | D_ENCRYPT(r, l, 10); /* 6 */ | ||
| 118 | D_ENCRYPT(l, r, 12); /* 7 */ | ||
| 119 | D_ENCRYPT(r, l, 14); /* 8 */ | ||
| 120 | D_ENCRYPT(l, r, 16); /* 9 */ | ||
| 121 | D_ENCRYPT(r, l, 18); /* 10 */ | ||
| 122 | D_ENCRYPT(l, r, 20); /* 11 */ | ||
| 123 | D_ENCRYPT(r, l, 22); /* 12 */ | ||
| 124 | D_ENCRYPT(l, r, 24); /* 13 */ | ||
| 125 | D_ENCRYPT(r, l, 26); /* 14 */ | ||
| 126 | D_ENCRYPT(l, r, 28); /* 15 */ | ||
| 127 | D_ENCRYPT(r, l, 30); /* 16 */ | ||
| 128 | #endif | ||
| 129 | |||
| 130 | t = l; | 110 | t = l; |
| 131 | l = r; | 111 | l = r; |
| 132 | r = t; | 112 | r = t; |
diff --git a/src/lib/libcrypto/des/des_key.c b/src/lib/libcrypto/des/des_key.c index eee8a7e127..62d6a8bb19 100644 --- a/src/lib/libcrypto/des/des_key.c +++ b/src/lib/libcrypto/des/des_key.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: des_key.c,v 1.1 2024/08/31 15:56:09 jsing Exp $ */ | 1 | /* $OpenBSD: des_key.c,v 1.2 2025/10/27 16:57:37 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -107,7 +107,7 @@ DES_check_key_parity(const_DES_cblock *key) | |||
| 107 | } | 107 | } |
| 108 | LCRYPTO_ALIAS(DES_check_key_parity); | 108 | LCRYPTO_ALIAS(DES_check_key_parity); |
| 109 | 109 | ||
| 110 | /* Weak and semi weak keys as taken from | 110 | /* Weak and semi-weak keys as taken from |
| 111 | * %A D.W. Davies | 111 | * %A D.W. Davies |
| 112 | * %A W.L. Price | 112 | * %A W.L. Price |
| 113 | * %T Security for Computer Networks | 113 | * %T Security for Computer Networks |
diff --git a/src/lib/libcrypto/des/des_local.h b/src/lib/libcrypto/des/des_local.h index 61bfde7520..077c03139f 100644 --- a/src/lib/libcrypto/des/des_local.h +++ b/src/lib/libcrypto/des/des_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: des_local.h,v 1.5 2024/08/31 16:22:18 jsing Exp $ */ | 1 | /* $OpenBSD: des_local.h,v 1.6 2025/04/23 10:08:20 jsing Exp $ */ |
| 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -217,10 +217,6 @@ ROTATE(uint32_t a, uint32_t n) | |||
| 217 | 217 | ||
| 218 | extern const DES_LONG DES_SPtrans[8][64]; | 218 | extern const DES_LONG DES_SPtrans[8][64]; |
| 219 | 219 | ||
| 220 | #ifdef OPENSSL_SMALL_FOOTPRINT | ||
| 221 | #undef DES_UNROLL | ||
| 222 | #endif | ||
| 223 | |||
| 224 | __END_HIDDEN_DECLS | 220 | __END_HIDDEN_DECLS |
| 225 | 221 | ||
| 226 | #endif | 222 | #endif |
diff --git a/src/lib/libcrypto/dh/dh_ameth.c b/src/lib/libcrypto/dh/dh_ameth.c index 289307bfd6..ec59245b9c 100644 --- a/src/lib/libcrypto/dh/dh_ameth.c +++ b/src/lib/libcrypto/dh/dh_ameth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dh_ameth.c,v 1.42 2025/01/17 05:04:25 tb Exp $ */ | 1 | /* $OpenBSD: dh_ameth.c,v 1.43 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -61,12 +61,12 @@ | |||
| 61 | #include <openssl/asn1.h> | 61 | #include <openssl/asn1.h> |
| 62 | #include <openssl/bn.h> | 62 | #include <openssl/bn.h> |
| 63 | #include <openssl/dh.h> | 63 | #include <openssl/dh.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
| 66 | 65 | ||
| 67 | #include "asn1_local.h" | 66 | #include "asn1_local.h" |
| 68 | #include "bn_local.h" | 67 | #include "bn_local.h" |
| 69 | #include "dh_local.h" | 68 | #include "dh_local.h" |
| 69 | #include "err_local.h" | ||
| 70 | #include "evp_local.h" | 70 | #include "evp_local.h" |
| 71 | 71 | ||
| 72 | static void | 72 | static void |
diff --git a/src/lib/libcrypto/dh/dh_check.c b/src/lib/libcrypto/dh/dh_check.c index a880f9fca1..1ba85bc824 100644 --- a/src/lib/libcrypto/dh/dh_check.c +++ b/src/lib/libcrypto/dh/dh_check.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dh_check.c,v 1.30 2024/11/29 15:59:57 tb Exp $ */ | 1 | /* $OpenBSD: dh_check.c,v 1.31 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -60,7 +60,6 @@ | |||
| 60 | 60 | ||
| 61 | #include <openssl/bn.h> | 61 | #include <openssl/bn.h> |
| 62 | #include <openssl/dh.h> | 62 | #include <openssl/dh.h> |
| 63 | #include <openssl/err.h> | ||
| 64 | 63 | ||
| 65 | #include "bn_local.h" | 64 | #include "bn_local.h" |
| 66 | #include "dh_local.h" | 65 | #include "dh_local.h" |
diff --git a/src/lib/libcrypto/dh/dh_gen.c b/src/lib/libcrypto/dh/dh_gen.c index 3ffa5d80f1..f28f75909c 100644 --- a/src/lib/libcrypto/dh/dh_gen.c +++ b/src/lib/libcrypto/dh/dh_gen.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dh_gen.c,v 1.21 2023/07/08 15:29:03 beck Exp $ */ | 1 | /* $OpenBSD: dh_gen.c,v 1.22 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -60,10 +60,10 @@ | |||
| 60 | 60 | ||
| 61 | #include <openssl/bn.h> | 61 | #include <openssl/bn.h> |
| 62 | #include <openssl/dh.h> | 62 | #include <openssl/dh.h> |
| 63 | #include <openssl/err.h> | ||
| 64 | 63 | ||
| 65 | #include "bn_local.h" | 64 | #include "bn_local.h" |
| 66 | #include "dh_local.h" | 65 | #include "dh_local.h" |
| 66 | #include "err_local.h" | ||
| 67 | 67 | ||
| 68 | static int dh_builtin_genparams(DH *ret, int prime_len, int generator, | 68 | static int dh_builtin_genparams(DH *ret, int prime_len, int generator, |
| 69 | BN_GENCB *cb); | 69 | BN_GENCB *cb); |
diff --git a/src/lib/libcrypto/dh/dh_key.c b/src/lib/libcrypto/dh/dh_key.c index 93b04f398f..89a02c8309 100644 --- a/src/lib/libcrypto/dh/dh_key.c +++ b/src/lib/libcrypto/dh/dh_key.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dh_key.c,v 1.42 2024/05/09 20:43:36 tb Exp $ */ | 1 | /* $OpenBSD: dh_key.c,v 1.43 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -60,10 +60,10 @@ | |||
| 60 | 60 | ||
| 61 | #include <openssl/bn.h> | 61 | #include <openssl/bn.h> |
| 62 | #include <openssl/dh.h> | 62 | #include <openssl/dh.h> |
| 63 | #include <openssl/err.h> | ||
| 64 | 63 | ||
| 65 | #include "bn_local.h" | 64 | #include "bn_local.h" |
| 66 | #include "dh_local.h" | 65 | #include "dh_local.h" |
| 66 | #include "err_local.h" | ||
| 67 | 67 | ||
| 68 | static int | 68 | static int |
| 69 | generate_key(DH *dh) | 69 | generate_key(DH *dh) |
diff --git a/src/lib/libcrypto/dh/dh_lib.c b/src/lib/libcrypto/dh/dh_lib.c index 803aca6421..db76244550 100644 --- a/src/lib/libcrypto/dh/dh_lib.c +++ b/src/lib/libcrypto/dh/dh_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dh_lib.c,v 1.46 2024/11/29 15:59:57 tb Exp $ */ | 1 | /* $OpenBSD: dh_lib.c,v 1.47 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -63,9 +63,9 @@ | |||
| 63 | 63 | ||
| 64 | #include <openssl/bn.h> | 64 | #include <openssl/bn.h> |
| 65 | #include <openssl/dh.h> | 65 | #include <openssl/dh.h> |
| 66 | #include <openssl/err.h> | ||
| 67 | 66 | ||
| 68 | #include "dh_local.h" | 67 | #include "dh_local.h" |
| 68 | #include "err_local.h" | ||
| 69 | 69 | ||
| 70 | static const DH_METHOD *default_DH_method = NULL; | 70 | static const DH_METHOD *default_DH_method = NULL; |
| 71 | 71 | ||
diff --git a/src/lib/libcrypto/dh/dh_pmeth.c b/src/lib/libcrypto/dh/dh_pmeth.c index 1e5327b11f..18517b0cde 100644 --- a/src/lib/libcrypto/dh/dh_pmeth.c +++ b/src/lib/libcrypto/dh/dh_pmeth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dh_pmeth.c,v 1.17 2024/08/26 22:00:47 op Exp $ */ | 1 | /* $OpenBSD: dh_pmeth.c,v 1.18 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -64,12 +64,12 @@ | |||
| 64 | #include <openssl/asn1t.h> | 64 | #include <openssl/asn1t.h> |
| 65 | #include <openssl/bn.h> | 65 | #include <openssl/bn.h> |
| 66 | #include <openssl/dh.h> | 66 | #include <openssl/dh.h> |
| 67 | #include <openssl/err.h> | ||
| 68 | #include <openssl/evp.h> | 67 | #include <openssl/evp.h> |
| 69 | #include <openssl/x509.h> | 68 | #include <openssl/x509.h> |
| 70 | 69 | ||
| 71 | #include "bn_local.h" | 70 | #include "bn_local.h" |
| 72 | #include "dh_local.h" | 71 | #include "dh_local.h" |
| 72 | #include "err_local.h" | ||
| 73 | #include "evp_local.h" | 73 | #include "evp_local.h" |
| 74 | 74 | ||
| 75 | /* DH pkey context structure */ | 75 | /* DH pkey context structure */ |
diff --git a/src/lib/libcrypto/dsa/dsa_ameth.c b/src/lib/libcrypto/dsa/dsa_ameth.c index 866e5ec476..8e65cf68f7 100644 --- a/src/lib/libcrypto/dsa/dsa_ameth.c +++ b/src/lib/libcrypto/dsa/dsa_ameth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dsa_ameth.c,v 1.59 2024/04/13 14:02:51 tb Exp $ */ | 1 | /* $OpenBSD: dsa_ameth.c,v 1.60 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -64,12 +64,12 @@ | |||
| 64 | #include <openssl/bn.h> | 64 | #include <openssl/bn.h> |
| 65 | #include <openssl/cms.h> | 65 | #include <openssl/cms.h> |
| 66 | #include <openssl/dsa.h> | 66 | #include <openssl/dsa.h> |
| 67 | #include <openssl/err.h> | ||
| 68 | #include <openssl/x509.h> | 67 | #include <openssl/x509.h> |
| 69 | 68 | ||
| 70 | #include "asn1_local.h" | 69 | #include "asn1_local.h" |
| 71 | #include "bn_local.h" | 70 | #include "bn_local.h" |
| 72 | #include "dsa_local.h" | 71 | #include "dsa_local.h" |
| 72 | #include "err_local.h" | ||
| 73 | #include "evp_local.h" | 73 | #include "evp_local.h" |
| 74 | #include "x509_local.h" | 74 | #include "x509_local.h" |
| 75 | 75 | ||
diff --git a/src/lib/libcrypto/dsa/dsa_asn1.c b/src/lib/libcrypto/dsa/dsa_asn1.c index de6ec46195..e8957a99ff 100644 --- a/src/lib/libcrypto/dsa/dsa_asn1.c +++ b/src/lib/libcrypto/dsa/dsa_asn1.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dsa_asn1.c,v 1.33 2024/07/08 17:11:05 beck Exp $ */ | 1 | /* $OpenBSD: dsa_asn1.c,v 1.34 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -63,9 +63,9 @@ | |||
| 63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
| 64 | #include <openssl/bn.h> | 64 | #include <openssl/bn.h> |
| 65 | #include <openssl/dsa.h> | 65 | #include <openssl/dsa.h> |
| 66 | #include <openssl/err.h> | ||
| 67 | 66 | ||
| 68 | #include "dsa_local.h" | 67 | #include "dsa_local.h" |
| 68 | #include "err_local.h" | ||
| 69 | 69 | ||
| 70 | /* Override the default new methods */ | 70 | /* Override the default new methods */ |
| 71 | static int | 71 | static int |
diff --git a/src/lib/libcrypto/dsa/dsa_lib.c b/src/lib/libcrypto/dsa/dsa_lib.c index daf2fa135b..ecd517cf8a 100644 --- a/src/lib/libcrypto/dsa/dsa_lib.c +++ b/src/lib/libcrypto/dsa/dsa_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dsa_lib.c,v 1.48 2024/03/27 01:49:31 tb Exp $ */ | 1 | /* $OpenBSD: dsa_lib.c,v 1.49 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -65,7 +65,6 @@ | |||
| 65 | #include <openssl/asn1.h> | 65 | #include <openssl/asn1.h> |
| 66 | #include <openssl/bn.h> | 66 | #include <openssl/bn.h> |
| 67 | #include <openssl/dsa.h> | 67 | #include <openssl/dsa.h> |
| 68 | #include <openssl/err.h> | ||
| 69 | 68 | ||
| 70 | #ifndef OPENSSL_NO_DH | 69 | #ifndef OPENSSL_NO_DH |
| 71 | #include <openssl/dh.h> | 70 | #include <openssl/dh.h> |
| @@ -73,6 +72,7 @@ | |||
| 73 | 72 | ||
| 74 | #include "dh_local.h" | 73 | #include "dh_local.h" |
| 75 | #include "dsa_local.h" | 74 | #include "dsa_local.h" |
| 75 | #include "err_local.h" | ||
| 76 | 76 | ||
| 77 | static const DSA_METHOD *default_DSA_method = NULL; | 77 | static const DSA_METHOD *default_DSA_method = NULL; |
| 78 | 78 | ||
diff --git a/src/lib/libcrypto/dsa/dsa_local.h b/src/lib/libcrypto/dsa/dsa_local.h index fc77c09fcb..3d32e5e547 100644 --- a/src/lib/libcrypto/dsa/dsa_local.h +++ b/src/lib/libcrypto/dsa/dsa_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dsa_local.h,v 1.5 2024/11/29 07:42:35 tb Exp $ */ | 1 | /* $OpenBSD: dsa_local.h,v 1.6 2025/11/26 10:19:57 tb Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 2007 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2007 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -53,6 +53,9 @@ | |||
| 53 | * | 53 | * |
| 54 | */ | 54 | */ |
| 55 | 55 | ||
| 56 | #ifndef HEADER_DSA_LOCAL_H | ||
| 57 | #define HEADER_DSA_LOCAL_H | ||
| 58 | |||
| 56 | #include <openssl/dsa.h> | 59 | #include <openssl/dsa.h> |
| 57 | 60 | ||
| 58 | __BEGIN_HIDDEN_DECLS | 61 | __BEGIN_HIDDEN_DECLS |
| @@ -102,3 +105,5 @@ int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits, | |||
| 102 | int dsa_check_key(const DSA *dsa); | 105 | int dsa_check_key(const DSA *dsa); |
| 103 | 106 | ||
| 104 | __END_HIDDEN_DECLS | 107 | __END_HIDDEN_DECLS |
| 108 | |||
| 109 | #endif /* HEADER_DSA_LOCAL_H */ | ||
diff --git a/src/lib/libcrypto/dsa/dsa_meth.c b/src/lib/libcrypto/dsa/dsa_meth.c index c84b5287e1..c961bb13b4 100644 --- a/src/lib/libcrypto/dsa/dsa_meth.c +++ b/src/lib/libcrypto/dsa/dsa_meth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dsa_meth.c,v 1.7 2023/07/08 14:28:15 beck Exp $ */ | 1 | /* $OpenBSD: dsa_meth.c,v 1.8 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> | 3 | * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> |
| 4 | * | 4 | * |
| @@ -19,9 +19,9 @@ | |||
| 19 | #include <string.h> | 19 | #include <string.h> |
| 20 | 20 | ||
| 21 | #include <openssl/dsa.h> | 21 | #include <openssl/dsa.h> |
| 22 | #include <openssl/err.h> | ||
| 23 | 22 | ||
| 24 | #include "dsa_local.h" | 23 | #include "dsa_local.h" |
| 24 | #include "err_local.h" | ||
| 25 | 25 | ||
| 26 | DSA_METHOD * | 26 | DSA_METHOD * |
| 27 | DSA_meth_new(const char *name, int flags) | 27 | DSA_meth_new(const char *name, int flags) |
diff --git a/src/lib/libcrypto/dsa/dsa_ossl.c b/src/lib/libcrypto/dsa/dsa_ossl.c index c53c8b9001..6d1546f4fc 100644 --- a/src/lib/libcrypto/dsa/dsa_ossl.c +++ b/src/lib/libcrypto/dsa/dsa_ossl.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dsa_ossl.c,v 1.56 2024/05/11 06:43:50 tb Exp $ */ | 1 | /* $OpenBSD: dsa_ossl.c,v 1.57 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -63,11 +63,11 @@ | |||
| 63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
| 64 | #include <openssl/bn.h> | 64 | #include <openssl/bn.h> |
| 65 | #include <openssl/dsa.h> | 65 | #include <openssl/dsa.h> |
| 66 | #include <openssl/err.h> | ||
| 67 | #include <openssl/sha.h> | 66 | #include <openssl/sha.h> |
| 68 | 67 | ||
| 69 | #include "bn_local.h" | 68 | #include "bn_local.h" |
| 70 | #include "dsa_local.h" | 69 | #include "dsa_local.h" |
| 70 | #include "err_local.h" | ||
| 71 | 71 | ||
| 72 | /* | 72 | /* |
| 73 | * Since DSA parameters are entirely arbitrary and checking them to be | 73 | * Since DSA parameters are entirely arbitrary and checking them to be |
diff --git a/src/lib/libcrypto/dsa/dsa_pmeth.c b/src/lib/libcrypto/dsa/dsa_pmeth.c index adc7319731..73889a8307 100644 --- a/src/lib/libcrypto/dsa/dsa_pmeth.c +++ b/src/lib/libcrypto/dsa/dsa_pmeth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dsa_pmeth.c,v 1.21 2024/10/19 14:39:44 tb Exp $ */ | 1 | /* $OpenBSD: dsa_pmeth.c,v 1.22 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -63,12 +63,12 @@ | |||
| 63 | 63 | ||
| 64 | #include <openssl/asn1t.h> | 64 | #include <openssl/asn1t.h> |
| 65 | #include <openssl/bn.h> | 65 | #include <openssl/bn.h> |
| 66 | #include <openssl/err.h> | ||
| 67 | #include <openssl/evp.h> | 66 | #include <openssl/evp.h> |
| 68 | #include <openssl/x509.h> | 67 | #include <openssl/x509.h> |
| 69 | 68 | ||
| 70 | #include "bn_local.h" | 69 | #include "bn_local.h" |
| 71 | #include "dsa_local.h" | 70 | #include "dsa_local.h" |
| 71 | #include "err_local.h" | ||
| 72 | #include "evp_local.h" | 72 | #include "evp_local.h" |
| 73 | 73 | ||
| 74 | /* DSA pkey context structure */ | 74 | /* DSA pkey context structure */ |
diff --git a/src/lib/libcrypto/dsa/dsa_prn.c b/src/lib/libcrypto/dsa/dsa_prn.c index f276d82482..058b7d9ffd 100644 --- a/src/lib/libcrypto/dsa/dsa_prn.c +++ b/src/lib/libcrypto/dsa/dsa_prn.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dsa_prn.c,v 1.10 2023/07/08 14:28:15 beck Exp $ */ | 1 | /* $OpenBSD: dsa_prn.c,v 1.11 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -59,9 +59,10 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | 60 | ||
| 61 | #include <openssl/dsa.h> | 61 | #include <openssl/dsa.h> |
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
| 64 | 63 | ||
| 64 | #include "err_local.h" | ||
| 65 | |||
| 65 | int | 66 | int |
| 66 | DSA_print_fp(FILE *fp, const DSA *x, int off) | 67 | DSA_print_fp(FILE *fp, const DSA *x, int off) |
| 67 | { | 68 | { |
diff --git a/src/lib/libcrypto/ec/ec_ameth.c b/src/lib/libcrypto/ec/ec_ameth.c index 903b18a8db..ddc8adea1e 100644 --- a/src/lib/libcrypto/ec/ec_ameth.c +++ b/src/lib/libcrypto/ec/ec_ameth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_ameth.c,v 1.73 2024/11/25 06:51:39 tb Exp $ */ | 1 | /* $OpenBSD: ec_ameth.c,v 1.74 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -66,7 +66,6 @@ | |||
| 66 | #include <openssl/bn.h> | 66 | #include <openssl/bn.h> |
| 67 | #include <openssl/cms.h> | 67 | #include <openssl/cms.h> |
| 68 | #include <openssl/ec.h> | 68 | #include <openssl/ec.h> |
| 69 | #include <openssl/err.h> | ||
| 70 | #include <openssl/evp.h> | 69 | #include <openssl/evp.h> |
| 71 | #include <openssl/pkcs7.h> | 70 | #include <openssl/pkcs7.h> |
| 72 | #include <openssl/objects.h> | 71 | #include <openssl/objects.h> |
| @@ -74,6 +73,7 @@ | |||
| 74 | 73 | ||
| 75 | #include "asn1_local.h" | 74 | #include "asn1_local.h" |
| 76 | #include "bn_local.h" | 75 | #include "bn_local.h" |
| 76 | #include "err_local.h" | ||
| 77 | #include "evp_local.h" | 77 | #include "evp_local.h" |
| 78 | #include "x509_local.h" | 78 | #include "x509_local.h" |
| 79 | 79 | ||
diff --git a/src/lib/libcrypto/ec/ec_asn1.c b/src/lib/libcrypto/ec/ec_asn1.c index ef318f8d43..35f4f5b0ba 100644 --- a/src/lib/libcrypto/ec/ec_asn1.c +++ b/src/lib/libcrypto/ec/ec_asn1.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_asn1.c,v 1.111 2025/03/13 10:31:12 tb Exp $ */ | 1 | /* $OpenBSD: ec_asn1.c,v 1.112 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -66,12 +66,12 @@ | |||
| 66 | #include <openssl/asn1.h> | 66 | #include <openssl/asn1.h> |
| 67 | #include <openssl/bn.h> | 67 | #include <openssl/bn.h> |
| 68 | #include <openssl/ec.h> | 68 | #include <openssl/ec.h> |
| 69 | #include <openssl/err.h> | ||
| 70 | #include <openssl/asn1t.h> | 69 | #include <openssl/asn1t.h> |
| 71 | #include <openssl/objects.h> | 70 | #include <openssl/objects.h> |
| 72 | 71 | ||
| 73 | #include "asn1_local.h" | 72 | #include "asn1_local.h" |
| 74 | #include "ec_local.h" | 73 | #include "ec_local.h" |
| 74 | #include "err_local.h" | ||
| 75 | 75 | ||
| 76 | int | 76 | int |
| 77 | EC_GROUP_get_basis_type(const EC_GROUP *group) | 77 | EC_GROUP_get_basis_type(const EC_GROUP *group) |
diff --git a/src/lib/libcrypto/ec/ec_convert.c b/src/lib/libcrypto/ec/ec_convert.c index a18bc49132..3b88bd20ba 100644 --- a/src/lib/libcrypto/ec/ec_convert.c +++ b/src/lib/libcrypto/ec/ec_convert.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_convert.c,v 1.14 2025/01/05 16:07:08 tb Exp $ */ | 1 | /* $OpenBSD: ec_convert.c,v 1.16 2025/12/26 18:44:19 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -64,10 +64,10 @@ | |||
| 64 | #include <string.h> | 64 | #include <string.h> |
| 65 | 65 | ||
| 66 | #include <openssl/asn1.h> | 66 | #include <openssl/asn1.h> |
| 67 | #include <openssl/err.h> | ||
| 68 | 67 | ||
| 69 | #include "asn1_local.h" | 68 | #include "asn1_local.h" |
| 70 | #include "ec_local.h" | 69 | #include "ec_local.h" |
| 70 | #include "err_local.h" | ||
| 71 | 71 | ||
| 72 | /* | 72 | /* |
| 73 | * Internal handling of the point conversion octet | 73 | * Internal handling of the point conversion octet |
| @@ -452,7 +452,7 @@ EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *point, | |||
| 452 | if (ctx == NULL) | 452 | if (ctx == NULL) |
| 453 | goto err; | 453 | goto err; |
| 454 | 454 | ||
| 455 | if (group->meth != point->meth) { | 455 | if (!ec_group_and_point_compatible(group, point)) { |
| 456 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); | 456 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 457 | goto err; | 457 | goto err; |
| 458 | } | 458 | } |
| @@ -478,7 +478,7 @@ EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point, | |||
| 478 | if (ctx == NULL) | 478 | if (ctx == NULL) |
| 479 | goto err; | 479 | goto err; |
| 480 | 480 | ||
| 481 | if (group->meth != point->meth) { | 481 | if (!ec_group_and_point_compatible(group, point)) { |
| 482 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); | 482 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 483 | goto err; | 483 | goto err; |
| 484 | } | 484 | } |
diff --git a/src/lib/libcrypto/ec/ec_curve.c b/src/lib/libcrypto/ec/ec_curve.c index a3ec2de7fb..fda2681704 100644 --- a/src/lib/libcrypto/ec/ec_curve.c +++ b/src/lib/libcrypto/ec/ec_curve.c | |||
| @@ -1,7 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_curve.c,v 1.54 2025/03/09 17:53:11 tb Exp $ */ | 1 | /* $OpenBSD: ec_curve.c,v 1.60 2025/12/15 12:09:46 tb Exp $ */ |
| 2 | /* | ||
| 3 | * Written by Nils Larsch for the OpenSSL project. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | 2 | /* ==================================================================== |
| 6 | * Copyright (c) 1998-2010 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2010 The OpenSSL Project. All rights reserved. |
| 7 | * | 4 | * |
| @@ -78,10 +75,10 @@ | |||
| 78 | 75 | ||
| 79 | #include <openssl/bn.h> | 76 | #include <openssl/bn.h> |
| 80 | #include <openssl/ec.h> | 77 | #include <openssl/ec.h> |
| 81 | #include <openssl/err.h> | ||
| 82 | #include <openssl/objects.h> | 78 | #include <openssl/objects.h> |
| 83 | 79 | ||
| 84 | #include "ec_local.h" | 80 | #include "ec_local.h" |
| 81 | #include "err_local.h" | ||
| 85 | 82 | ||
| 86 | static const struct { | 83 | static const struct { |
| 87 | uint8_t seed[20]; | 84 | uint8_t seed[20]; |
| @@ -130,6 +127,57 @@ static const struct { | |||
| 130 | 127 | ||
| 131 | static const struct { | 128 | static const struct { |
| 132 | uint8_t seed[20]; | 129 | uint8_t seed[20]; |
| 130 | uint8_t p[32]; | ||
| 131 | uint8_t a[32]; | ||
| 132 | uint8_t b[32]; | ||
| 133 | uint8_t x[32]; | ||
| 134 | uint8_t y[32]; | ||
| 135 | uint8_t order[32]; | ||
| 136 | } _EC_NIST_PRIME_256 = { | ||
| 137 | .seed = { | ||
| 138 | 0xc4, 0x9d, 0x36, 0x08, 0x86, 0xe7, 0x04, 0x93, 0x6a, 0x66, | ||
| 139 | 0x78, 0xe1, 0x13, 0x9d, 0x26, 0xb7, 0x81, 0x9f, 0x7e, 0x90, | ||
| 140 | }, | ||
| 141 | .p = { | ||
| 142 | 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, | ||
| 143 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 144 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
| 145 | 0xff, 0xff, | ||
| 146 | }, | ||
| 147 | .a = { | ||
| 148 | 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, | ||
| 149 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 150 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
| 151 | 0xff, 0xfc, | ||
| 152 | }, | ||
| 153 | .b = { | ||
| 154 | 0x5a, 0xc6, 0x35, 0xd8, 0xaa, 0x3a, 0x93, 0xe7, 0xb3, 0xeb, | ||
| 155 | 0xbd, 0x55, 0x76, 0x98, 0x86, 0xbc, 0x65, 0x1d, 0x06, 0xb0, | ||
| 156 | 0xcc, 0x53, 0xb0, 0xf6, 0x3b, 0xce, 0x3c, 0x3e, 0x27, 0xd2, | ||
| 157 | 0x60, 0x4b, | ||
| 158 | }, | ||
| 159 | .x = { | ||
| 160 | 0x6b, 0x17, 0xd1, 0xf2, 0xe1, 0x2c, 0x42, 0x47, 0xf8, 0xbc, | ||
| 161 | 0xe6, 0xe5, 0x63, 0xa4, 0x40, 0xf2, 0x77, 0x03, 0x7d, 0x81, | ||
| 162 | 0x2d, 0xeb, 0x33, 0xa0, 0xf4, 0xa1, 0x39, 0x45, 0xd8, 0x98, | ||
| 163 | 0xc2, 0x96, | ||
| 164 | }, | ||
| 165 | .y = { | ||
| 166 | 0x4f, 0xe3, 0x42, 0xe2, 0xfe, 0x1a, 0x7f, 0x9b, 0x8e, 0xe7, | ||
| 167 | 0xeb, 0x4a, 0x7c, 0x0f, 0x9e, 0x16, 0x2b, 0xce, 0x33, 0x57, | ||
| 168 | 0x6b, 0x31, 0x5e, 0xce, 0xcb, 0xb6, 0x40, 0x68, 0x37, 0xbf, | ||
| 169 | 0x51, 0xf5, | ||
| 170 | }, | ||
| 171 | .order = { | ||
| 172 | 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, | ||
| 173 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbc, 0xe6, 0xfa, 0xad, | ||
| 174 | 0xa7, 0x17, 0x9e, 0x84, 0xf3, 0xb9, 0xca, 0xc2, 0xfc, 0x63, | ||
| 175 | 0x25, 0x51, | ||
| 176 | }, | ||
| 177 | }; | ||
| 178 | |||
| 179 | static const struct { | ||
| 180 | uint8_t seed[20]; | ||
| 133 | uint8_t p[48]; | 181 | uint8_t p[48]; |
| 134 | uint8_t a[48]; | 182 | uint8_t a[48]; |
| 135 | uint8_t b[48]; | 183 | uint8_t b[48]; |
| @@ -255,192 +303,6 @@ static const struct { | |||
| 255 | }; | 303 | }; |
| 256 | 304 | ||
| 257 | static const struct { | 305 | static const struct { |
| 258 | uint8_t seed[20]; | ||
| 259 | uint8_t p[30]; | ||
| 260 | uint8_t a[30]; | ||
| 261 | uint8_t b[30]; | ||
| 262 | uint8_t x[30]; | ||
| 263 | uint8_t y[30]; | ||
| 264 | uint8_t order[30]; | ||
| 265 | } _EC_X9_62_PRIME_239V1 = { | ||
| 266 | .seed = { | ||
| 267 | 0xe4, 0x3b, 0xb4, 0x60, 0xf0, 0xb8, 0x0c, 0xc0, 0xc0, 0xb0, | ||
| 268 | 0x75, 0x79, 0x8e, 0x94, 0x80, 0x60, 0xf8, 0x32, 0x1b, 0x7d, | ||
| 269 | }, | ||
| 270 | .p = { | ||
| 271 | 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
| 272 | 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, | ||
| 273 | 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
| 274 | }, | ||
| 275 | .a = { | ||
| 276 | 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
| 277 | 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, | ||
| 278 | 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xfc, | ||
| 279 | }, | ||
| 280 | .b = { | ||
| 281 | 0x6b, 0x01, 0x6c, 0x3b, 0xdc, 0xf1, 0x89, 0x41, 0xd0, 0xd6, | ||
| 282 | 0x54, 0x92, 0x14, 0x75, 0xca, 0x71, 0xa9, 0xdb, 0x2f, 0xb2, | ||
| 283 | 0x7d, 0x1d, 0x37, 0x79, 0x61, 0x85, 0xc2, 0x94, 0x2c, 0x0a, | ||
| 284 | }, | ||
| 285 | .x = { | ||
| 286 | 0x0f, 0xfa, 0x96, 0x3c, 0xdc, 0xa8, 0x81, 0x6c, 0xcc, 0x33, | ||
| 287 | 0xb8, 0x64, 0x2b, 0xed, 0xf9, 0x05, 0xc3, 0xd3, 0x58, 0x57, | ||
| 288 | 0x3d, 0x3f, 0x27, 0xfb, 0xbd, 0x3b, 0x3c, 0xb9, 0xaa, 0xaf, | ||
| 289 | }, | ||
| 290 | .y = { | ||
| 291 | 0x7d, 0xeb, 0xe8, 0xe4, 0xe9, 0x0a, 0x5d, 0xae, 0x6e, 0x40, | ||
| 292 | 0x54, 0xca, 0x53, 0x0b, 0xa0, 0x46, 0x54, 0xb3, 0x68, 0x18, | ||
| 293 | 0xce, 0x22, 0x6b, 0x39, 0xfc, 0xcb, 0x7b, 0x02, 0xf1, 0xae, | ||
| 294 | }, | ||
| 295 | .order = { | ||
| 296 | 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
| 297 | 0xff, 0xff, 0x7f, 0xff, 0xff, 0x9e, 0x5e, 0x9a, 0x9f, 0x5d, | ||
| 298 | 0x90, 0x71, 0xfb, 0xd1, 0x52, 0x26, 0x88, 0x90, 0x9d, 0x0b, | ||
| 299 | }, | ||
| 300 | }; | ||
| 301 | |||
| 302 | static const struct { | ||
| 303 | uint8_t seed[20]; | ||
| 304 | uint8_t p[30]; | ||
| 305 | uint8_t a[30]; | ||
| 306 | uint8_t b[30]; | ||
| 307 | uint8_t x[30]; | ||
| 308 | uint8_t y[30]; | ||
| 309 | uint8_t order[30]; | ||
| 310 | } _EC_X9_62_PRIME_239V2 = { | ||
| 311 | .seed = { | ||
| 312 | 0xe8, 0xb4, 0x01, 0x16, 0x04, 0x09, 0x53, 0x03, 0xca, 0x3b, | ||
| 313 | 0x80, 0x99, 0x98, 0x2b, 0xe0, 0x9f, 0xcb, 0x9a, 0xe6, 0x16, | ||
| 314 | }, | ||
| 315 | .p = { | ||
| 316 | 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
| 317 | 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, | ||
| 318 | 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
| 319 | }, | ||
| 320 | .a = { | ||
| 321 | 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
| 322 | 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, | ||
| 323 | 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xfc, | ||
| 324 | }, | ||
| 325 | .b = { | ||
| 326 | 0x61, 0x7f, 0xab, 0x68, 0x32, 0x57, 0x6c, 0xbb, 0xfe, 0xd5, | ||
| 327 | 0x0d, 0x99, 0xf0, 0x24, 0x9c, 0x3f, 0xee, 0x58, 0xb9, 0x4b, | ||
| 328 | 0xa0, 0x03, 0x8c, 0x7a, 0xe8, 0x4c, 0x8c, 0x83, 0x2f, 0x2c, | ||
| 329 | }, | ||
| 330 | .x = { | ||
| 331 | 0x38, 0xaf, 0x09, 0xd9, 0x87, 0x27, 0x70, 0x51, 0x20, 0xc9, | ||
| 332 | 0x21, 0xbb, 0x5e, 0x9e, 0x26, 0x29, 0x6a, 0x3c, 0xdc, 0xf2, | ||
| 333 | 0xf3, 0x57, 0x57, 0xa0, 0xea, 0xfd, 0x87, 0xb8, 0x30, 0xe7, | ||
| 334 | }, | ||
| 335 | .y = { | ||
| 336 | 0x5b, 0x01, 0x25, 0xe4, 0xdb, 0xea, 0x0e, 0xc7, 0x20, 0x6d, | ||
| 337 | 0xa0, 0xfc, 0x01, 0xd9, 0xb0, 0x81, 0x32, 0x9f, 0xb5, 0x55, | ||
| 338 | 0xde, 0x6e, 0xf4, 0x60, 0x23, 0x7d, 0xff, 0x8b, 0xe4, 0xba, | ||
| 339 | }, | ||
| 340 | .order = { | ||
| 341 | 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
| 342 | 0xff, 0xff, 0x80, 0x00, 0x00, 0xcf, 0xa7, 0xe8, 0x59, 0x43, | ||
| 343 | 0x77, 0xd4, 0x14, 0xc0, 0x38, 0x21, 0xbc, 0x58, 0x20, 0x63, | ||
| 344 | }, | ||
| 345 | }; | ||
| 346 | |||
| 347 | static const struct { | ||
| 348 | uint8_t seed[20]; | ||
| 349 | uint8_t p[30]; | ||
| 350 | uint8_t a[30]; | ||
| 351 | uint8_t b[30]; | ||
| 352 | uint8_t x[30]; | ||
| 353 | uint8_t y[30]; | ||
| 354 | uint8_t order[30]; | ||
| 355 | } _EC_X9_62_PRIME_239V3 = { | ||
| 356 | .seed = { | ||
| 357 | 0x7d, 0x73, 0x74, 0x16, 0x8f, 0xfe, 0x34, 0x71, 0xb6, 0x0a, | ||
| 358 | 0x85, 0x76, 0x86, 0xa1, 0x94, 0x75, 0xd3, 0xbf, 0xa2, 0xff, | ||
| 359 | }, | ||
| 360 | .p = { | ||
| 361 | 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
| 362 | 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, | ||
| 363 | 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
| 364 | }, | ||
| 365 | .a = { | ||
| 366 | 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
| 367 | 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, | ||
| 368 | 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xfc, | ||
| 369 | }, | ||
| 370 | .b = { | ||
| 371 | 0x25, 0x57, 0x05, 0xfa, 0x2a, 0x30, 0x66, 0x54, 0xb1, 0xf4, | ||
| 372 | 0xcb, 0x03, 0xd6, 0xa7, 0x50, 0xa3, 0x0c, 0x25, 0x01, 0x02, | ||
| 373 | 0xd4, 0x98, 0x87, 0x17, 0xd9, 0xba, 0x15, 0xab, 0x6d, 0x3e, | ||
| 374 | }, | ||
| 375 | .x = { | ||
| 376 | 0x67, 0x68, 0xae, 0x8e, 0x18, 0xbb, 0x92, 0xcf, 0xcf, 0x00, | ||
| 377 | 0x5c, 0x94, 0x9a, 0xa2, 0xc6, 0xd9, 0x48, 0x53, 0xd0, 0xe6, | ||
| 378 | 0x60, 0xbb, 0xf8, 0x54, 0xb1, 0xc9, 0x50, 0x5f, 0xe9, 0x5a, | ||
| 379 | }, | ||
| 380 | .y = { | ||
| 381 | 0x16, 0x07, 0xe6, 0x89, 0x8f, 0x39, 0x0c, 0x06, 0xbc, 0x1d, | ||
| 382 | 0x55, 0x2b, 0xad, 0x22, 0x6f, 0x3b, 0x6f, 0xcf, 0xe4, 0x8b, | ||
| 383 | 0x6e, 0x81, 0x84, 0x99, 0xaf, 0x18, 0xe3, 0xed, 0x6c, 0xf3, | ||
| 384 | }, | ||
| 385 | .order = { | ||
| 386 | 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
| 387 | 0xff, 0xff, 0x7f, 0xff, 0xff, 0x97, 0x5d, 0xeb, 0x41, 0xb3, | ||
| 388 | 0xa6, 0x05, 0x7c, 0x3c, 0x43, 0x21, 0x46, 0x52, 0x65, 0x51, | ||
| 389 | }, | ||
| 390 | }; | ||
| 391 | |||
| 392 | static const struct { | ||
| 393 | uint8_t seed[20]; | ||
| 394 | uint8_t p[32]; | ||
| 395 | uint8_t a[32]; | ||
| 396 | uint8_t b[32]; | ||
| 397 | uint8_t x[32]; | ||
| 398 | uint8_t y[32]; | ||
| 399 | uint8_t order[32]; | ||
| 400 | } _EC_X9_62_PRIME_256V1 = { | ||
| 401 | .seed = { | ||
| 402 | 0xc4, 0x9d, 0x36, 0x08, 0x86, 0xe7, 0x04, 0x93, 0x6a, 0x66, | ||
| 403 | 0x78, 0xe1, 0x13, 0x9d, 0x26, 0xb7, 0x81, 0x9f, 0x7e, 0x90, | ||
| 404 | }, | ||
| 405 | .p = { | ||
| 406 | 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, | ||
| 407 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 408 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
| 409 | 0xff, 0xff, | ||
| 410 | }, | ||
| 411 | .a = { | ||
| 412 | 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, | ||
| 413 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 414 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
| 415 | 0xff, 0xfc, | ||
| 416 | }, | ||
| 417 | .b = { | ||
| 418 | 0x5a, 0xc6, 0x35, 0xd8, 0xaa, 0x3a, 0x93, 0xe7, 0xb3, 0xeb, | ||
| 419 | 0xbd, 0x55, 0x76, 0x98, 0x86, 0xbc, 0x65, 0x1d, 0x06, 0xb0, | ||
| 420 | 0xcc, 0x53, 0xb0, 0xf6, 0x3b, 0xce, 0x3c, 0x3e, 0x27, 0xd2, | ||
| 421 | 0x60, 0x4b, | ||
| 422 | }, | ||
| 423 | .x = { | ||
| 424 | 0x6b, 0x17, 0xd1, 0xf2, 0xe1, 0x2c, 0x42, 0x47, 0xf8, 0xbc, | ||
| 425 | 0xe6, 0xe5, 0x63, 0xa4, 0x40, 0xf2, 0x77, 0x03, 0x7d, 0x81, | ||
| 426 | 0x2d, 0xeb, 0x33, 0xa0, 0xf4, 0xa1, 0x39, 0x45, 0xd8, 0x98, | ||
| 427 | 0xc2, 0x96, | ||
| 428 | }, | ||
| 429 | .y = { | ||
| 430 | 0x4f, 0xe3, 0x42, 0xe2, 0xfe, 0x1a, 0x7f, 0x9b, 0x8e, 0xe7, | ||
| 431 | 0xeb, 0x4a, 0x7c, 0x0f, 0x9e, 0x16, 0x2b, 0xce, 0x33, 0x57, | ||
| 432 | 0x6b, 0x31, 0x5e, 0xce, 0xcb, 0xb6, 0x40, 0x68, 0x37, 0xbf, | ||
| 433 | 0x51, 0xf5, | ||
| 434 | }, | ||
| 435 | .order = { | ||
| 436 | 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, | ||
| 437 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbc, 0xe6, 0xfa, 0xad, | ||
| 438 | 0xa7, 0x17, 0x9e, 0x84, 0xf3, 0xb9, 0xca, 0xc2, 0xfc, 0x63, | ||
| 439 | 0x25, 0x51, | ||
| 440 | }, | ||
| 441 | }; | ||
| 442 | |||
| 443 | static const struct { | ||
| 444 | uint8_t p[29]; | 306 | uint8_t p[29]; |
| 445 | uint8_t a[29]; | 307 | uint8_t a[29]; |
| 446 | uint8_t b[29]; | 308 | uint8_t b[29]; |
| @@ -1121,7 +983,21 @@ static const struct ec_curve { | |||
| 1121 | .order = _EC_SECG_PRIME_256K1.order, | 983 | .order = _EC_SECG_PRIME_256K1.order, |
| 1122 | .cofactor = 1, | 984 | .cofactor = 1, |
| 1123 | }, | 985 | }, |
| 1124 | /* SECG secp256r1 is the same as X9.62 prime256v1 and hence omitted */ | 986 | { |
| 987 | /* Everyone except OpenSSL calls this secp256r1 or P-256. */ | ||
| 988 | .comment = "X9.62/SECG curve prime256v1", | ||
| 989 | .nid = NID_X9_62_prime256v1, | ||
| 990 | .seed_len = sizeof(_EC_NIST_PRIME_256.seed), | ||
| 991 | .param_len = sizeof(_EC_NIST_PRIME_256.p), | ||
| 992 | .seed = _EC_NIST_PRIME_256.seed, | ||
| 993 | .p = _EC_NIST_PRIME_256.p, | ||
| 994 | .a = _EC_NIST_PRIME_256.a, | ||
| 995 | .b = _EC_NIST_PRIME_256.b, | ||
| 996 | .x = _EC_NIST_PRIME_256.x, | ||
| 997 | .y = _EC_NIST_PRIME_256.y, | ||
| 998 | .order = _EC_NIST_PRIME_256.order, | ||
| 999 | .cofactor = 1, | ||
| 1000 | }, | ||
| 1125 | { | 1001 | { |
| 1126 | .comment = "NIST/SECG curve secp384r1", | 1002 | .comment = "NIST/SECG curve secp384r1", |
| 1127 | .nid = NID_secp384r1, | 1003 | .nid = NID_secp384r1, |
| @@ -1150,63 +1026,6 @@ static const struct ec_curve { | |||
| 1150 | .order = _EC_NIST_PRIME_521.order, | 1026 | .order = _EC_NIST_PRIME_521.order, |
| 1151 | .cofactor = 1, | 1027 | .cofactor = 1, |
| 1152 | }, | 1028 | }, |
| 1153 | /* X9.62 curves */ | ||
| 1154 | { | ||
| 1155 | .comment = "X9.62 curve prime239v1", | ||
| 1156 | .nid = NID_X9_62_prime239v1, | ||
| 1157 | .seed_len = sizeof(_EC_X9_62_PRIME_239V1.seed), | ||
| 1158 | .param_len = sizeof(_EC_X9_62_PRIME_239V1.p), | ||
| 1159 | .seed = _EC_X9_62_PRIME_239V1.seed, | ||
| 1160 | .p = _EC_X9_62_PRIME_239V1.p, | ||
| 1161 | .a = _EC_X9_62_PRIME_239V1.a, | ||
| 1162 | .b = _EC_X9_62_PRIME_239V1.b, | ||
| 1163 | .x = _EC_X9_62_PRIME_239V1.x, | ||
| 1164 | .y = _EC_X9_62_PRIME_239V1.y, | ||
| 1165 | .order = _EC_X9_62_PRIME_239V1.order, | ||
| 1166 | .cofactor = 1, | ||
| 1167 | }, | ||
| 1168 | { | ||
| 1169 | .comment = "X9.62 curve prime239v2", | ||
| 1170 | .nid = NID_X9_62_prime239v2, | ||
| 1171 | .seed_len = sizeof(_EC_X9_62_PRIME_239V2.seed), | ||
| 1172 | .param_len = sizeof(_EC_X9_62_PRIME_239V2.p), | ||
| 1173 | .seed = _EC_X9_62_PRIME_239V2.seed, | ||
| 1174 | .p = _EC_X9_62_PRIME_239V2.p, | ||
| 1175 | .a = _EC_X9_62_PRIME_239V2.a, | ||
| 1176 | .b = _EC_X9_62_PRIME_239V2.b, | ||
| 1177 | .x = _EC_X9_62_PRIME_239V2.x, | ||
| 1178 | .y = _EC_X9_62_PRIME_239V2.y, | ||
| 1179 | .order = _EC_X9_62_PRIME_239V2.order, | ||
| 1180 | .cofactor = 1, | ||
| 1181 | }, | ||
| 1182 | { | ||
| 1183 | .comment = "X9.62 curve prime239v3", | ||
| 1184 | .nid = NID_X9_62_prime239v3, | ||
| 1185 | .seed_len = sizeof(_EC_X9_62_PRIME_239V3.seed), | ||
| 1186 | .param_len = sizeof(_EC_X9_62_PRIME_239V3.p), | ||
| 1187 | .seed = _EC_X9_62_PRIME_239V3.seed, | ||
| 1188 | .p = _EC_X9_62_PRIME_239V3.p, | ||
| 1189 | .a = _EC_X9_62_PRIME_239V3.a, | ||
| 1190 | .b = _EC_X9_62_PRIME_239V3.b, | ||
| 1191 | .x = _EC_X9_62_PRIME_239V3.x, | ||
| 1192 | .y = _EC_X9_62_PRIME_239V3.y, | ||
| 1193 | .order = _EC_X9_62_PRIME_239V3.order, | ||
| 1194 | .cofactor = 1, | ||
| 1195 | }, | ||
| 1196 | { | ||
| 1197 | .comment = "X9.62/SECG curve prime256v1", | ||
| 1198 | .nid = NID_X9_62_prime256v1, | ||
| 1199 | .seed_len = sizeof(_EC_X9_62_PRIME_256V1.seed), | ||
| 1200 | .param_len = sizeof(_EC_X9_62_PRIME_256V1.p), | ||
| 1201 | .seed = _EC_X9_62_PRIME_256V1.seed, | ||
| 1202 | .p = _EC_X9_62_PRIME_256V1.p, | ||
| 1203 | .a = _EC_X9_62_PRIME_256V1.a, | ||
| 1204 | .b = _EC_X9_62_PRIME_256V1.b, | ||
| 1205 | .x = _EC_X9_62_PRIME_256V1.x, | ||
| 1206 | .y = _EC_X9_62_PRIME_256V1.y, | ||
| 1207 | .order = _EC_X9_62_PRIME_256V1.order, | ||
| 1208 | .cofactor = 1, | ||
| 1209 | }, | ||
| 1210 | /* RFC 5639 curves */ | 1029 | /* RFC 5639 curves */ |
| 1211 | { | 1030 | { |
| 1212 | .comment = "RFC 5639 curve brainpoolP224r1", | 1031 | .comment = "RFC 5639 curve brainpoolP224r1", |
| @@ -1221,7 +1040,7 @@ static const struct ec_curve { | |||
| 1221 | .cofactor = 1, | 1040 | .cofactor = 1, |
| 1222 | }, | 1041 | }, |
| 1223 | { | 1042 | { |
| 1224 | .comment = "RFC 5639 curve brainpoolP224r2", | 1043 | .comment = "RFC 5639 curve brainpoolP224t1", |
| 1225 | .nid = NID_brainpoolP224t1, | 1044 | .nid = NID_brainpoolP224t1, |
| 1226 | .param_len = sizeof(_EC_brainpoolP224t1.p), | 1045 | .param_len = sizeof(_EC_brainpoolP224t1.p), |
| 1227 | .p = _EC_brainpoolP224t1.p, | 1046 | .p = _EC_brainpoolP224t1.p, |
| @@ -1573,7 +1392,7 @@ ec_curve_from_group(const EC_GROUP *group) | |||
| 1573 | if ((cofactor = EC_GROUP_get0_cofactor(group)) != NULL) { | 1392 | if ((cofactor = EC_GROUP_get0_cofactor(group)) != NULL) { |
| 1574 | BN_ULONG cofactor_word; | 1393 | BN_ULONG cofactor_word; |
| 1575 | 1394 | ||
| 1576 | if ((cofactor_word = BN_get_word(cofactor)) == BN_MASK2) | 1395 | if ((cofactor_word = BN_get_word(cofactor)) == (BN_ULONG)-1) |
| 1577 | goto err; | 1396 | goto err; |
| 1578 | if (cofactor_word > INT_MAX) | 1397 | if (cofactor_word > INT_MAX) |
| 1579 | goto err; | 1398 | goto err; |
diff --git a/src/lib/libcrypto/ec/ec_field.c b/src/lib/libcrypto/ec/ec_field.c new file mode 100644 index 0000000000..6576526e77 --- /dev/null +++ b/src/lib/libcrypto/ec/ec_field.c | |||
| @@ -0,0 +1,202 @@ | |||
| 1 | /* $OpenBSD: ec_field.c,v 1.3 2025/08/02 16:20:00 jsing Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <string.h> | ||
| 19 | |||
| 20 | #include <openssl/ec.h> | ||
| 21 | |||
| 22 | #include "bn_local.h" | ||
| 23 | #include "bn_internal.h" | ||
| 24 | #include "ec_local.h" | ||
| 25 | #include "ec_internal.h" | ||
| 26 | |||
| 27 | int | ||
| 28 | ec_field_modulus_from_bn(EC_FIELD_MODULUS *fm, const BIGNUM *bn, BN_CTX *ctx) | ||
| 29 | { | ||
| 30 | BN_MONT_CTX *mctx = NULL; | ||
| 31 | size_t i; | ||
| 32 | int ret = 0; | ||
| 33 | |||
| 34 | if (BN_is_negative(bn)) | ||
| 35 | goto err; | ||
| 36 | if (BN_num_bits(bn) > EC_FIELD_ELEMENT_MAX_BITS) | ||
| 37 | goto err; | ||
| 38 | |||
| 39 | memset(fm, 0, sizeof(*fm)); | ||
| 40 | |||
| 41 | fm->n = (BN_num_bits(bn) + BN_BITS2 - 1) / BN_BITS2; | ||
| 42 | |||
| 43 | for (i = 0; i < bn->top; i++) | ||
| 44 | fm->m.w[i] = bn->d[i]; | ||
| 45 | |||
| 46 | /* XXX - implement this without BN_MONT_CTX. */ | ||
| 47 | if ((mctx = BN_MONT_CTX_new()) == NULL) | ||
| 48 | goto err; | ||
| 49 | if (!BN_MONT_CTX_set(mctx, bn, ctx)) | ||
| 50 | goto err; | ||
| 51 | |||
| 52 | for (i = 0; i < mctx->RR.top; i++) | ||
| 53 | fm->rr.w[i] = mctx->RR.d[i]; | ||
| 54 | |||
| 55 | fm->minv0 = mctx->n0[0]; | ||
| 56 | |||
| 57 | ret = 1; | ||
| 58 | |||
| 59 | err: | ||
| 60 | BN_MONT_CTX_free(mctx); | ||
| 61 | |||
| 62 | return ret; | ||
| 63 | } | ||
| 64 | |||
| 65 | int | ||
| 66 | ec_field_element_from_bn(const EC_FIELD_MODULUS *fm, const EC_GROUP *group, | ||
| 67 | EC_FIELD_ELEMENT *fe, const BIGNUM *bn, BN_CTX *ctx) | ||
| 68 | { | ||
| 69 | BN_ULONG t[EC_FIELD_ELEMENT_MAX_WORDS * 2 + 2]; | ||
| 70 | BIGNUM *tmp; | ||
| 71 | size_t i; | ||
| 72 | int ret = 0; | ||
| 73 | |||
| 74 | BN_CTX_start(ctx); | ||
| 75 | |||
| 76 | if ((tmp = BN_CTX_get(ctx)) == NULL) | ||
| 77 | goto err; | ||
| 78 | |||
| 79 | /* XXX - enforce 0 <= n < p. */ | ||
| 80 | |||
| 81 | if (BN_num_bits(bn) > EC_FIELD_ELEMENT_MAX_BITS) | ||
| 82 | goto err; | ||
| 83 | |||
| 84 | /* XXX - do this without BN. */ | ||
| 85 | if (!BN_nnmod(tmp, bn, group->p, ctx)) | ||
| 86 | goto err; | ||
| 87 | |||
| 88 | if (BN_num_bits(tmp) > EC_FIELD_ELEMENT_MAX_BITS) | ||
| 89 | abort(); | ||
| 90 | |||
| 91 | memset(fe->w, 0, sizeof(fe->w)); | ||
| 92 | |||
| 93 | for (i = 0; i < tmp->top; i++) | ||
| 94 | fe->w[i] = tmp->d[i]; | ||
| 95 | |||
| 96 | bn_mod_mul_words(fe->w, fe->w, fm->rr.w, fm->m.w, t, fm->minv0, fm->n); | ||
| 97 | |||
| 98 | ret = 1; | ||
| 99 | |||
| 100 | err: | ||
| 101 | BN_CTX_end(ctx); | ||
| 102 | |||
| 103 | return ret; | ||
| 104 | } | ||
| 105 | |||
| 106 | int | ||
| 107 | ec_field_element_to_bn(const EC_FIELD_MODULUS *fm, const EC_FIELD_ELEMENT *fe, | ||
| 108 | BIGNUM *bn, BN_CTX *ctx) | ||
| 109 | { | ||
| 110 | BN_ULONG t[EC_FIELD_ELEMENT_MAX_WORDS * 2 + 2]; | ||
| 111 | size_t i; | ||
| 112 | |||
| 113 | if (!bn_wexpand(bn, fm->n)) | ||
| 114 | return 0; | ||
| 115 | |||
| 116 | memset(t, 0, sizeof(t)); | ||
| 117 | for (i = 0; i < fm->n; i++) | ||
| 118 | t[i] = fe->w[i]; | ||
| 119 | |||
| 120 | bn_montgomery_reduce_words(bn->d, t, fm->m.w, fm->minv0, fm->n); | ||
| 121 | |||
| 122 | bn->top = fm->n; | ||
| 123 | bn_correct_top(bn); | ||
| 124 | |||
| 125 | return 1; | ||
| 126 | } | ||
| 127 | |||
| 128 | void | ||
| 129 | ec_field_element_copy(EC_FIELD_ELEMENT *dst, const EC_FIELD_ELEMENT *src) | ||
| 130 | { | ||
| 131 | memcpy(dst, src, sizeof(EC_FIELD_ELEMENT)); | ||
| 132 | } | ||
| 133 | |||
| 134 | void | ||
| 135 | ec_field_element_select(const EC_FIELD_MODULUS *fm, EC_FIELD_ELEMENT *r, | ||
| 136 | const EC_FIELD_ELEMENT *a, const EC_FIELD_ELEMENT *b, int conditional) | ||
| 137 | { | ||
| 138 | BN_ULONG mask; | ||
| 139 | int i; | ||
| 140 | |||
| 141 | mask = bn_ct_eq_zero_mask(conditional); | ||
| 142 | |||
| 143 | for (i = 0; i < fm->n; i++) | ||
| 144 | r->w[i] = (a->w[i] & mask) | (b->w[i] & ~mask); | ||
| 145 | } | ||
| 146 | |||
| 147 | int | ||
| 148 | ec_field_element_equal(const EC_FIELD_MODULUS *fm, const EC_FIELD_ELEMENT *a, | ||
| 149 | const EC_FIELD_ELEMENT *b) | ||
| 150 | { | ||
| 151 | BN_ULONG v = 0; | ||
| 152 | int i; | ||
| 153 | |||
| 154 | for (i = 0; i < fm->n; i++) | ||
| 155 | v |= a->w[i] ^ b->w[i]; | ||
| 156 | |||
| 157 | return bn_ct_eq_zero(v); | ||
| 158 | } | ||
| 159 | |||
| 160 | int | ||
| 161 | ec_field_element_is_zero(const EC_FIELD_MODULUS *fm, const EC_FIELD_ELEMENT *fe) | ||
| 162 | { | ||
| 163 | BN_ULONG v = 0; | ||
| 164 | int i; | ||
| 165 | |||
| 166 | for (i = 0; i < fm->n; i++) | ||
| 167 | v |= fe->w[i]; | ||
| 168 | |||
| 169 | return bn_ct_eq_zero(v); | ||
| 170 | } | ||
| 171 | |||
| 172 | void | ||
| 173 | ec_field_element_add(const EC_FIELD_MODULUS *m, EC_FIELD_ELEMENT *r, | ||
| 174 | const EC_FIELD_ELEMENT *a, const EC_FIELD_ELEMENT *b) | ||
| 175 | { | ||
| 176 | bn_mod_add_words(r->w, a->w, b->w, m->m.w, m->n); | ||
| 177 | } | ||
| 178 | |||
| 179 | void | ||
| 180 | ec_field_element_sub(const EC_FIELD_MODULUS *m, EC_FIELD_ELEMENT *r, | ||
| 181 | const EC_FIELD_ELEMENT *a, const EC_FIELD_ELEMENT *b) | ||
| 182 | { | ||
| 183 | bn_mod_sub_words(r->w, a->w, b->w, m->m.w, m->n); | ||
| 184 | } | ||
| 185 | |||
| 186 | void | ||
| 187 | ec_field_element_mul(const EC_FIELD_MODULUS *m, EC_FIELD_ELEMENT *r, | ||
| 188 | const EC_FIELD_ELEMENT *a, const EC_FIELD_ELEMENT *b) | ||
| 189 | { | ||
| 190 | BN_ULONG t[EC_FIELD_ELEMENT_MAX_WORDS * 2 + 2]; | ||
| 191 | |||
| 192 | bn_mod_mul_words(r->w, a->w, b->w, m->m.w, t, m->minv0, m->n); | ||
| 193 | } | ||
| 194 | |||
| 195 | void | ||
| 196 | ec_field_element_sqr(const EC_FIELD_MODULUS *m, EC_FIELD_ELEMENT *r, | ||
| 197 | const EC_FIELD_ELEMENT *a) | ||
| 198 | { | ||
| 199 | BN_ULONG t[EC_FIELD_ELEMENT_MAX_WORDS * 2 + 2]; | ||
| 200 | |||
| 201 | bn_mod_sqr_words(r->w, a->w, m->m.w, t, m->minv0, m->n); | ||
| 202 | } | ||
diff --git a/src/lib/libcrypto/ec/ec_internal.h b/src/lib/libcrypto/ec/ec_internal.h new file mode 100644 index 0000000000..de0affa206 --- /dev/null +++ b/src/lib/libcrypto/ec/ec_internal.h | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | /* $OpenBSD: ec_internal.h,v 1.3 2025/12/05 14:12:32 tb Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <openssl/bn.h> | ||
| 19 | |||
| 20 | #ifndef HEADER_EC_INTERNAL_H | ||
| 21 | #define HEADER_EC_INTERNAL_H | ||
| 22 | |||
| 23 | #define EC_FIELD_ELEMENT_MAX_BITS 521 | ||
| 24 | #define EC_FIELD_ELEMENT_MAX_BYTES \ | ||
| 25 | (EC_FIELD_ELEMENT_MAX_BITS + 7) / 8 | ||
| 26 | #define EC_FIELD_ELEMENT_MAX_WORDS \ | ||
| 27 | ((EC_FIELD_ELEMENT_MAX_BYTES + sizeof(BN_ULONG) - 1) / sizeof(BN_ULONG)) | ||
| 28 | |||
| 29 | typedef struct { | ||
| 30 | BN_ULONG w[EC_FIELD_ELEMENT_MAX_WORDS]; | ||
| 31 | } EC_FIELD_ELEMENT; | ||
| 32 | |||
| 33 | typedef struct { | ||
| 34 | size_t n; | ||
| 35 | EC_FIELD_ELEMENT m; | ||
| 36 | EC_FIELD_ELEMENT rr; | ||
| 37 | BN_ULONG minv0; | ||
| 38 | } EC_FIELD_MODULUS; | ||
| 39 | |||
| 40 | int ec_field_modulus_from_bn(EC_FIELD_MODULUS *fm, const BIGNUM *bn, | ||
| 41 | BN_CTX *ctx); | ||
| 42 | |||
| 43 | int ec_field_element_from_bn(const EC_FIELD_MODULUS *fm, const EC_GROUP *group, | ||
| 44 | EC_FIELD_ELEMENT *fe, const BIGNUM *bn, BN_CTX *ctx); | ||
| 45 | int ec_field_element_to_bn(const EC_FIELD_MODULUS *fm, const EC_FIELD_ELEMENT *fe, | ||
| 46 | BIGNUM *bn, BN_CTX *ctx); | ||
| 47 | |||
| 48 | void ec_field_element_copy(EC_FIELD_ELEMENT *dst, const EC_FIELD_ELEMENT *src); | ||
| 49 | void ec_field_element_select(const EC_FIELD_MODULUS *fm, EC_FIELD_ELEMENT *r, | ||
| 50 | const EC_FIELD_ELEMENT *a, const EC_FIELD_ELEMENT *b, int conditional); | ||
| 51 | |||
| 52 | int ec_field_element_equal(const EC_FIELD_MODULUS *fm, const EC_FIELD_ELEMENT *a, | ||
| 53 | const EC_FIELD_ELEMENT *b); | ||
| 54 | int ec_field_element_is_zero(const EC_FIELD_MODULUS *fm, const EC_FIELD_ELEMENT *fe); | ||
| 55 | |||
| 56 | void ec_field_element_add(const EC_FIELD_MODULUS *m, EC_FIELD_ELEMENT *r, | ||
| 57 | const EC_FIELD_ELEMENT *a, const EC_FIELD_ELEMENT *b); | ||
| 58 | void ec_field_element_sub(const EC_FIELD_MODULUS *m, EC_FIELD_ELEMENT *r, | ||
| 59 | const EC_FIELD_ELEMENT *a, const EC_FIELD_ELEMENT *b); | ||
| 60 | void ec_field_element_mul(const EC_FIELD_MODULUS *m, EC_FIELD_ELEMENT *r, | ||
| 61 | const EC_FIELD_ELEMENT *a, const EC_FIELD_ELEMENT *b); | ||
| 62 | void ec_field_element_sqr(const EC_FIELD_MODULUS *m, EC_FIELD_ELEMENT *r, | ||
| 63 | const EC_FIELD_ELEMENT *a); | ||
| 64 | |||
| 65 | #endif | ||
diff --git a/src/lib/libcrypto/ec/ec_key.c b/src/lib/libcrypto/ec/ec_key.c index 6257d67cd1..e9777019c8 100644 --- a/src/lib/libcrypto/ec/ec_key.c +++ b/src/lib/libcrypto/ec/ec_key.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_key.c,v 1.51 2025/01/25 10:34:36 tb Exp $ */ | 1 | /* $OpenBSD: ec_key.c,v 1.52 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -66,11 +66,11 @@ | |||
| 66 | #include <openssl/opensslconf.h> | 66 | #include <openssl/opensslconf.h> |
| 67 | 67 | ||
| 68 | #include <openssl/ec.h> | 68 | #include <openssl/ec.h> |
| 69 | #include <openssl/err.h> | ||
| 70 | 69 | ||
| 71 | #include "bn_local.h" | 70 | #include "bn_local.h" |
| 72 | #include "ec_local.h" | 71 | #include "ec_local.h" |
| 73 | #include "ecdsa_local.h" | 72 | #include "ecdsa_local.h" |
| 73 | #include "err_local.h" | ||
| 74 | 74 | ||
| 75 | EC_KEY * | 75 | EC_KEY * |
| 76 | EC_KEY_new(void) | 76 | EC_KEY_new(void) |
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index 7982d23f06..30b2cf95b8 100644 --- a/src/lib/libcrypto/ec/ec_lib.c +++ b/src/lib/libcrypto/ec/ec_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_lib.c,v 1.123 2025/03/24 13:07:04 jsing Exp $ */ | 1 | /* $OpenBSD: ec_lib.c,v 1.131 2025/12/26 18:49:13 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -68,12 +68,12 @@ | |||
| 68 | 68 | ||
| 69 | #include <openssl/bn.h> | 69 | #include <openssl/bn.h> |
| 70 | #include <openssl/ec.h> | 70 | #include <openssl/ec.h> |
| 71 | #include <openssl/err.h> | ||
| 72 | #include <openssl/objects.h> | 71 | #include <openssl/objects.h> |
| 73 | #include <openssl/opensslv.h> | 72 | #include <openssl/opensslv.h> |
| 74 | 73 | ||
| 75 | #include "bn_local.h" | 74 | #include "bn_local.h" |
| 76 | #include "ec_local.h" | 75 | #include "ec_local.h" |
| 76 | #include "err_local.h" | ||
| 77 | 77 | ||
| 78 | EC_GROUP * | 78 | EC_GROUP * |
| 79 | EC_GROUP_new(const EC_METHOD *meth) | 79 | EC_GROUP_new(const EC_METHOD *meth) |
| @@ -165,6 +165,10 @@ EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src) | |||
| 165 | 165 | ||
| 166 | dst->a_is_minus3 = src->a_is_minus3; | 166 | dst->a_is_minus3 = src->a_is_minus3; |
| 167 | 167 | ||
| 168 | memcpy(&dst->fm, &src->fm, sizeof(src->fm)); | ||
| 169 | memcpy(&dst->fe_a, &src->fe_a, sizeof(src->fe_a)); | ||
| 170 | memcpy(&dst->fe_b, &src->fe_b, sizeof(src->fe_b)); | ||
| 171 | |||
| 168 | BN_MONT_CTX_free(dst->mont_ctx); | 172 | BN_MONT_CTX_free(dst->mont_ctx); |
| 169 | dst->mont_ctx = NULL; | 173 | dst->mont_ctx = NULL; |
| 170 | if (src->mont_ctx != NULL) { | 174 | if (src->mont_ctx != NULL) { |
| @@ -788,6 +792,16 @@ EC_GROUP_cmp(const EC_GROUP *group1, const EC_GROUP *group2, BN_CTX *ctx_in) | |||
| 788 | } | 792 | } |
| 789 | LCRYPTO_ALIAS(EC_GROUP_cmp); | 793 | LCRYPTO_ALIAS(EC_GROUP_cmp); |
| 790 | 794 | ||
| 795 | int | ||
| 796 | ec_group_and_point_compatible(const EC_GROUP *group, const EC_POINT *point) | ||
| 797 | { | ||
| 798 | if (group->meth != point->meth) | ||
| 799 | return 0; | ||
| 800 | if (group->nid == NID_undef || point->nid == NID_undef) | ||
| 801 | return 1; | ||
| 802 | return group->nid == point->nid; | ||
| 803 | } | ||
| 804 | |||
| 791 | EC_POINT * | 805 | EC_POINT * |
| 792 | EC_POINT_new(const EC_GROUP *group) | 806 | EC_POINT_new(const EC_GROUP *group) |
| 793 | { | 807 | { |
| @@ -811,6 +825,7 @@ EC_POINT_new(const EC_GROUP *group) | |||
| 811 | goto err; | 825 | goto err; |
| 812 | 826 | ||
| 813 | point->meth = group->meth; | 827 | point->meth = group->meth; |
| 828 | point->nid = group->nid; | ||
| 814 | 829 | ||
| 815 | return point; | 830 | return point; |
| 816 | 831 | ||
| @@ -852,6 +867,8 @@ EC_POINT_copy(EC_POINT *dst, const EC_POINT *src) | |||
| 852 | if (dst == src) | 867 | if (dst == src) |
| 853 | return 1; | 868 | return 1; |
| 854 | 869 | ||
| 870 | dst->nid = src->nid; | ||
| 871 | |||
| 855 | if (!bn_copy(dst->X, src->X)) | 872 | if (!bn_copy(dst->X, src->X)) |
| 856 | return 0; | 873 | return 0; |
| 857 | if (!bn_copy(dst->Y, src->Y)) | 874 | if (!bn_copy(dst->Y, src->Y)) |
| @@ -860,6 +877,10 @@ EC_POINT_copy(EC_POINT *dst, const EC_POINT *src) | |||
| 860 | return 0; | 877 | return 0; |
| 861 | dst->Z_is_one = src->Z_is_one; | 878 | dst->Z_is_one = src->Z_is_one; |
| 862 | 879 | ||
| 880 | memcpy(&dst->fe_x, &src->fe_x, sizeof(dst->fe_x)); | ||
| 881 | memcpy(&dst->fe_y, &src->fe_y, sizeof(dst->fe_y)); | ||
| 882 | memcpy(&dst->fe_z, &src->fe_z, sizeof(dst->fe_z)); | ||
| 883 | |||
| 863 | return 1; | 884 | return 1; |
| 864 | } | 885 | } |
| 865 | LCRYPTO_ALIAS(EC_POINT_copy); | 886 | LCRYPTO_ALIAS(EC_POINT_copy); |
| @@ -890,15 +911,11 @@ LCRYPTO_ALIAS(EC_POINT_dup); | |||
| 890 | int | 911 | int |
| 891 | EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point) | 912 | EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point) |
| 892 | { | 913 | { |
| 893 | if (group->meth != point->meth) { | 914 | if (!ec_group_and_point_compatible(group, point)) { |
| 894 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); | 915 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 895 | return 0; | 916 | return 0; |
| 896 | } | 917 | } |
| 897 | 918 | return group->meth->point_set_to_infinity(group, point); | |
| 898 | BN_zero(point->Z); | ||
| 899 | point->Z_is_one = 0; | ||
| 900 | |||
| 901 | return 1; | ||
| 902 | } | 919 | } |
| 903 | LCRYPTO_ALIAS(EC_POINT_set_to_infinity); | 920 | LCRYPTO_ALIAS(EC_POINT_set_to_infinity); |
| 904 | 921 | ||
| @@ -918,7 +935,7 @@ EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *point, | |||
| 918 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 935 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 919 | goto err; | 936 | goto err; |
| 920 | } | 937 | } |
| 921 | if (group->meth != point->meth) { | 938 | if (!ec_group_and_point_compatible(group, point)) { |
| 922 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); | 939 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 923 | goto err; | 940 | goto err; |
| 924 | } | 941 | } |
| @@ -969,7 +986,7 @@ EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *point, | |||
| 969 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 986 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 970 | goto err; | 987 | goto err; |
| 971 | } | 988 | } |
| 972 | if (group->meth != point->meth) { | 989 | if (!ec_group_and_point_compatible(group, point)) { |
| 973 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); | 990 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 974 | goto err; | 991 | goto err; |
| 975 | } | 992 | } |
| @@ -1119,8 +1136,9 @@ EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, | |||
| 1119 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 1136 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 1120 | goto err; | 1137 | goto err; |
| 1121 | } | 1138 | } |
| 1122 | if (group->meth != r->meth || group->meth != a->meth || | 1139 | if (!ec_group_and_point_compatible(group, r) || |
| 1123 | group->meth != b->meth) { | 1140 | !ec_group_and_point_compatible(group, a) || |
| 1141 | !ec_group_and_point_compatible(group, b)) { | ||
| 1124 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); | 1142 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 1125 | goto err; | 1143 | goto err; |
| 1126 | } | 1144 | } |
| @@ -1150,7 +1168,8 @@ EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, | |||
| 1150 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 1168 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 1151 | goto err; | 1169 | goto err; |
| 1152 | } | 1170 | } |
| 1153 | if (group->meth != r->meth || r->meth != a->meth) { | 1171 | if (!ec_group_and_point_compatible(group, r) || |
| 1172 | !ec_group_and_point_compatible(group, a)) { | ||
| 1154 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); | 1173 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 1155 | goto err; | 1174 | goto err; |
| 1156 | } | 1175 | } |
| @@ -1179,7 +1198,7 @@ EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx_in) | |||
| 1179 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 1198 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 1180 | goto err; | 1199 | goto err; |
| 1181 | } | 1200 | } |
| 1182 | if (group->meth != a->meth) { | 1201 | if (!ec_group_and_point_compatible(group, a)) { |
| 1183 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); | 1202 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 1184 | goto err; | 1203 | goto err; |
| 1185 | } | 1204 | } |
| @@ -1196,12 +1215,11 @@ LCRYPTO_ALIAS(EC_POINT_invert); | |||
| 1196 | int | 1215 | int |
| 1197 | EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) | 1216 | EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) |
| 1198 | { | 1217 | { |
| 1199 | if (group->meth != point->meth) { | 1218 | if (!ec_group_and_point_compatible(group, point)) { |
| 1200 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); | 1219 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 1201 | return 0; | 1220 | return 0; |
| 1202 | } | 1221 | } |
| 1203 | 1222 | return group->meth->point_is_at_infinity(group, point); | |
| 1204 | return BN_is_zero(point->Z); | ||
| 1205 | } | 1223 | } |
| 1206 | LCRYPTO_ALIAS(EC_POINT_is_at_infinity); | 1224 | LCRYPTO_ALIAS(EC_POINT_is_at_infinity); |
| 1207 | 1225 | ||
| @@ -1221,7 +1239,7 @@ EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, | |||
| 1221 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 1239 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 1222 | goto err; | 1240 | goto err; |
| 1223 | } | 1241 | } |
| 1224 | if (group->meth != point->meth) { | 1242 | if (!ec_group_and_point_compatible(group, point)) { |
| 1225 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); | 1243 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 1226 | goto err; | 1244 | goto err; |
| 1227 | } | 1245 | } |
| @@ -1251,7 +1269,8 @@ EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, | |||
| 1251 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 1269 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 1252 | goto err; | 1270 | goto err; |
| 1253 | } | 1271 | } |
| 1254 | if (group->meth != a->meth || a->meth != b->meth) { | 1272 | if (!ec_group_and_point_compatible(group, a) || |
| 1273 | !ec_group_and_point_compatible(group, b)) { | ||
| 1255 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); | 1274 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 1256 | goto err; | 1275 | goto err; |
| 1257 | } | 1276 | } |
| @@ -1324,6 +1343,12 @@ EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, | |||
| 1324 | goto err; | 1343 | goto err; |
| 1325 | } | 1344 | } |
| 1326 | 1345 | ||
| 1346 | if (!ec_group_and_point_compatible(group, r) || | ||
| 1347 | (point != NULL && !ec_group_and_point_compatible(group, point))) { | ||
| 1348 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); | ||
| 1349 | goto err; | ||
| 1350 | } | ||
| 1351 | |||
| 1327 | if (g_scalar != NULL && point == NULL && p_scalar == NULL) { | 1352 | if (g_scalar != NULL && point == NULL && p_scalar == NULL) { |
| 1328 | /* | 1353 | /* |
| 1329 | * In this case we want to compute g_scalar * GeneratorPoint: | 1354 | * In this case we want to compute g_scalar * GeneratorPoint: |
diff --git a/src/lib/libcrypto/ec/ec_local.h b/src/lib/libcrypto/ec/ec_local.h index c7a54d3a2b..d84e92767c 100644 --- a/src/lib/libcrypto/ec/ec_local.h +++ b/src/lib/libcrypto/ec/ec_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_local.h,v 1.67 2025/03/24 13:07:04 jsing Exp $ */ | 1 | /* $OpenBSD: ec_local.h,v 1.73 2025/12/26 18:42:33 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -69,6 +69,9 @@ | |||
| 69 | * | 69 | * |
| 70 | */ | 70 | */ |
| 71 | 71 | ||
| 72 | #ifndef HEADER_EC_LOCAL_H | ||
| 73 | #define HEADER_EC_LOCAL_H | ||
| 74 | |||
| 72 | #include <stdlib.h> | 75 | #include <stdlib.h> |
| 73 | 76 | ||
| 74 | #include <openssl/bn.h> | 77 | #include <openssl/bn.h> |
| @@ -76,6 +79,7 @@ | |||
| 76 | #include <openssl/objects.h> | 79 | #include <openssl/objects.h> |
| 77 | 80 | ||
| 78 | #include "bn_local.h" | 81 | #include "bn_local.h" |
| 82 | #include "ec_internal.h" | ||
| 79 | 83 | ||
| 80 | __BEGIN_HIDDEN_DECLS | 84 | __BEGIN_HIDDEN_DECLS |
| 81 | 85 | ||
| @@ -85,6 +89,9 @@ typedef struct ec_method_st { | |||
| 85 | int (*group_get_curve)(const EC_GROUP *, BIGNUM *p, BIGNUM *a, | 89 | int (*group_get_curve)(const EC_GROUP *, BIGNUM *p, BIGNUM *a, |
| 86 | BIGNUM *b, BN_CTX *); | 90 | BIGNUM *b, BN_CTX *); |
| 87 | 91 | ||
| 92 | int (*point_set_to_infinity)(const EC_GROUP *, EC_POINT *); | ||
| 93 | int (*point_is_at_infinity)(const EC_GROUP *, const EC_POINT *); | ||
| 94 | |||
| 88 | int (*point_is_on_curve)(const EC_GROUP *, const EC_POINT *, BN_CTX *); | 95 | int (*point_is_on_curve)(const EC_GROUP *, const EC_POINT *, BN_CTX *); |
| 89 | int (*point_cmp)(const EC_GROUP *, const EC_POINT *a, const EC_POINT *b, | 96 | int (*point_cmp)(const EC_GROUP *, const EC_POINT *a, const EC_POINT *b, |
| 90 | BN_CTX *); | 97 | BN_CTX *); |
| @@ -155,10 +162,15 @@ struct ec_group_st { | |||
| 155 | 162 | ||
| 156 | /* Montgomery context used by EC_GFp_mont_method. */ | 163 | /* Montgomery context used by EC_GFp_mont_method. */ |
| 157 | BN_MONT_CTX *mont_ctx; | 164 | BN_MONT_CTX *mont_ctx; |
| 165 | |||
| 166 | EC_FIELD_MODULUS fm; | ||
| 167 | EC_FIELD_ELEMENT fe_a; | ||
| 168 | EC_FIELD_ELEMENT fe_b; | ||
| 158 | } /* EC_GROUP */; | 169 | } /* EC_GROUP */; |
| 159 | 170 | ||
| 160 | struct ec_point_st { | 171 | struct ec_point_st { |
| 161 | const EC_METHOD *meth; | 172 | const EC_METHOD *meth; |
| 173 | int nid; | ||
| 162 | 174 | ||
| 163 | /* | 175 | /* |
| 164 | * Jacobian projective coordinates: (X, Y, Z) represents (X/Z^2, Y/Z^3) | 176 | * Jacobian projective coordinates: (X, Y, Z) represents (X/Z^2, Y/Z^3) |
| @@ -168,10 +180,15 @@ struct ec_point_st { | |||
| 168 | BIGNUM *Y; | 180 | BIGNUM *Y; |
| 169 | BIGNUM *Z; | 181 | BIGNUM *Z; |
| 170 | int Z_is_one; /* enable optimized point arithmetics for special case */ | 182 | int Z_is_one; /* enable optimized point arithmetics for special case */ |
| 183 | |||
| 184 | EC_FIELD_ELEMENT fe_x; | ||
| 185 | EC_FIELD_ELEMENT fe_y; | ||
| 186 | EC_FIELD_ELEMENT fe_z; | ||
| 171 | } /* EC_POINT */; | 187 | } /* EC_POINT */; |
| 172 | 188 | ||
| 173 | const EC_METHOD *EC_GFp_simple_method(void); | 189 | const EC_METHOD *EC_GFp_simple_method(void); |
| 174 | const EC_METHOD *EC_GFp_mont_method(void); | 190 | const EC_METHOD *EC_GFp_mont_method(void); |
| 191 | const EC_METHOD *EC_GFp_homogeneous_projective_method(void); | ||
| 175 | 192 | ||
| 176 | /* Compute r = scalar1 * point1 + scalar2 * point2 in non-constant time. */ | 193 | /* Compute r = scalar1 * point1 + scalar2 * point2 in non-constant time. */ |
| 177 | int ec_wnaf_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar1, | 194 | int ec_wnaf_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar1, |
| @@ -179,6 +196,7 @@ int ec_wnaf_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar1, | |||
| 179 | BN_CTX *ctx); | 196 | BN_CTX *ctx); |
| 180 | 197 | ||
| 181 | int ec_group_is_builtin_curve(const EC_GROUP *group, int *out_nid); | 198 | int ec_group_is_builtin_curve(const EC_GROUP *group, int *out_nid); |
| 199 | int ec_group_and_point_compatible(const EC_GROUP *group, const EC_POINT *point); | ||
| 182 | 200 | ||
| 183 | /* | 201 | /* |
| 184 | * Wrappers around the unergonomic EC_POINT_{oct2point,point2oct}(). | 202 | * Wrappers around the unergonomic EC_POINT_{oct2point,point2oct}(). |
| @@ -252,3 +270,5 @@ int ecdh_KDF_X9_63(unsigned char *out, size_t outlen, const unsigned char *Z, | |||
| 252 | size_t Zlen, const unsigned char *sinfo, size_t sinfolen, const EVP_MD *md); | 270 | size_t Zlen, const unsigned char *sinfo, size_t sinfolen, const EVP_MD *md); |
| 253 | 271 | ||
| 254 | __END_HIDDEN_DECLS | 272 | __END_HIDDEN_DECLS |
| 273 | |||
| 274 | #endif /* HEADER_EC_LOCAL_H */ | ||
diff --git a/src/lib/libcrypto/ec/ec_mult.c b/src/lib/libcrypto/ec/ec_mult.c index 673696a9fd..067df9a2a2 100644 --- a/src/lib/libcrypto/ec/ec_mult.c +++ b/src/lib/libcrypto/ec/ec_mult.c | |||
| @@ -1,64 +1,19 @@ | |||
| 1 | /* $OpenBSD: ec_mult.c,v 1.58 2025/03/24 13:07:04 jsing Exp $ */ | 1 | /* $OpenBSD: ec_mult.c,v 1.61 2025/12/26 18:44:19 tb Exp $ */ |
| 2 | |||
| 2 | /* | 3 | /* |
| 3 | * Originally written by Bodo Moeller and Nils Larsch for the OpenSSL project. | 4 | * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> |
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 24 | * | 5 | * |
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | 6 | * Permission to use, copy, modify, and distribute this software for any |
| 26 | * endorse or promote products derived from this software without | 7 | * purpose with or without fee is hereby granted, provided that the above |
| 27 | * prior written permission. For written permission, please contact | 8 | * copyright notice and this permission notice appear in all copies. |
| 28 | * openssl-core@openssl.org. | ||
| 29 | * | 9 | * |
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 31 | * nor may "OpenSSL" appear in their names without prior written | 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 32 | * permission of the OpenSSL Project. | 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 33 | * | 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 34 | * 6. Redistributions of any form whatsoever must retain the following | 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 35 | * acknowledgment: | 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 36 | * "This product includes software developed by the OpenSSL Project | 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 37 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | /* ==================================================================== | ||
| 59 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | ||
| 60 | * Portions of this software developed by SUN MICROSYSTEMS, INC., | ||
| 61 | * and contributed to the OpenSSL project. | ||
| 62 | */ | 17 | */ |
| 63 | 18 | ||
| 64 | #include <stdint.h> | 19 | #include <stdint.h> |
| @@ -67,9 +22,9 @@ | |||
| 67 | 22 | ||
| 68 | #include <openssl/bn.h> | 23 | #include <openssl/bn.h> |
| 69 | #include <openssl/ec.h> | 24 | #include <openssl/ec.h> |
| 70 | #include <openssl/err.h> | ||
| 71 | 25 | ||
| 72 | #include "ec_local.h" | 26 | #include "ec_local.h" |
| 27 | #include "err_local.h" | ||
| 73 | 28 | ||
| 74 | /* Holds the wNAF digits of bn and the corresponding odd multiples of point. */ | 29 | /* Holds the wNAF digits of bn and the corresponding odd multiples of point. */ |
| 75 | struct ec_wnaf { | 30 | struct ec_wnaf { |
| @@ -332,8 +287,9 @@ ec_wnaf_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar1, | |||
| 332 | ECerror(ERR_R_PASSED_NULL_PARAMETER); | 287 | ECerror(ERR_R_PASSED_NULL_PARAMETER); |
| 333 | goto err; | 288 | goto err; |
| 334 | } | 289 | } |
| 335 | if (group->meth != r->meth || group->meth != point1->meth || | 290 | if (!ec_group_and_point_compatible(group, r) || |
| 336 | group->meth != point2->meth) { | 291 | !ec_group_and_point_compatible(group, point1) || |
| 292 | !ec_group_and_point_compatible(group, point2)) { | ||
| 337 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); | 293 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 338 | goto err; | 294 | goto err; |
| 339 | } | 295 | } |
diff --git a/src/lib/libcrypto/ec/ec_pmeth.c b/src/lib/libcrypto/ec/ec_pmeth.c index 85ac4822d1..69bf7e741a 100644 --- a/src/lib/libcrypto/ec/ec_pmeth.c +++ b/src/lib/libcrypto/ec/ec_pmeth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_pmeth.c,v 1.26 2025/03/13 10:39:51 tb Exp $ */ | 1 | /* $OpenBSD: ec_pmeth.c,v 1.27 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -62,12 +62,12 @@ | |||
| 62 | 62 | ||
| 63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
| 64 | #include <openssl/ec.h> | 64 | #include <openssl/ec.h> |
| 65 | #include <openssl/err.h> | ||
| 66 | #include <openssl/evp.h> | 65 | #include <openssl/evp.h> |
| 67 | #include <openssl/x509.h> | 66 | #include <openssl/x509.h> |
| 68 | 67 | ||
| 69 | #include "bn_local.h" | 68 | #include "bn_local.h" |
| 70 | #include "ec_local.h" | 69 | #include "ec_local.h" |
| 70 | #include "err_local.h" | ||
| 71 | #include "evp_local.h" | 71 | #include "evp_local.h" |
| 72 | 72 | ||
| 73 | /* EC pkey context structure */ | 73 | /* EC pkey context structure */ |
diff --git a/src/lib/libcrypto/ec/eck_prn.c b/src/lib/libcrypto/ec/eck_prn.c index c40a64966a..ed5fdce9c1 100644 --- a/src/lib/libcrypto/ec/eck_prn.c +++ b/src/lib/libcrypto/ec/eck_prn.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: eck_prn.c,v 1.41 2025/01/25 10:30:17 tb Exp $ */ | 1 | /* $OpenBSD: eck_prn.c,v 1.42 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -66,12 +66,12 @@ | |||
| 66 | #include <openssl/bio.h> | 66 | #include <openssl/bio.h> |
| 67 | #include <openssl/bn.h> | 67 | #include <openssl/bn.h> |
| 68 | #include <openssl/ec.h> | 68 | #include <openssl/ec.h> |
| 69 | #include <openssl/err.h> | ||
| 70 | #include <openssl/evp.h> | 69 | #include <openssl/evp.h> |
| 71 | #include <openssl/objects.h> | 70 | #include <openssl/objects.h> |
| 72 | 71 | ||
| 73 | #include "bn_local.h" | 72 | #include "bn_local.h" |
| 74 | #include "ec_local.h" | 73 | #include "ec_local.h" |
| 74 | #include "err_local.h" | ||
| 75 | 75 | ||
| 76 | int | 76 | int |
| 77 | EC_KEY_print(BIO *bio, const EC_KEY *ec_key, int off) | 77 | EC_KEY_print(BIO *bio, const EC_KEY *ec_key, int off) |
diff --git a/src/lib/libcrypto/ec/ecp_hp_methods.c b/src/lib/libcrypto/ec/ecp_hp_methods.c new file mode 100644 index 0000000000..0b34a55b9d --- /dev/null +++ b/src/lib/libcrypto/ec/ecp_hp_methods.c | |||
| @@ -0,0 +1,943 @@ | |||
| 1 | /* $OpenBSD: ecp_hp_methods.c,v 1.5 2025/08/03 15:44:00 jsing Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2024-2025 Joel Sing <jsing@openbsd.org> | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <string.h> | ||
| 19 | |||
| 20 | #include <openssl/bn.h> | ||
| 21 | #include <openssl/ec.h> | ||
| 22 | #include <openssl/err.h> | ||
| 23 | |||
| 24 | #include "bn_internal.h" | ||
| 25 | #include "crypto_internal.h" | ||
| 26 | #include "ec_local.h" | ||
| 27 | #include "ec_internal.h" | ||
| 28 | #include "err_local.h" | ||
| 29 | |||
| 30 | static int | ||
| 31 | ec_group_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, | ||
| 32 | const BIGNUM *b, BN_CTX *ctx) | ||
| 33 | { | ||
| 34 | BIGNUM *t; | ||
| 35 | int ret = 0; | ||
| 36 | |||
| 37 | BN_CTX_start(ctx); | ||
| 38 | |||
| 39 | /* XXX - p must be a prime > 3. */ | ||
| 40 | |||
| 41 | if (!bn_copy(group->p, p)) | ||
| 42 | goto err; | ||
| 43 | if (!bn_copy(group->a, a)) | ||
| 44 | goto err; | ||
| 45 | if (!bn_copy(group->b, b)) | ||
| 46 | goto err; | ||
| 47 | |||
| 48 | /* XXX */ | ||
| 49 | BN_set_negative(group->p, 0); | ||
| 50 | |||
| 51 | /* XXX */ | ||
| 52 | if (!BN_nnmod(group->a, group->a, group->p, ctx)) | ||
| 53 | goto err; | ||
| 54 | if (!BN_nnmod(group->b, group->b, group->p, ctx)) | ||
| 55 | goto err; | ||
| 56 | |||
| 57 | if ((t = BN_CTX_get(ctx)) == NULL) | ||
| 58 | goto err; | ||
| 59 | if (!BN_set_word(t, 3)) | ||
| 60 | goto err; | ||
| 61 | if (!BN_mod_add(t, t, a, group->p, ctx)) | ||
| 62 | goto err; | ||
| 63 | |||
| 64 | group->a_is_minus3 = BN_is_zero(t); | ||
| 65 | |||
| 66 | if (!ec_field_modulus_from_bn(&group->fm, group->p, ctx)) | ||
| 67 | goto err; | ||
| 68 | if (!ec_field_element_from_bn(&group->fm, group, &group->fe_a, group->a, ctx)) | ||
| 69 | goto err; | ||
| 70 | if (!ec_field_element_from_bn(&group->fm, group, &group->fe_b, group->b, ctx)) | ||
| 71 | goto err; | ||
| 72 | |||
| 73 | ret = 1; | ||
| 74 | |||
| 75 | err: | ||
| 76 | BN_CTX_end(ctx); | ||
| 77 | |||
| 78 | return ret; | ||
| 79 | } | ||
| 80 | |||
| 81 | static int | ||
| 82 | ec_group_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, | ||
| 83 | BIGNUM *b, BN_CTX *ctx) | ||
| 84 | { | ||
| 85 | if (p != NULL) { | ||
| 86 | if (!bn_copy(p, group->p)) | ||
| 87 | return 0; | ||
| 88 | } | ||
| 89 | if (a != NULL) { | ||
| 90 | if (!bn_copy(a, group->a)) | ||
| 91 | return 0; | ||
| 92 | } | ||
| 93 | if (b != NULL) { | ||
| 94 | if (!bn_copy(b, group->b)) | ||
| 95 | return 0; | ||
| 96 | } | ||
| 97 | return 1; | ||
| 98 | } | ||
| 99 | |||
| 100 | static int | ||
| 101 | ec_point_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) | ||
| 102 | { | ||
| 103 | /* Check if Z is equal to zero. */ | ||
| 104 | return ec_field_element_is_zero(&group->fm, &point->fe_z); | ||
| 105 | } | ||
| 106 | |||
| 107 | static int | ||
| 108 | ec_point_set_to_infinity(const EC_GROUP *group, EC_POINT *point) | ||
| 109 | { | ||
| 110 | /* Infinity is (x = 0, y = 1, z = 0). */ | ||
| 111 | |||
| 112 | memset(&point->fe_x, 0, sizeof(point->fe_x)); | ||
| 113 | memset(&point->fe_y, 0, sizeof(point->fe_y)); | ||
| 114 | memset(&point->fe_z, 0, sizeof(point->fe_z)); | ||
| 115 | |||
| 116 | point->fe_y.w[0] = 1; | ||
| 117 | |||
| 118 | return 1; | ||
| 119 | } | ||
| 120 | |||
| 121 | static int | ||
| 122 | ec_point_set_affine_coordinates(const EC_GROUP *group, EC_POINT *point, | ||
| 123 | const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx) | ||
| 124 | { | ||
| 125 | if (x == NULL || y == NULL) { | ||
| 126 | ECerror(ERR_R_PASSED_NULL_PARAMETER); | ||
| 127 | return 0; | ||
| 128 | } | ||
| 129 | |||
| 130 | if (!bn_copy(point->X, x)) | ||
| 131 | return 0; | ||
| 132 | if (!bn_copy(point->Y, y)) | ||
| 133 | return 0; | ||
| 134 | if (!BN_one(point->Z)) | ||
| 135 | return 0; | ||
| 136 | |||
| 137 | /* XXX */ | ||
| 138 | if (!BN_nnmod(point->X, point->X, group->p, ctx)) | ||
| 139 | return 0; | ||
| 140 | if (!BN_nnmod(point->Y, point->Y, group->p, ctx)) | ||
| 141 | return 0; | ||
| 142 | |||
| 143 | if (!ec_field_element_from_bn(&group->fm, group, &point->fe_x, point->X, ctx)) | ||
| 144 | return 0; | ||
| 145 | if (!ec_field_element_from_bn(&group->fm, group, &point->fe_y, point->Y, ctx)) | ||
| 146 | return 0; | ||
| 147 | if (!ec_field_element_from_bn(&group->fm, group, &point->fe_z, point->Z, ctx)) | ||
| 148 | return 0; | ||
| 149 | |||
| 150 | return 1; | ||
| 151 | } | ||
| 152 | |||
| 153 | static int | ||
| 154 | ec_point_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *point, | ||
| 155 | BIGNUM *x, BIGNUM *y, BN_CTX *ctx) | ||
| 156 | { | ||
| 157 | BIGNUM *zinv; | ||
| 158 | int ret = 0; | ||
| 159 | |||
| 160 | /* | ||
| 161 | * Convert homogeneous projective coordinates (XZ, YZ, Z) to affine | ||
| 162 | * coordinates (x = X/Z, y = Y/Z). | ||
| 163 | */ | ||
| 164 | if (!ec_field_element_to_bn(&group->fm, &point->fe_x, point->X, ctx)) | ||
| 165 | return 0; | ||
| 166 | if (!ec_field_element_to_bn(&group->fm, &point->fe_y, point->Y, ctx)) | ||
| 167 | return 0; | ||
| 168 | if (!ec_field_element_to_bn(&group->fm, &point->fe_z, point->Z, ctx)) | ||
| 169 | return 0; | ||
| 170 | |||
| 171 | BN_CTX_start(ctx); | ||
| 172 | |||
| 173 | if ((zinv = BN_CTX_get(ctx)) == NULL) | ||
| 174 | goto err; | ||
| 175 | |||
| 176 | if (BN_mod_inverse_ct(zinv, point->Z, group->p, ctx) == NULL) | ||
| 177 | goto err; | ||
| 178 | |||
| 179 | if (x != NULL) { | ||
| 180 | if (!BN_mod_mul(x, point->X, zinv, group->p, ctx)) | ||
| 181 | goto err; | ||
| 182 | } | ||
| 183 | if (y != NULL) { | ||
| 184 | if (!BN_mod_mul(y, point->Y, zinv, group->p, ctx)) | ||
| 185 | goto err; | ||
| 186 | } | ||
| 187 | |||
| 188 | ret = 1; | ||
| 189 | |||
| 190 | err: | ||
| 191 | BN_CTX_end(ctx); | ||
| 192 | |||
| 193 | return ret; | ||
| 194 | } | ||
| 195 | |||
| 196 | static int | ||
| 197 | ec_point_add_a1(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, | ||
| 198 | const EC_POINT *b, BN_CTX *ctx) | ||
| 199 | { | ||
| 200 | EC_FIELD_ELEMENT X1, Y1, Z1, X2, Y2, Z2, X3, Y3, Z3; | ||
| 201 | EC_FIELD_ELEMENT b3, t0, t1, t2, t3, t4, t5; | ||
| 202 | EC_FIELD_ELEMENT ga, gb; | ||
| 203 | |||
| 204 | /* | ||
| 205 | * Complete, projective point addition for arbitrary prime order short | ||
| 206 | * Weierstrass curves with arbitrary a - see | ||
| 207 | * https://eprint.iacr.org/2015/1060, algorithm 1 and appendix A.1. | ||
| 208 | */ | ||
| 209 | |||
| 210 | ec_field_element_copy(&ga, &group->fe_a); | ||
| 211 | ec_field_element_copy(&gb, &group->fe_b); | ||
| 212 | |||
| 213 | ec_field_element_copy(&X1, &a->fe_x); | ||
| 214 | ec_field_element_copy(&Y1, &a->fe_y); | ||
| 215 | ec_field_element_copy(&Z1, &a->fe_z); | ||
| 216 | |||
| 217 | ec_field_element_copy(&X2, &b->fe_x); | ||
| 218 | ec_field_element_copy(&Y2, &b->fe_y); | ||
| 219 | ec_field_element_copy(&Z2, &b->fe_z); | ||
| 220 | |||
| 221 | /* b3 := 3 * b ; */ | ||
| 222 | ec_field_element_add(&group->fm, &b3, &gb, &gb); | ||
| 223 | ec_field_element_add(&group->fm, &b3, &b3, &gb); | ||
| 224 | |||
| 225 | /* t0 := X1 * X2 ; t1 := Y1 * Y2 ; t2 := Z1 * Z2 ; */ | ||
| 226 | ec_field_element_mul(&group->fm, &t0, &X1, &X2); | ||
| 227 | ec_field_element_mul(&group->fm, &t1, &Y1, &Y2); | ||
| 228 | ec_field_element_mul(&group->fm, &t2, &Z1, &Z2); | ||
| 229 | |||
| 230 | /* t3 := X1 + Y1 ; t4 := X2 + Y2 ; t3 := t3 * t4 ; */ | ||
| 231 | ec_field_element_add(&group->fm, &t3, &X1, &Y1); | ||
| 232 | ec_field_element_add(&group->fm, &t4, &X2, &Y2); | ||
| 233 | ec_field_element_mul(&group->fm, &t3, &t3, &t4); | ||
| 234 | |||
| 235 | /* t4 := t0 + t1 ; t3 := t3 - t4 ; t4 := X1 + Z1 ; */ | ||
| 236 | ec_field_element_add(&group->fm, &t4, &t0, &t1); | ||
| 237 | ec_field_element_sub(&group->fm, &t3, &t3, &t4); | ||
| 238 | ec_field_element_add(&group->fm, &t4, &X1, &Z1); | ||
| 239 | |||
| 240 | /* t5 := X2 + Z2 ; t4 := t4 * t5 ; t5 := t0 + t2 ; */ | ||
| 241 | ec_field_element_add(&group->fm, &t5, &X2, &Z2); | ||
| 242 | ec_field_element_mul(&group->fm, &t4, &t4, &t5); | ||
| 243 | ec_field_element_add(&group->fm, &t5, &t0, &t2); | ||
| 244 | |||
| 245 | /* t4 := t4 - t5 ; t5 := Y1 + Z1 ; X3 := Y2 + Z2 ; */ | ||
| 246 | ec_field_element_sub(&group->fm, &t4, &t4, &t5); | ||
| 247 | ec_field_element_add(&group->fm, &t5, &Y1, &Z1); | ||
| 248 | ec_field_element_add(&group->fm, &X3, &Y2, &Z2); | ||
| 249 | |||
| 250 | /* t5 := t5 * X3 ; X3 := t1 + t2 ; t5 := t5 - X3 ; */ | ||
| 251 | ec_field_element_mul(&group->fm, &t5, &t5, &X3); | ||
| 252 | ec_field_element_add(&group->fm, &X3, &t1, &t2); | ||
| 253 | ec_field_element_sub(&group->fm, &t5, &t5, &X3); | ||
| 254 | |||
| 255 | /* Z3 := a * t4 ; X3 := b3 * t2 ; Z3 := X3 + Z3 ; */ | ||
| 256 | ec_field_element_mul(&group->fm, &Z3, &ga, &t4); | ||
| 257 | ec_field_element_mul(&group->fm, &X3, &b3, &t2); | ||
| 258 | ec_field_element_add(&group->fm, &Z3, &X3, &Z3); | ||
| 259 | |||
| 260 | /* X3 := t1 - Z3 ; Z3 := t1 + Z3 ; Y3 := X3 * Z3 ; */ | ||
| 261 | ec_field_element_sub(&group->fm, &X3, &t1, &Z3); | ||
| 262 | ec_field_element_add(&group->fm, &Z3, &t1, &Z3); | ||
| 263 | ec_field_element_mul(&group->fm, &Y3, &X3, &Z3); | ||
| 264 | |||
| 265 | /* t1 := t0 + t0 ; t1 := t1 + t0 ; t2 := a * t2 ; */ | ||
| 266 | ec_field_element_add(&group->fm, &t1, &t0, &t0); | ||
| 267 | ec_field_element_add(&group->fm, &t1, &t1, &t0); | ||
| 268 | ec_field_element_mul(&group->fm, &t2, &ga, &t2); | ||
| 269 | |||
| 270 | /* t4 := b3 * t4 ; t1 := t1 + t2 ; t2 := t0 - t2 ; */ | ||
| 271 | ec_field_element_mul(&group->fm, &t4, &b3, &t4); | ||
| 272 | ec_field_element_add(&group->fm, &t1, &t1, &t2); | ||
| 273 | ec_field_element_sub(&group->fm, &t2, &t0, &t2); | ||
| 274 | |||
| 275 | /* t2 := a * t2 ; t4 := t4 + t2 ; t0 := t1 * t4 ; */ | ||
| 276 | ec_field_element_mul(&group->fm, &t2, &ga, &t2); | ||
| 277 | ec_field_element_add(&group->fm, &t4, &t4, &t2); | ||
| 278 | ec_field_element_mul(&group->fm, &t0, &t1, &t4); | ||
| 279 | |||
| 280 | /* Y3 := Y3 + t0 ; t0 := t5 * t4 ; X3 := t3 * X3 ; */ | ||
| 281 | ec_field_element_add(&group->fm, &Y3, &Y3, &t0); | ||
| 282 | ec_field_element_mul(&group->fm, &t0, &t5, &t4); | ||
| 283 | ec_field_element_mul(&group->fm, &X3, &t3, &X3); | ||
| 284 | |||
| 285 | /* X3 := X3 - t0 ; t0 := t3 * t1 ; Z3 := t5 * Z3 ; */ | ||
| 286 | ec_field_element_sub(&group->fm, &X3, &X3, &t0); | ||
| 287 | ec_field_element_mul(&group->fm, &t0, &t3, &t1); | ||
| 288 | ec_field_element_mul(&group->fm, &Z3, &t5, &Z3); | ||
| 289 | |||
| 290 | /* Z3 := Z3 + t0 ; */ | ||
| 291 | ec_field_element_add(&group->fm, &Z3, &Z3, &t0); | ||
| 292 | |||
| 293 | ec_field_element_copy(&r->fe_x, &X3); | ||
| 294 | ec_field_element_copy(&r->fe_y, &Y3); | ||
| 295 | ec_field_element_copy(&r->fe_z, &Z3); | ||
| 296 | |||
| 297 | return 1; | ||
| 298 | } | ||
| 299 | |||
| 300 | static int | ||
| 301 | ec_point_add_a2(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, | ||
| 302 | const EC_POINT *b, BN_CTX *ctx) | ||
| 303 | { | ||
| 304 | EC_FIELD_ELEMENT X1, Y1, Z1, X2, Y2, Z2, X3, Y3, Z3; | ||
| 305 | EC_FIELD_ELEMENT t0, t1, t2, t3, t4; | ||
| 306 | EC_FIELD_ELEMENT gb; | ||
| 307 | |||
| 308 | /* | ||
| 309 | * Complete, projective point addition for arbitrary prime order short | ||
| 310 | * Weierstrass curves with a = -3 - see https://eprint.iacr.org/2015/1060, | ||
| 311 | * algorithm 4 and appendix A.2. | ||
| 312 | */ | ||
| 313 | |||
| 314 | ec_field_element_copy(&gb, &group->fe_b); | ||
| 315 | |||
| 316 | ec_field_element_copy(&X1, &a->fe_x); | ||
| 317 | ec_field_element_copy(&Y1, &a->fe_y); | ||
| 318 | ec_field_element_copy(&Z1, &a->fe_z); | ||
| 319 | |||
| 320 | ec_field_element_copy(&X2, &b->fe_x); | ||
| 321 | ec_field_element_copy(&Y2, &b->fe_y); | ||
| 322 | ec_field_element_copy(&Z2, &b->fe_z); | ||
| 323 | |||
| 324 | /* t0 := X1 * X2 ; t1 := Y1 * Y2 ; t2 := Z1 * Z2 ; */ | ||
| 325 | ec_field_element_mul(&group->fm, &t0, &X1, &X2); | ||
| 326 | ec_field_element_mul(&group->fm, &t1, &Y1, &Y2); | ||
| 327 | ec_field_element_mul(&group->fm, &t2, &Z1, &Z2); | ||
| 328 | |||
| 329 | /* t3 := X1 + Y1 ; t4 := X2 + Y2 ; t3 := t3 * t4 ; */ | ||
| 330 | ec_field_element_add(&group->fm, &t3, &X1, &Y1); | ||
| 331 | ec_field_element_add(&group->fm, &t4, &X2, &Y2); | ||
| 332 | ec_field_element_mul(&group->fm, &t3, &t3, &t4); | ||
| 333 | |||
| 334 | /* t4 := t0 + t1 ; t3 := t3 - t4 ; t4 := Y1 + Z1 ; */ | ||
| 335 | ec_field_element_add(&group->fm, &t4, &t0, &t1); | ||
| 336 | ec_field_element_sub(&group->fm, &t3, &t3, &t4); | ||
| 337 | ec_field_element_add(&group->fm, &t4, &Y1, &Z1); | ||
| 338 | |||
| 339 | /* X3 := Y2 + Z2 ; t4 := t4 * X3 ; X3 := t1 + t2 ; */ | ||
| 340 | ec_field_element_add(&group->fm, &X3, &Y2, &Z2); | ||
| 341 | ec_field_element_mul(&group->fm, &t4, &t4, &X3); | ||
| 342 | ec_field_element_add(&group->fm, &X3, &t1, &t2); | ||
| 343 | |||
| 344 | /* t4 := t4 - X3 ; X3 := X1 + Z1 ; Y3 := X2 + Z2 ; */ | ||
| 345 | ec_field_element_sub(&group->fm, &t4, &t4, &X3); | ||
| 346 | ec_field_element_add(&group->fm, &X3, &X1, &Z1); | ||
| 347 | ec_field_element_add(&group->fm, &Y3, &X2, &Z2); | ||
| 348 | |||
| 349 | /* X3 := X3 * Y3 ; Y3 := t0 + t2 ; Y3 := X3 - Y3 ; */ | ||
| 350 | ec_field_element_mul(&group->fm, &X3, &X3, &Y3); | ||
| 351 | ec_field_element_add(&group->fm, &Y3, &t0, &t2); | ||
| 352 | ec_field_element_sub(&group->fm, &Y3, &X3, &Y3); | ||
| 353 | |||
| 354 | /* Z3 := b * t2 ; X3 := Y3 - Z3 ; Z3 := X3 + X3 ; */ | ||
| 355 | ec_field_element_mul(&group->fm, &Z3, &gb, &t2); | ||
| 356 | ec_field_element_sub(&group->fm, &X3, &Y3, &Z3); | ||
| 357 | ec_field_element_add(&group->fm, &Z3, &X3, &X3); | ||
| 358 | |||
| 359 | /* X3 := X3 + Z3 ; Z3 := t1 - X3 ; X3 := t1 + X3 ; */ | ||
| 360 | ec_field_element_add(&group->fm, &X3, &X3, &Z3); | ||
| 361 | ec_field_element_sub(&group->fm, &Z3, &t1, &X3); | ||
| 362 | ec_field_element_add(&group->fm, &X3, &t1, &X3); | ||
| 363 | |||
| 364 | /* Y3 := b * Y3 ; t1 := t2 + t2 ; t2 := t1 + t2 ; */ | ||
| 365 | ec_field_element_mul(&group->fm, &Y3, &gb, &Y3); | ||
| 366 | ec_field_element_add(&group->fm, &t1, &t2, &t2); | ||
| 367 | ec_field_element_add(&group->fm, &t2, &t1, &t2); | ||
| 368 | |||
| 369 | /* Y3 := Y3 - t2 ; Y3 := Y3 - t0 ; t1 := Y3 + Y3 ; */ | ||
| 370 | ec_field_element_sub(&group->fm, &Y3, &Y3, &t2); | ||
| 371 | ec_field_element_sub(&group->fm, &Y3, &Y3, &t0); | ||
| 372 | ec_field_element_add(&group->fm, &t1, &Y3, &Y3); | ||
| 373 | |||
| 374 | /* Y3 := t1 + Y3 ; t1 := t0 + t0 ; t0 := t1 + t0 ; */ | ||
| 375 | ec_field_element_add(&group->fm, &Y3, &t1, &Y3); | ||
| 376 | ec_field_element_add(&group->fm, &t1, &t0, &t0); | ||
| 377 | ec_field_element_add(&group->fm, &t0, &t1, &t0); | ||
| 378 | |||
| 379 | /* t0 := t0 - t2 ; t1 := t4 * Y3 ; t2 := t0 * Y3 ; */ | ||
| 380 | ec_field_element_sub(&group->fm, &t0, &t0, &t2); | ||
| 381 | ec_field_element_mul(&group->fm, &t1, &t4, &Y3); | ||
| 382 | ec_field_element_mul(&group->fm, &t2, &t0, &Y3); | ||
| 383 | |||
| 384 | /* Y3 := X3 * Z3 ; Y3 := Y3 + t2 ; X3 := t3 * X3 ; */ | ||
| 385 | ec_field_element_mul(&group->fm, &Y3, &X3, &Z3); | ||
| 386 | ec_field_element_add(&group->fm, &Y3, &Y3, &t2); | ||
| 387 | ec_field_element_mul(&group->fm, &X3, &t3, &X3); | ||
| 388 | |||
| 389 | /* X3 := X3 - t1 ; Z3 := t4 * Z3 ; t1 := t3 * t0 ; */ | ||
| 390 | ec_field_element_sub(&group->fm, &X3, &X3, &t1); | ||
| 391 | ec_field_element_mul(&group->fm, &Z3, &t4, &Z3); | ||
| 392 | ec_field_element_mul(&group->fm, &t1, &t3, &t0); | ||
| 393 | |||
| 394 | /* Z3 := Z3 + t1 ; */ | ||
| 395 | ec_field_element_add(&group->fm, &Z3, &Z3, &t1); | ||
| 396 | |||
| 397 | ec_field_element_copy(&r->fe_x, &X3); | ||
| 398 | ec_field_element_copy(&r->fe_y, &Y3); | ||
| 399 | ec_field_element_copy(&r->fe_z, &Z3); | ||
| 400 | |||
| 401 | return 1; | ||
| 402 | } | ||
| 403 | |||
| 404 | static int | ||
| 405 | ec_point_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, | ||
| 406 | const EC_POINT *b, BN_CTX *ctx) | ||
| 407 | { | ||
| 408 | if (group->a_is_minus3) | ||
| 409 | return ec_point_add_a2(group, r, a, b, ctx); | ||
| 410 | |||
| 411 | return ec_point_add_a1(group, r, a, b, ctx); | ||
| 412 | } | ||
| 413 | |||
| 414 | static int | ||
| 415 | ec_point_dbl_a1(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx) | ||
| 416 | { | ||
| 417 | EC_FIELD_ELEMENT X1, Y1, Z1, X3, Y3, Z3; | ||
| 418 | EC_FIELD_ELEMENT b3, t0, t1, t2, t3; | ||
| 419 | EC_FIELD_ELEMENT ga, gb; | ||
| 420 | |||
| 421 | /* | ||
| 422 | * Exception-free point doubling for arbitrary prime order short | ||
| 423 | * Weierstrass curves with arbitrary a - see | ||
| 424 | * https://eprint.iacr.org/2015/1060, algorithm 3 and appendix A.1. | ||
| 425 | */ | ||
| 426 | |||
| 427 | ec_field_element_copy(&ga, &group->fe_a); | ||
| 428 | ec_field_element_copy(&gb, &group->fe_b); | ||
| 429 | |||
| 430 | ec_field_element_copy(&X1, &a->fe_x); | ||
| 431 | ec_field_element_copy(&Y1, &a->fe_y); | ||
| 432 | ec_field_element_copy(&Z1, &a->fe_z); | ||
| 433 | |||
| 434 | /* b3 := 3 * b ; */ | ||
| 435 | ec_field_element_add(&group->fm, &b3, &gb, &gb); | ||
| 436 | ec_field_element_add(&group->fm, &b3, &b3, &gb); | ||
| 437 | |||
| 438 | /* t0 := X^2; t1 := Y^2; t2 := Z^2 ; */ | ||
| 439 | ec_field_element_sqr(&group->fm, &t0, &X1); | ||
| 440 | ec_field_element_sqr(&group->fm, &t1, &Y1); | ||
| 441 | ec_field_element_sqr(&group->fm, &t2, &Z1); | ||
| 442 | |||
| 443 | /* t3 := X * Y ; t3 := t3 + t3 ; Z3 := X * Z ; */ | ||
| 444 | ec_field_element_mul(&group->fm, &t3, &X1, &Y1); | ||
| 445 | ec_field_element_add(&group->fm, &t3, &t3, &t3); | ||
| 446 | ec_field_element_mul(&group->fm, &Z3, &X1, &Z1); | ||
| 447 | |||
| 448 | /* Z3 := Z3 + Z3 ; X3 := a * Z3 ; Y3 := b3 * t2 ; */ | ||
| 449 | ec_field_element_add(&group->fm, &Z3, &Z3, &Z3); | ||
| 450 | ec_field_element_mul(&group->fm, &X3, &ga, &Z3); | ||
| 451 | ec_field_element_mul(&group->fm, &Y3, &b3, &t2); | ||
| 452 | |||
| 453 | /* Y3 := X3 + Y3 ; X3 := t1 - Y3 ; Y3 := t1 + Y3 ; */ | ||
| 454 | ec_field_element_add(&group->fm, &Y3, &X3, &Y3); | ||
| 455 | ec_field_element_sub(&group->fm, &X3, &t1, &Y3); | ||
| 456 | ec_field_element_add(&group->fm, &Y3, &t1, &Y3); | ||
| 457 | |||
| 458 | /* Y3 := X3 * Y3 ; X3 := t3 * X3 ; Z3 := b3 * Z3 ; */ | ||
| 459 | ec_field_element_mul(&group->fm, &Y3, &X3, &Y3); | ||
| 460 | ec_field_element_mul(&group->fm, &X3, &t3, &X3); | ||
| 461 | ec_field_element_mul(&group->fm, &Z3, &b3, &Z3); | ||
| 462 | |||
| 463 | /* t2 := a * t2 ; t3 := t0 - t2 ; t3 := a * t3 ; */ | ||
| 464 | ec_field_element_mul(&group->fm, &t2, &ga, &t2); | ||
| 465 | ec_field_element_sub(&group->fm, &t3, &t0, &t2); | ||
| 466 | ec_field_element_mul(&group->fm, &t3, &ga, &t3); | ||
| 467 | |||
| 468 | /* t3 := t3 + Z3 ; Z3 := t0 + t0 ; t0 := Z3 + t0 ; */ | ||
| 469 | ec_field_element_add(&group->fm, &t3, &t3, &Z3); | ||
| 470 | ec_field_element_add(&group->fm, &Z3, &t0, &t0); | ||
| 471 | ec_field_element_add(&group->fm, &t0, &Z3, &t0); | ||
| 472 | |||
| 473 | /* t0 := t0 + t2 ; t0 := t0 * t3 ; Y3 := Y3 + t0 ; */ | ||
| 474 | ec_field_element_add(&group->fm, &t0, &t0, &t2); | ||
| 475 | ec_field_element_mul(&group->fm, &t0, &t0, &t3); | ||
| 476 | ec_field_element_add(&group->fm, &Y3, &Y3, &t0); | ||
| 477 | |||
| 478 | /* t2 := Y * Z ; t2 := t2 + t2 ; t0 := t2 * t3 ; */ | ||
| 479 | ec_field_element_mul(&group->fm, &t2, &Y1, &Z1); | ||
| 480 | ec_field_element_add(&group->fm, &t2, &t2, &t2); | ||
| 481 | ec_field_element_mul(&group->fm, &t0, &t2, &t3); | ||
| 482 | |||
| 483 | /* X3 := X3 - t0 ; Z3 := t2 * t1 ; Z3 := Z3 + Z3 ; */ | ||
| 484 | ec_field_element_sub(&group->fm, &X3, &X3, &t0); | ||
| 485 | ec_field_element_mul(&group->fm, &Z3, &t2, &t1); | ||
| 486 | ec_field_element_add(&group->fm, &Z3, &Z3, &Z3); | ||
| 487 | |||
| 488 | /* Z3 := Z3 + Z3 ; */ | ||
| 489 | ec_field_element_add(&group->fm, &Z3, &Z3, &Z3); | ||
| 490 | |||
| 491 | ec_field_element_copy(&r->fe_x, &X3); | ||
| 492 | ec_field_element_copy(&r->fe_y, &Y3); | ||
| 493 | ec_field_element_copy(&r->fe_z, &Z3); | ||
| 494 | |||
| 495 | return 1; | ||
| 496 | } | ||
| 497 | |||
| 498 | static int | ||
| 499 | ec_point_dbl_a2(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx) | ||
| 500 | { | ||
| 501 | EC_FIELD_ELEMENT X1, Y1, Z1, X3, Y3, Z3; | ||
| 502 | EC_FIELD_ELEMENT t0, t1, t2, t3; | ||
| 503 | EC_FIELD_ELEMENT ga, gb; | ||
| 504 | |||
| 505 | /* | ||
| 506 | * Exception-free point doubling for arbitrary prime order short | ||
| 507 | * Weierstrass curves with a = -3 - see https://eprint.iacr.org/2015/1060, | ||
| 508 | * algorithm 6 and appendix A.2. | ||
| 509 | */ | ||
| 510 | |||
| 511 | ec_field_element_copy(&ga, &group->fe_a); | ||
| 512 | ec_field_element_copy(&gb, &group->fe_b); | ||
| 513 | |||
| 514 | ec_field_element_copy(&X1, &a->fe_x); | ||
| 515 | ec_field_element_copy(&Y1, &a->fe_y); | ||
| 516 | ec_field_element_copy(&Z1, &a->fe_z); | ||
| 517 | |||
| 518 | /* t0 := X^2; t1 := Y^2; t2 := Z^2 ; */ | ||
| 519 | ec_field_element_sqr(&group->fm, &t0, &X1); | ||
| 520 | ec_field_element_sqr(&group->fm, &t1, &Y1); | ||
| 521 | ec_field_element_sqr(&group->fm, &t2, &Z1); | ||
| 522 | |||
| 523 | /* t3 := X * Y ; t3 := t3 + t3 ; Z3 := X * Z ; */ | ||
| 524 | ec_field_element_mul(&group->fm, &t3, &X1, &Y1); | ||
| 525 | ec_field_element_add(&group->fm, &t3, &t3, &t3); | ||
| 526 | ec_field_element_mul(&group->fm, &Z3, &X1, &Z1); | ||
| 527 | |||
| 528 | /* Z3 := Z3 + Z3 ; Y3 := b * t2 ; Y3 := Y3 - Z3 ; */ | ||
| 529 | ec_field_element_add(&group->fm, &Z3, &Z3, &Z3); | ||
| 530 | ec_field_element_mul(&group->fm, &Y3, &gb, &t2); | ||
| 531 | ec_field_element_sub(&group->fm, &Y3, &Y3, &Z3); | ||
| 532 | |||
| 533 | /* X3 := Y3 + Y3 ; Y3 := X3 + Y3 ; X3 := t1 - Y3 ; */ | ||
| 534 | ec_field_element_add(&group->fm, &X3, &Y3, &Y3); | ||
| 535 | ec_field_element_add(&group->fm, &Y3, &X3, &Y3); | ||
| 536 | ec_field_element_sub(&group->fm, &X3, &t1, &Y3); | ||
| 537 | |||
| 538 | /* Y3 := t1 + Y3 ; Y3 := X3 * Y3 ; X3 := X3 * t3 ; */ | ||
| 539 | ec_field_element_add(&group->fm, &Y3, &t1, &Y3); | ||
| 540 | ec_field_element_mul(&group->fm, &Y3, &X3, &Y3); | ||
| 541 | ec_field_element_mul(&group->fm, &X3, &X3, &t3); | ||
| 542 | |||
| 543 | /* t3 := t2 + t2 ; t2 := t2 + t3 ; Z3 := b * Z3 ; */ | ||
| 544 | ec_field_element_add(&group->fm, &t3, &t2, &t2); | ||
| 545 | ec_field_element_add(&group->fm, &t2, &t2, &t3); | ||
| 546 | ec_field_element_mul(&group->fm, &Z3, &gb, &Z3); | ||
| 547 | |||
| 548 | /* Z3 := Z3 - t2 ; Z3 := Z3 - t0 ; t3 := Z3 + Z3 ; */ | ||
| 549 | ec_field_element_sub(&group->fm, &Z3, &Z3, &t2); | ||
| 550 | ec_field_element_sub(&group->fm, &Z3, &Z3, &t0); | ||
| 551 | ec_field_element_add(&group->fm, &t3, &Z3, &Z3); | ||
| 552 | |||
| 553 | /* Z3 := Z3 + t3 ; t3 := t0 + t0 ; t0 := t3 + t0 ; */ | ||
| 554 | ec_field_element_add(&group->fm, &Z3, &Z3, &t3); | ||
| 555 | ec_field_element_add(&group->fm, &t3, &t0, &t0); | ||
| 556 | ec_field_element_add(&group->fm, &t0, &t3, &t0); | ||
| 557 | |||
| 558 | /* t0 := t0 - t2 ; t0 := t0 * Z3 ; Y3 := Y3 + t0 ; */ | ||
| 559 | ec_field_element_sub(&group->fm, &t0, &t0, &t2); | ||
| 560 | ec_field_element_mul(&group->fm, &t0, &t0, &Z3); | ||
| 561 | ec_field_element_add(&group->fm, &Y3, &Y3, &t0); | ||
| 562 | |||
| 563 | /* t0 := Y * Z ; t0 := t0 + t0 ; Z3 := t0 * Z3 ; */ | ||
| 564 | ec_field_element_mul(&group->fm, &t0, &Y1, &Z1); | ||
| 565 | ec_field_element_add(&group->fm, &t0, &t0, &t0); | ||
| 566 | ec_field_element_mul(&group->fm, &Z3, &t0, &Z3); | ||
| 567 | |||
| 568 | /* X3 := X3 - Z3 ; Z3 := t0 * t1 ; Z3 := Z3 + Z3 ; */ | ||
| 569 | ec_field_element_sub(&group->fm, &X3, &X3, &Z3); | ||
| 570 | ec_field_element_mul(&group->fm, &Z3, &t0, &t1); | ||
| 571 | ec_field_element_add(&group->fm, &Z3, &Z3, &Z3); | ||
| 572 | |||
| 573 | /* Z3 := Z3 + Z3 ; */ | ||
| 574 | ec_field_element_add(&group->fm, &Z3, &Z3, &Z3); | ||
| 575 | |||
| 576 | ec_field_element_copy(&r->fe_x, &X3); | ||
| 577 | ec_field_element_copy(&r->fe_y, &Y3); | ||
| 578 | ec_field_element_copy(&r->fe_z, &Z3); | ||
| 579 | |||
| 580 | return 1; | ||
| 581 | } | ||
| 582 | |||
| 583 | static int | ||
| 584 | ec_point_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx) | ||
| 585 | { | ||
| 586 | if (group->a_is_minus3) | ||
| 587 | return ec_point_dbl_a2(group, r, a, ctx); | ||
| 588 | |||
| 589 | return ec_point_dbl_a1(group, r, a, ctx); | ||
| 590 | } | ||
| 591 | |||
| 592 | static int | ||
| 593 | ec_point_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) | ||
| 594 | { | ||
| 595 | EC_FIELD_ELEMENT y; | ||
| 596 | BN_ULONG mask; | ||
| 597 | int i; | ||
| 598 | |||
| 599 | /* | ||
| 600 | * Invert the point by setting Y = p - Y, if Y is non-zero and the point | ||
| 601 | * is not at infinity. | ||
| 602 | */ | ||
| 603 | |||
| 604 | mask = ~(0 - (ec_point_is_at_infinity(group, point) | | ||
| 605 | ec_field_element_is_zero(&group->fm, &point->fe_y))); | ||
| 606 | |||
| 607 | /* XXX - masked/conditional subtraction? */ | ||
| 608 | ec_field_element_sub(&group->fm, &y, &group->fm.m, &point->fe_y); | ||
| 609 | |||
| 610 | for (i = 0; i < group->fm.n; i++) | ||
| 611 | point->fe_y.w[i] = (point->fe_y.w[i] & ~mask) | (y.w[i] & mask); | ||
| 612 | |||
| 613 | return 1; | ||
| 614 | } | ||
| 615 | |||
| 616 | static int | ||
| 617 | ec_point_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx) | ||
| 618 | { | ||
| 619 | EC_FIELD_ELEMENT sum, axz2, bz3, x3, y2z, z2; | ||
| 620 | |||
| 621 | /* | ||
| 622 | * Curve is defined by a Weierstrass equation y^2 = x^3 + a*x + b. | ||
| 623 | * The given point is in homogeneous projective coordinates | ||
| 624 | * (x = X/Z, y = Y/Z). Substitute and multiply by Z^3 in order to | ||
| 625 | * evaluate as zy^2 = x^3 + axz^2 + bz^3. | ||
| 626 | */ | ||
| 627 | |||
| 628 | ec_field_element_sqr(&group->fm, &z2, &point->fe_z); | ||
| 629 | |||
| 630 | ec_field_element_sqr(&group->fm, &y2z, &point->fe_y); | ||
| 631 | ec_field_element_mul(&group->fm, &y2z, &y2z, &point->fe_z); | ||
| 632 | |||
| 633 | ec_field_element_sqr(&group->fm, &x3, &point->fe_x); | ||
| 634 | ec_field_element_mul(&group->fm, &x3, &x3, &point->fe_x); | ||
| 635 | |||
| 636 | ec_field_element_mul(&group->fm, &axz2, &group->fe_a, &point->fe_x); | ||
| 637 | ec_field_element_mul(&group->fm, &axz2, &axz2, &z2); | ||
| 638 | |||
| 639 | ec_field_element_mul(&group->fm, &bz3, &group->fe_b, &point->fe_z); | ||
| 640 | ec_field_element_mul(&group->fm, &bz3, &bz3, &z2); | ||
| 641 | |||
| 642 | ec_field_element_add(&group->fm, &sum, &x3, &axz2); | ||
| 643 | ec_field_element_add(&group->fm, &sum, &sum, &bz3); | ||
| 644 | |||
| 645 | return ec_field_element_equal(&group->fm, &y2z, &sum) | | ||
| 646 | ec_point_is_at_infinity(group, point); | ||
| 647 | } | ||
| 648 | |||
| 649 | static int | ||
| 650 | ec_point_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx) | ||
| 651 | { | ||
| 652 | EC_FIELD_ELEMENT ax, ay, bx, by; | ||
| 653 | |||
| 654 | /* | ||
| 655 | * Compare two points that have homogeneous projection coordinates, that | ||
| 656 | * is (X_a/Z_a, Y_a/Z_a) == (X_b/Z_b, Y_b/Z_b). Return -1 on error, 0 on | ||
| 657 | * equality and 1 on inequality. | ||
| 658 | * | ||
| 659 | * If a and b are both at infinity, Z_a and Z_b will both be zero, | ||
| 660 | * resulting in all values becoming zero, resulting in equality. If a is | ||
| 661 | * at infinity and b is not, then Y_a will be one and Z_b will be | ||
| 662 | * non-zero, hence Y_a * Z_b will be non-zero. Z_a will be zero, hence | ||
| 663 | * Y_b * Z_a will be zero, resulting in inequality. The same applies if | ||
| 664 | * b is at infinity and a is not. | ||
| 665 | */ | ||
| 666 | |||
| 667 | ec_field_element_mul(&group->fm, &ax, &a->fe_x, &b->fe_z); | ||
| 668 | ec_field_element_mul(&group->fm, &ay, &a->fe_y, &b->fe_z); | ||
| 669 | ec_field_element_mul(&group->fm, &bx, &b->fe_x, &a->fe_z); | ||
| 670 | ec_field_element_mul(&group->fm, &by, &b->fe_y, &a->fe_z); | ||
| 671 | |||
| 672 | return 1 - (ec_field_element_equal(&group->fm, &ax, &bx) & | ||
| 673 | ec_field_element_equal(&group->fm, &ay, &by)); | ||
| 674 | } | ||
| 675 | |||
| 676 | #if 0 | ||
| 677 | static int | ||
| 678 | ec_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], | ||
| 679 | BN_CTX *ctx) | ||
| 680 | { | ||
| 681 | size_t i; | ||
| 682 | |||
| 683 | /* XXX */ | ||
| 684 | for (i = 0; i < num; i++) { | ||
| 685 | if (!EC_POINT_make_affine(group, points[0], ctx)) | ||
| 686 | return 0; | ||
| 687 | } | ||
| 688 | |||
| 689 | return 1; | ||
| 690 | } | ||
| 691 | #else | ||
| 692 | |||
| 693 | static int | ||
| 694 | ec_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], | ||
| 695 | BN_CTX *ctx) | ||
| 696 | { | ||
| 697 | BIGNUM **prod_Z = NULL; | ||
| 698 | BIGNUM *tmp, *tmp_Z; | ||
| 699 | size_t i; | ||
| 700 | int ret = 0; | ||
| 701 | |||
| 702 | if (num == 0) | ||
| 703 | return 1; | ||
| 704 | |||
| 705 | BN_CTX_start(ctx); | ||
| 706 | |||
| 707 | if ((tmp = BN_CTX_get(ctx)) == NULL) | ||
| 708 | goto err; | ||
| 709 | if ((tmp_Z = BN_CTX_get(ctx)) == NULL) | ||
| 710 | goto err; | ||
| 711 | |||
| 712 | if ((prod_Z = calloc(num, sizeof *prod_Z)) == NULL) | ||
| 713 | goto err; | ||
| 714 | for (i = 0; i < num; i++) { | ||
| 715 | if ((prod_Z[i] = BN_CTX_get(ctx)) == NULL) | ||
| 716 | goto err; | ||
| 717 | } | ||
| 718 | |||
| 719 | if (!BN_is_zero(points[0]->Z)) { | ||
| 720 | if (!bn_copy(prod_Z[0], points[0]->Z)) | ||
| 721 | goto err; | ||
| 722 | } else { | ||
| 723 | if (!BN_one(prod_Z[0])) | ||
| 724 | goto err; | ||
| 725 | } | ||
| 726 | |||
| 727 | for (i = 1; i < num; i++) { | ||
| 728 | if (!BN_is_zero(points[i]->Z)) { | ||
| 729 | if (!BN_mod_mul(prod_Z[i], prod_Z[i - 1], points[i]->Z, | ||
| 730 | group->p, ctx)) | ||
| 731 | goto err; | ||
| 732 | } else { | ||
| 733 | if (!bn_copy(prod_Z[i], prod_Z[i - 1])) | ||
| 734 | goto err; | ||
| 735 | } | ||
| 736 | } | ||
| 737 | |||
| 738 | if (!BN_mod_inverse_nonct(tmp, prod_Z[num - 1], group->p, ctx)) { | ||
| 739 | ECerror(ERR_R_BN_LIB); | ||
| 740 | goto err; | ||
| 741 | } | ||
| 742 | |||
| 743 | for (i = num - 1; i > 0; i--) { | ||
| 744 | if (BN_is_zero(points[i]->Z)) | ||
| 745 | continue; | ||
| 746 | |||
| 747 | if (!BN_mod_mul(tmp_Z, prod_Z[i - 1], tmp, group->p, ctx)) | ||
| 748 | goto err; | ||
| 749 | if (!BN_mod_mul(tmp, tmp, points[i]->Z, group->p, ctx)) | ||
| 750 | goto err; | ||
| 751 | if (!bn_copy(points[i]->Z, tmp_Z)) | ||
| 752 | goto err; | ||
| 753 | } | ||
| 754 | |||
| 755 | for (i = 0; i < num; i++) { | ||
| 756 | EC_POINT *p = points[i]; | ||
| 757 | |||
| 758 | if (BN_is_zero(p->Z)) | ||
| 759 | continue; | ||
| 760 | |||
| 761 | if (!BN_mod_mul(p->X, p->X, p->Z, group->p, ctx)) | ||
| 762 | goto err; | ||
| 763 | if (!BN_mod_mul(p->Y, p->Y, p->Z, group->p, ctx)) | ||
| 764 | goto err; | ||
| 765 | |||
| 766 | if (!BN_one(p->Z)) | ||
| 767 | goto err; | ||
| 768 | } | ||
| 769 | |||
| 770 | ret = 1; | ||
| 771 | |||
| 772 | err: | ||
| 773 | BN_CTX_end(ctx); | ||
| 774 | free(prod_Z); | ||
| 775 | |||
| 776 | return ret; | ||
| 777 | } | ||
| 778 | #endif | ||
| 779 | |||
| 780 | static void | ||
| 781 | ec_point_select(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, | ||
| 782 | const EC_POINT *b, int conditional) | ||
| 783 | { | ||
| 784 | ec_field_element_select(&group->fm, &r->fe_x, &a->fe_x, &b->fe_x, conditional); | ||
| 785 | ec_field_element_select(&group->fm, &r->fe_y, &a->fe_y, &b->fe_y, conditional); | ||
| 786 | ec_field_element_select(&group->fm, &r->fe_z, &a->fe_z, &b->fe_z, conditional); | ||
| 787 | } | ||
| 788 | |||
| 789 | static int | ||
| 790 | ec_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, const EC_POINT *point, | ||
| 791 | BN_CTX *ctx) | ||
| 792 | { | ||
| 793 | BIGNUM *cardinality; | ||
| 794 | EC_POINT *multiples[15]; | ||
| 795 | EC_POINT *rr = NULL, *t = NULL; | ||
| 796 | uint8_t *scalar_bytes = NULL; | ||
| 797 | int scalar_len = 0; | ||
| 798 | uint8_t j, wv; | ||
| 799 | int conditional, i; | ||
| 800 | int ret = 0; | ||
| 801 | |||
| 802 | memset(multiples, 0, sizeof(multiples)); | ||
| 803 | |||
| 804 | BN_CTX_start(ctx); | ||
| 805 | |||
| 806 | /* XXX - consider blinding. */ | ||
| 807 | |||
| 808 | if ((cardinality = BN_CTX_get(ctx)) == NULL) | ||
| 809 | goto err; | ||
| 810 | if (!BN_mul(cardinality, group->order, group->cofactor, ctx)) | ||
| 811 | goto err; | ||
| 812 | |||
| 813 | /* XXX - handle scalar > cardinality and/or negative. */ | ||
| 814 | |||
| 815 | /* Convert scalar into big endian bytes. */ | ||
| 816 | scalar_len = BN_num_bytes(cardinality); | ||
| 817 | if ((scalar_bytes = calloc(1, scalar_len)) == NULL) | ||
| 818 | goto err; | ||
| 819 | if (!BN_bn2binpad(scalar, scalar_bytes, scalar_len)) | ||
| 820 | goto err; | ||
| 821 | |||
| 822 | /* Compute multiples of point. */ | ||
| 823 | if ((multiples[0] = EC_POINT_dup(point, group)) == NULL) | ||
| 824 | goto err; | ||
| 825 | for (i = 1; i < 15; i += 2) { | ||
| 826 | if ((multiples[i] = EC_POINT_new(group)) == NULL) | ||
| 827 | goto err; | ||
| 828 | if (!EC_POINT_dbl(group, multiples[i], multiples[i / 2], ctx)) | ||
| 829 | goto err; | ||
| 830 | if ((multiples[i + 1] = EC_POINT_new(group)) == NULL) | ||
| 831 | goto err; | ||
| 832 | if (!EC_POINT_add(group, multiples[i + 1], multiples[i], point, ctx)) | ||
| 833 | goto err; | ||
| 834 | } | ||
| 835 | |||
| 836 | if ((rr = EC_POINT_new(group)) == NULL) | ||
| 837 | goto err; | ||
| 838 | if ((t = EC_POINT_new(group)) == NULL) | ||
| 839 | goto err; | ||
| 840 | |||
| 841 | if (!EC_POINT_set_to_infinity(group, rr)) | ||
| 842 | goto err; | ||
| 843 | |||
| 844 | for (i = 0; i < scalar_len; i++) { | ||
| 845 | if (i != 0) { | ||
| 846 | if (!EC_POINT_dbl(group, rr, rr, ctx)) | ||
| 847 | goto err; | ||
| 848 | if (!EC_POINT_dbl(group, rr, rr, ctx)) | ||
| 849 | goto err; | ||
| 850 | if (!EC_POINT_dbl(group, rr, rr, ctx)) | ||
| 851 | goto err; | ||
| 852 | if (!EC_POINT_dbl(group, rr, rr, ctx)) | ||
| 853 | goto err; | ||
| 854 | } | ||
| 855 | |||
| 856 | if (!EC_POINT_set_to_infinity(group, t)) | ||
| 857 | goto err; | ||
| 858 | |||
| 859 | wv = scalar_bytes[i] >> 4; | ||
| 860 | for (j = 1; j < 16; j++) { | ||
| 861 | conditional = crypto_ct_eq_u8(j, wv); | ||
| 862 | ec_point_select(group, t, t, multiples[j - 1], conditional); | ||
| 863 | } | ||
| 864 | if (!EC_POINT_add(group, rr, rr, t, ctx)) | ||
| 865 | goto err; | ||
| 866 | |||
| 867 | if (!EC_POINT_dbl(group, rr, rr, ctx)) | ||
| 868 | goto err; | ||
| 869 | if (!EC_POINT_dbl(group, rr, rr, ctx)) | ||
| 870 | goto err; | ||
| 871 | if (!EC_POINT_dbl(group, rr, rr, ctx)) | ||
| 872 | goto err; | ||
| 873 | if (!EC_POINT_dbl(group, rr, rr, ctx)) | ||
| 874 | goto err; | ||
| 875 | |||
| 876 | if (!EC_POINT_set_to_infinity(group, t)) | ||
| 877 | goto err; | ||
| 878 | |||
| 879 | wv = scalar_bytes[i] & 0xf; | ||
| 880 | for (j = 1; j < 16; j++) { | ||
| 881 | conditional = crypto_ct_eq_u8(j, wv); | ||
| 882 | ec_point_select(group, t, t, multiples[j - 1], conditional); | ||
| 883 | } | ||
| 884 | if (!EC_POINT_add(group, rr, rr, t, ctx)) | ||
| 885 | goto err; | ||
| 886 | } | ||
| 887 | |||
| 888 | if (!EC_POINT_copy(r, rr)) | ||
| 889 | goto err; | ||
| 890 | |||
| 891 | ret = 1; | ||
| 892 | |||
| 893 | err: | ||
| 894 | for (i = 0; i < 15; i++) | ||
| 895 | EC_POINT_free(multiples[i]); | ||
| 896 | |||
| 897 | EC_POINT_free(rr); | ||
| 898 | EC_POINT_free(t); | ||
| 899 | |||
| 900 | freezero(scalar_bytes, scalar_len); | ||
| 901 | |||
| 902 | BN_CTX_end(ctx); | ||
| 903 | |||
| 904 | return ret; | ||
| 905 | } | ||
| 906 | |||
| 907 | static int | ||
| 908 | ec_mul_single_ct(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | ||
| 909 | const EC_POINT *point, BN_CTX *ctx) | ||
| 910 | { | ||
| 911 | return ec_mul(group, r, scalar, point, ctx); | ||
| 912 | } | ||
| 913 | |||
| 914 | static int | ||
| 915 | ec_mul_double_nonct(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar1, | ||
| 916 | const EC_POINT *point1, const BIGNUM *scalar2, const EC_POINT *point2, | ||
| 917 | BN_CTX *ctx) | ||
| 918 | { | ||
| 919 | return ec_wnaf_mul(group, r, scalar1, point1, scalar2, point2, ctx); | ||
| 920 | } | ||
| 921 | |||
| 922 | static const EC_METHOD ec_GFp_homogeneous_projective_method = { | ||
| 923 | .group_set_curve = ec_group_set_curve, | ||
| 924 | .group_get_curve = ec_group_get_curve, | ||
| 925 | .point_set_to_infinity = ec_point_set_to_infinity, | ||
| 926 | .point_is_at_infinity = ec_point_is_at_infinity, | ||
| 927 | .point_set_affine_coordinates = ec_point_set_affine_coordinates, | ||
| 928 | .point_get_affine_coordinates = ec_point_get_affine_coordinates, | ||
| 929 | .add = ec_point_add, | ||
| 930 | .dbl = ec_point_dbl, | ||
| 931 | .invert = ec_point_invert, | ||
| 932 | .point_is_on_curve = ec_point_is_on_curve, | ||
| 933 | .point_cmp = ec_point_cmp, | ||
| 934 | .points_make_affine = ec_points_make_affine, | ||
| 935 | .mul_single_ct = ec_mul_single_ct, | ||
| 936 | .mul_double_nonct = ec_mul_double_nonct, | ||
| 937 | }; | ||
| 938 | |||
| 939 | const EC_METHOD * | ||
| 940 | EC_GFp_homogeneous_projective_method(void) | ||
| 941 | { | ||
| 942 | return &ec_GFp_homogeneous_projective_method; | ||
| 943 | } | ||
diff --git a/src/lib/libcrypto/ec/ecp_methods.c b/src/lib/libcrypto/ec/ecp_methods.c index ced85ceb1e..8fa78924d2 100644 --- a/src/lib/libcrypto/ec/ecp_methods.c +++ b/src/lib/libcrypto/ec/ecp_methods.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ecp_methods.c,v 1.45 2025/03/24 13:07:04 jsing Exp $ */ | 1 | /* $OpenBSD: ecp_methods.c,v 1.48 2026/01/18 10:07:44 tb Exp $ */ |
| 2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> | 2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> |
| 3 | * for the OpenSSL project. | 3 | * for the OpenSSL project. |
| 4 | * Includes code written by Bodo Moeller for the OpenSSL project. | 4 | * Includes code written by Bodo Moeller for the OpenSSL project. |
| @@ -66,11 +66,11 @@ | |||
| 66 | 66 | ||
| 67 | #include <openssl/bn.h> | 67 | #include <openssl/bn.h> |
| 68 | #include <openssl/ec.h> | 68 | #include <openssl/ec.h> |
| 69 | #include <openssl/err.h> | ||
| 70 | #include <openssl/objects.h> | 69 | #include <openssl/objects.h> |
| 71 | 70 | ||
| 72 | #include "bn_local.h" | 71 | #include "bn_local.h" |
| 73 | #include "ec_local.h" | 72 | #include "ec_local.h" |
| 73 | #include "err_local.h" | ||
| 74 | 74 | ||
| 75 | /* | 75 | /* |
| 76 | * Most method functions in this file are designed to work with non-trivial | 76 | * Most method functions in this file are designed to work with non-trivial |
| @@ -180,6 +180,21 @@ ec_group_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, | |||
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | static int | 182 | static int |
| 183 | ec_point_set_to_infinity(const EC_GROUP *group, EC_POINT *point) | ||
| 184 | { | ||
| 185 | BN_zero(point->Z); | ||
| 186 | point->Z_is_one = 0; | ||
| 187 | |||
| 188 | return 1; | ||
| 189 | } | ||
| 190 | |||
| 191 | static int | ||
| 192 | ec_point_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) | ||
| 193 | { | ||
| 194 | return BN_is_zero(point->Z); | ||
| 195 | } | ||
| 196 | |||
| 197 | static int | ||
| 183 | ec_point_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx) | 198 | ec_point_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx) |
| 184 | { | 199 | { |
| 185 | BIGNUM *rh, *tmp, *Z4, *Z6; | 200 | BIGNUM *rh, *tmp, *Z4, *Z6; |
| @@ -268,6 +283,65 @@ ec_point_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx) | |||
| 268 | } | 283 | } |
| 269 | 284 | ||
| 270 | /* | 285 | /* |
| 286 | * Compare a and b under the assumption that exactly one of them is affine. | ||
| 287 | * This avoids needless multiplications by one, which are expensive in the | ||
| 288 | * Montgomery domain. | ||
| 289 | */ | ||
| 290 | |||
| 291 | static int | ||
| 292 | ec_point_cmp_one_affine(const EC_GROUP *group, const EC_POINT *a, | ||
| 293 | const EC_POINT *b, BN_CTX *ctx) | ||
| 294 | { | ||
| 295 | const EC_POINT *tmp; | ||
| 296 | BIGNUM *az, *bn; | ||
| 297 | int ret = -1; | ||
| 298 | |||
| 299 | BN_CTX_start(ctx); | ||
| 300 | |||
| 301 | if (a->Z_is_one == b->Z_is_one) | ||
| 302 | goto err; | ||
| 303 | |||
| 304 | /* Ensure b is the affine point. */ | ||
| 305 | if (a->Z_is_one) { | ||
| 306 | tmp = a; | ||
| 307 | a = b; | ||
| 308 | b = tmp; | ||
| 309 | } | ||
| 310 | |||
| 311 | if ((az = BN_CTX_get(ctx)) == NULL) | ||
| 312 | goto err; | ||
| 313 | if ((bn = BN_CTX_get(ctx)) == NULL) | ||
| 314 | goto err; | ||
| 315 | |||
| 316 | /* a->X == b->X * a->Z^2 ? */ | ||
| 317 | if (!ec_field_sqr(group, az, a->Z, ctx)) | ||
| 318 | goto err; | ||
| 319 | if (!ec_field_mul(group, bn, b->X, az, ctx)) | ||
| 320 | goto err; | ||
| 321 | if (BN_cmp(a->X, bn) != 0) { | ||
| 322 | ret = 1; | ||
| 323 | goto err; | ||
| 324 | } | ||
| 325 | |||
| 326 | /* a->Y == b->Y * a->Z^3 ? */ | ||
| 327 | if (!ec_field_mul(group, az, az, a->Z, ctx)) | ||
| 328 | goto err; | ||
| 329 | if (!ec_field_mul(group, bn, b->Y, az, ctx)) | ||
| 330 | goto err; | ||
| 331 | if (BN_cmp(a->Y, bn) != 0) { | ||
| 332 | ret = 1; | ||
| 333 | goto err; | ||
| 334 | } | ||
| 335 | |||
| 336 | ret = 0; | ||
| 337 | |||
| 338 | err: | ||
| 339 | BN_CTX_end(ctx); | ||
| 340 | |||
| 341 | return ret; | ||
| 342 | } | ||
| 343 | |||
| 344 | /* | ||
| 271 | * Returns -1 on error, 0 if the points are equal, 1 if the points are distinct. | 345 | * Returns -1 on error, 0 if the points are equal, 1 if the points are distinct. |
| 272 | */ | 346 | */ |
| 273 | 347 | ||
| @@ -275,8 +349,7 @@ static int | |||
| 275 | ec_point_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, | 349 | ec_point_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, |
| 276 | BN_CTX *ctx) | 350 | BN_CTX *ctx) |
| 277 | { | 351 | { |
| 278 | BIGNUM *tmp1, *tmp2, *Za23, *Zb23; | 352 | BIGNUM *az, *bz, *bn1, *bn2; |
| 279 | const BIGNUM *tmp1_, *tmp2_; | ||
| 280 | int ret = -1; | 353 | int ret = -1; |
| 281 | 354 | ||
| 282 | if (EC_POINT_is_at_infinity(group, a) && EC_POINT_is_at_infinity(group, b)) | 355 | if (EC_POINT_is_at_infinity(group, a) && EC_POINT_is_at_infinity(group, b)) |
| @@ -286,71 +359,51 @@ ec_point_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, | |||
| 286 | 359 | ||
| 287 | if (a->Z_is_one && b->Z_is_one) | 360 | if (a->Z_is_one && b->Z_is_one) |
| 288 | return BN_cmp(a->X, b->X) != 0 || BN_cmp(a->Y, b->Y) != 0; | 361 | return BN_cmp(a->X, b->X) != 0 || BN_cmp(a->Y, b->Y) != 0; |
| 362 | if (a->Z_is_one || b->Z_is_one) | ||
| 363 | return ec_point_cmp_one_affine(group, a, b, ctx); | ||
| 289 | 364 | ||
| 290 | BN_CTX_start(ctx); | 365 | BN_CTX_start(ctx); |
| 291 | 366 | ||
| 292 | if ((tmp1 = BN_CTX_get(ctx)) == NULL) | 367 | if ((az = BN_CTX_get(ctx)) == NULL) |
| 293 | goto end; | 368 | goto err; |
| 294 | if ((tmp2 = BN_CTX_get(ctx)) == NULL) | 369 | if ((bz = BN_CTX_get(ctx)) == NULL) |
| 295 | goto end; | 370 | goto err; |
| 296 | if ((Za23 = BN_CTX_get(ctx)) == NULL) | 371 | if ((bn1 = BN_CTX_get(ctx)) == NULL) |
| 297 | goto end; | 372 | goto err; |
| 298 | if ((Zb23 = BN_CTX_get(ctx)) == NULL) | 373 | if ((bn2 = BN_CTX_get(ctx)) == NULL) |
| 299 | goto end; | 374 | goto err; |
| 300 | |||
| 301 | /* | ||
| 302 | * Decide whether (X_a/Z_a^2, Y_a/Z_a^3) = (X_b/Z_b^2, Y_b/Z_b^3), or | ||
| 303 | * equivalently, (X_a*Z_b^2, Y_a*Z_b^3) = (X_b*Z_a^2, Y_b*Z_a^3). | ||
| 304 | */ | ||
| 305 | |||
| 306 | if (!b->Z_is_one) { | ||
| 307 | if (!ec_field_sqr(group, Zb23, b->Z, ctx)) | ||
| 308 | goto end; | ||
| 309 | if (!ec_field_mul(group, tmp1, a->X, Zb23, ctx)) | ||
| 310 | goto end; | ||
| 311 | tmp1_ = tmp1; | ||
| 312 | } else | ||
| 313 | tmp1_ = a->X; | ||
| 314 | if (!a->Z_is_one) { | ||
| 315 | if (!ec_field_sqr(group, Za23, a->Z, ctx)) | ||
| 316 | goto end; | ||
| 317 | if (!ec_field_mul(group, tmp2, b->X, Za23, ctx)) | ||
| 318 | goto end; | ||
| 319 | tmp2_ = tmp2; | ||
| 320 | } else | ||
| 321 | tmp2_ = b->X; | ||
| 322 | 375 | ||
| 323 | /* compare X_a*Z_b^2 with X_b*Z_a^2 */ | 376 | /* a->X * b->Z^2 == b->X * a->Z^2 ? */ |
| 324 | if (BN_cmp(tmp1_, tmp2_) != 0) { | 377 | if (!ec_field_sqr(group, bz, b->Z, ctx)) |
| 325 | ret = 1; /* points differ */ | 378 | goto err; |
| 326 | goto end; | 379 | if (!ec_field_mul(group, bn1, a->X, bz, ctx)) |
| 380 | goto err; | ||
| 381 | if (!ec_field_sqr(group, az, a->Z, ctx)) | ||
| 382 | goto err; | ||
| 383 | if (!ec_field_mul(group, bn2, b->X, az, ctx)) | ||
| 384 | goto err; | ||
| 385 | if (BN_cmp(bn1, bn2) != 0) { | ||
| 386 | ret = 1; | ||
| 387 | goto err; | ||
| 327 | } | 388 | } |
| 328 | if (!b->Z_is_one) { | ||
| 329 | if (!ec_field_mul(group, Zb23, Zb23, b->Z, ctx)) | ||
| 330 | goto end; | ||
| 331 | if (!ec_field_mul(group, tmp1, a->Y, Zb23, ctx)) | ||
| 332 | goto end; | ||
| 333 | /* tmp1_ = tmp1 */ | ||
| 334 | } else | ||
| 335 | tmp1_ = a->Y; | ||
| 336 | if (!a->Z_is_one) { | ||
| 337 | if (!ec_field_mul(group, Za23, Za23, a->Z, ctx)) | ||
| 338 | goto end; | ||
| 339 | if (!ec_field_mul(group, tmp2, b->Y, Za23, ctx)) | ||
| 340 | goto end; | ||
| 341 | /* tmp2_ = tmp2 */ | ||
| 342 | } else | ||
| 343 | tmp2_ = b->Y; | ||
| 344 | 389 | ||
| 345 | /* compare Y_a*Z_b^3 with Y_b*Z_a^3 */ | 390 | /* a->Y * b->Z^3 == b->Y * a->Z^3 ? */ |
| 346 | if (BN_cmp(tmp1_, tmp2_) != 0) { | 391 | if (!ec_field_mul(group, bz, bz, b->Z, ctx)) |
| 347 | ret = 1; /* points differ */ | 392 | goto err; |
| 348 | goto end; | 393 | if (!ec_field_mul(group, bn1, a->Y, bz, ctx)) |
| 394 | goto err; | ||
| 395 | if (!ec_field_mul(group, az, az, a->Z, ctx)) | ||
| 396 | goto err; | ||
| 397 | if (!ec_field_mul(group, bn2, b->Y, az, ctx)) | ||
| 398 | goto err; | ||
| 399 | if (BN_cmp(bn1, bn2) != 0) { | ||
| 400 | ret = 1; | ||
| 401 | goto err; | ||
| 349 | } | 402 | } |
| 350 | /* points are equal */ | 403 | |
| 351 | ret = 0; | 404 | ret = 0; |
| 352 | 405 | ||
| 353 | end: | 406 | err: |
| 354 | BN_CTX_end(ctx); | 407 | BN_CTX_end(ctx); |
| 355 | 408 | ||
| 356 | return ret; | 409 | return ret; |
| @@ -1281,6 +1334,8 @@ ec_mont_field_decode(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, | |||
| 1281 | static const EC_METHOD ec_GFp_simple_method = { | 1334 | static const EC_METHOD ec_GFp_simple_method = { |
| 1282 | .group_set_curve = ec_group_set_curve, | 1335 | .group_set_curve = ec_group_set_curve, |
| 1283 | .group_get_curve = ec_group_get_curve, | 1336 | .group_get_curve = ec_group_get_curve, |
| 1337 | .point_set_to_infinity = ec_point_set_to_infinity, | ||
| 1338 | .point_is_at_infinity = ec_point_is_at_infinity, | ||
| 1284 | .point_is_on_curve = ec_point_is_on_curve, | 1339 | .point_is_on_curve = ec_point_is_on_curve, |
| 1285 | .point_cmp = ec_point_cmp, | 1340 | .point_cmp = ec_point_cmp, |
| 1286 | .point_set_affine_coordinates = ec_point_set_affine_coordinates, | 1341 | .point_set_affine_coordinates = ec_point_set_affine_coordinates, |
| @@ -1304,6 +1359,8 @@ EC_GFp_simple_method(void) | |||
| 1304 | static const EC_METHOD ec_GFp_mont_method = { | 1359 | static const EC_METHOD ec_GFp_mont_method = { |
| 1305 | .group_set_curve = ec_mont_group_set_curve, | 1360 | .group_set_curve = ec_mont_group_set_curve, |
| 1306 | .group_get_curve = ec_group_get_curve, | 1361 | .group_get_curve = ec_group_get_curve, |
| 1362 | .point_set_to_infinity = ec_point_set_to_infinity, | ||
| 1363 | .point_is_at_infinity = ec_point_is_at_infinity, | ||
| 1307 | .point_is_on_curve = ec_point_is_on_curve, | 1364 | .point_is_on_curve = ec_point_is_on_curve, |
| 1308 | .point_cmp = ec_point_cmp, | 1365 | .point_cmp = ec_point_cmp, |
| 1309 | .point_set_affine_coordinates = ec_point_set_affine_coordinates, | 1366 | .point_set_affine_coordinates = ec_point_set_affine_coordinates, |
diff --git a/src/lib/libcrypto/ec/ecx_methods.c b/src/lib/libcrypto/ec/ecx_methods.c index 6b5759d4fa..b08456d03b 100644 --- a/src/lib/libcrypto/ec/ecx_methods.c +++ b/src/lib/libcrypto/ec/ecx_methods.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ecx_methods.c,v 1.14 2024/08/28 07:15:04 tb Exp $ */ | 1 | /* $OpenBSD: ecx_methods.c,v 1.15 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2022 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2022 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -20,13 +20,13 @@ | |||
| 20 | #include <openssl/cms.h> | 20 | #include <openssl/cms.h> |
| 21 | #include <openssl/curve25519.h> | 21 | #include <openssl/curve25519.h> |
| 22 | #include <openssl/ec.h> | 22 | #include <openssl/ec.h> |
| 23 | #include <openssl/err.h> | ||
| 24 | #include <openssl/evp.h> | 23 | #include <openssl/evp.h> |
| 25 | #include <openssl/x509.h> | 24 | #include <openssl/x509.h> |
| 26 | 25 | ||
| 27 | #include "asn1_local.h" | 26 | #include "asn1_local.h" |
| 28 | #include "bytestring.h" | 27 | #include "bytestring.h" |
| 29 | #include "curve25519_internal.h" | 28 | #include "curve25519_internal.h" |
| 29 | #include "err_local.h" | ||
| 30 | #include "evp_local.h" | 30 | #include "evp_local.h" |
| 31 | #include "x509_local.h" | 31 | #include "x509_local.h" |
| 32 | 32 | ||
diff --git a/src/lib/libcrypto/ecdh/ecdh.c b/src/lib/libcrypto/ecdh/ecdh.c index dbb91f1991..c3affed682 100644 --- a/src/lib/libcrypto/ecdh/ecdh.c +++ b/src/lib/libcrypto/ecdh/ecdh.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ecdh.c,v 1.11 2025/02/17 09:25:45 tb Exp $ */ | 1 | /* $OpenBSD: ecdh.c,v 1.12 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
| 4 | * | 4 | * |
| @@ -73,10 +73,10 @@ | |||
| 73 | 73 | ||
| 74 | #include <openssl/bn.h> | 74 | #include <openssl/bn.h> |
| 75 | #include <openssl/ec.h> | 75 | #include <openssl/ec.h> |
| 76 | #include <openssl/err.h> | ||
| 77 | #include <openssl/evp.h> | 76 | #include <openssl/evp.h> |
| 78 | 77 | ||
| 79 | #include "ec_local.h" | 78 | #include "ec_local.h" |
| 79 | #include "err_local.h" | ||
| 80 | 80 | ||
| 81 | /* | 81 | /* |
| 82 | * Key derivation function from X9.63/SECG. | 82 | * Key derivation function from X9.63/SECG. |
diff --git a/src/lib/libcrypto/ecdsa/ecdsa.c b/src/lib/libcrypto/ecdsa/ecdsa.c index 5abc3586e3..4e00eb5ec8 100644 --- a/src/lib/libcrypto/ecdsa/ecdsa.c +++ b/src/lib/libcrypto/ecdsa/ecdsa.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ecdsa.c,v 1.19 2024/04/15 15:49:37 tb Exp $ */ | 1 | /* $OpenBSD: ecdsa.c,v 1.20 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -61,11 +61,11 @@ | |||
| 61 | #include <openssl/asn1t.h> | 61 | #include <openssl/asn1t.h> |
| 62 | #include <openssl/bn.h> | 62 | #include <openssl/bn.h> |
| 63 | #include <openssl/ec.h> | 63 | #include <openssl/ec.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | 64 | ||
| 66 | #include "bn_local.h" | 65 | #include "bn_local.h" |
| 67 | #include "ec_local.h" | 66 | #include "ec_local.h" |
| 68 | #include "ecdsa_local.h" | 67 | #include "ecdsa_local.h" |
| 68 | #include "err_local.h" | ||
| 69 | 69 | ||
| 70 | static const ASN1_TEMPLATE ECDSA_SIG_seq_tt[] = { | 70 | static const ASN1_TEMPLATE ECDSA_SIG_seq_tt[] = { |
| 71 | { | 71 | { |
diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c index 25fbb03875..a60769fc2a 100644 --- a/src/lib/libcrypto/err/err.c +++ b/src/lib/libcrypto/err/err.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: err.c,v 1.75 2024/11/02 12:46:36 tb Exp $ */ | 1 | /* $OpenBSD: err.c,v 1.78 2025/06/10 08:53:37 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -484,33 +484,27 @@ err_build_SYS_str_reasons(void) | |||
| 484 | { | 484 | { |
| 485 | /* malloc cannot be used here, use static storage instead */ | 485 | /* malloc cannot be used here, use static storage instead */ |
| 486 | static char strerror_tab[NUM_SYS_STR_REASONS][LEN_SYS_STR_REASON]; | 486 | static char strerror_tab[NUM_SYS_STR_REASONS][LEN_SYS_STR_REASON]; |
| 487 | const char *errstr; | ||
| 487 | int save_errno; | 488 | int save_errno; |
| 488 | int i; | 489 | int i; |
| 489 | 490 | ||
| 490 | /* strerror(3) will set errno to EINVAL when i is an unknown errno. */ | 491 | /* strerror(3) will set errno to EINVAL when i is an unknown errno. */ |
| 491 | save_errno = errno; | 492 | save_errno = errno; |
| 492 | for (i = 1; i <= NUM_SYS_STR_REASONS; i++) { | 493 | for (i = 0; i < NUM_SYS_STR_REASONS; i++) { |
| 493 | ERR_STRING_DATA *str = &SYS_str_reasons[i - 1]; | 494 | ERR_STRING_DATA *str = &SYS_str_reasons[i]; |
| 494 | 495 | ||
| 495 | str->error = (unsigned long)i; | 496 | str->error = i + 1; |
| 496 | if (str->string == NULL) { | 497 | str->string = "unknown"; |
| 497 | char (*dest)[LEN_SYS_STR_REASON] = | 498 | |
| 498 | &(strerror_tab[i - 1]); | 499 | if ((errstr = strerror((int)str->error)) != NULL) { |
| 499 | const char *src = strerror(i); | 500 | strlcpy(strerror_tab[i], errstr, sizeof(strerror_tab[i])); |
| 500 | if (src != NULL) { | 501 | str->string = strerror_tab[i]; |
| 501 | strlcpy(*dest, src, sizeof *dest); | ||
| 502 | str->string = *dest; | ||
| 503 | } | ||
| 504 | } | 502 | } |
| 505 | if (str->string == NULL) | ||
| 506 | str->string = "unknown"; | ||
| 507 | } | 503 | } |
| 508 | errno = save_errno; | 504 | errno = save_errno; |
| 509 | 505 | ||
| 510 | /* | 506 | SYS_str_reasons[NUM_SYS_STR_REASONS].error = 0; |
| 511 | * Now we still have SYS_str_reasons[NUM_SYS_STR_REASONS] = {0, NULL}, | 507 | SYS_str_reasons[NUM_SYS_STR_REASONS].string = NULL; |
| 512 | * as required by ERR_load_strings. | ||
| 513 | */ | ||
| 514 | } | 508 | } |
| 515 | #endif | 509 | #endif |
| 516 | 510 | ||
| @@ -830,7 +824,7 @@ err_clear_last_constant_time(int clear) | |||
| 830 | 824 | ||
| 831 | es = ERR_get_state(); | 825 | es = ERR_get_state(); |
| 832 | if (es == NULL) | 826 | if (es == NULL) |
| 833 | return; | 827 | return; |
| 834 | 828 | ||
| 835 | top = es->top; | 829 | top = es->top; |
| 836 | 830 | ||
diff --git a/src/lib/libcrypto/err/err.h b/src/lib/libcrypto/err/err.h index fe6c34dd0a..093db4316e 100644 --- a/src/lib/libcrypto/err/err.h +++ b/src/lib/libcrypto/err/err.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: err.h,v 1.36 2025/03/09 15:12:18 tb Exp $ */ | 1 | /* $OpenBSD: err.h,v 1.38 2025/05/10 06:17:09 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -192,80 +192,9 @@ extern "C" { | |||
| 192 | #define ERR_LIB_USER 128 | 192 | #define ERR_LIB_USER 128 |
| 193 | 193 | ||
| 194 | #ifndef LIBRESSL_INTERNAL | 194 | #ifndef LIBRESSL_INTERNAL |
| 195 | #define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | 195 | #define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),OPENSSL_FILE,OPENSSL_LINE) |
| 196 | #define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | 196 | #define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) |
| 197 | #define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | 197 | #define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),OPENSSL_FILE,OPENSSL_LINE) |
| 198 | #define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 199 | #define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 200 | #define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 201 | #define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 202 | #define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 203 | #define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 204 | #define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 205 | #define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 206 | #define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 207 | #define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 208 | #define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 209 | #define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 210 | #define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 211 | #define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 212 | #define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 213 | #define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 214 | #define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 215 | #define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 216 | #define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 217 | #define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 218 | #define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 219 | #define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 220 | #define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 221 | #define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 222 | #define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 223 | #define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 224 | #define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 225 | #define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 226 | #define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 227 | #define GOSTerr(f,r) ERR_PUT_error(ERR_LIB_GOST,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 228 | #define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 229 | #define CTerr(f, r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 230 | #define KDFerr(f, r) ERR_PUT_error(ERR_LIB_KDF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 231 | #endif | ||
| 232 | |||
| 233 | #ifdef LIBRESSL_INTERNAL | ||
| 234 | #define SYSerror(r) ERR_PUT_error(ERR_LIB_SYS,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 235 | #define BNerror(r) ERR_PUT_error(ERR_LIB_BN,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 236 | #define RSAerror(r) ERR_PUT_error(ERR_LIB_RSA,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 237 | #define DHerror(r) ERR_PUT_error(ERR_LIB_DH,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 238 | #define EVPerror(r) ERR_PUT_error(ERR_LIB_EVP,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 239 | #define BUFerror(r) ERR_PUT_error(ERR_LIB_BUF,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 240 | #define OBJerror(r) ERR_PUT_error(ERR_LIB_OBJ,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 241 | #define PEMerror(r) ERR_PUT_error(ERR_LIB_PEM,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 242 | #define DSAerror(r) ERR_PUT_error(ERR_LIB_DSA,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 243 | #define X509error(r) ERR_PUT_error(ERR_LIB_X509,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 244 | #define ASN1error(r) ERR_PUT_error(ERR_LIB_ASN1,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 245 | #define CONFerror(r) ERR_PUT_error(ERR_LIB_CONF,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 246 | #define CRYPTOerror(r) ERR_PUT_error(ERR_LIB_CRYPTO,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 247 | #define ECerror(r) ERR_PUT_error(ERR_LIB_EC,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 248 | #define BIOerror(r) ERR_PUT_error(ERR_LIB_BIO,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 249 | #define PKCS7error(r) ERR_PUT_error(ERR_LIB_PKCS7,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 250 | #define X509V3error(r) ERR_PUT_error(ERR_LIB_X509V3,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 251 | #define PKCS12error(r) ERR_PUT_error(ERR_LIB_PKCS12,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 252 | #define RANDerror(r) ERR_PUT_error(ERR_LIB_RAND,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 253 | #define DSOerror(r) ERR_PUT_error(ERR_LIB_DSO,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 254 | #define ENGINEerror(r) ERR_PUT_error(ERR_LIB_ENGINE,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 255 | #define OCSPerror(r) ERR_PUT_error(ERR_LIB_OCSP,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 256 | #define UIerror(r) ERR_PUT_error(ERR_LIB_UI,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 257 | #define COMPerror(r) ERR_PUT_error(ERR_LIB_COMP,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 258 | #define ECDSAerror(r) ERR_PUT_error(ERR_LIB_ECDSA,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 259 | #define ECDHerror(r) ERR_PUT_error(ERR_LIB_ECDH,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 260 | #define STOREerror(r) ERR_PUT_error(ERR_LIB_STORE,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 261 | #define FIPSerror(r) ERR_PUT_error(ERR_LIB_FIPS,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 262 | #define CMSerror(r) ERR_PUT_error(ERR_LIB_CMS,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 263 | #define TSerror(r) ERR_PUT_error(ERR_LIB_TS,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 264 | #define HMACerror(r) ERR_PUT_error(ERR_LIB_HMAC,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 265 | #define JPAKEerror(r) ERR_PUT_error(ERR_LIB_JPAKE,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 266 | #define GOSTerror(r) ERR_PUT_error(ERR_LIB_GOST,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 267 | #define CTerror(r) ERR_PUT_error(ERR_LIB_CT,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 268 | #define KDFerror(r) ERR_PUT_error(ERR_LIB_KDF,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 269 | #endif | 198 | #endif |
| 270 | 199 | ||
| 271 | #define ERR_PACK(l,f,r) (((((unsigned long)l)&0xffL)<<24L)| \ | 200 | #define ERR_PACK(l,f,r) (((((unsigned long)l)&0xffL)<<24L)| \ |
diff --git a/src/lib/libcrypto/err/err_local.h b/src/lib/libcrypto/err/err_local.h index d091b979cc..87cd40f4a8 100644 --- a/src/lib/libcrypto/err/err_local.h +++ b/src/lib/libcrypto/err/err_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: err_local.h,v 1.1 2024/06/24 06:43:22 tb Exp $ */ | 1 | /* $OpenBSD: err_local.h,v 1.5 2025/05/10 06:45:46 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -118,6 +118,34 @@ __BEGIN_HIDDEN_DECLS | |||
| 118 | 118 | ||
| 119 | void ERR_load_const_strings(const ERR_STRING_DATA *str); | 119 | void ERR_load_const_strings(const ERR_STRING_DATA *str); |
| 120 | 120 | ||
| 121 | #define ERR_PUT_ERROR(l, r) ERR_PUT_error((l), 0xfff, (r), OPENSSL_FILE, OPENSSL_LINE) | ||
| 122 | |||
| 123 | #define ASN1error(r) ERR_PUT_ERROR(ERR_LIB_ASN1, (r)) | ||
| 124 | #define BIOerror(r) ERR_PUT_ERROR(ERR_LIB_BIO, (r)) | ||
| 125 | #define BNerror(r) ERR_PUT_ERROR(ERR_LIB_BN, (r)) | ||
| 126 | #define BUFerror(r) ERR_PUT_ERROR(ERR_LIB_BUF, (r)) | ||
| 127 | #define CMSerror(r) ERR_PUT_ERROR(ERR_LIB_CMS, (r)) | ||
| 128 | #define CONFerror(r) ERR_PUT_ERROR(ERR_LIB_CONF, (r)) | ||
| 129 | #define CRYPTOerror(r) ERR_PUT_ERROR(ERR_LIB_CRYPTO, (r)) | ||
| 130 | #define CTerror(r) ERR_PUT_ERROR(ERR_LIB_CT, (r)) | ||
| 131 | #define DHerror(r) ERR_PUT_ERROR(ERR_LIB_DH, (r)) | ||
| 132 | #define DSAerror(r) ERR_PUT_ERROR(ERR_LIB_DSA, (r)) | ||
| 133 | #define ECerror(r) ERR_PUT_ERROR(ERR_LIB_EC, (r)) | ||
| 134 | #define EVPerror(r) ERR_PUT_ERROR(ERR_LIB_EVP, (r)) | ||
| 135 | #define KDFerror(r) ERR_PUT_ERROR(ERR_LIB_KDF, (r)) | ||
| 136 | #define OBJerror(r) ERR_PUT_ERROR(ERR_LIB_OBJ, (r)) | ||
| 137 | #define OCSPerror(r) ERR_PUT_ERROR(ERR_LIB_OCSP, (r)) | ||
| 138 | #define PEMerror(r) ERR_PUT_ERROR(ERR_LIB_PEM, (r)) | ||
| 139 | #define PKCS12error(r) ERR_PUT_ERROR(ERR_LIB_PKCS12, (r)) | ||
| 140 | #define PKCS7error(r) ERR_PUT_ERROR(ERR_LIB_PKCS7, (r)) | ||
| 141 | #define RANDerror(r) ERR_PUT_ERROR(ERR_LIB_RAND, (r)) | ||
| 142 | #define RSAerror(r) ERR_PUT_ERROR(ERR_LIB_RSA, (r)) | ||
| 143 | #define SYSerror(r) ERR_PUT_ERROR(ERR_LIB_SYS, (r)) | ||
| 144 | #define TSerror(r) ERR_PUT_ERROR(ERR_LIB_TS, (r)) | ||
| 145 | #define UIerror(r) ERR_PUT_ERROR(ERR_LIB_UI, (r)) | ||
| 146 | #define X509V3error(r) ERR_PUT_ERROR(ERR_LIB_X509V3, (r)) | ||
| 147 | #define X509error(r) ERR_PUT_ERROR(ERR_LIB_X509, (r)) | ||
| 148 | |||
| 121 | __END_HIDDEN_DECLS | 149 | __END_HIDDEN_DECLS |
| 122 | 150 | ||
| 123 | #endif /* HEADER_ERR_LOCAL_H */ | 151 | #endif /* HEADER_ERR_LOCAL_H */ |
diff --git a/src/lib/libcrypto/evp/e_aes.c b/src/lib/libcrypto/evp/e_aes.c index 7753c18c15..e1ae1e9a5b 100644 --- a/src/lib/libcrypto/evp/e_aes.c +++ b/src/lib/libcrypto/evp/e_aes.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: e_aes.c,v 1.59 2024/09/06 09:57:32 tb Exp $ */ | 1 | /* $OpenBSD: e_aes.c,v 1.83 2025/07/22 09:31:09 jsing Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -59,19 +59,15 @@ | |||
| 59 | 59 | ||
| 60 | #ifndef OPENSSL_NO_AES | 60 | #ifndef OPENSSL_NO_AES |
| 61 | #include <openssl/aes.h> | 61 | #include <openssl/aes.h> |
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
| 64 | 63 | ||
| 64 | #include "aes_local.h" | ||
| 65 | #include "err_local.h" | ||
| 65 | #include "evp_local.h" | 66 | #include "evp_local.h" |
| 66 | #include "modes_local.h" | 67 | #include "modes_local.h" |
| 67 | 68 | ||
| 68 | typedef struct { | 69 | typedef struct { |
| 69 | AES_KEY ks; | 70 | AES_KEY ks; |
| 70 | block128_f block; | ||
| 71 | union { | ||
| 72 | cbc128_f cbc; | ||
| 73 | ctr128_f ctr; | ||
| 74 | } stream; | ||
| 75 | } EVP_AES_KEY; | 71 | } EVP_AES_KEY; |
| 76 | 72 | ||
| 77 | typedef struct { | 73 | typedef struct { |
| @@ -84,15 +80,11 @@ typedef struct { | |||
| 84 | int taglen; | 80 | int taglen; |
| 85 | int iv_gen; /* It is OK to generate IVs */ | 81 | int iv_gen; /* It is OK to generate IVs */ |
| 86 | int tls_aad_len; /* TLS AAD length */ | 82 | int tls_aad_len; /* TLS AAD length */ |
| 87 | ctr128_f ctr; | ||
| 88 | } EVP_AES_GCM_CTX; | 83 | } EVP_AES_GCM_CTX; |
| 89 | 84 | ||
| 90 | typedef struct { | 85 | typedef struct { |
| 91 | AES_KEY ks1, ks2; /* AES key schedules to use */ | 86 | AES_KEY ks1, ks2; /* AES key schedules to use */ |
| 92 | XTS128_CONTEXT xts; | 87 | XTS128_CONTEXT xts; /* XXX - replace with flags. */ |
| 93 | void (*stream)(const unsigned char *in, unsigned char *out, | ||
| 94 | size_t length, const AES_KEY *key1, const AES_KEY *key2, | ||
| 95 | const unsigned char iv[16]); | ||
| 96 | } EVP_AES_XTS_CTX; | 88 | } EVP_AES_XTS_CTX; |
| 97 | 89 | ||
| 98 | typedef struct { | 90 | typedef struct { |
| @@ -103,131 +95,17 @@ typedef struct { | |||
| 103 | int len_set; /* Set if message length set */ | 95 | int len_set; /* Set if message length set */ |
| 104 | int L, M; /* L and M parameters from RFC3610 */ | 96 | int L, M; /* L and M parameters from RFC3610 */ |
| 105 | CCM128_CONTEXT ccm; | 97 | CCM128_CONTEXT ccm; |
| 106 | ccm128_f str; | ||
| 107 | } EVP_AES_CCM_CTX; | 98 | } EVP_AES_CCM_CTX; |
| 108 | 99 | ||
| 109 | #define MAXBITCHUNK ((size_t)1<<(sizeof(size_t)*8-4)) | 100 | #define MAXBITCHUNK ((size_t)1<<(sizeof(size_t)*8-4)) |
| 110 | 101 | ||
| 111 | #ifdef VPAES_ASM | ||
| 112 | int vpaes_set_encrypt_key(const unsigned char *userKey, int bits, | ||
| 113 | AES_KEY *key); | ||
| 114 | int vpaes_set_decrypt_key(const unsigned char *userKey, int bits, | ||
| 115 | AES_KEY *key); | ||
| 116 | |||
| 117 | void vpaes_encrypt(const unsigned char *in, unsigned char *out, | ||
| 118 | const AES_KEY *key); | ||
| 119 | void vpaes_decrypt(const unsigned char *in, unsigned char *out, | ||
| 120 | const AES_KEY *key); | ||
| 121 | |||
| 122 | void vpaes_cbc_encrypt(const unsigned char *in, unsigned char *out, | ||
| 123 | size_t length, const AES_KEY *key, unsigned char *ivec, int enc); | ||
| 124 | #endif | ||
| 125 | #ifdef BSAES_ASM | ||
| 126 | void bsaes_cbc_encrypt(const unsigned char *in, unsigned char *out, | ||
| 127 | size_t length, const AES_KEY *key, unsigned char ivec[16], int enc); | ||
| 128 | void bsaes_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out, | ||
| 129 | size_t len, const AES_KEY *key, const unsigned char ivec[16]); | ||
| 130 | void bsaes_xts_encrypt(const unsigned char *inp, unsigned char *out, | ||
| 131 | size_t len, const AES_KEY *key1, const AES_KEY *key2, | ||
| 132 | const unsigned char iv[16]); | ||
| 133 | void bsaes_xts_decrypt(const unsigned char *inp, unsigned char *out, | ||
| 134 | size_t len, const AES_KEY *key1, const AES_KEY *key2, | ||
| 135 | const unsigned char iv[16]); | ||
| 136 | #endif | ||
| 137 | #ifdef AES_CTR_ASM | ||
| 138 | void AES_ctr32_encrypt(const unsigned char *in, unsigned char *out, | ||
| 139 | size_t blocks, const AES_KEY *key, | ||
| 140 | const unsigned char ivec[AES_BLOCK_SIZE]); | ||
| 141 | #endif | ||
| 142 | #ifdef AES_XTS_ASM | ||
| 143 | void AES_xts_encrypt(const char *inp, char *out, size_t len, | ||
| 144 | const AES_KEY *key1, const AES_KEY *key2, const unsigned char iv[16]); | ||
| 145 | void AES_xts_decrypt(const char *inp, char *out, size_t len, | ||
| 146 | const AES_KEY *key1, const AES_KEY *key2, const unsigned char iv[16]); | ||
| 147 | #endif | ||
| 148 | |||
| 149 | #if defined(AES_ASM) && ( \ | ||
| 150 | ((defined(__i386) || defined(__i386__) || \ | ||
| 151 | defined(_M_IX86)) && defined(OPENSSL_IA32_SSE2))|| \ | ||
| 152 | defined(__x86_64) || defined(__x86_64__) || \ | ||
| 153 | defined(_M_AMD64) || defined(_M_X64) || \ | ||
| 154 | defined(__INTEL__) ) | ||
| 155 | |||
| 156 | #include "x86_arch.h" | ||
| 157 | |||
| 158 | #ifdef VPAES_ASM | ||
| 159 | #define VPAES_CAPABLE (crypto_cpu_caps_ia32() & CPUCAP_MASK_SSSE3) | ||
| 160 | #endif | ||
| 161 | #ifdef BSAES_ASM | ||
| 162 | #define BSAES_CAPABLE VPAES_CAPABLE | ||
| 163 | #endif | ||
| 164 | /* | ||
| 165 | * AES-NI section | ||
| 166 | */ | ||
| 167 | #define AESNI_CAPABLE (crypto_cpu_caps_ia32() & CPUCAP_MASK_AESNI) | ||
| 168 | |||
| 169 | int aesni_set_encrypt_key(const unsigned char *userKey, int bits, | ||
| 170 | AES_KEY *key); | ||
| 171 | int aesni_set_decrypt_key(const unsigned char *userKey, int bits, | ||
| 172 | AES_KEY *key); | ||
| 173 | |||
| 174 | void aesni_encrypt(const unsigned char *in, unsigned char *out, | ||
| 175 | const AES_KEY *key); | ||
| 176 | void aesni_decrypt(const unsigned char *in, unsigned char *out, | ||
| 177 | const AES_KEY *key); | ||
| 178 | |||
| 179 | void aesni_ecb_encrypt(const unsigned char *in, unsigned char *out, | ||
| 180 | size_t length, const AES_KEY *key, int enc); | ||
| 181 | void aesni_cbc_encrypt(const unsigned char *in, unsigned char *out, | ||
| 182 | size_t length, const AES_KEY *key, unsigned char *ivec, int enc); | ||
| 183 | |||
| 184 | void aesni_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out, | ||
| 185 | size_t blocks, const void *key, const unsigned char *ivec); | ||
| 186 | |||
| 187 | void aesni_xts_encrypt(const unsigned char *in, unsigned char *out, | ||
| 188 | size_t length, const AES_KEY *key1, const AES_KEY *key2, | ||
| 189 | const unsigned char iv[16]); | ||
| 190 | |||
| 191 | void aesni_xts_decrypt(const unsigned char *in, unsigned char *out, | ||
| 192 | size_t length, const AES_KEY *key1, const AES_KEY *key2, | ||
| 193 | const unsigned char iv[16]); | ||
| 194 | |||
| 195 | void aesni_ccm64_encrypt_blocks (const unsigned char *in, unsigned char *out, | ||
| 196 | size_t blocks, const void *key, const unsigned char ivec[16], | ||
| 197 | unsigned char cmac[16]); | ||
| 198 | |||
| 199 | void aesni_ccm64_decrypt_blocks (const unsigned char *in, unsigned char *out, | ||
| 200 | size_t blocks, const void *key, const unsigned char ivec[16], | ||
| 201 | unsigned char cmac[16]); | ||
| 202 | |||
| 203 | static int | 102 | static int |
| 204 | aesni_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 103 | aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
| 205 | const unsigned char *iv, int enc) | 104 | const unsigned char *iv, int enc) |
| 206 | { | 105 | { |
| 207 | int ret, mode; | 106 | EVP_AES_KEY *eak = ctx->cipher_data; |
| 208 | EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data; | ||
| 209 | |||
| 210 | mode = ctx->cipher->flags & EVP_CIPH_MODE; | ||
| 211 | if ((mode == EVP_CIPH_ECB_MODE || mode == EVP_CIPH_CBC_MODE) && | ||
| 212 | !enc) { | ||
| 213 | ret = aesni_set_decrypt_key(key, ctx->key_len * 8, | ||
| 214 | ctx->cipher_data); | ||
| 215 | dat->block = (block128_f)aesni_decrypt; | ||
| 216 | dat->stream.cbc = mode == EVP_CIPH_CBC_MODE ? | ||
| 217 | (cbc128_f)aesni_cbc_encrypt : NULL; | ||
| 218 | } else { | ||
| 219 | ret = aesni_set_encrypt_key(key, ctx->key_len * 8, | ||
| 220 | ctx->cipher_data); | ||
| 221 | dat->block = (block128_f)aesni_encrypt; | ||
| 222 | if (mode == EVP_CIPH_CBC_MODE) | ||
| 223 | dat->stream.cbc = (cbc128_f)aesni_cbc_encrypt; | ||
| 224 | else if (mode == EVP_CIPH_CTR_MODE) | ||
| 225 | dat->stream.ctr = (ctr128_f)aesni_ctr32_encrypt_blocks; | ||
| 226 | else | ||
| 227 | dat->stream.cbc = NULL; | ||
| 228 | } | ||
| 229 | 107 | ||
| 230 | if (ret < 0) { | 108 | if (AES_set_encrypt_key(key, ctx->key_len * 8, &eak->ks) < 0) { |
| 231 | EVPerror(EVP_R_AES_KEY_SETUP_FAILED); | 109 | EVPerror(EVP_R_AES_KEY_SETUP_FAILED); |
| 232 | return 0; | 110 | return 0; |
| 233 | } | 111 | } |
| @@ -236,213 +114,54 @@ aesni_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | |||
| 236 | } | 114 | } |
| 237 | 115 | ||
| 238 | static int | 116 | static int |
| 239 | aesni_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 117 | aes_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
| 240 | const unsigned char *in, size_t len) | 118 | const unsigned char *iv, int encrypt) |
| 241 | { | ||
| 242 | aesni_cbc_encrypt(in, out, len, ctx->cipher_data, ctx->iv, | ||
| 243 | ctx->encrypt); | ||
| 244 | |||
| 245 | return 1; | ||
| 246 | } | ||
| 247 | |||
| 248 | static int | ||
| 249 | aesni_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 250 | const unsigned char *in, size_t len) | ||
| 251 | { | 119 | { |
| 252 | size_t bl = ctx->cipher->block_size; | 120 | EVP_AES_KEY *eak = ctx->cipher_data; |
| 253 | 121 | ||
| 254 | if (len < bl) | 122 | if (encrypt) { |
| 255 | return 1; | 123 | if (AES_set_encrypt_key(key, ctx->key_len * 8, &eak->ks) < 0) { |
| 256 | 124 | EVPerror(EVP_R_AES_KEY_SETUP_FAILED); | |
| 257 | aesni_ecb_encrypt(in, out, len, ctx->cipher_data, ctx->encrypt); | 125 | return 0; |
| 258 | |||
| 259 | return 1; | ||
| 260 | } | ||
| 261 | |||
| 262 | static int | ||
| 263 | aesni_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 264 | const unsigned char *iv, int enc) | ||
| 265 | { | ||
| 266 | EVP_AES_GCM_CTX *gctx = ctx->cipher_data; | ||
| 267 | |||
| 268 | if (!iv && !key) | ||
| 269 | return 1; | ||
| 270 | if (key) { | ||
| 271 | aesni_set_encrypt_key(key, ctx->key_len * 8, &gctx->ks); | ||
| 272 | CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks, | ||
| 273 | (block128_f)aesni_encrypt); | ||
| 274 | gctx->ctr = (ctr128_f)aesni_ctr32_encrypt_blocks; | ||
| 275 | /* If we have an iv can set it directly, otherwise use | ||
| 276 | * saved IV. | ||
| 277 | */ | ||
| 278 | if (iv == NULL && gctx->iv_set) | ||
| 279 | iv = gctx->iv; | ||
| 280 | if (iv) { | ||
| 281 | CRYPTO_gcm128_setiv(&gctx->gcm, iv, gctx->ivlen); | ||
| 282 | gctx->iv_set = 1; | ||
| 283 | } | 126 | } |
| 284 | gctx->key_set = 1; | ||
| 285 | } else { | 127 | } else { |
| 286 | /* If key set use IV, otherwise copy */ | 128 | if (AES_set_decrypt_key(key, ctx->key_len * 8, &eak->ks) < 0) { |
| 287 | if (gctx->key_set) | 129 | EVPerror(EVP_R_AES_KEY_SETUP_FAILED); |
| 288 | CRYPTO_gcm128_setiv(&gctx->gcm, iv, gctx->ivlen); | 130 | return 0; |
| 289 | else | ||
| 290 | memcpy(gctx->iv, iv, gctx->ivlen); | ||
| 291 | gctx->iv_set = 1; | ||
| 292 | gctx->iv_gen = 0; | ||
| 293 | } | ||
| 294 | return 1; | ||
| 295 | } | ||
| 296 | |||
| 297 | static int | ||
| 298 | aesni_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 299 | const unsigned char *iv, int enc) | ||
| 300 | { | ||
| 301 | EVP_AES_XTS_CTX *xctx = ctx->cipher_data; | ||
| 302 | |||
| 303 | if (!iv && !key) | ||
| 304 | return 1; | ||
| 305 | |||
| 306 | if (key) { | ||
| 307 | /* key_len is two AES keys */ | ||
| 308 | if (enc) { | ||
| 309 | aesni_set_encrypt_key(key, ctx->key_len * 4, | ||
| 310 | &xctx->ks1); | ||
| 311 | xctx->xts.block1 = (block128_f)aesni_encrypt; | ||
| 312 | xctx->stream = aesni_xts_encrypt; | ||
| 313 | } else { | ||
| 314 | aesni_set_decrypt_key(key, ctx->key_len * 4, | ||
| 315 | &xctx->ks1); | ||
| 316 | xctx->xts.block1 = (block128_f)aesni_decrypt; | ||
| 317 | xctx->stream = aesni_xts_decrypt; | ||
| 318 | } | 131 | } |
| 319 | |||
| 320 | aesni_set_encrypt_key(key + ctx->key_len / 2, | ||
| 321 | ctx->key_len * 4, &xctx->ks2); | ||
| 322 | xctx->xts.block2 = (block128_f)aesni_encrypt; | ||
| 323 | |||
| 324 | xctx->xts.key1 = &xctx->ks1; | ||
| 325 | } | ||
| 326 | |||
| 327 | if (iv) { | ||
| 328 | xctx->xts.key2 = &xctx->ks2; | ||
| 329 | memcpy(ctx->iv, iv, 16); | ||
| 330 | } | 132 | } |
| 331 | 133 | ||
| 332 | return 1; | 134 | return 1; |
| 333 | } | 135 | } |
| 334 | 136 | ||
| 335 | static int | 137 | static int |
| 336 | aesni_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 138 | aes_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 337 | const unsigned char *iv, int enc) | 139 | const unsigned char *in, size_t len) |
| 338 | { | ||
| 339 | EVP_AES_CCM_CTX *cctx = ctx->cipher_data; | ||
| 340 | |||
| 341 | if (!iv && !key) | ||
| 342 | return 1; | ||
| 343 | if (key) { | ||
| 344 | aesni_set_encrypt_key(key, ctx->key_len * 8, &cctx->ks); | ||
| 345 | CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, | ||
| 346 | &cctx->ks, (block128_f)aesni_encrypt); | ||
| 347 | cctx->str = enc ? (ccm128_f)aesni_ccm64_encrypt_blocks : | ||
| 348 | (ccm128_f)aesni_ccm64_decrypt_blocks; | ||
| 349 | cctx->key_set = 1; | ||
| 350 | } | ||
| 351 | if (iv) { | ||
| 352 | memcpy(ctx->iv, iv, 15 - cctx->L); | ||
| 353 | cctx->iv_set = 1; | ||
| 354 | } | ||
| 355 | return 1; | ||
| 356 | } | ||
| 357 | |||
| 358 | #endif | ||
| 359 | |||
| 360 | static int | ||
| 361 | aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 362 | const unsigned char *iv, int enc) | ||
| 363 | { | 140 | { |
| 364 | int ret, mode; | 141 | EVP_AES_KEY *eak = ctx->cipher_data; |
| 365 | EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data; | ||
| 366 | |||
| 367 | mode = ctx->cipher->flags & EVP_CIPH_MODE; | ||
| 368 | if ((mode == EVP_CIPH_ECB_MODE || mode == EVP_CIPH_CBC_MODE) && | ||
| 369 | !enc) | ||
| 370 | #ifdef BSAES_CAPABLE | ||
| 371 | if (BSAES_CAPABLE && mode == EVP_CIPH_CBC_MODE) { | ||
| 372 | ret = AES_set_decrypt_key(key, ctx->key_len * 8, | ||
| 373 | &dat->ks); | ||
| 374 | dat->block = (block128_f)AES_decrypt; | ||
| 375 | dat->stream.cbc = (cbc128_f)bsaes_cbc_encrypt; | ||
| 376 | } else | ||
| 377 | #endif | ||
| 378 | #ifdef VPAES_CAPABLE | ||
| 379 | if (VPAES_CAPABLE) { | ||
| 380 | ret = vpaes_set_decrypt_key(key, ctx->key_len * 8, | ||
| 381 | &dat->ks); | ||
| 382 | dat->block = (block128_f)vpaes_decrypt; | ||
| 383 | dat->stream.cbc = mode == EVP_CIPH_CBC_MODE ? | ||
| 384 | (cbc128_f)vpaes_cbc_encrypt : NULL; | ||
| 385 | } else | ||
| 386 | #endif | ||
| 387 | { | ||
| 388 | ret = AES_set_decrypt_key(key, ctx->key_len * 8, | ||
| 389 | &dat->ks); | ||
| 390 | dat->block = (block128_f)AES_decrypt; | ||
| 391 | dat->stream.cbc = mode == EVP_CIPH_CBC_MODE ? | ||
| 392 | (cbc128_f)AES_cbc_encrypt : NULL; | ||
| 393 | } else | ||
| 394 | #ifdef BSAES_CAPABLE | ||
| 395 | if (BSAES_CAPABLE && mode == EVP_CIPH_CTR_MODE) { | ||
| 396 | ret = AES_set_encrypt_key(key, ctx->key_len * 8, | ||
| 397 | &dat->ks); | ||
| 398 | dat->block = (block128_f)AES_encrypt; | ||
| 399 | dat->stream.ctr = (ctr128_f)bsaes_ctr32_encrypt_blocks; | ||
| 400 | } else | ||
| 401 | #endif | ||
| 402 | #ifdef VPAES_CAPABLE | ||
| 403 | if (VPAES_CAPABLE) { | ||
| 404 | ret = vpaes_set_encrypt_key(key, ctx->key_len * 8, | ||
| 405 | &dat->ks); | ||
| 406 | dat->block = (block128_f)vpaes_encrypt; | ||
| 407 | dat->stream.cbc = mode == EVP_CIPH_CBC_MODE ? | ||
| 408 | (cbc128_f)vpaes_cbc_encrypt : NULL; | ||
| 409 | } else | ||
| 410 | #endif | ||
| 411 | { | ||
| 412 | ret = AES_set_encrypt_key(key, ctx->key_len * 8, | ||
| 413 | &dat->ks); | ||
| 414 | dat->block = (block128_f)AES_encrypt; | ||
| 415 | dat->stream.cbc = mode == EVP_CIPH_CBC_MODE ? | ||
| 416 | (cbc128_f)AES_cbc_encrypt : NULL; | ||
| 417 | #ifdef AES_CTR_ASM | ||
| 418 | if (mode == EVP_CIPH_CTR_MODE) | ||
| 419 | dat->stream.ctr = (ctr128_f)AES_ctr32_encrypt; | ||
| 420 | #endif | ||
| 421 | } | ||
| 422 | 142 | ||
| 423 | if (ret < 0) { | 143 | AES_cbc_encrypt(in, out, len, &eak->ks, ctx->iv, ctx->encrypt); |
| 424 | EVPerror(EVP_R_AES_KEY_SETUP_FAILED); | ||
| 425 | return 0; | ||
| 426 | } | ||
| 427 | 144 | ||
| 428 | return 1; | 145 | return 1; |
| 429 | } | 146 | } |
| 430 | 147 | ||
| 431 | static int | 148 | static int |
| 432 | aes_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 149 | aes_ecb_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
| 433 | const unsigned char *in, size_t len) | 150 | const unsigned char *iv, int encrypt) |
| 434 | { | 151 | { |
| 435 | EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data; | 152 | EVP_AES_KEY *eak = ctx->cipher_data; |
| 436 | 153 | ||
| 437 | if (dat->stream.cbc) | 154 | if (encrypt) { |
| 438 | (*dat->stream.cbc)(in, out, len, &dat->ks, ctx->iv, | 155 | if (AES_set_encrypt_key(key, ctx->key_len * 8, &eak->ks) < 0) { |
| 439 | ctx->encrypt); | 156 | EVPerror(EVP_R_AES_KEY_SETUP_FAILED); |
| 440 | else if (ctx->encrypt) | 157 | return 0; |
| 441 | CRYPTO_cbc128_encrypt(in, out, len, &dat->ks, ctx->iv, | 158 | } |
| 442 | dat->block); | 159 | } else { |
| 443 | else | 160 | if (AES_set_decrypt_key(key, ctx->key_len * 8, &eak->ks) < 0) { |
| 444 | CRYPTO_cbc128_decrypt(in, out, len, &dat->ks, ctx->iv, | 161 | EVPerror(EVP_R_AES_KEY_SETUP_FAILED); |
| 445 | dat->block); | 162 | return 0; |
| 163 | } | ||
| 164 | } | ||
| 446 | 165 | ||
| 447 | return 1; | 166 | return 1; |
| 448 | } | 167 | } |
| @@ -451,15 +170,9 @@ static int | |||
| 451 | aes_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 170 | aes_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 452 | const unsigned char *in, size_t len) | 171 | const unsigned char *in, size_t len) |
| 453 | { | 172 | { |
| 454 | size_t bl = ctx->cipher->block_size; | 173 | EVP_AES_KEY *eak = ctx->cipher_data; |
| 455 | size_t i; | ||
| 456 | EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data; | ||
| 457 | |||
| 458 | if (len < bl) | ||
| 459 | return 1; | ||
| 460 | 174 | ||
| 461 | for (i = 0, len -= bl; i <= len; i += bl) | 175 | aes_ecb_encrypt_internal(in, out, len, &eak->ks, ctx->encrypt); |
| 462 | (*dat->block)(in + i, out + i, &dat->ks); | ||
| 463 | 176 | ||
| 464 | return 1; | 177 | return 1; |
| 465 | } | 178 | } |
| @@ -468,10 +181,10 @@ static int | |||
| 468 | aes_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 181 | aes_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 469 | const unsigned char *in, size_t len) | 182 | const unsigned char *in, size_t len) |
| 470 | { | 183 | { |
| 471 | EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data; | 184 | EVP_AES_KEY *eak = ctx->cipher_data; |
| 185 | |||
| 186 | AES_ofb128_encrypt(in, out, len, &eak->ks, ctx->iv, &ctx->num); | ||
| 472 | 187 | ||
| 473 | CRYPTO_ofb128_encrypt(in, out, len, &dat->ks, ctx->iv, &ctx->num, | ||
| 474 | dat->block); | ||
| 475 | return 1; | 188 | return 1; |
| 476 | } | 189 | } |
| 477 | 190 | ||
| @@ -479,10 +192,11 @@ static int | |||
| 479 | aes_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 192 | aes_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 480 | const unsigned char *in, size_t len) | 193 | const unsigned char *in, size_t len) |
| 481 | { | 194 | { |
| 482 | EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data; | 195 | EVP_AES_KEY *eak = ctx->cipher_data; |
| 196 | |||
| 197 | AES_cfb128_encrypt(in, out, len, &eak->ks, ctx->iv, &ctx->num, | ||
| 198 | ctx->encrypt); | ||
| 483 | 199 | ||
| 484 | CRYPTO_cfb128_encrypt(in, out, len, &dat->ks, ctx->iv, &ctx->num, | ||
| 485 | ctx->encrypt, dat->block); | ||
| 486 | return 1; | 200 | return 1; |
| 487 | } | 201 | } |
| 488 | 202 | ||
| @@ -490,10 +204,11 @@ static int | |||
| 490 | aes_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 204 | aes_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 491 | const unsigned char *in, size_t len) | 205 | const unsigned char *in, size_t len) |
| 492 | { | 206 | { |
| 493 | EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data; | 207 | EVP_AES_KEY *eak = ctx->cipher_data; |
| 208 | |||
| 209 | AES_cfb8_encrypt(in, out, len, &eak->ks, ctx->iv, &ctx->num, | ||
| 210 | ctx->encrypt); | ||
| 494 | 211 | ||
| 495 | CRYPTO_cfb128_8_encrypt(in, out, len, &dat->ks, ctx->iv, &ctx->num, | ||
| 496 | ctx->encrypt, dat->block); | ||
| 497 | return 1; | 212 | return 1; |
| 498 | } | 213 | } |
| 499 | 214 | ||
| @@ -501,24 +216,25 @@ static int | |||
| 501 | aes_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 216 | aes_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 502 | const unsigned char *in, size_t len) | 217 | const unsigned char *in, size_t len) |
| 503 | { | 218 | { |
| 504 | EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data; | 219 | EVP_AES_KEY *eak = ctx->cipher_data; |
| 505 | 220 | ||
| 506 | if (ctx->flags&EVP_CIPH_FLAG_LENGTH_BITS) { | 221 | if ((ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) != 0) { |
| 507 | CRYPTO_cfb128_1_encrypt(in, out, len, &dat->ks, ctx->iv, | 222 | AES_cfb1_encrypt(in, out, len, &eak->ks, ctx->iv, &ctx->num, |
| 508 | &ctx->num, ctx->encrypt, dat->block); | 223 | ctx->encrypt); |
| 509 | return 1; | 224 | return 1; |
| 510 | } | 225 | } |
| 511 | 226 | ||
| 512 | while (len >= MAXBITCHUNK) { | 227 | while (len >= MAXBITCHUNK) { |
| 513 | CRYPTO_cfb128_1_encrypt(in, out, MAXBITCHUNK*8, &dat->ks, | 228 | AES_cfb1_encrypt(in, out, MAXBITCHUNK * 8, &eak->ks, ctx->iv, |
| 514 | ctx->iv, &ctx->num, ctx->encrypt, dat->block); | 229 | &ctx->num, ctx->encrypt); |
| 515 | len -= MAXBITCHUNK; | 230 | len -= MAXBITCHUNK; |
| 516 | in += MAXBITCHUNK; | 231 | in += MAXBITCHUNK; |
| 517 | out += MAXBITCHUNK; | 232 | out += MAXBITCHUNK; |
| 518 | } | 233 | } |
| 519 | if (len) | 234 | if (len > 0) { |
| 520 | CRYPTO_cfb128_1_encrypt(in, out, len*8, &dat->ks, | 235 | AES_cfb1_encrypt(in, out, len * 8, &eak->ks, ctx->iv, &ctx->num, |
| 521 | ctx->iv, &ctx->num, ctx->encrypt, dat->block); | 236 | ctx->encrypt); |
| 237 | } | ||
| 522 | 238 | ||
| 523 | return 1; | 239 | return 1; |
| 524 | } | 240 | } |
| @@ -527,40 +243,23 @@ static int | |||
| 527 | aes_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 243 | aes_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 528 | const unsigned char *in, size_t len) | 244 | const unsigned char *in, size_t len) |
| 529 | { | 245 | { |
| 246 | EVP_AES_KEY *eak = ctx->cipher_data; | ||
| 530 | unsigned int num = ctx->num; | 247 | unsigned int num = ctx->num; |
| 531 | EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data; | ||
| 532 | 248 | ||
| 533 | if (dat->stream.ctr) | 249 | AES_ctr128_encrypt(in, out, len, &eak->ks, ctx->iv, ctx->buf, &num); |
| 534 | CRYPTO_ctr128_encrypt_ctr32(in, out, len, &dat->ks, | 250 | |
| 535 | ctx->iv, ctx->buf, &num, dat->stream.ctr); | ||
| 536 | else | ||
| 537 | CRYPTO_ctr128_encrypt(in, out, len, &dat->ks, | ||
| 538 | ctx->iv, ctx->buf, &num, dat->block); | ||
| 539 | ctx->num = (size_t)num; | 251 | ctx->num = (size_t)num; |
| 252 | |||
| 540 | return 1; | 253 | return 1; |
| 541 | } | 254 | } |
| 542 | 255 | ||
| 543 | |||
| 544 | #ifdef AESNI_CAPABLE | ||
| 545 | static const EVP_CIPHER aesni_128_cbc = { | ||
| 546 | .nid = NID_aes_128_cbc, | ||
| 547 | .block_size = 16, | ||
| 548 | .key_len = 16, | ||
| 549 | .iv_len = 16, | ||
| 550 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE, | ||
| 551 | .init = aesni_init_key, | ||
| 552 | .do_cipher = aesni_cbc_cipher, | ||
| 553 | .ctx_size = sizeof(EVP_AES_KEY), | ||
| 554 | }; | ||
| 555 | #endif | ||
| 556 | |||
| 557 | static const EVP_CIPHER aes_128_cbc = { | 256 | static const EVP_CIPHER aes_128_cbc = { |
| 558 | .nid = NID_aes_128_cbc, | 257 | .nid = NID_aes_128_cbc, |
| 559 | .block_size = 16, | 258 | .block_size = 16, |
| 560 | .key_len = 16, | 259 | .key_len = 16, |
| 561 | .iv_len = 16, | 260 | .iv_len = 16, |
| 562 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE, | 261 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE, |
| 563 | .init = aes_init_key, | 262 | .init = aes_cbc_init_key, |
| 564 | .do_cipher = aes_cbc_cipher, | 263 | .do_cipher = aes_cbc_cipher, |
| 565 | .ctx_size = sizeof(EVP_AES_KEY), | 264 | .ctx_size = sizeof(EVP_AES_KEY), |
| 566 | }; | 265 | }; |
| @@ -568,34 +267,17 @@ static const EVP_CIPHER aes_128_cbc = { | |||
| 568 | const EVP_CIPHER * | 267 | const EVP_CIPHER * |
| 569 | EVP_aes_128_cbc(void) | 268 | EVP_aes_128_cbc(void) |
| 570 | { | 269 | { |
| 571 | #ifdef AESNI_CAPABLE | ||
| 572 | return AESNI_CAPABLE ? &aesni_128_cbc : &aes_128_cbc; | ||
| 573 | #else | ||
| 574 | return &aes_128_cbc; | 270 | return &aes_128_cbc; |
| 575 | #endif | ||
| 576 | } | 271 | } |
| 577 | LCRYPTO_ALIAS(EVP_aes_128_cbc); | 272 | LCRYPTO_ALIAS(EVP_aes_128_cbc); |
| 578 | 273 | ||
| 579 | #ifdef AESNI_CAPABLE | ||
| 580 | static const EVP_CIPHER aesni_128_ecb = { | ||
| 581 | .nid = NID_aes_128_ecb, | ||
| 582 | .block_size = 16, | ||
| 583 | .key_len = 16, | ||
| 584 | .iv_len = 0, | ||
| 585 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE, | ||
| 586 | .init = aesni_init_key, | ||
| 587 | .do_cipher = aesni_ecb_cipher, | ||
| 588 | .ctx_size = sizeof(EVP_AES_KEY), | ||
| 589 | }; | ||
| 590 | #endif | ||
| 591 | |||
| 592 | static const EVP_CIPHER aes_128_ecb = { | 274 | static const EVP_CIPHER aes_128_ecb = { |
| 593 | .nid = NID_aes_128_ecb, | 275 | .nid = NID_aes_128_ecb, |
| 594 | .block_size = 16, | 276 | .block_size = 16, |
| 595 | .key_len = 16, | 277 | .key_len = 16, |
| 596 | .iv_len = 0, | 278 | .iv_len = 0, |
| 597 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE, | 279 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE, |
| 598 | .init = aes_init_key, | 280 | .init = aes_ecb_init_key, |
| 599 | .do_cipher = aes_ecb_cipher, | 281 | .do_cipher = aes_ecb_cipher, |
| 600 | .ctx_size = sizeof(EVP_AES_KEY), | 282 | .ctx_size = sizeof(EVP_AES_KEY), |
| 601 | }; | 283 | }; |
| @@ -603,27 +285,10 @@ static const EVP_CIPHER aes_128_ecb = { | |||
| 603 | const EVP_CIPHER * | 285 | const EVP_CIPHER * |
| 604 | EVP_aes_128_ecb(void) | 286 | EVP_aes_128_ecb(void) |
| 605 | { | 287 | { |
| 606 | #ifdef AESNI_CAPABLE | ||
| 607 | return AESNI_CAPABLE ? &aesni_128_ecb : &aes_128_ecb; | ||
| 608 | #else | ||
| 609 | return &aes_128_ecb; | 288 | return &aes_128_ecb; |
| 610 | #endif | ||
| 611 | } | 289 | } |
| 612 | LCRYPTO_ALIAS(EVP_aes_128_ecb); | 290 | LCRYPTO_ALIAS(EVP_aes_128_ecb); |
| 613 | 291 | ||
| 614 | #ifdef AESNI_CAPABLE | ||
| 615 | static const EVP_CIPHER aesni_128_ofb = { | ||
| 616 | .nid = NID_aes_128_ofb128, | ||
| 617 | .block_size = 1, | ||
| 618 | .key_len = 16, | ||
| 619 | .iv_len = 16, | ||
| 620 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_OFB_MODE, | ||
| 621 | .init = aesni_init_key, | ||
| 622 | .do_cipher = aes_ofb_cipher, | ||
| 623 | .ctx_size = sizeof(EVP_AES_KEY), | ||
| 624 | }; | ||
| 625 | #endif | ||
| 626 | |||
| 627 | static const EVP_CIPHER aes_128_ofb = { | 292 | static const EVP_CIPHER aes_128_ofb = { |
| 628 | .nid = NID_aes_128_ofb128, | 293 | .nid = NID_aes_128_ofb128, |
| 629 | .block_size = 1, | 294 | .block_size = 1, |
| @@ -638,27 +303,10 @@ static const EVP_CIPHER aes_128_ofb = { | |||
| 638 | const EVP_CIPHER * | 303 | const EVP_CIPHER * |
| 639 | EVP_aes_128_ofb(void) | 304 | EVP_aes_128_ofb(void) |
| 640 | { | 305 | { |
| 641 | #ifdef AESNI_CAPABLE | ||
| 642 | return AESNI_CAPABLE ? &aesni_128_ofb : &aes_128_ofb; | ||
| 643 | #else | ||
| 644 | return &aes_128_ofb; | 306 | return &aes_128_ofb; |
| 645 | #endif | ||
| 646 | } | 307 | } |
| 647 | LCRYPTO_ALIAS(EVP_aes_128_ofb); | 308 | LCRYPTO_ALIAS(EVP_aes_128_ofb); |
| 648 | 309 | ||
| 649 | #ifdef AESNI_CAPABLE | ||
| 650 | static const EVP_CIPHER aesni_128_cfb = { | ||
| 651 | .nid = NID_aes_128_cfb128, | ||
| 652 | .block_size = 1, | ||
| 653 | .key_len = 16, | ||
| 654 | .iv_len = 16, | ||
| 655 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CFB_MODE, | ||
| 656 | .init = aesni_init_key, | ||
| 657 | .do_cipher = aes_cfb_cipher, | ||
| 658 | .ctx_size = sizeof(EVP_AES_KEY), | ||
| 659 | }; | ||
| 660 | #endif | ||
| 661 | |||
| 662 | static const EVP_CIPHER aes_128_cfb = { | 310 | static const EVP_CIPHER aes_128_cfb = { |
| 663 | .nid = NID_aes_128_cfb128, | 311 | .nid = NID_aes_128_cfb128, |
| 664 | .block_size = 1, | 312 | .block_size = 1, |
| @@ -673,27 +321,10 @@ static const EVP_CIPHER aes_128_cfb = { | |||
| 673 | const EVP_CIPHER * | 321 | const EVP_CIPHER * |
| 674 | EVP_aes_128_cfb128(void) | 322 | EVP_aes_128_cfb128(void) |
| 675 | { | 323 | { |
| 676 | #ifdef AESNI_CAPABLE | ||
| 677 | return AESNI_CAPABLE ? &aesni_128_cfb : &aes_128_cfb; | ||
| 678 | #else | ||
| 679 | return &aes_128_cfb; | 324 | return &aes_128_cfb; |
| 680 | #endif | ||
| 681 | } | 325 | } |
| 682 | LCRYPTO_ALIAS(EVP_aes_128_cfb128); | 326 | LCRYPTO_ALIAS(EVP_aes_128_cfb128); |
| 683 | 327 | ||
| 684 | #ifdef AESNI_CAPABLE | ||
| 685 | static const EVP_CIPHER aesni_128_cfb1 = { | ||
| 686 | .nid = NID_aes_128_cfb1, | ||
| 687 | .block_size = 1, | ||
| 688 | .key_len = 16, | ||
| 689 | .iv_len = 16, | ||
| 690 | .flags = EVP_CIPH_CFB_MODE, | ||
| 691 | .init = aesni_init_key, | ||
| 692 | .do_cipher = aes_cfb1_cipher, | ||
| 693 | .ctx_size = sizeof(EVP_AES_KEY), | ||
| 694 | }; | ||
| 695 | #endif | ||
| 696 | |||
| 697 | static const EVP_CIPHER aes_128_cfb1 = { | 328 | static const EVP_CIPHER aes_128_cfb1 = { |
| 698 | .nid = NID_aes_128_cfb1, | 329 | .nid = NID_aes_128_cfb1, |
| 699 | .block_size = 1, | 330 | .block_size = 1, |
| @@ -708,27 +339,10 @@ static const EVP_CIPHER aes_128_cfb1 = { | |||
| 708 | const EVP_CIPHER * | 339 | const EVP_CIPHER * |
| 709 | EVP_aes_128_cfb1(void) | 340 | EVP_aes_128_cfb1(void) |
| 710 | { | 341 | { |
| 711 | #ifdef AESNI_CAPABLE | ||
| 712 | return AESNI_CAPABLE ? &aesni_128_cfb1 : &aes_128_cfb1; | ||
| 713 | #else | ||
| 714 | return &aes_128_cfb1; | 342 | return &aes_128_cfb1; |
| 715 | #endif | ||
| 716 | } | 343 | } |
| 717 | LCRYPTO_ALIAS(EVP_aes_128_cfb1); | 344 | LCRYPTO_ALIAS(EVP_aes_128_cfb1); |
| 718 | 345 | ||
| 719 | #ifdef AESNI_CAPABLE | ||
| 720 | static const EVP_CIPHER aesni_128_cfb8 = { | ||
| 721 | .nid = NID_aes_128_cfb8, | ||
| 722 | .block_size = 1, | ||
| 723 | .key_len = 16, | ||
| 724 | .iv_len = 16, | ||
| 725 | .flags = EVP_CIPH_CFB_MODE, | ||
| 726 | .init = aesni_init_key, | ||
| 727 | .do_cipher = aes_cfb8_cipher, | ||
| 728 | .ctx_size = sizeof(EVP_AES_KEY), | ||
| 729 | }; | ||
| 730 | #endif | ||
| 731 | |||
| 732 | static const EVP_CIPHER aes_128_cfb8 = { | 346 | static const EVP_CIPHER aes_128_cfb8 = { |
| 733 | .nid = NID_aes_128_cfb8, | 347 | .nid = NID_aes_128_cfb8, |
| 734 | .block_size = 1, | 348 | .block_size = 1, |
| @@ -743,27 +357,10 @@ static const EVP_CIPHER aes_128_cfb8 = { | |||
| 743 | const EVP_CIPHER * | 357 | const EVP_CIPHER * |
| 744 | EVP_aes_128_cfb8(void) | 358 | EVP_aes_128_cfb8(void) |
| 745 | { | 359 | { |
| 746 | #ifdef AESNI_CAPABLE | ||
| 747 | return AESNI_CAPABLE ? &aesni_128_cfb8 : &aes_128_cfb8; | ||
| 748 | #else | ||
| 749 | return &aes_128_cfb8; | 360 | return &aes_128_cfb8; |
| 750 | #endif | ||
| 751 | } | 361 | } |
| 752 | LCRYPTO_ALIAS(EVP_aes_128_cfb8); | 362 | LCRYPTO_ALIAS(EVP_aes_128_cfb8); |
| 753 | 363 | ||
| 754 | #ifdef AESNI_CAPABLE | ||
| 755 | static const EVP_CIPHER aesni_128_ctr = { | ||
| 756 | .nid = NID_aes_128_ctr, | ||
| 757 | .block_size = 1, | ||
| 758 | .key_len = 16, | ||
| 759 | .iv_len = 16, | ||
| 760 | .flags = EVP_CIPH_CTR_MODE, | ||
| 761 | .init = aesni_init_key, | ||
| 762 | .do_cipher = aes_ctr_cipher, | ||
| 763 | .ctx_size = sizeof(EVP_AES_KEY), | ||
| 764 | }; | ||
| 765 | #endif | ||
| 766 | |||
| 767 | static const EVP_CIPHER aes_128_ctr = { | 364 | static const EVP_CIPHER aes_128_ctr = { |
| 768 | .nid = NID_aes_128_ctr, | 365 | .nid = NID_aes_128_ctr, |
| 769 | .block_size = 1, | 366 | .block_size = 1, |
| @@ -778,35 +375,17 @@ static const EVP_CIPHER aes_128_ctr = { | |||
| 778 | const EVP_CIPHER * | 375 | const EVP_CIPHER * |
| 779 | EVP_aes_128_ctr(void) | 376 | EVP_aes_128_ctr(void) |
| 780 | { | 377 | { |
| 781 | #ifdef AESNI_CAPABLE | ||
| 782 | return AESNI_CAPABLE ? &aesni_128_ctr : &aes_128_ctr; | ||
| 783 | #else | ||
| 784 | return &aes_128_ctr; | 378 | return &aes_128_ctr; |
| 785 | #endif | ||
| 786 | } | 379 | } |
| 787 | LCRYPTO_ALIAS(EVP_aes_128_ctr); | 380 | LCRYPTO_ALIAS(EVP_aes_128_ctr); |
| 788 | 381 | ||
| 789 | |||
| 790 | #ifdef AESNI_CAPABLE | ||
| 791 | static const EVP_CIPHER aesni_192_cbc = { | ||
| 792 | .nid = NID_aes_192_cbc, | ||
| 793 | .block_size = 16, | ||
| 794 | .key_len = 24, | ||
| 795 | .iv_len = 16, | ||
| 796 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE, | ||
| 797 | .init = aesni_init_key, | ||
| 798 | .do_cipher = aesni_cbc_cipher, | ||
| 799 | .ctx_size = sizeof(EVP_AES_KEY), | ||
| 800 | }; | ||
| 801 | #endif | ||
| 802 | |||
| 803 | static const EVP_CIPHER aes_192_cbc = { | 382 | static const EVP_CIPHER aes_192_cbc = { |
| 804 | .nid = NID_aes_192_cbc, | 383 | .nid = NID_aes_192_cbc, |
| 805 | .block_size = 16, | 384 | .block_size = 16, |
| 806 | .key_len = 24, | 385 | .key_len = 24, |
| 807 | .iv_len = 16, | 386 | .iv_len = 16, |
| 808 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE, | 387 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE, |
| 809 | .init = aes_init_key, | 388 | .init = aes_cbc_init_key, |
| 810 | .do_cipher = aes_cbc_cipher, | 389 | .do_cipher = aes_cbc_cipher, |
| 811 | .ctx_size = sizeof(EVP_AES_KEY), | 390 | .ctx_size = sizeof(EVP_AES_KEY), |
| 812 | }; | 391 | }; |
| @@ -814,34 +393,17 @@ static const EVP_CIPHER aes_192_cbc = { | |||
| 814 | const EVP_CIPHER * | 393 | const EVP_CIPHER * |
| 815 | EVP_aes_192_cbc(void) | 394 | EVP_aes_192_cbc(void) |
| 816 | { | 395 | { |
| 817 | #ifdef AESNI_CAPABLE | ||
| 818 | return AESNI_CAPABLE ? &aesni_192_cbc : &aes_192_cbc; | ||
| 819 | #else | ||
| 820 | return &aes_192_cbc; | 396 | return &aes_192_cbc; |
| 821 | #endif | ||
| 822 | } | 397 | } |
| 823 | LCRYPTO_ALIAS(EVP_aes_192_cbc); | 398 | LCRYPTO_ALIAS(EVP_aes_192_cbc); |
| 824 | 399 | ||
| 825 | #ifdef AESNI_CAPABLE | ||
| 826 | static const EVP_CIPHER aesni_192_ecb = { | ||
| 827 | .nid = NID_aes_192_ecb, | ||
| 828 | .block_size = 16, | ||
| 829 | .key_len = 24, | ||
| 830 | .iv_len = 0, | ||
| 831 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE, | ||
| 832 | .init = aesni_init_key, | ||
| 833 | .do_cipher = aesni_ecb_cipher, | ||
| 834 | .ctx_size = sizeof(EVP_AES_KEY), | ||
| 835 | }; | ||
| 836 | #endif | ||
| 837 | |||
| 838 | static const EVP_CIPHER aes_192_ecb = { | 400 | static const EVP_CIPHER aes_192_ecb = { |
| 839 | .nid = NID_aes_192_ecb, | 401 | .nid = NID_aes_192_ecb, |
| 840 | .block_size = 16, | 402 | .block_size = 16, |
| 841 | .key_len = 24, | 403 | .key_len = 24, |
| 842 | .iv_len = 0, | 404 | .iv_len = 0, |
| 843 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE, | 405 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE, |
| 844 | .init = aes_init_key, | 406 | .init = aes_ecb_init_key, |
| 845 | .do_cipher = aes_ecb_cipher, | 407 | .do_cipher = aes_ecb_cipher, |
| 846 | .ctx_size = sizeof(EVP_AES_KEY), | 408 | .ctx_size = sizeof(EVP_AES_KEY), |
| 847 | }; | 409 | }; |
| @@ -849,27 +411,10 @@ static const EVP_CIPHER aes_192_ecb = { | |||
| 849 | const EVP_CIPHER * | 411 | const EVP_CIPHER * |
| 850 | EVP_aes_192_ecb(void) | 412 | EVP_aes_192_ecb(void) |
| 851 | { | 413 | { |
| 852 | #ifdef AESNI_CAPABLE | ||
| 853 | return AESNI_CAPABLE ? &aesni_192_ecb : &aes_192_ecb; | ||
| 854 | #else | ||
| 855 | return &aes_192_ecb; | 414 | return &aes_192_ecb; |
| 856 | #endif | ||
| 857 | } | 415 | } |
| 858 | LCRYPTO_ALIAS(EVP_aes_192_ecb); | 416 | LCRYPTO_ALIAS(EVP_aes_192_ecb); |
| 859 | 417 | ||
| 860 | #ifdef AESNI_CAPABLE | ||
| 861 | static const EVP_CIPHER aesni_192_ofb = { | ||
| 862 | .nid = NID_aes_192_ofb128, | ||
| 863 | .block_size = 1, | ||
| 864 | .key_len = 24, | ||
| 865 | .iv_len = 16, | ||
| 866 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_OFB_MODE, | ||
| 867 | .init = aesni_init_key, | ||
| 868 | .do_cipher = aes_ofb_cipher, | ||
| 869 | .ctx_size = sizeof(EVP_AES_KEY), | ||
| 870 | }; | ||
| 871 | #endif | ||
| 872 | |||
| 873 | static const EVP_CIPHER aes_192_ofb = { | 418 | static const EVP_CIPHER aes_192_ofb = { |
| 874 | .nid = NID_aes_192_ofb128, | 419 | .nid = NID_aes_192_ofb128, |
| 875 | .block_size = 1, | 420 | .block_size = 1, |
| @@ -884,27 +429,10 @@ static const EVP_CIPHER aes_192_ofb = { | |||
| 884 | const EVP_CIPHER * | 429 | const EVP_CIPHER * |
| 885 | EVP_aes_192_ofb(void) | 430 | EVP_aes_192_ofb(void) |
| 886 | { | 431 | { |
| 887 | #ifdef AESNI_CAPABLE | ||
| 888 | return AESNI_CAPABLE ? &aesni_192_ofb : &aes_192_ofb; | ||
| 889 | #else | ||
| 890 | return &aes_192_ofb; | 432 | return &aes_192_ofb; |
| 891 | #endif | ||
| 892 | } | 433 | } |
| 893 | LCRYPTO_ALIAS(EVP_aes_192_ofb); | 434 | LCRYPTO_ALIAS(EVP_aes_192_ofb); |
| 894 | 435 | ||
| 895 | #ifdef AESNI_CAPABLE | ||
| 896 | static const EVP_CIPHER aesni_192_cfb = { | ||
| 897 | .nid = NID_aes_192_cfb128, | ||
| 898 | .block_size = 1, | ||
| 899 | .key_len = 24, | ||
| 900 | .iv_len = 16, | ||
| 901 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CFB_MODE, | ||
| 902 | .init = aesni_init_key, | ||
| 903 | .do_cipher = aes_cfb_cipher, | ||
| 904 | .ctx_size = sizeof(EVP_AES_KEY), | ||
| 905 | }; | ||
| 906 | #endif | ||
| 907 | |||
| 908 | static const EVP_CIPHER aes_192_cfb = { | 436 | static const EVP_CIPHER aes_192_cfb = { |
| 909 | .nid = NID_aes_192_cfb128, | 437 | .nid = NID_aes_192_cfb128, |
| 910 | .block_size = 1, | 438 | .block_size = 1, |
| @@ -919,27 +447,10 @@ static const EVP_CIPHER aes_192_cfb = { | |||
| 919 | const EVP_CIPHER * | 447 | const EVP_CIPHER * |
| 920 | EVP_aes_192_cfb128(void) | 448 | EVP_aes_192_cfb128(void) |
| 921 | { | 449 | { |
| 922 | #ifdef AESNI_CAPABLE | ||
| 923 | return AESNI_CAPABLE ? &aesni_192_cfb : &aes_192_cfb; | ||
| 924 | #else | ||
| 925 | return &aes_192_cfb; | 450 | return &aes_192_cfb; |
| 926 | #endif | ||
| 927 | } | 451 | } |
| 928 | LCRYPTO_ALIAS(EVP_aes_192_cfb128); | 452 | LCRYPTO_ALIAS(EVP_aes_192_cfb128); |
| 929 | 453 | ||
| 930 | #ifdef AESNI_CAPABLE | ||
| 931 | static const EVP_CIPHER aesni_192_cfb1 = { | ||
| 932 | .nid = NID_aes_192_cfb1, | ||
| 933 | .block_size = 1, | ||
| 934 | .key_len = 24, | ||
| 935 | .iv_len = 16, | ||
| 936 | .flags = EVP_CIPH_CFB_MODE, | ||
| 937 | .init = aesni_init_key, | ||
| 938 | .do_cipher = aes_cfb1_cipher, | ||
| 939 | .ctx_size = sizeof(EVP_AES_KEY), | ||
| 940 | }; | ||
| 941 | #endif | ||
| 942 | |||
| 943 | static const EVP_CIPHER aes_192_cfb1 = { | 454 | static const EVP_CIPHER aes_192_cfb1 = { |
| 944 | .nid = NID_aes_192_cfb1, | 455 | .nid = NID_aes_192_cfb1, |
| 945 | .block_size = 1, | 456 | .block_size = 1, |
| @@ -954,27 +465,10 @@ static const EVP_CIPHER aes_192_cfb1 = { | |||
| 954 | const EVP_CIPHER * | 465 | const EVP_CIPHER * |
| 955 | EVP_aes_192_cfb1(void) | 466 | EVP_aes_192_cfb1(void) |
| 956 | { | 467 | { |
| 957 | #ifdef AESNI_CAPABLE | ||
| 958 | return AESNI_CAPABLE ? &aesni_192_cfb1 : &aes_192_cfb1; | ||
| 959 | #else | ||
| 960 | return &aes_192_cfb1; | 468 | return &aes_192_cfb1; |
| 961 | #endif | ||
| 962 | } | 469 | } |
| 963 | LCRYPTO_ALIAS(EVP_aes_192_cfb1); | 470 | LCRYPTO_ALIAS(EVP_aes_192_cfb1); |
| 964 | 471 | ||
| 965 | #ifdef AESNI_CAPABLE | ||
| 966 | static const EVP_CIPHER aesni_192_cfb8 = { | ||
| 967 | .nid = NID_aes_192_cfb8, | ||
| 968 | .block_size = 1, | ||
| 969 | .key_len = 24, | ||
| 970 | .iv_len = 16, | ||
| 971 | .flags = EVP_CIPH_CFB_MODE, | ||
| 972 | .init = aesni_init_key, | ||
| 973 | .do_cipher = aes_cfb8_cipher, | ||
| 974 | .ctx_size = sizeof(EVP_AES_KEY), | ||
| 975 | }; | ||
| 976 | #endif | ||
| 977 | |||
| 978 | static const EVP_CIPHER aes_192_cfb8 = { | 472 | static const EVP_CIPHER aes_192_cfb8 = { |
| 979 | .nid = NID_aes_192_cfb8, | 473 | .nid = NID_aes_192_cfb8, |
| 980 | .block_size = 1, | 474 | .block_size = 1, |
| @@ -989,27 +483,10 @@ static const EVP_CIPHER aes_192_cfb8 = { | |||
| 989 | const EVP_CIPHER * | 483 | const EVP_CIPHER * |
| 990 | EVP_aes_192_cfb8(void) | 484 | EVP_aes_192_cfb8(void) |
| 991 | { | 485 | { |
| 992 | #ifdef AESNI_CAPABLE | ||
| 993 | return AESNI_CAPABLE ? &aesni_192_cfb8 : &aes_192_cfb8; | ||
| 994 | #else | ||
| 995 | return &aes_192_cfb8; | 486 | return &aes_192_cfb8; |
| 996 | #endif | ||
| 997 | } | 487 | } |
| 998 | LCRYPTO_ALIAS(EVP_aes_192_cfb8); | 488 | LCRYPTO_ALIAS(EVP_aes_192_cfb8); |
| 999 | 489 | ||
| 1000 | #ifdef AESNI_CAPABLE | ||
| 1001 | static const EVP_CIPHER aesni_192_ctr = { | ||
| 1002 | .nid = NID_aes_192_ctr, | ||
| 1003 | .block_size = 1, | ||
| 1004 | .key_len = 24, | ||
| 1005 | .iv_len = 16, | ||
| 1006 | .flags = EVP_CIPH_CTR_MODE, | ||
| 1007 | .init = aesni_init_key, | ||
| 1008 | .do_cipher = aes_ctr_cipher, | ||
| 1009 | .ctx_size = sizeof(EVP_AES_KEY), | ||
| 1010 | }; | ||
| 1011 | #endif | ||
| 1012 | |||
| 1013 | static const EVP_CIPHER aes_192_ctr = { | 490 | static const EVP_CIPHER aes_192_ctr = { |
| 1014 | .nid = NID_aes_192_ctr, | 491 | .nid = NID_aes_192_ctr, |
| 1015 | .block_size = 1, | 492 | .block_size = 1, |
| @@ -1024,35 +501,17 @@ static const EVP_CIPHER aes_192_ctr = { | |||
| 1024 | const EVP_CIPHER * | 501 | const EVP_CIPHER * |
| 1025 | EVP_aes_192_ctr(void) | 502 | EVP_aes_192_ctr(void) |
| 1026 | { | 503 | { |
| 1027 | #ifdef AESNI_CAPABLE | ||
| 1028 | return AESNI_CAPABLE ? &aesni_192_ctr : &aes_192_ctr; | ||
| 1029 | #else | ||
| 1030 | return &aes_192_ctr; | 504 | return &aes_192_ctr; |
| 1031 | #endif | ||
| 1032 | } | 505 | } |
| 1033 | LCRYPTO_ALIAS(EVP_aes_192_ctr); | 506 | LCRYPTO_ALIAS(EVP_aes_192_ctr); |
| 1034 | 507 | ||
| 1035 | |||
| 1036 | #ifdef AESNI_CAPABLE | ||
| 1037 | static const EVP_CIPHER aesni_256_cbc = { | ||
| 1038 | .nid = NID_aes_256_cbc, | ||
| 1039 | .block_size = 16, | ||
| 1040 | .key_len = 32, | ||
| 1041 | .iv_len = 16, | ||
| 1042 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE, | ||
| 1043 | .init = aesni_init_key, | ||
| 1044 | .do_cipher = aesni_cbc_cipher, | ||
| 1045 | .ctx_size = sizeof(EVP_AES_KEY), | ||
| 1046 | }; | ||
| 1047 | #endif | ||
| 1048 | |||
| 1049 | static const EVP_CIPHER aes_256_cbc = { | 508 | static const EVP_CIPHER aes_256_cbc = { |
| 1050 | .nid = NID_aes_256_cbc, | 509 | .nid = NID_aes_256_cbc, |
| 1051 | .block_size = 16, | 510 | .block_size = 16, |
| 1052 | .key_len = 32, | 511 | .key_len = 32, |
| 1053 | .iv_len = 16, | 512 | .iv_len = 16, |
| 1054 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE, | 513 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE, |
| 1055 | .init = aes_init_key, | 514 | .init = aes_cbc_init_key, |
| 1056 | .do_cipher = aes_cbc_cipher, | 515 | .do_cipher = aes_cbc_cipher, |
| 1057 | .ctx_size = sizeof(EVP_AES_KEY), | 516 | .ctx_size = sizeof(EVP_AES_KEY), |
| 1058 | }; | 517 | }; |
| @@ -1060,34 +519,17 @@ static const EVP_CIPHER aes_256_cbc = { | |||
| 1060 | const EVP_CIPHER * | 519 | const EVP_CIPHER * |
| 1061 | EVP_aes_256_cbc(void) | 520 | EVP_aes_256_cbc(void) |
| 1062 | { | 521 | { |
| 1063 | #ifdef AESNI_CAPABLE | ||
| 1064 | return AESNI_CAPABLE ? &aesni_256_cbc : &aes_256_cbc; | ||
| 1065 | #else | ||
| 1066 | return &aes_256_cbc; | 522 | return &aes_256_cbc; |
| 1067 | #endif | ||
| 1068 | } | 523 | } |
| 1069 | LCRYPTO_ALIAS(EVP_aes_256_cbc); | 524 | LCRYPTO_ALIAS(EVP_aes_256_cbc); |
| 1070 | 525 | ||
| 1071 | #ifdef AESNI_CAPABLE | ||
| 1072 | static const EVP_CIPHER aesni_256_ecb = { | ||
| 1073 | .nid = NID_aes_256_ecb, | ||
| 1074 | .block_size = 16, | ||
| 1075 | .key_len = 32, | ||
| 1076 | .iv_len = 0, | ||
| 1077 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE, | ||
| 1078 | .init = aesni_init_key, | ||
| 1079 | .do_cipher = aesni_ecb_cipher, | ||
| 1080 | .ctx_size = sizeof(EVP_AES_KEY), | ||
| 1081 | }; | ||
| 1082 | #endif | ||
| 1083 | |||
| 1084 | static const EVP_CIPHER aes_256_ecb = { | 526 | static const EVP_CIPHER aes_256_ecb = { |
| 1085 | .nid = NID_aes_256_ecb, | 527 | .nid = NID_aes_256_ecb, |
| 1086 | .block_size = 16, | 528 | .block_size = 16, |
| 1087 | .key_len = 32, | 529 | .key_len = 32, |
| 1088 | .iv_len = 0, | 530 | .iv_len = 0, |
| 1089 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE, | 531 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_ECB_MODE, |
| 1090 | .init = aes_init_key, | 532 | .init = aes_ecb_init_key, |
| 1091 | .do_cipher = aes_ecb_cipher, | 533 | .do_cipher = aes_ecb_cipher, |
| 1092 | .ctx_size = sizeof(EVP_AES_KEY), | 534 | .ctx_size = sizeof(EVP_AES_KEY), |
| 1093 | }; | 535 | }; |
| @@ -1095,27 +537,10 @@ static const EVP_CIPHER aes_256_ecb = { | |||
| 1095 | const EVP_CIPHER * | 537 | const EVP_CIPHER * |
| 1096 | EVP_aes_256_ecb(void) | 538 | EVP_aes_256_ecb(void) |
| 1097 | { | 539 | { |
| 1098 | #ifdef AESNI_CAPABLE | ||
| 1099 | return AESNI_CAPABLE ? &aesni_256_ecb : &aes_256_ecb; | ||
| 1100 | #else | ||
| 1101 | return &aes_256_ecb; | 540 | return &aes_256_ecb; |
| 1102 | #endif | ||
| 1103 | } | 541 | } |
| 1104 | LCRYPTO_ALIAS(EVP_aes_256_ecb); | 542 | LCRYPTO_ALIAS(EVP_aes_256_ecb); |
| 1105 | 543 | ||
| 1106 | #ifdef AESNI_CAPABLE | ||
| 1107 | static const EVP_CIPHER aesni_256_ofb = { | ||
| 1108 | .nid = NID_aes_256_ofb128, | ||
| 1109 | .block_size = 1, | ||
| 1110 | .key_len = 32, | ||
| 1111 | .iv_len = 16, | ||
| 1112 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_OFB_MODE, | ||
| 1113 | .init = aesni_init_key, | ||
| 1114 | .do_cipher = aes_ofb_cipher, | ||
| 1115 | .ctx_size = sizeof(EVP_AES_KEY), | ||
| 1116 | }; | ||
| 1117 | #endif | ||
| 1118 | |||
| 1119 | static const EVP_CIPHER aes_256_ofb = { | 544 | static const EVP_CIPHER aes_256_ofb = { |
| 1120 | .nid = NID_aes_256_ofb128, | 545 | .nid = NID_aes_256_ofb128, |
| 1121 | .block_size = 1, | 546 | .block_size = 1, |
| @@ -1130,27 +555,10 @@ static const EVP_CIPHER aes_256_ofb = { | |||
| 1130 | const EVP_CIPHER * | 555 | const EVP_CIPHER * |
| 1131 | EVP_aes_256_ofb(void) | 556 | EVP_aes_256_ofb(void) |
| 1132 | { | 557 | { |
| 1133 | #ifdef AESNI_CAPABLE | ||
| 1134 | return AESNI_CAPABLE ? &aesni_256_ofb : &aes_256_ofb; | ||
| 1135 | #else | ||
| 1136 | return &aes_256_ofb; | 558 | return &aes_256_ofb; |
| 1137 | #endif | ||
| 1138 | } | 559 | } |
| 1139 | LCRYPTO_ALIAS(EVP_aes_256_ofb); | 560 | LCRYPTO_ALIAS(EVP_aes_256_ofb); |
| 1140 | 561 | ||
| 1141 | #ifdef AESNI_CAPABLE | ||
| 1142 | static const EVP_CIPHER aesni_256_cfb = { | ||
| 1143 | .nid = NID_aes_256_cfb128, | ||
| 1144 | .block_size = 1, | ||
| 1145 | .key_len = 32, | ||
| 1146 | .iv_len = 16, | ||
| 1147 | .flags = EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CFB_MODE, | ||
| 1148 | .init = aesni_init_key, | ||
| 1149 | .do_cipher = aes_cfb_cipher, | ||
| 1150 | .ctx_size = sizeof(EVP_AES_KEY), | ||
| 1151 | }; | ||
| 1152 | #endif | ||
| 1153 | |||
| 1154 | static const EVP_CIPHER aes_256_cfb = { | 562 | static const EVP_CIPHER aes_256_cfb = { |
| 1155 | .nid = NID_aes_256_cfb128, | 563 | .nid = NID_aes_256_cfb128, |
| 1156 | .block_size = 1, | 564 | .block_size = 1, |
| @@ -1165,27 +573,10 @@ static const EVP_CIPHER aes_256_cfb = { | |||
| 1165 | const EVP_CIPHER * | 573 | const EVP_CIPHER * |
| 1166 | EVP_aes_256_cfb128(void) | 574 | EVP_aes_256_cfb128(void) |
| 1167 | { | 575 | { |
| 1168 | #ifdef AESNI_CAPABLE | ||
| 1169 | return AESNI_CAPABLE ? &aesni_256_cfb : &aes_256_cfb; | ||
| 1170 | #else | ||
| 1171 | return &aes_256_cfb; | 576 | return &aes_256_cfb; |
| 1172 | #endif | ||
| 1173 | } | 577 | } |
| 1174 | LCRYPTO_ALIAS(EVP_aes_256_cfb128); | 578 | LCRYPTO_ALIAS(EVP_aes_256_cfb128); |
| 1175 | 579 | ||
| 1176 | #ifdef AESNI_CAPABLE | ||
| 1177 | static const EVP_CIPHER aesni_256_cfb1 = { | ||
| 1178 | .nid = NID_aes_256_cfb1, | ||
| 1179 | .block_size = 1, | ||
| 1180 | .key_len = 32, | ||
| 1181 | .iv_len = 16, | ||
| 1182 | .flags = EVP_CIPH_CFB_MODE, | ||
| 1183 | .init = aesni_init_key, | ||
| 1184 | .do_cipher = aes_cfb1_cipher, | ||
| 1185 | .ctx_size = sizeof(EVP_AES_KEY), | ||
| 1186 | }; | ||
| 1187 | #endif | ||
| 1188 | |||
| 1189 | static const EVP_CIPHER aes_256_cfb1 = { | 580 | static const EVP_CIPHER aes_256_cfb1 = { |
| 1190 | .nid = NID_aes_256_cfb1, | 581 | .nid = NID_aes_256_cfb1, |
| 1191 | .block_size = 1, | 582 | .block_size = 1, |
| @@ -1200,27 +591,10 @@ static const EVP_CIPHER aes_256_cfb1 = { | |||
| 1200 | const EVP_CIPHER * | 591 | const EVP_CIPHER * |
| 1201 | EVP_aes_256_cfb1(void) | 592 | EVP_aes_256_cfb1(void) |
| 1202 | { | 593 | { |
| 1203 | #ifdef AESNI_CAPABLE | ||
| 1204 | return AESNI_CAPABLE ? &aesni_256_cfb1 : &aes_256_cfb1; | ||
| 1205 | #else | ||
| 1206 | return &aes_256_cfb1; | 594 | return &aes_256_cfb1; |
| 1207 | #endif | ||
| 1208 | } | 595 | } |
| 1209 | LCRYPTO_ALIAS(EVP_aes_256_cfb1); | 596 | LCRYPTO_ALIAS(EVP_aes_256_cfb1); |
| 1210 | 597 | ||
| 1211 | #ifdef AESNI_CAPABLE | ||
| 1212 | static const EVP_CIPHER aesni_256_cfb8 = { | ||
| 1213 | .nid = NID_aes_256_cfb8, | ||
| 1214 | .block_size = 1, | ||
| 1215 | .key_len = 32, | ||
| 1216 | .iv_len = 16, | ||
| 1217 | .flags = EVP_CIPH_CFB_MODE, | ||
| 1218 | .init = aesni_init_key, | ||
| 1219 | .do_cipher = aes_cfb8_cipher, | ||
| 1220 | .ctx_size = sizeof(EVP_AES_KEY), | ||
| 1221 | }; | ||
| 1222 | #endif | ||
| 1223 | |||
| 1224 | static const EVP_CIPHER aes_256_cfb8 = { | 598 | static const EVP_CIPHER aes_256_cfb8 = { |
| 1225 | .nid = NID_aes_256_cfb8, | 599 | .nid = NID_aes_256_cfb8, |
| 1226 | .block_size = 1, | 600 | .block_size = 1, |
| @@ -1235,27 +609,10 @@ static const EVP_CIPHER aes_256_cfb8 = { | |||
| 1235 | const EVP_CIPHER * | 609 | const EVP_CIPHER * |
| 1236 | EVP_aes_256_cfb8(void) | 610 | EVP_aes_256_cfb8(void) |
| 1237 | { | 611 | { |
| 1238 | #ifdef AESNI_CAPABLE | ||
| 1239 | return AESNI_CAPABLE ? &aesni_256_cfb8 : &aes_256_cfb8; | ||
| 1240 | #else | ||
| 1241 | return &aes_256_cfb8; | 612 | return &aes_256_cfb8; |
| 1242 | #endif | ||
| 1243 | } | 613 | } |
| 1244 | LCRYPTO_ALIAS(EVP_aes_256_cfb8); | 614 | LCRYPTO_ALIAS(EVP_aes_256_cfb8); |
| 1245 | 615 | ||
| 1246 | #ifdef AESNI_CAPABLE | ||
| 1247 | static const EVP_CIPHER aesni_256_ctr = { | ||
| 1248 | .nid = NID_aes_256_ctr, | ||
| 1249 | .block_size = 1, | ||
| 1250 | .key_len = 32, | ||
| 1251 | .iv_len = 16, | ||
| 1252 | .flags = EVP_CIPH_CTR_MODE, | ||
| 1253 | .init = aesni_init_key, | ||
| 1254 | .do_cipher = aes_ctr_cipher, | ||
| 1255 | .ctx_size = sizeof(EVP_AES_KEY), | ||
| 1256 | }; | ||
| 1257 | #endif | ||
| 1258 | |||
| 1259 | static const EVP_CIPHER aes_256_ctr = { | 616 | static const EVP_CIPHER aes_256_ctr = { |
| 1260 | .nid = NID_aes_256_ctr, | 617 | .nid = NID_aes_256_ctr, |
| 1261 | .block_size = 1, | 618 | .block_size = 1, |
| @@ -1270,11 +627,7 @@ static const EVP_CIPHER aes_256_ctr = { | |||
| 1270 | const EVP_CIPHER * | 627 | const EVP_CIPHER * |
| 1271 | EVP_aes_256_ctr(void) | 628 | EVP_aes_256_ctr(void) |
| 1272 | { | 629 | { |
| 1273 | #ifdef AESNI_CAPABLE | ||
| 1274 | return AESNI_CAPABLE ? &aesni_256_ctr : &aes_256_ctr; | ||
| 1275 | #else | ||
| 1276 | return &aes_256_ctr; | 630 | return &aes_256_ctr; |
| 1277 | #endif | ||
| 1278 | } | 631 | } |
| 1279 | LCRYPTO_ALIAS(EVP_aes_256_ctr); | 632 | LCRYPTO_ALIAS(EVP_aes_256_ctr); |
| 1280 | 633 | ||
| @@ -1455,35 +808,6 @@ aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) | |||
| 1455 | } | 808 | } |
| 1456 | } | 809 | } |
| 1457 | 810 | ||
| 1458 | static ctr128_f | ||
| 1459 | aes_gcm_set_key(AES_KEY *aes_key, GCM128_CONTEXT *gcm_ctx, | ||
| 1460 | const unsigned char *key, size_t key_len) | ||
| 1461 | { | ||
| 1462 | #ifdef BSAES_CAPABLE | ||
| 1463 | if (BSAES_CAPABLE) { | ||
| 1464 | AES_set_encrypt_key(key, key_len * 8, aes_key); | ||
| 1465 | CRYPTO_gcm128_init(gcm_ctx, aes_key, (block128_f)AES_encrypt); | ||
| 1466 | return (ctr128_f)bsaes_ctr32_encrypt_blocks; | ||
| 1467 | } else | ||
| 1468 | #endif | ||
| 1469 | #ifdef VPAES_CAPABLE | ||
| 1470 | if (VPAES_CAPABLE) { | ||
| 1471 | vpaes_set_encrypt_key(key, key_len * 8, aes_key); | ||
| 1472 | CRYPTO_gcm128_init(gcm_ctx, aes_key, (block128_f)vpaes_encrypt); | ||
| 1473 | return NULL; | ||
| 1474 | } else | ||
| 1475 | #endif | ||
| 1476 | (void)0; /* terminate potentially open 'else' */ | ||
| 1477 | |||
| 1478 | AES_set_encrypt_key(key, key_len * 8, aes_key); | ||
| 1479 | CRYPTO_gcm128_init(gcm_ctx, aes_key, (block128_f)AES_encrypt); | ||
| 1480 | #ifdef AES_CTR_ASM | ||
| 1481 | return (ctr128_f)AES_ctr32_encrypt; | ||
| 1482 | #else | ||
| 1483 | return NULL; | ||
| 1484 | #endif | ||
| 1485 | } | ||
| 1486 | |||
| 1487 | static int | 811 | static int |
| 1488 | aes_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 812 | aes_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
| 1489 | const unsigned char *iv, int enc) | 813 | const unsigned char *iv, int enc) |
| @@ -1493,8 +817,8 @@ aes_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | |||
| 1493 | if (!iv && !key) | 817 | if (!iv && !key) |
| 1494 | return 1; | 818 | return 1; |
| 1495 | if (key) { | 819 | if (key) { |
| 1496 | gctx->ctr = aes_gcm_set_key(&gctx->ks, &gctx->gcm, | 820 | AES_set_encrypt_key(key, ctx->key_len * 8, &gctx->ks); |
| 1497 | key, ctx->key_len); | 821 | CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks, aes_encrypt_block128); |
| 1498 | 822 | ||
| 1499 | /* If we have an iv can set it directly, otherwise use | 823 | /* If we have an iv can set it directly, otherwise use |
| 1500 | * saved IV. | 824 | * saved IV. |
| @@ -1554,14 +878,9 @@ aes_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 1554 | len -= EVP_GCM_TLS_EXPLICIT_IV_LEN + EVP_GCM_TLS_TAG_LEN; | 878 | len -= EVP_GCM_TLS_EXPLICIT_IV_LEN + EVP_GCM_TLS_TAG_LEN; |
| 1555 | if (ctx->encrypt) { | 879 | if (ctx->encrypt) { |
| 1556 | /* Encrypt payload */ | 880 | /* Encrypt payload */ |
| 1557 | if (gctx->ctr) { | 881 | if (CRYPTO_gcm128_encrypt_ctr32(&gctx->gcm, in, out, len, |
| 1558 | if (CRYPTO_gcm128_encrypt_ctr32(&gctx->gcm, in, out, | 882 | aes_ctr32_encrypt_ctr128f)) |
| 1559 | len, gctx->ctr)) | 883 | goto err; |
| 1560 | goto err; | ||
| 1561 | } else { | ||
| 1562 | if (CRYPTO_gcm128_encrypt(&gctx->gcm, in, out, len)) | ||
| 1563 | goto err; | ||
| 1564 | } | ||
| 1565 | out += len; | 884 | out += len; |
| 1566 | 885 | ||
| 1567 | /* Finally write tag */ | 886 | /* Finally write tag */ |
| @@ -1569,19 +888,15 @@ aes_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 1569 | rv = len + EVP_GCM_TLS_EXPLICIT_IV_LEN + EVP_GCM_TLS_TAG_LEN; | 888 | rv = len + EVP_GCM_TLS_EXPLICIT_IV_LEN + EVP_GCM_TLS_TAG_LEN; |
| 1570 | } else { | 889 | } else { |
| 1571 | /* Decrypt */ | 890 | /* Decrypt */ |
| 1572 | if (gctx->ctr) { | 891 | if (CRYPTO_gcm128_decrypt_ctr32(&gctx->gcm, in, out, len, |
| 1573 | if (CRYPTO_gcm128_decrypt_ctr32(&gctx->gcm, in, out, | 892 | aes_ctr32_encrypt_ctr128f)) |
| 1574 | len, gctx->ctr)) | 893 | goto err; |
| 1575 | goto err; | 894 | |
| 1576 | } else { | ||
| 1577 | if (CRYPTO_gcm128_decrypt(&gctx->gcm, in, out, len)) | ||
| 1578 | goto err; | ||
| 1579 | } | ||
| 1580 | /* Retrieve tag */ | 895 | /* Retrieve tag */ |
| 1581 | CRYPTO_gcm128_tag(&gctx->gcm, ctx->buf, EVP_GCM_TLS_TAG_LEN); | 896 | CRYPTO_gcm128_tag(&gctx->gcm, ctx->buf, EVP_GCM_TLS_TAG_LEN); |
| 1582 | 897 | ||
| 1583 | /* If tag mismatch wipe buffer */ | 898 | /* If tag mismatch wipe buffer */ |
| 1584 | if (memcmp(ctx->buf, in + len, EVP_GCM_TLS_TAG_LEN)) { | 899 | if (timingsafe_memcmp(ctx->buf, in + len, EVP_GCM_TLS_TAG_LEN) != 0) { |
| 1585 | explicit_bzero(out, len); | 900 | explicit_bzero(out, len); |
| 1586 | goto err; | 901 | goto err; |
| 1587 | } | 902 | } |
| @@ -1615,25 +930,13 @@ aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 1615 | if (CRYPTO_gcm128_aad(&gctx->gcm, in, len)) | 930 | if (CRYPTO_gcm128_aad(&gctx->gcm, in, len)) |
| 1616 | return -1; | 931 | return -1; |
| 1617 | } else if (ctx->encrypt) { | 932 | } else if (ctx->encrypt) { |
| 1618 | if (gctx->ctr) { | 933 | if (CRYPTO_gcm128_encrypt_ctr32(&gctx->gcm, |
| 1619 | if (CRYPTO_gcm128_encrypt_ctr32(&gctx->gcm, | 934 | in, out, len, aes_ctr32_encrypt_ctr128f)) |
| 1620 | in, out, len, gctx->ctr)) | 935 | return -1; |
| 1621 | return -1; | ||
| 1622 | } else { | ||
| 1623 | if (CRYPTO_gcm128_encrypt(&gctx->gcm, | ||
| 1624 | in, out, len)) | ||
| 1625 | return -1; | ||
| 1626 | } | ||
| 1627 | } else { | 936 | } else { |
| 1628 | if (gctx->ctr) { | 937 | if (CRYPTO_gcm128_decrypt_ctr32(&gctx->gcm, |
| 1629 | if (CRYPTO_gcm128_decrypt_ctr32(&gctx->gcm, | 938 | in, out, len, aes_ctr32_encrypt_ctr128f)) |
| 1630 | in, out, len, gctx->ctr)) | 939 | return -1; |
| 1631 | return -1; | ||
| 1632 | } else { | ||
| 1633 | if (CRYPTO_gcm128_decrypt(&gctx->gcm, | ||
| 1634 | in, out, len)) | ||
| 1635 | return -1; | ||
| 1636 | } | ||
| 1637 | } | 940 | } |
| 1638 | return len; | 941 | return len; |
| 1639 | } else { | 942 | } else { |
| @@ -1662,22 +965,6 @@ aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 1662 | EVP_CIPH_FLAG_CUSTOM_CIPHER | EVP_CIPH_ALWAYS_CALL_INIT | \ | 965 | EVP_CIPH_FLAG_CUSTOM_CIPHER | EVP_CIPH_ALWAYS_CALL_INIT | \ |
| 1663 | EVP_CIPH_CTRL_INIT | EVP_CIPH_CUSTOM_COPY ) | 966 | EVP_CIPH_CTRL_INIT | EVP_CIPH_CUSTOM_COPY ) |
| 1664 | 967 | ||
| 1665 | |||
| 1666 | #ifdef AESNI_CAPABLE | ||
| 1667 | static const EVP_CIPHER aesni_128_gcm = { | ||
| 1668 | .nid = NID_aes_128_gcm, | ||
| 1669 | .block_size = 1, | ||
| 1670 | .key_len = 16, | ||
| 1671 | .iv_len = 12, | ||
| 1672 | .flags = EVP_CIPH_FLAG_AEAD_CIPHER|CUSTOM_FLAGS | EVP_CIPH_GCM_MODE, | ||
| 1673 | .init = aesni_gcm_init_key, | ||
| 1674 | .do_cipher = aes_gcm_cipher, | ||
| 1675 | .cleanup = aes_gcm_cleanup, | ||
| 1676 | .ctx_size = sizeof(EVP_AES_GCM_CTX), | ||
| 1677 | .ctrl = aes_gcm_ctrl, | ||
| 1678 | }; | ||
| 1679 | #endif | ||
| 1680 | |||
| 1681 | static const EVP_CIPHER aes_128_gcm = { | 968 | static const EVP_CIPHER aes_128_gcm = { |
| 1682 | .nid = NID_aes_128_gcm, | 969 | .nid = NID_aes_128_gcm, |
| 1683 | .block_size = 1, | 970 | .block_size = 1, |
| @@ -1694,29 +981,10 @@ static const EVP_CIPHER aes_128_gcm = { | |||
| 1694 | const EVP_CIPHER * | 981 | const EVP_CIPHER * |
| 1695 | EVP_aes_128_gcm(void) | 982 | EVP_aes_128_gcm(void) |
| 1696 | { | 983 | { |
| 1697 | #ifdef AESNI_CAPABLE | ||
| 1698 | return AESNI_CAPABLE ? &aesni_128_gcm : &aes_128_gcm; | ||
| 1699 | #else | ||
| 1700 | return &aes_128_gcm; | 984 | return &aes_128_gcm; |
| 1701 | #endif | ||
| 1702 | } | 985 | } |
| 1703 | LCRYPTO_ALIAS(EVP_aes_128_gcm); | 986 | LCRYPTO_ALIAS(EVP_aes_128_gcm); |
| 1704 | 987 | ||
| 1705 | #ifdef AESNI_CAPABLE | ||
| 1706 | static const EVP_CIPHER aesni_192_gcm = { | ||
| 1707 | .nid = NID_aes_192_gcm, | ||
| 1708 | .block_size = 1, | ||
| 1709 | .key_len = 24, | ||
| 1710 | .iv_len = 12, | ||
| 1711 | .flags = EVP_CIPH_FLAG_AEAD_CIPHER|CUSTOM_FLAGS | EVP_CIPH_GCM_MODE, | ||
| 1712 | .init = aesni_gcm_init_key, | ||
| 1713 | .do_cipher = aes_gcm_cipher, | ||
| 1714 | .cleanup = aes_gcm_cleanup, | ||
| 1715 | .ctx_size = sizeof(EVP_AES_GCM_CTX), | ||
| 1716 | .ctrl = aes_gcm_ctrl, | ||
| 1717 | }; | ||
| 1718 | #endif | ||
| 1719 | |||
| 1720 | static const EVP_CIPHER aes_192_gcm = { | 988 | static const EVP_CIPHER aes_192_gcm = { |
| 1721 | .nid = NID_aes_192_gcm, | 989 | .nid = NID_aes_192_gcm, |
| 1722 | .block_size = 1, | 990 | .block_size = 1, |
| @@ -1733,29 +1001,10 @@ static const EVP_CIPHER aes_192_gcm = { | |||
| 1733 | const EVP_CIPHER * | 1001 | const EVP_CIPHER * |
| 1734 | EVP_aes_192_gcm(void) | 1002 | EVP_aes_192_gcm(void) |
| 1735 | { | 1003 | { |
| 1736 | #ifdef AESNI_CAPABLE | ||
| 1737 | return AESNI_CAPABLE ? &aesni_192_gcm : &aes_192_gcm; | ||
| 1738 | #else | ||
| 1739 | return &aes_192_gcm; | 1004 | return &aes_192_gcm; |
| 1740 | #endif | ||
| 1741 | } | 1005 | } |
| 1742 | LCRYPTO_ALIAS(EVP_aes_192_gcm); | 1006 | LCRYPTO_ALIAS(EVP_aes_192_gcm); |
| 1743 | 1007 | ||
| 1744 | #ifdef AESNI_CAPABLE | ||
| 1745 | static const EVP_CIPHER aesni_256_gcm = { | ||
| 1746 | .nid = NID_aes_256_gcm, | ||
| 1747 | .block_size = 1, | ||
| 1748 | .key_len = 32, | ||
| 1749 | .iv_len = 12, | ||
| 1750 | .flags = EVP_CIPH_FLAG_AEAD_CIPHER|CUSTOM_FLAGS | EVP_CIPH_GCM_MODE, | ||
| 1751 | .init = aesni_gcm_init_key, | ||
| 1752 | .do_cipher = aes_gcm_cipher, | ||
| 1753 | .cleanup = aes_gcm_cleanup, | ||
| 1754 | .ctx_size = sizeof(EVP_AES_GCM_CTX), | ||
| 1755 | .ctrl = aes_gcm_ctrl, | ||
| 1756 | }; | ||
| 1757 | #endif | ||
| 1758 | |||
| 1759 | static const EVP_CIPHER aes_256_gcm = { | 1008 | static const EVP_CIPHER aes_256_gcm = { |
| 1760 | .nid = NID_aes_256_gcm, | 1009 | .nid = NID_aes_256_gcm, |
| 1761 | .block_size = 1, | 1010 | .block_size = 1, |
| @@ -1772,11 +1021,7 @@ static const EVP_CIPHER aes_256_gcm = { | |||
| 1772 | const EVP_CIPHER * | 1021 | const EVP_CIPHER * |
| 1773 | EVP_aes_256_gcm(void) | 1022 | EVP_aes_256_gcm(void) |
| 1774 | { | 1023 | { |
| 1775 | #ifdef AESNI_CAPABLE | ||
| 1776 | return AESNI_CAPABLE ? &aesni_256_gcm : &aes_256_gcm; | ||
| 1777 | #else | ||
| 1778 | return &aes_256_gcm; | 1024 | return &aes_256_gcm; |
| 1779 | #endif | ||
| 1780 | } | 1025 | } |
| 1781 | LCRYPTO_ALIAS(EVP_aes_256_gcm); | 1026 | LCRYPTO_ALIAS(EVP_aes_256_gcm); |
| 1782 | 1027 | ||
| @@ -1818,64 +1063,24 @@ aes_xts_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) | |||
| 1818 | 1063 | ||
| 1819 | static int | 1064 | static int |
| 1820 | aes_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 1065 | aes_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
| 1821 | const unsigned char *iv, int enc) | 1066 | const unsigned char *iv, int encrypt) |
| 1822 | { | 1067 | { |
| 1823 | EVP_AES_XTS_CTX *xctx = ctx->cipher_data; | 1068 | EVP_AES_XTS_CTX *xctx = ctx->cipher_data; |
| 1824 | 1069 | ||
| 1825 | if (!iv && !key) | 1070 | if (key != NULL) { |
| 1826 | return 1; | ||
| 1827 | |||
| 1828 | if (key) do { | ||
| 1829 | #ifdef AES_XTS_ASM | ||
| 1830 | xctx->stream = enc ? AES_xts_encrypt : AES_xts_decrypt; | ||
| 1831 | #else | ||
| 1832 | xctx->stream = NULL; | ||
| 1833 | #endif | ||
| 1834 | /* key_len is two AES keys */ | 1071 | /* key_len is two AES keys */ |
| 1835 | #ifdef BSAES_CAPABLE | 1072 | if (encrypt) |
| 1836 | if (BSAES_CAPABLE) | ||
| 1837 | xctx->stream = enc ? bsaes_xts_encrypt : | ||
| 1838 | bsaes_xts_decrypt; | ||
| 1839 | else | ||
| 1840 | #endif | ||
| 1841 | #ifdef VPAES_CAPABLE | ||
| 1842 | if (VPAES_CAPABLE) { | ||
| 1843 | if (enc) { | ||
| 1844 | vpaes_set_encrypt_key(key, ctx->key_len * 4, | ||
| 1845 | &xctx->ks1); | ||
| 1846 | xctx->xts.block1 = (block128_f)vpaes_encrypt; | ||
| 1847 | } else { | ||
| 1848 | vpaes_set_decrypt_key(key, ctx->key_len * 4, | ||
| 1849 | &xctx->ks1); | ||
| 1850 | xctx->xts.block1 = (block128_f)vpaes_decrypt; | ||
| 1851 | } | ||
| 1852 | |||
| 1853 | vpaes_set_encrypt_key(key + ctx->key_len / 2, | ||
| 1854 | ctx->key_len * 4, &xctx->ks2); | ||
| 1855 | xctx->xts.block2 = (block128_f)vpaes_encrypt; | ||
| 1856 | |||
| 1857 | xctx->xts.key1 = &xctx->ks1; | ||
| 1858 | break; | ||
| 1859 | } else | ||
| 1860 | #endif | ||
| 1861 | (void)0; /* terminate potentially open 'else' */ | ||
| 1862 | |||
| 1863 | if (enc) { | ||
| 1864 | AES_set_encrypt_key(key, ctx->key_len * 4, &xctx->ks1); | 1073 | AES_set_encrypt_key(key, ctx->key_len * 4, &xctx->ks1); |
| 1865 | xctx->xts.block1 = (block128_f)AES_encrypt; | 1074 | else |
| 1866 | } else { | ||
| 1867 | AES_set_decrypt_key(key, ctx->key_len * 4, &xctx->ks1); | 1075 | AES_set_decrypt_key(key, ctx->key_len * 4, &xctx->ks1); |
| 1868 | xctx->xts.block1 = (block128_f)AES_decrypt; | ||
| 1869 | } | ||
| 1870 | 1076 | ||
| 1871 | AES_set_encrypt_key(key + ctx->key_len / 2, | 1077 | AES_set_encrypt_key(key + ctx->key_len / 2, ctx->key_len * 4, |
| 1872 | ctx->key_len * 4, &xctx->ks2); | 1078 | &xctx->ks2); |
| 1873 | xctx->xts.block2 = (block128_f)AES_encrypt; | ||
| 1874 | 1079 | ||
| 1875 | xctx->xts.key1 = &xctx->ks1; | 1080 | xctx->xts.key1 = &xctx->ks1; |
| 1876 | } while (0); | 1081 | } |
| 1877 | 1082 | ||
| 1878 | if (iv) { | 1083 | if (iv != NULL) { |
| 1879 | xctx->xts.key2 = &xctx->ks2; | 1084 | xctx->xts.key2 = &xctx->ks2; |
| 1880 | memcpy(ctx->iv, iv, 16); | 1085 | memcpy(ctx->iv, iv, 16); |
| 1881 | } | 1086 | } |
| @@ -1889,17 +1094,15 @@ aes_xts_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 1889 | { | 1094 | { |
| 1890 | EVP_AES_XTS_CTX *xctx = ctx->cipher_data; | 1095 | EVP_AES_XTS_CTX *xctx = ctx->cipher_data; |
| 1891 | 1096 | ||
| 1892 | if (!xctx->xts.key1 || !xctx->xts.key2) | 1097 | if (xctx->xts.key1 == NULL || xctx->xts.key2 == NULL) |
| 1893 | return 0; | ||
| 1894 | if (!out || !in || len < AES_BLOCK_SIZE) | ||
| 1895 | return 0; | 1098 | return 0; |
| 1896 | 1099 | ||
| 1897 | if (xctx->stream) | 1100 | if (out == NULL || in == NULL || len < AES_BLOCK_SIZE) |
| 1898 | (*xctx->stream)(in, out, len, xctx->xts.key1, xctx->xts.key2, | ||
| 1899 | ctx->iv); | ||
| 1900 | else if (CRYPTO_xts128_encrypt(&xctx->xts, ctx->iv, in, out, len, | ||
| 1901 | ctx->encrypt)) | ||
| 1902 | return 0; | 1101 | return 0; |
| 1102 | |||
| 1103 | aes_xts_encrypt_internal(in, out, len, xctx->xts.key1, xctx->xts.key2, | ||
| 1104 | ctx->iv, ctx->encrypt); | ||
| 1105 | |||
| 1903 | return 1; | 1106 | return 1; |
| 1904 | } | 1107 | } |
| 1905 | 1108 | ||
| @@ -1907,22 +1110,6 @@ aes_xts_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 1907 | ( EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CUSTOM_IV | \ | 1110 | ( EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CUSTOM_IV | \ |
| 1908 | EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CTRL_INIT | EVP_CIPH_CUSTOM_COPY ) | 1111 | EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CTRL_INIT | EVP_CIPH_CUSTOM_COPY ) |
| 1909 | 1112 | ||
| 1910 | |||
| 1911 | #ifdef AESNI_CAPABLE | ||
| 1912 | static const EVP_CIPHER aesni_128_xts = { | ||
| 1913 | .nid = NID_aes_128_xts, | ||
| 1914 | .block_size = 1, | ||
| 1915 | .key_len = 2 * 16, | ||
| 1916 | .iv_len = 16, | ||
| 1917 | .flags = XTS_FLAGS | EVP_CIPH_XTS_MODE, | ||
| 1918 | .init = aesni_xts_init_key, | ||
| 1919 | .do_cipher = aes_xts_cipher, | ||
| 1920 | .cleanup = NULL, | ||
| 1921 | .ctx_size = sizeof(EVP_AES_XTS_CTX), | ||
| 1922 | .ctrl = aes_xts_ctrl, | ||
| 1923 | }; | ||
| 1924 | #endif | ||
| 1925 | |||
| 1926 | static const EVP_CIPHER aes_128_xts = { | 1113 | static const EVP_CIPHER aes_128_xts = { |
| 1927 | .nid = NID_aes_128_xts, | 1114 | .nid = NID_aes_128_xts, |
| 1928 | .block_size = 1, | 1115 | .block_size = 1, |
| @@ -1939,29 +1126,10 @@ static const EVP_CIPHER aes_128_xts = { | |||
| 1939 | const EVP_CIPHER * | 1126 | const EVP_CIPHER * |
| 1940 | EVP_aes_128_xts(void) | 1127 | EVP_aes_128_xts(void) |
| 1941 | { | 1128 | { |
| 1942 | #ifdef AESNI_CAPABLE | ||
| 1943 | return AESNI_CAPABLE ? &aesni_128_xts : &aes_128_xts; | ||
| 1944 | #else | ||
| 1945 | return &aes_128_xts; | 1129 | return &aes_128_xts; |
| 1946 | #endif | ||
| 1947 | } | 1130 | } |
| 1948 | LCRYPTO_ALIAS(EVP_aes_128_xts); | 1131 | LCRYPTO_ALIAS(EVP_aes_128_xts); |
| 1949 | 1132 | ||
| 1950 | #ifdef AESNI_CAPABLE | ||
| 1951 | static const EVP_CIPHER aesni_256_xts = { | ||
| 1952 | .nid = NID_aes_256_xts, | ||
| 1953 | .block_size = 1, | ||
| 1954 | .key_len = 2 * 32, | ||
| 1955 | .iv_len = 16, | ||
| 1956 | .flags = XTS_FLAGS | EVP_CIPH_XTS_MODE, | ||
| 1957 | .init = aesni_xts_init_key, | ||
| 1958 | .do_cipher = aes_xts_cipher, | ||
| 1959 | .cleanup = NULL, | ||
| 1960 | .ctx_size = sizeof(EVP_AES_XTS_CTX), | ||
| 1961 | .ctrl = aes_xts_ctrl, | ||
| 1962 | }; | ||
| 1963 | #endif | ||
| 1964 | |||
| 1965 | static const EVP_CIPHER aes_256_xts = { | 1133 | static const EVP_CIPHER aes_256_xts = { |
| 1966 | .nid = NID_aes_256_xts, | 1134 | .nid = NID_aes_256_xts, |
| 1967 | .block_size = 1, | 1135 | .block_size = 1, |
| @@ -1978,11 +1146,7 @@ static const EVP_CIPHER aes_256_xts = { | |||
| 1978 | const EVP_CIPHER * | 1146 | const EVP_CIPHER * |
| 1979 | EVP_aes_256_xts(void) | 1147 | EVP_aes_256_xts(void) |
| 1980 | { | 1148 | { |
| 1981 | #ifdef AESNI_CAPABLE | ||
| 1982 | return AESNI_CAPABLE ? &aesni_256_xts : &aes_256_xts; | ||
| 1983 | #else | ||
| 1984 | return &aes_256_xts; | 1149 | return &aes_256_xts; |
| 1985 | #endif | ||
| 1986 | } | 1150 | } |
| 1987 | LCRYPTO_ALIAS(EVP_aes_256_xts); | 1151 | LCRYPTO_ALIAS(EVP_aes_256_xts); |
| 1988 | 1152 | ||
| @@ -2062,23 +1226,12 @@ aes_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | |||
| 2062 | 1226 | ||
| 2063 | if (!iv && !key) | 1227 | if (!iv && !key) |
| 2064 | return 1; | 1228 | return 1; |
| 2065 | if (key) do { | 1229 | if (key) { |
| 2066 | #ifdef VPAES_CAPABLE | ||
| 2067 | if (VPAES_CAPABLE) { | ||
| 2068 | vpaes_set_encrypt_key(key, ctx->key_len*8, &cctx->ks); | ||
| 2069 | CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, | ||
| 2070 | &cctx->ks, (block128_f)vpaes_encrypt); | ||
| 2071 | cctx->str = NULL; | ||
| 2072 | cctx->key_set = 1; | ||
| 2073 | break; | ||
| 2074 | } | ||
| 2075 | #endif | ||
| 2076 | AES_set_encrypt_key(key, ctx->key_len * 8, &cctx->ks); | 1230 | AES_set_encrypt_key(key, ctx->key_len * 8, &cctx->ks); |
| 2077 | CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, | 1231 | CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, |
| 2078 | &cctx->ks, (block128_f)AES_encrypt); | 1232 | &cctx->ks, aes_encrypt_block128); |
| 2079 | cctx->str = NULL; | ||
| 2080 | cctx->key_set = 1; | 1233 | cctx->key_set = 1; |
| 2081 | } while (0); | 1234 | } |
| 2082 | if (iv) { | 1235 | if (iv) { |
| 2083 | memcpy(ctx->iv, iv, 15 - cctx->L); | 1236 | memcpy(ctx->iv, iv, 15 - cctx->L); |
| 2084 | cctx->iv_set = 1; | 1237 | cctx->iv_set = 1; |
| @@ -2094,7 +1247,14 @@ aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 2094 | CCM128_CONTEXT *ccm = &cctx->ccm; | 1247 | CCM128_CONTEXT *ccm = &cctx->ccm; |
| 2095 | 1248 | ||
| 2096 | /* If not set up, return error */ | 1249 | /* If not set up, return error */ |
| 2097 | if (!cctx->iv_set && !cctx->key_set) | 1250 | if (!cctx->key_set) |
| 1251 | return -1; | ||
| 1252 | |||
| 1253 | /* EVP_*Final() doesn't return any data */ | ||
| 1254 | if (in == NULL && out != NULL) | ||
| 1255 | return 0; | ||
| 1256 | |||
| 1257 | if (!cctx->iv_set) | ||
| 2098 | return -1; | 1258 | return -1; |
| 2099 | if (!ctx->encrypt && !cctx->tag_set) | 1259 | if (!ctx->encrypt && !cctx->tag_set) |
| 2100 | return -1; | 1260 | return -1; |
| @@ -2113,9 +1273,7 @@ aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 2113 | CRYPTO_ccm128_aad(ccm, in, len); | 1273 | CRYPTO_ccm128_aad(ccm, in, len); |
| 2114 | return len; | 1274 | return len; |
| 2115 | } | 1275 | } |
| 2116 | /* EVP_*Final() doesn't return any data */ | 1276 | |
| 2117 | if (!in) | ||
| 2118 | return 0; | ||
| 2119 | /* If not set length yet do it */ | 1277 | /* If not set length yet do it */ |
| 2120 | if (!cctx->len_set) { | 1278 | if (!cctx->len_set) { |
| 2121 | if (CRYPTO_ccm128_setiv(ccm, ctx->iv, 15 - cctx->L, len)) | 1279 | if (CRYPTO_ccm128_setiv(ccm, ctx->iv, 15 - cctx->L, len)) |
| @@ -2123,18 +1281,18 @@ aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 2123 | cctx->len_set = 1; | 1281 | cctx->len_set = 1; |
| 2124 | } | 1282 | } |
| 2125 | if (ctx->encrypt) { | 1283 | if (ctx->encrypt) { |
| 2126 | if (cctx->str ? CRYPTO_ccm128_encrypt_ccm64(ccm, in, out, len, | 1284 | if (CRYPTO_ccm128_encrypt_ccm64(ccm, in, out, len, |
| 2127 | cctx->str) : CRYPTO_ccm128_encrypt(ccm, in, out, len)) | 1285 | aes_ccm64_encrypt_ccm128f) != 0) |
| 2128 | return -1; | 1286 | return -1; |
| 2129 | cctx->tag_set = 1; | 1287 | cctx->tag_set = 1; |
| 2130 | return len; | 1288 | return len; |
| 2131 | } else { | 1289 | } else { |
| 2132 | int rv = -1; | 1290 | int rv = -1; |
| 2133 | if (cctx->str ? !CRYPTO_ccm128_decrypt_ccm64(ccm, in, out, len, | 1291 | if (CRYPTO_ccm128_decrypt_ccm64(ccm, in, out, len, |
| 2134 | cctx->str) : !CRYPTO_ccm128_decrypt(ccm, in, out, len)) { | 1292 | aes_ccm64_decrypt_ccm128f) == 0) { |
| 2135 | unsigned char tag[16]; | 1293 | unsigned char tag[16]; |
| 2136 | if (CRYPTO_ccm128_tag(ccm, tag, cctx->M)) { | 1294 | if (CRYPTO_ccm128_tag(ccm, tag, cctx->M)) { |
| 2137 | if (!memcmp(tag, ctx->buf, cctx->M)) | 1295 | if (timingsafe_memcmp(tag, ctx->buf, cctx->M) == 0) |
| 2138 | rv = len; | 1296 | rv = len; |
| 2139 | } | 1297 | } |
| 2140 | } | 1298 | } |
| @@ -2145,24 +1303,8 @@ aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 2145 | cctx->len_set = 0; | 1303 | cctx->len_set = 0; |
| 2146 | return rv; | 1304 | return rv; |
| 2147 | } | 1305 | } |
| 2148 | |||
| 2149 | } | 1306 | } |
| 2150 | 1307 | ||
| 2151 | #ifdef AESNI_CAPABLE | ||
| 2152 | static const EVP_CIPHER aesni_128_ccm = { | ||
| 2153 | .nid = NID_aes_128_ccm, | ||
| 2154 | .block_size = 1, | ||
| 2155 | .key_len = 16, | ||
| 2156 | .iv_len = 12, | ||
| 2157 | .flags = CUSTOM_FLAGS | EVP_CIPH_CCM_MODE, | ||
| 2158 | .init = aesni_ccm_init_key, | ||
| 2159 | .do_cipher = aes_ccm_cipher, | ||
| 2160 | .cleanup = NULL, | ||
| 2161 | .ctx_size = sizeof(EVP_AES_CCM_CTX), | ||
| 2162 | .ctrl = aes_ccm_ctrl, | ||
| 2163 | }; | ||
| 2164 | #endif | ||
| 2165 | |||
| 2166 | static const EVP_CIPHER aes_128_ccm = { | 1308 | static const EVP_CIPHER aes_128_ccm = { |
| 2167 | .nid = NID_aes_128_ccm, | 1309 | .nid = NID_aes_128_ccm, |
| 2168 | .block_size = 1, | 1310 | .block_size = 1, |
| @@ -2179,29 +1321,10 @@ static const EVP_CIPHER aes_128_ccm = { | |||
| 2179 | const EVP_CIPHER * | 1321 | const EVP_CIPHER * |
| 2180 | EVP_aes_128_ccm(void) | 1322 | EVP_aes_128_ccm(void) |
| 2181 | { | 1323 | { |
| 2182 | #ifdef AESNI_CAPABLE | ||
| 2183 | return AESNI_CAPABLE ? &aesni_128_ccm : &aes_128_ccm; | ||
| 2184 | #else | ||
| 2185 | return &aes_128_ccm; | 1324 | return &aes_128_ccm; |
| 2186 | #endif | ||
| 2187 | } | 1325 | } |
| 2188 | LCRYPTO_ALIAS(EVP_aes_128_ccm); | 1326 | LCRYPTO_ALIAS(EVP_aes_128_ccm); |
| 2189 | 1327 | ||
| 2190 | #ifdef AESNI_CAPABLE | ||
| 2191 | static const EVP_CIPHER aesni_192_ccm = { | ||
| 2192 | .nid = NID_aes_192_ccm, | ||
| 2193 | .block_size = 1, | ||
| 2194 | .key_len = 24, | ||
| 2195 | .iv_len = 12, | ||
| 2196 | .flags = CUSTOM_FLAGS | EVP_CIPH_CCM_MODE, | ||
| 2197 | .init = aesni_ccm_init_key, | ||
| 2198 | .do_cipher = aes_ccm_cipher, | ||
| 2199 | .cleanup = NULL, | ||
| 2200 | .ctx_size = sizeof(EVP_AES_CCM_CTX), | ||
| 2201 | .ctrl = aes_ccm_ctrl, | ||
| 2202 | }; | ||
| 2203 | #endif | ||
| 2204 | |||
| 2205 | static const EVP_CIPHER aes_192_ccm = { | 1328 | static const EVP_CIPHER aes_192_ccm = { |
| 2206 | .nid = NID_aes_192_ccm, | 1329 | .nid = NID_aes_192_ccm, |
| 2207 | .block_size = 1, | 1330 | .block_size = 1, |
| @@ -2218,29 +1341,10 @@ static const EVP_CIPHER aes_192_ccm = { | |||
| 2218 | const EVP_CIPHER * | 1341 | const EVP_CIPHER * |
| 2219 | EVP_aes_192_ccm(void) | 1342 | EVP_aes_192_ccm(void) |
| 2220 | { | 1343 | { |
| 2221 | #ifdef AESNI_CAPABLE | ||
| 2222 | return AESNI_CAPABLE ? &aesni_192_ccm : &aes_192_ccm; | ||
| 2223 | #else | ||
| 2224 | return &aes_192_ccm; | 1344 | return &aes_192_ccm; |
| 2225 | #endif | ||
| 2226 | } | 1345 | } |
| 2227 | LCRYPTO_ALIAS(EVP_aes_192_ccm); | 1346 | LCRYPTO_ALIAS(EVP_aes_192_ccm); |
| 2228 | 1347 | ||
| 2229 | #ifdef AESNI_CAPABLE | ||
| 2230 | static const EVP_CIPHER aesni_256_ccm = { | ||
| 2231 | .nid = NID_aes_256_ccm, | ||
| 2232 | .block_size = 1, | ||
| 2233 | .key_len = 32, | ||
| 2234 | .iv_len = 12, | ||
| 2235 | .flags = CUSTOM_FLAGS | EVP_CIPH_CCM_MODE, | ||
| 2236 | .init = aesni_ccm_init_key, | ||
| 2237 | .do_cipher = aes_ccm_cipher, | ||
| 2238 | .cleanup = NULL, | ||
| 2239 | .ctx_size = sizeof(EVP_AES_CCM_CTX), | ||
| 2240 | .ctrl = aes_ccm_ctrl, | ||
| 2241 | }; | ||
| 2242 | #endif | ||
| 2243 | |||
| 2244 | static const EVP_CIPHER aes_256_ccm = { | 1348 | static const EVP_CIPHER aes_256_ccm = { |
| 2245 | .nid = NID_aes_256_ccm, | 1349 | .nid = NID_aes_256_ccm, |
| 2246 | .block_size = 1, | 1350 | .block_size = 1, |
| @@ -2257,11 +1361,7 @@ static const EVP_CIPHER aes_256_ccm = { | |||
| 2257 | const EVP_CIPHER * | 1361 | const EVP_CIPHER * |
| 2258 | EVP_aes_256_ccm(void) | 1362 | EVP_aes_256_ccm(void) |
| 2259 | { | 1363 | { |
| 2260 | #ifdef AESNI_CAPABLE | ||
| 2261 | return AESNI_CAPABLE ? &aesni_256_ccm : &aes_256_ccm; | ||
| 2262 | #else | ||
| 2263 | return &aes_256_ccm; | 1364 | return &aes_256_ccm; |
| 2264 | #endif | ||
| 2265 | } | 1365 | } |
| 2266 | LCRYPTO_ALIAS(EVP_aes_256_ccm); | 1366 | LCRYPTO_ALIAS(EVP_aes_256_ccm); |
| 2267 | 1367 | ||
| @@ -2273,7 +1373,6 @@ struct aead_aes_gcm_ctx { | |||
| 2273 | AES_KEY ks; | 1373 | AES_KEY ks; |
| 2274 | } ks; | 1374 | } ks; |
| 2275 | GCM128_CONTEXT gcm; | 1375 | GCM128_CONTEXT gcm; |
| 2276 | ctr128_f ctr; | ||
| 2277 | unsigned char tag_len; | 1376 | unsigned char tag_len; |
| 2278 | }; | 1377 | }; |
| 2279 | 1378 | ||
| @@ -2301,18 +1400,8 @@ aead_aes_gcm_init(EVP_AEAD_CTX *ctx, const unsigned char *key, size_t key_len, | |||
| 2301 | if ((gcm_ctx = calloc(1, sizeof(struct aead_aes_gcm_ctx))) == NULL) | 1400 | if ((gcm_ctx = calloc(1, sizeof(struct aead_aes_gcm_ctx))) == NULL) |
| 2302 | return 0; | 1401 | return 0; |
| 2303 | 1402 | ||
| 2304 | #ifdef AESNI_CAPABLE | 1403 | AES_set_encrypt_key(key, key_bits, &gcm_ctx->ks.ks); |
| 2305 | if (AESNI_CAPABLE) { | 1404 | CRYPTO_gcm128_init(&gcm_ctx->gcm, &gcm_ctx->ks.ks, aes_encrypt_block128); |
| 2306 | aesni_set_encrypt_key(key, key_bits, &gcm_ctx->ks.ks); | ||
| 2307 | CRYPTO_gcm128_init(&gcm_ctx->gcm, &gcm_ctx->ks.ks, | ||
| 2308 | (block128_f)aesni_encrypt); | ||
| 2309 | gcm_ctx->ctr = (ctr128_f) aesni_ctr32_encrypt_blocks; | ||
| 2310 | } else | ||
| 2311 | #endif | ||
| 2312 | { | ||
| 2313 | gcm_ctx->ctr = aes_gcm_set_key(&gcm_ctx->ks.ks, &gcm_ctx->gcm, | ||
| 2314 | key, key_len); | ||
| 2315 | } | ||
| 2316 | gcm_ctx->tag_len = tag_len; | 1405 | gcm_ctx->tag_len = tag_len; |
| 2317 | ctx->aead_state = gcm_ctx; | 1406 | ctx->aead_state = gcm_ctx; |
| 2318 | 1407 | ||
| @@ -2353,15 +1442,9 @@ aead_aes_gcm_seal(const EVP_AEAD_CTX *ctx, unsigned char *out, size_t *out_len, | |||
| 2353 | if (ad_len > 0 && CRYPTO_gcm128_aad(&gcm, ad, ad_len)) | 1442 | if (ad_len > 0 && CRYPTO_gcm128_aad(&gcm, ad, ad_len)) |
| 2354 | return 0; | 1443 | return 0; |
| 2355 | 1444 | ||
| 2356 | if (gcm_ctx->ctr) { | 1445 | if (CRYPTO_gcm128_encrypt_ctr32(&gcm, in + bulk, out + bulk, |
| 2357 | if (CRYPTO_gcm128_encrypt_ctr32(&gcm, in + bulk, out + bulk, | 1446 | in_len - bulk, aes_ctr32_encrypt_ctr128f)) |
| 2358 | in_len - bulk, gcm_ctx->ctr)) | 1447 | return 0; |
| 2359 | return 0; | ||
| 2360 | } else { | ||
| 2361 | if (CRYPTO_gcm128_encrypt(&gcm, in + bulk, out + bulk, | ||
| 2362 | in_len - bulk)) | ||
| 2363 | return 0; | ||
| 2364 | } | ||
| 2365 | 1448 | ||
| 2366 | CRYPTO_gcm128_tag(&gcm, out + in_len, gcm_ctx->tag_len); | 1449 | CRYPTO_gcm128_tag(&gcm, out + in_len, gcm_ctx->tag_len); |
| 2367 | *out_len = in_len + gcm_ctx->tag_len; | 1450 | *out_len = in_len + gcm_ctx->tag_len; |
| @@ -2404,15 +1487,9 @@ aead_aes_gcm_open(const EVP_AEAD_CTX *ctx, unsigned char *out, size_t *out_len, | |||
| 2404 | if (CRYPTO_gcm128_aad(&gcm, ad, ad_len)) | 1487 | if (CRYPTO_gcm128_aad(&gcm, ad, ad_len)) |
| 2405 | return 0; | 1488 | return 0; |
| 2406 | 1489 | ||
| 2407 | if (gcm_ctx->ctr) { | 1490 | if (CRYPTO_gcm128_decrypt_ctr32(&gcm, in + bulk, out + bulk, |
| 2408 | if (CRYPTO_gcm128_decrypt_ctr32(&gcm, in + bulk, out + bulk, | 1491 | in_len - bulk - gcm_ctx->tag_len, aes_ctr32_encrypt_ctr128f)) |
| 2409 | in_len - bulk - gcm_ctx->tag_len, gcm_ctx->ctr)) | 1492 | return 0; |
| 2410 | return 0; | ||
| 2411 | } else { | ||
| 2412 | if (CRYPTO_gcm128_decrypt(&gcm, in + bulk, out + bulk, | ||
| 2413 | in_len - bulk - gcm_ctx->tag_len)) | ||
| 2414 | return 0; | ||
| 2415 | } | ||
| 2416 | 1493 | ||
| 2417 | CRYPTO_gcm128_tag(&gcm, tag, gcm_ctx->tag_len); | 1494 | CRYPTO_gcm128_tag(&gcm, tag, gcm_ctx->tag_len); |
| 2418 | if (timingsafe_memcmp(tag, in + plaintext_len, gcm_ctx->tag_len) != 0) { | 1495 | if (timingsafe_memcmp(tag, in + plaintext_len, gcm_ctx->tag_len) != 0) { |
diff --git a/src/lib/libcrypto/evp/e_bf.c b/src/lib/libcrypto/evp/e_bf.c index 4f3799975b..8c32a5658e 100644 --- a/src/lib/libcrypto/evp/e_bf.c +++ b/src/lib/libcrypto/evp/e_bf.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: e_bf.c,v 1.19 2024/04/09 13:52:41 beck Exp $ */ | 1 | /* $OpenBSD: e_bf.c,v 1.20 2025/05/27 03:58:12 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -162,13 +162,14 @@ static const EVP_CIPHER bf_cbc = { | |||
| 162 | .block_size = 8, | 162 | .block_size = 8, |
| 163 | .key_len = 16, | 163 | .key_len = 16, |
| 164 | .iv_len = 8, | 164 | .iv_len = 8, |
| 165 | .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CBC_MODE, | 165 | .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CBC_MODE | |
| 166 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 166 | .init = bf_init_key, | 167 | .init = bf_init_key, |
| 167 | .do_cipher = bf_cbc_cipher, | 168 | .do_cipher = bf_cbc_cipher, |
| 168 | .cleanup = NULL, | 169 | .cleanup = NULL, |
| 169 | .ctx_size = sizeof(EVP_BF_KEY), | 170 | .ctx_size = sizeof(EVP_BF_KEY), |
| 170 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 171 | .set_asn1_parameters = NULL, |
| 171 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 172 | .get_asn1_parameters = NULL, |
| 172 | .ctrl = NULL, | 173 | .ctrl = NULL, |
| 173 | }; | 174 | }; |
| 174 | 175 | ||
| @@ -184,13 +185,14 @@ static const EVP_CIPHER bf_cfb64 = { | |||
| 184 | .block_size = 1, | 185 | .block_size = 1, |
| 185 | .key_len = 16, | 186 | .key_len = 16, |
| 186 | .iv_len = 8, | 187 | .iv_len = 8, |
| 187 | .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CFB_MODE, | 188 | .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CFB_MODE | |
| 189 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 188 | .init = bf_init_key, | 190 | .init = bf_init_key, |
| 189 | .do_cipher = bf_cfb64_cipher, | 191 | .do_cipher = bf_cfb64_cipher, |
| 190 | .cleanup = NULL, | 192 | .cleanup = NULL, |
| 191 | .ctx_size = sizeof(EVP_BF_KEY), | 193 | .ctx_size = sizeof(EVP_BF_KEY), |
| 192 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 194 | .set_asn1_parameters = NULL, |
| 193 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 195 | .get_asn1_parameters = NULL, |
| 194 | .ctrl = NULL, | 196 | .ctrl = NULL, |
| 195 | }; | 197 | }; |
| 196 | 198 | ||
| @@ -206,13 +208,14 @@ static const EVP_CIPHER bf_ofb = { | |||
| 206 | .block_size = 1, | 208 | .block_size = 1, |
| 207 | .key_len = 16, | 209 | .key_len = 16, |
| 208 | .iv_len = 8, | 210 | .iv_len = 8, |
| 209 | .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_OFB_MODE, | 211 | .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_OFB_MODE | |
| 212 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 210 | .init = bf_init_key, | 213 | .init = bf_init_key, |
| 211 | .do_cipher = bf_ofb_cipher, | 214 | .do_cipher = bf_ofb_cipher, |
| 212 | .cleanup = NULL, | 215 | .cleanup = NULL, |
| 213 | .ctx_size = sizeof(EVP_BF_KEY), | 216 | .ctx_size = sizeof(EVP_BF_KEY), |
| 214 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 217 | .set_asn1_parameters = NULL, |
| 215 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 218 | .get_asn1_parameters = NULL, |
| 216 | .ctrl = NULL, | 219 | .ctrl = NULL, |
| 217 | }; | 220 | }; |
| 218 | 221 | ||
| @@ -228,13 +231,14 @@ static const EVP_CIPHER bf_ecb = { | |||
| 228 | .block_size = 8, | 231 | .block_size = 8, |
| 229 | .key_len = 16, | 232 | .key_len = 16, |
| 230 | .iv_len = 0, | 233 | .iv_len = 0, |
| 231 | .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_ECB_MODE, | 234 | .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_ECB_MODE | |
| 235 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 232 | .init = bf_init_key, | 236 | .init = bf_init_key, |
| 233 | .do_cipher = bf_ecb_cipher, | 237 | .do_cipher = bf_ecb_cipher, |
| 234 | .cleanup = NULL, | 238 | .cleanup = NULL, |
| 235 | .ctx_size = sizeof(EVP_BF_KEY), | 239 | .ctx_size = sizeof(EVP_BF_KEY), |
| 236 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 240 | .set_asn1_parameters = NULL, |
| 237 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 241 | .get_asn1_parameters = NULL, |
| 238 | .ctrl = NULL, | 242 | .ctrl = NULL, |
| 239 | }; | 243 | }; |
| 240 | 244 | ||
diff --git a/src/lib/libcrypto/evp/e_camellia.c b/src/lib/libcrypto/evp/e_camellia.c index 55dcc79922..8da46275a3 100644 --- a/src/lib/libcrypto/evp/e_camellia.c +++ b/src/lib/libcrypto/evp/e_camellia.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: e_camellia.c,v 1.20 2024/04/09 13:52:41 beck Exp $ */ | 1 | /* $OpenBSD: e_camellia.c,v 1.22 2025/05/27 03:58:12 tb Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 2006 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -59,9 +59,9 @@ | |||
| 59 | 59 | ||
| 60 | #ifndef OPENSSL_NO_CAMELLIA | 60 | #ifndef OPENSSL_NO_CAMELLIA |
| 61 | #include <openssl/evp.h> | 61 | #include <openssl/evp.h> |
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/camellia.h> | 62 | #include <openssl/camellia.h> |
| 64 | 63 | ||
| 64 | #include "err_local.h" | ||
| 65 | #include "evp_local.h" | 65 | #include "evp_local.h" |
| 66 | 66 | ||
| 67 | /* Camellia subkey Structure */ | 67 | /* Camellia subkey Structure */ |
| @@ -163,13 +163,13 @@ static const EVP_CIPHER camellia_128_cbc = { | |||
| 163 | .block_size = 16, | 163 | .block_size = 16, |
| 164 | .key_len = 16, | 164 | .key_len = 16, |
| 165 | .iv_len = 16, | 165 | .iv_len = 16, |
| 166 | .flags = 0 | EVP_CIPH_CBC_MODE, | 166 | .flags = EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 167 | .init = camellia_init_key, | 167 | .init = camellia_init_key, |
| 168 | .do_cipher = camellia_128_cbc_cipher, | 168 | .do_cipher = camellia_128_cbc_cipher, |
| 169 | .cleanup = NULL, | 169 | .cleanup = NULL, |
| 170 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), | 170 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), |
| 171 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 171 | .set_asn1_parameters = NULL, |
| 172 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 172 | .get_asn1_parameters = NULL, |
| 173 | .ctrl = NULL, | 173 | .ctrl = NULL, |
| 174 | }; | 174 | }; |
| 175 | 175 | ||
| @@ -185,13 +185,13 @@ static const EVP_CIPHER camellia_128_cfb128 = { | |||
| 185 | .block_size = 1, | 185 | .block_size = 1, |
| 186 | .key_len = 16, | 186 | .key_len = 16, |
| 187 | .iv_len = 16, | 187 | .iv_len = 16, |
| 188 | .flags = 0 | EVP_CIPH_CFB_MODE, | 188 | .flags = EVP_CIPH_CFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 189 | .init = camellia_init_key, | 189 | .init = camellia_init_key, |
| 190 | .do_cipher = camellia_128_cfb128_cipher, | 190 | .do_cipher = camellia_128_cfb128_cipher, |
| 191 | .cleanup = NULL, | 191 | .cleanup = NULL, |
| 192 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), | 192 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), |
| 193 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 193 | .set_asn1_parameters = NULL, |
| 194 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 194 | .get_asn1_parameters = NULL, |
| 195 | .ctrl = NULL, | 195 | .ctrl = NULL, |
| 196 | }; | 196 | }; |
| 197 | 197 | ||
| @@ -207,13 +207,13 @@ static const EVP_CIPHER camellia_128_ofb = { | |||
| 207 | .block_size = 1, | 207 | .block_size = 1, |
| 208 | .key_len = 16, | 208 | .key_len = 16, |
| 209 | .iv_len = 16, | 209 | .iv_len = 16, |
| 210 | .flags = 0 | EVP_CIPH_OFB_MODE, | 210 | .flags = EVP_CIPH_OFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 211 | .init = camellia_init_key, | 211 | .init = camellia_init_key, |
| 212 | .do_cipher = camellia_128_ofb_cipher, | 212 | .do_cipher = camellia_128_ofb_cipher, |
| 213 | .cleanup = NULL, | 213 | .cleanup = NULL, |
| 214 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), | 214 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), |
| 215 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 215 | .set_asn1_parameters = NULL, |
| 216 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 216 | .get_asn1_parameters = NULL, |
| 217 | .ctrl = NULL, | 217 | .ctrl = NULL, |
| 218 | }; | 218 | }; |
| 219 | 219 | ||
| @@ -229,13 +229,13 @@ static const EVP_CIPHER camellia_128_ecb = { | |||
| 229 | .block_size = 16, | 229 | .block_size = 16, |
| 230 | .key_len = 16, | 230 | .key_len = 16, |
| 231 | .iv_len = 0, | 231 | .iv_len = 0, |
| 232 | .flags = 0 | EVP_CIPH_ECB_MODE, | 232 | .flags = EVP_CIPH_ECB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 233 | .init = camellia_init_key, | 233 | .init = camellia_init_key, |
| 234 | .do_cipher = camellia_128_ecb_cipher, | 234 | .do_cipher = camellia_128_ecb_cipher, |
| 235 | .cleanup = NULL, | 235 | .cleanup = NULL, |
| 236 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), | 236 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), |
| 237 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 237 | .set_asn1_parameters = NULL, |
| 238 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 238 | .get_asn1_parameters = NULL, |
| 239 | .ctrl = NULL, | 239 | .ctrl = NULL, |
| 240 | }; | 240 | }; |
| 241 | 241 | ||
| @@ -321,13 +321,13 @@ static const EVP_CIPHER camellia_192_cbc = { | |||
| 321 | .block_size = 16, | 321 | .block_size = 16, |
| 322 | .key_len = 24, | 322 | .key_len = 24, |
| 323 | .iv_len = 16, | 323 | .iv_len = 16, |
| 324 | .flags = 0 | EVP_CIPH_CBC_MODE, | 324 | .flags = EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 325 | .init = camellia_init_key, | 325 | .init = camellia_init_key, |
| 326 | .do_cipher = camellia_192_cbc_cipher, | 326 | .do_cipher = camellia_192_cbc_cipher, |
| 327 | .cleanup = NULL, | 327 | .cleanup = NULL, |
| 328 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), | 328 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), |
| 329 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 329 | .set_asn1_parameters = NULL, |
| 330 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 330 | .get_asn1_parameters = NULL, |
| 331 | .ctrl = NULL, | 331 | .ctrl = NULL, |
| 332 | }; | 332 | }; |
| 333 | 333 | ||
| @@ -343,13 +343,13 @@ static const EVP_CIPHER camellia_192_cfb128 = { | |||
| 343 | .block_size = 1, | 343 | .block_size = 1, |
| 344 | .key_len = 24, | 344 | .key_len = 24, |
| 345 | .iv_len = 16, | 345 | .iv_len = 16, |
| 346 | .flags = 0 | EVP_CIPH_CFB_MODE, | 346 | .flags = EVP_CIPH_CFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 347 | .init = camellia_init_key, | 347 | .init = camellia_init_key, |
| 348 | .do_cipher = camellia_192_cfb128_cipher, | 348 | .do_cipher = camellia_192_cfb128_cipher, |
| 349 | .cleanup = NULL, | 349 | .cleanup = NULL, |
| 350 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), | 350 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), |
| 351 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 351 | .set_asn1_parameters = NULL, |
| 352 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 352 | .get_asn1_parameters = NULL, |
| 353 | .ctrl = NULL, | 353 | .ctrl = NULL, |
| 354 | }; | 354 | }; |
| 355 | 355 | ||
| @@ -365,13 +365,13 @@ static const EVP_CIPHER camellia_192_ofb = { | |||
| 365 | .block_size = 1, | 365 | .block_size = 1, |
| 366 | .key_len = 24, | 366 | .key_len = 24, |
| 367 | .iv_len = 16, | 367 | .iv_len = 16, |
| 368 | .flags = 0 | EVP_CIPH_OFB_MODE, | 368 | .flags = EVP_CIPH_OFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 369 | .init = camellia_init_key, | 369 | .init = camellia_init_key, |
| 370 | .do_cipher = camellia_192_ofb_cipher, | 370 | .do_cipher = camellia_192_ofb_cipher, |
| 371 | .cleanup = NULL, | 371 | .cleanup = NULL, |
| 372 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), | 372 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), |
| 373 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 373 | .set_asn1_parameters = NULL, |
| 374 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 374 | .get_asn1_parameters = NULL, |
| 375 | .ctrl = NULL, | 375 | .ctrl = NULL, |
| 376 | }; | 376 | }; |
| 377 | 377 | ||
| @@ -387,13 +387,13 @@ static const EVP_CIPHER camellia_192_ecb = { | |||
| 387 | .block_size = 16, | 387 | .block_size = 16, |
| 388 | .key_len = 24, | 388 | .key_len = 24, |
| 389 | .iv_len = 0, | 389 | .iv_len = 0, |
| 390 | .flags = 0 | EVP_CIPH_ECB_MODE, | 390 | .flags = EVP_CIPH_ECB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 391 | .init = camellia_init_key, | 391 | .init = camellia_init_key, |
| 392 | .do_cipher = camellia_192_ecb_cipher, | 392 | .do_cipher = camellia_192_ecb_cipher, |
| 393 | .cleanup = NULL, | 393 | .cleanup = NULL, |
| 394 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), | 394 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), |
| 395 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 395 | .set_asn1_parameters = NULL, |
| 396 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 396 | .get_asn1_parameters = NULL, |
| 397 | .ctrl = NULL, | 397 | .ctrl = NULL, |
| 398 | }; | 398 | }; |
| 399 | 399 | ||
| @@ -479,13 +479,13 @@ static const EVP_CIPHER camellia_256_cbc = { | |||
| 479 | .block_size = 16, | 479 | .block_size = 16, |
| 480 | .key_len = 32, | 480 | .key_len = 32, |
| 481 | .iv_len = 16, | 481 | .iv_len = 16, |
| 482 | .flags = 0 | EVP_CIPH_CBC_MODE, | 482 | .flags = EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 483 | .init = camellia_init_key, | 483 | .init = camellia_init_key, |
| 484 | .do_cipher = camellia_256_cbc_cipher, | 484 | .do_cipher = camellia_256_cbc_cipher, |
| 485 | .cleanup = NULL, | 485 | .cleanup = NULL, |
| 486 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), | 486 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), |
| 487 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 487 | .set_asn1_parameters = NULL, |
| 488 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 488 | .get_asn1_parameters = NULL, |
| 489 | .ctrl = NULL, | 489 | .ctrl = NULL, |
| 490 | }; | 490 | }; |
| 491 | 491 | ||
| @@ -501,13 +501,13 @@ static const EVP_CIPHER camellia_256_cfb128 = { | |||
| 501 | .block_size = 1, | 501 | .block_size = 1, |
| 502 | .key_len = 32, | 502 | .key_len = 32, |
| 503 | .iv_len = 16, | 503 | .iv_len = 16, |
| 504 | .flags = 0 | EVP_CIPH_CFB_MODE, | 504 | .flags = EVP_CIPH_CFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 505 | .init = camellia_init_key, | 505 | .init = camellia_init_key, |
| 506 | .do_cipher = camellia_256_cfb128_cipher, | 506 | .do_cipher = camellia_256_cfb128_cipher, |
| 507 | .cleanup = NULL, | 507 | .cleanup = NULL, |
| 508 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), | 508 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), |
| 509 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 509 | .set_asn1_parameters = NULL, |
| 510 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 510 | .get_asn1_parameters = NULL, |
| 511 | .ctrl = NULL, | 511 | .ctrl = NULL, |
| 512 | }; | 512 | }; |
| 513 | 513 | ||
| @@ -523,13 +523,13 @@ static const EVP_CIPHER camellia_256_ofb = { | |||
| 523 | .block_size = 1, | 523 | .block_size = 1, |
| 524 | .key_len = 32, | 524 | .key_len = 32, |
| 525 | .iv_len = 16, | 525 | .iv_len = 16, |
| 526 | .flags = 0 | EVP_CIPH_OFB_MODE, | 526 | .flags = EVP_CIPH_OFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 527 | .init = camellia_init_key, | 527 | .init = camellia_init_key, |
| 528 | .do_cipher = camellia_256_ofb_cipher, | 528 | .do_cipher = camellia_256_ofb_cipher, |
| 529 | .cleanup = NULL, | 529 | .cleanup = NULL, |
| 530 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), | 530 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), |
| 531 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 531 | .set_asn1_parameters = NULL, |
| 532 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 532 | .get_asn1_parameters = NULL, |
| 533 | .ctrl = NULL, | 533 | .ctrl = NULL, |
| 534 | }; | 534 | }; |
| 535 | 535 | ||
| @@ -545,13 +545,13 @@ static const EVP_CIPHER camellia_256_ecb = { | |||
| 545 | .block_size = 16, | 545 | .block_size = 16, |
| 546 | .key_len = 32, | 546 | .key_len = 32, |
| 547 | .iv_len = 0, | 547 | .iv_len = 0, |
| 548 | .flags = 0 | EVP_CIPH_ECB_MODE, | 548 | .flags = EVP_CIPH_ECB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 549 | .init = camellia_init_key, | 549 | .init = camellia_init_key, |
| 550 | .do_cipher = camellia_256_ecb_cipher, | 550 | .do_cipher = camellia_256_ecb_cipher, |
| 551 | .cleanup = NULL, | 551 | .cleanup = NULL, |
| 552 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), | 552 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), |
| 553 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 553 | .set_asn1_parameters = NULL, |
| 554 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 554 | .get_asn1_parameters = NULL, |
| 555 | .ctrl = NULL, | 555 | .ctrl = NULL, |
| 556 | }; | 556 | }; |
| 557 | 557 | ||
| @@ -589,13 +589,13 @@ static const EVP_CIPHER camellia_128_cfb1 = { | |||
| 589 | .block_size = 1, | 589 | .block_size = 1, |
| 590 | .key_len = 128/8, | 590 | .key_len = 128/8, |
| 591 | .iv_len = 16, | 591 | .iv_len = 16, |
| 592 | .flags = 0 | EVP_CIPH_CFB_MODE, | 592 | .flags = EVP_CIPH_CFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 593 | .init = camellia_init_key, | 593 | .init = camellia_init_key, |
| 594 | .do_cipher = camellia_128_cfb1_cipher, | 594 | .do_cipher = camellia_128_cfb1_cipher, |
| 595 | .cleanup = NULL, | 595 | .cleanup = NULL, |
| 596 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), | 596 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), |
| 597 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 597 | .set_asn1_parameters = NULL, |
| 598 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 598 | .get_asn1_parameters = NULL, |
| 599 | .ctrl = NULL, | 599 | .ctrl = NULL, |
| 600 | }; | 600 | }; |
| 601 | 601 | ||
| @@ -633,13 +633,13 @@ static const EVP_CIPHER camellia_192_cfb1 = { | |||
| 633 | .block_size = 1, | 633 | .block_size = 1, |
| 634 | .key_len = 192/8, | 634 | .key_len = 192/8, |
| 635 | .iv_len = 16, | 635 | .iv_len = 16, |
| 636 | .flags = 0 | EVP_CIPH_CFB_MODE, | 636 | .flags = EVP_CIPH_CFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 637 | .init = camellia_init_key, | 637 | .init = camellia_init_key, |
| 638 | .do_cipher = camellia_192_cfb1_cipher, | 638 | .do_cipher = camellia_192_cfb1_cipher, |
| 639 | .cleanup = NULL, | 639 | .cleanup = NULL, |
| 640 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), | 640 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), |
| 641 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 641 | .set_asn1_parameters = NULL, |
| 642 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 642 | .get_asn1_parameters = NULL, |
| 643 | .ctrl = NULL, | 643 | .ctrl = NULL, |
| 644 | }; | 644 | }; |
| 645 | 645 | ||
| @@ -677,13 +677,13 @@ static const EVP_CIPHER camellia_256_cfb1 = { | |||
| 677 | .block_size = 1, | 677 | .block_size = 1, |
| 678 | .key_len = 256/8, | 678 | .key_len = 256/8, |
| 679 | .iv_len = 16, | 679 | .iv_len = 16, |
| 680 | .flags = 0 | EVP_CIPH_CFB_MODE, | 680 | .flags = EVP_CIPH_CFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 681 | .init = camellia_init_key, | 681 | .init = camellia_init_key, |
| 682 | .do_cipher = camellia_256_cfb1_cipher, | 682 | .do_cipher = camellia_256_cfb1_cipher, |
| 683 | .cleanup = NULL, | 683 | .cleanup = NULL, |
| 684 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), | 684 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), |
| 685 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 685 | .set_asn1_parameters = NULL, |
| 686 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 686 | .get_asn1_parameters = NULL, |
| 687 | .ctrl = NULL, | 687 | .ctrl = NULL, |
| 688 | }; | 688 | }; |
| 689 | 689 | ||
| @@ -720,13 +720,13 @@ static const EVP_CIPHER camellia_128_cfb8 = { | |||
| 720 | .block_size = 1, | 720 | .block_size = 1, |
| 721 | .key_len = 128/8, | 721 | .key_len = 128/8, |
| 722 | .iv_len = 16, | 722 | .iv_len = 16, |
| 723 | .flags = 0 | EVP_CIPH_CFB_MODE, | 723 | .flags = EVP_CIPH_CFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 724 | .init = camellia_init_key, | 724 | .init = camellia_init_key, |
| 725 | .do_cipher = camellia_128_cfb8_cipher, | 725 | .do_cipher = camellia_128_cfb8_cipher, |
| 726 | .cleanup = NULL, | 726 | .cleanup = NULL, |
| 727 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), | 727 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), |
| 728 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 728 | .set_asn1_parameters = NULL, |
| 729 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 729 | .get_asn1_parameters = NULL, |
| 730 | .ctrl = NULL, | 730 | .ctrl = NULL, |
| 731 | }; | 731 | }; |
| 732 | 732 | ||
| @@ -762,13 +762,13 @@ static const EVP_CIPHER camellia_192_cfb8 = { | |||
| 762 | .block_size = 1, | 762 | .block_size = 1, |
| 763 | .key_len = 192/8, | 763 | .key_len = 192/8, |
| 764 | .iv_len = 16, | 764 | .iv_len = 16, |
| 765 | .flags = 0 | EVP_CIPH_CFB_MODE, | 765 | .flags = EVP_CIPH_CFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 766 | .init = camellia_init_key, | 766 | .init = camellia_init_key, |
| 767 | .do_cipher = camellia_192_cfb8_cipher, | 767 | .do_cipher = camellia_192_cfb8_cipher, |
| 768 | .cleanup = NULL, | 768 | .cleanup = NULL, |
| 769 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), | 769 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), |
| 770 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 770 | .set_asn1_parameters = NULL, |
| 771 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 771 | .get_asn1_parameters = NULL, |
| 772 | .ctrl = NULL, | 772 | .ctrl = NULL, |
| 773 | }; | 773 | }; |
| 774 | 774 | ||
| @@ -804,13 +804,13 @@ static const EVP_CIPHER camellia_256_cfb8 = { | |||
| 804 | .block_size = 1, | 804 | .block_size = 1, |
| 805 | .key_len = 256/8, | 805 | .key_len = 256/8, |
| 806 | .iv_len = 16, | 806 | .iv_len = 16, |
| 807 | .flags = 0 | EVP_CIPH_CFB_MODE, | 807 | .flags = EVP_CIPH_CFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 808 | .init = camellia_init_key, | 808 | .init = camellia_init_key, |
| 809 | .do_cipher = camellia_256_cfb8_cipher, | 809 | .do_cipher = camellia_256_cfb8_cipher, |
| 810 | .cleanup = NULL, | 810 | .cleanup = NULL, |
| 811 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), | 811 | .ctx_size = sizeof(EVP_CAMELLIA_KEY), |
| 812 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 812 | .set_asn1_parameters = NULL, |
| 813 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 813 | .get_asn1_parameters = NULL, |
| 814 | .ctrl = NULL, | 814 | .ctrl = NULL, |
| 815 | }; | 815 | }; |
| 816 | 816 | ||
diff --git a/src/lib/libcrypto/evp/e_cast.c b/src/lib/libcrypto/evp/e_cast.c index 1575a7a5bb..283cb8cf63 100644 --- a/src/lib/libcrypto/evp/e_cast.c +++ b/src/lib/libcrypto/evp/e_cast.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: e_cast.c,v 1.18 2024/04/09 13:52:41 beck Exp $ */ | 1 | /* $OpenBSD: e_cast.c,v 1.19 2025/05/27 03:58:12 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -162,13 +162,14 @@ static const EVP_CIPHER cast5_cbc = { | |||
| 162 | .block_size = 8, | 162 | .block_size = 8, |
| 163 | .key_len = CAST_KEY_LENGTH, | 163 | .key_len = CAST_KEY_LENGTH, |
| 164 | .iv_len = 8, | 164 | .iv_len = 8, |
| 165 | .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CBC_MODE, | 165 | .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CBC_MODE | |
| 166 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 166 | .init = cast_init_key, | 167 | .init = cast_init_key, |
| 167 | .do_cipher = cast5_cbc_cipher, | 168 | .do_cipher = cast5_cbc_cipher, |
| 168 | .cleanup = NULL, | 169 | .cleanup = NULL, |
| 169 | .ctx_size = sizeof(EVP_CAST_KEY), | 170 | .ctx_size = sizeof(EVP_CAST_KEY), |
| 170 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 171 | .set_asn1_parameters = NULL, |
| 171 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 172 | .get_asn1_parameters = NULL, |
| 172 | .ctrl = NULL, | 173 | .ctrl = NULL, |
| 173 | }; | 174 | }; |
| 174 | 175 | ||
| @@ -184,13 +185,14 @@ static const EVP_CIPHER cast5_cfb64 = { | |||
| 184 | .block_size = 1, | 185 | .block_size = 1, |
| 185 | .key_len = CAST_KEY_LENGTH, | 186 | .key_len = CAST_KEY_LENGTH, |
| 186 | .iv_len = 8, | 187 | .iv_len = 8, |
| 187 | .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CFB_MODE, | 188 | .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CFB_MODE | |
| 189 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 188 | .init = cast_init_key, | 190 | .init = cast_init_key, |
| 189 | .do_cipher = cast5_cfb64_cipher, | 191 | .do_cipher = cast5_cfb64_cipher, |
| 190 | .cleanup = NULL, | 192 | .cleanup = NULL, |
| 191 | .ctx_size = sizeof(EVP_CAST_KEY), | 193 | .ctx_size = sizeof(EVP_CAST_KEY), |
| 192 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 194 | .set_asn1_parameters = NULL, |
| 193 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 195 | .get_asn1_parameters = NULL, |
| 194 | .ctrl = NULL, | 196 | .ctrl = NULL, |
| 195 | }; | 197 | }; |
| 196 | 198 | ||
| @@ -206,13 +208,14 @@ static const EVP_CIPHER cast5_ofb = { | |||
| 206 | .block_size = 1, | 208 | .block_size = 1, |
| 207 | .key_len = CAST_KEY_LENGTH, | 209 | .key_len = CAST_KEY_LENGTH, |
| 208 | .iv_len = 8, | 210 | .iv_len = 8, |
| 209 | .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_OFB_MODE, | 211 | .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_OFB_MODE | |
| 212 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 210 | .init = cast_init_key, | 213 | .init = cast_init_key, |
| 211 | .do_cipher = cast5_ofb_cipher, | 214 | .do_cipher = cast5_ofb_cipher, |
| 212 | .cleanup = NULL, | 215 | .cleanup = NULL, |
| 213 | .ctx_size = sizeof(EVP_CAST_KEY), | 216 | .ctx_size = sizeof(EVP_CAST_KEY), |
| 214 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 217 | .set_asn1_parameters = NULL, |
| 215 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 218 | .get_asn1_parameters = NULL, |
| 216 | .ctrl = NULL, | 219 | .ctrl = NULL, |
| 217 | }; | 220 | }; |
| 218 | 221 | ||
| @@ -228,13 +231,14 @@ static const EVP_CIPHER cast5_ecb = { | |||
| 228 | .block_size = 8, | 231 | .block_size = 8, |
| 229 | .key_len = CAST_KEY_LENGTH, | 232 | .key_len = CAST_KEY_LENGTH, |
| 230 | .iv_len = 0, | 233 | .iv_len = 0, |
| 231 | .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_ECB_MODE, | 234 | .flags = EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_ECB_MODE | |
| 235 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 232 | .init = cast_init_key, | 236 | .init = cast_init_key, |
| 233 | .do_cipher = cast5_ecb_cipher, | 237 | .do_cipher = cast5_ecb_cipher, |
| 234 | .cleanup = NULL, | 238 | .cleanup = NULL, |
| 235 | .ctx_size = sizeof(EVP_CAST_KEY), | 239 | .ctx_size = sizeof(EVP_CAST_KEY), |
| 236 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 240 | .set_asn1_parameters = NULL, |
| 237 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 241 | .get_asn1_parameters = NULL, |
| 238 | .ctrl = NULL, | 242 | .ctrl = NULL, |
| 239 | }; | 243 | }; |
| 240 | 244 | ||
diff --git a/src/lib/libcrypto/evp/e_chacha20poly1305.c b/src/lib/libcrypto/evp/e_chacha20poly1305.c index d176569f90..d3a1e44875 100644 --- a/src/lib/libcrypto/evp/e_chacha20poly1305.c +++ b/src/lib/libcrypto/evp/e_chacha20poly1305.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: e_chacha20poly1305.c,v 1.37 2024/12/20 20:05:29 schwarze Exp $ */ | 1 | /* $OpenBSD: e_chacha20poly1305.c,v 1.38 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (c) 2022 Joel Sing <jsing@openbsd.org> | 4 | * Copyright (c) 2022 Joel Sing <jsing@openbsd.org> |
| @@ -26,12 +26,12 @@ | |||
| 26 | 26 | ||
| 27 | #if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305) | 27 | #if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305) |
| 28 | 28 | ||
| 29 | #include <openssl/err.h> | ||
| 30 | #include <openssl/evp.h> | 29 | #include <openssl/evp.h> |
| 31 | #include <openssl/chacha.h> | 30 | #include <openssl/chacha.h> |
| 32 | #include <openssl/poly1305.h> | 31 | #include <openssl/poly1305.h> |
| 33 | 32 | ||
| 34 | #include "bytestring.h" | 33 | #include "bytestring.h" |
| 34 | #include "err_local.h" | ||
| 35 | #include "evp_local.h" | 35 | #include "evp_local.h" |
| 36 | 36 | ||
| 37 | #define POLY1305_TAG_LEN 16 | 37 | #define POLY1305_TAG_LEN 16 |
diff --git a/src/lib/libcrypto/evp/e_des.c b/src/lib/libcrypto/evp/e_des.c index fb335e95b1..680f77a723 100644 --- a/src/lib/libcrypto/evp/e_des.c +++ b/src/lib/libcrypto/evp/e_des.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: e_des.c,v 1.24 2024/04/09 13:52:41 beck Exp $ */ | 1 | /* $OpenBSD: e_des.c,v 1.25 2025/05/27 03:58:12 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -226,13 +226,14 @@ static const EVP_CIPHER des_cbc = { | |||
| 226 | .block_size = 8, | 226 | .block_size = 8, |
| 227 | .key_len = 8, | 227 | .key_len = 8, |
| 228 | .iv_len = 8, | 228 | .iv_len = 8, |
| 229 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CBC_MODE, | 229 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CBC_MODE | |
| 230 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 230 | .init = des_init_key, | 231 | .init = des_init_key, |
| 231 | .do_cipher = des_cbc_cipher, | 232 | .do_cipher = des_cbc_cipher, |
| 232 | .cleanup = NULL, | 233 | .cleanup = NULL, |
| 233 | .ctx_size = sizeof(DES_key_schedule), | 234 | .ctx_size = sizeof(DES_key_schedule), |
| 234 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 235 | .set_asn1_parameters = NULL, |
| 235 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 236 | .get_asn1_parameters = NULL, |
| 236 | .ctrl = des_ctrl, | 237 | .ctrl = des_ctrl, |
| 237 | }; | 238 | }; |
| 238 | 239 | ||
| @@ -248,13 +249,14 @@ static const EVP_CIPHER des_cfb64 = { | |||
| 248 | .block_size = 1, | 249 | .block_size = 1, |
| 249 | .key_len = 8, | 250 | .key_len = 8, |
| 250 | .iv_len = 8, | 251 | .iv_len = 8, |
| 251 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE, | 252 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE | |
| 253 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 252 | .init = des_init_key, | 254 | .init = des_init_key, |
| 253 | .do_cipher = des_cfb64_cipher, | 255 | .do_cipher = des_cfb64_cipher, |
| 254 | .cleanup = NULL, | 256 | .cleanup = NULL, |
| 255 | .ctx_size = sizeof(DES_key_schedule), | 257 | .ctx_size = sizeof(DES_key_schedule), |
| 256 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 258 | .set_asn1_parameters = NULL, |
| 257 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 259 | .get_asn1_parameters = NULL, |
| 258 | .ctrl = des_ctrl, | 260 | .ctrl = des_ctrl, |
| 259 | }; | 261 | }; |
| 260 | 262 | ||
| @@ -270,13 +272,14 @@ static const EVP_CIPHER des_ofb = { | |||
| 270 | .block_size = 1, | 272 | .block_size = 1, |
| 271 | .key_len = 8, | 273 | .key_len = 8, |
| 272 | .iv_len = 8, | 274 | .iv_len = 8, |
| 273 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_OFB_MODE, | 275 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_OFB_MODE | |
| 276 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 274 | .init = des_init_key, | 277 | .init = des_init_key, |
| 275 | .do_cipher = des_ofb_cipher, | 278 | .do_cipher = des_ofb_cipher, |
| 276 | .cleanup = NULL, | 279 | .cleanup = NULL, |
| 277 | .ctx_size = sizeof(DES_key_schedule), | 280 | .ctx_size = sizeof(DES_key_schedule), |
| 278 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 281 | .set_asn1_parameters = NULL, |
| 279 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 282 | .get_asn1_parameters = NULL, |
| 280 | .ctrl = des_ctrl, | 283 | .ctrl = des_ctrl, |
| 281 | }; | 284 | }; |
| 282 | 285 | ||
| @@ -292,13 +295,14 @@ static const EVP_CIPHER des_ecb = { | |||
| 292 | .block_size = 8, | 295 | .block_size = 8, |
| 293 | .key_len = 8, | 296 | .key_len = 8, |
| 294 | .iv_len = 0, | 297 | .iv_len = 0, |
| 295 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_ECB_MODE, | 298 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_ECB_MODE | |
| 299 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 296 | .init = des_init_key, | 300 | .init = des_init_key, |
| 297 | .do_cipher = des_ecb_cipher, | 301 | .do_cipher = des_ecb_cipher, |
| 298 | .cleanup = NULL, | 302 | .cleanup = NULL, |
| 299 | .ctx_size = sizeof(DES_key_schedule), | 303 | .ctx_size = sizeof(DES_key_schedule), |
| 300 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 304 | .set_asn1_parameters = NULL, |
| 301 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 305 | .get_asn1_parameters = NULL, |
| 302 | .ctrl = des_ctrl, | 306 | .ctrl = des_ctrl, |
| 303 | }; | 307 | }; |
| 304 | 308 | ||
| @@ -314,13 +318,14 @@ static const EVP_CIPHER des_cfb1 = { | |||
| 314 | .block_size = 1, | 318 | .block_size = 1, |
| 315 | .key_len = 8, | 319 | .key_len = 8, |
| 316 | .iv_len = 8, | 320 | .iv_len = 8, |
| 317 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE, | 321 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE | |
| 322 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 318 | .init = des_init_key, | 323 | .init = des_init_key, |
| 319 | .do_cipher = des_cfb1_cipher, | 324 | .do_cipher = des_cfb1_cipher, |
| 320 | .cleanup = NULL, | 325 | .cleanup = NULL, |
| 321 | .ctx_size = sizeof(DES_key_schedule), | 326 | .ctx_size = sizeof(DES_key_schedule), |
| 322 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 327 | .set_asn1_parameters = NULL, |
| 323 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 328 | .get_asn1_parameters = NULL, |
| 324 | .ctrl = des_ctrl, | 329 | .ctrl = des_ctrl, |
| 325 | }; | 330 | }; |
| 326 | 331 | ||
| @@ -336,13 +341,14 @@ static const EVP_CIPHER des_cfb8 = { | |||
| 336 | .block_size = 1, | 341 | .block_size = 1, |
| 337 | .key_len = 8, | 342 | .key_len = 8, |
| 338 | .iv_len = 8, | 343 | .iv_len = 8, |
| 339 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE, | 344 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE | |
| 345 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 340 | .init = des_init_key, | 346 | .init = des_init_key, |
| 341 | .do_cipher = des_cfb8_cipher, | 347 | .do_cipher = des_cfb8_cipher, |
| 342 | .cleanup = NULL, | 348 | .cleanup = NULL, |
| 343 | .ctx_size = sizeof(DES_key_schedule), | 349 | .ctx_size = sizeof(DES_key_schedule), |
| 344 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 350 | .set_asn1_parameters = NULL, |
| 345 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 351 | .get_asn1_parameters = NULL, |
| 346 | .ctrl = des_ctrl, | 352 | .ctrl = des_ctrl, |
| 347 | }; | 353 | }; |
| 348 | 354 | ||
diff --git a/src/lib/libcrypto/evp/e_des3.c b/src/lib/libcrypto/evp/e_des3.c index 48fbcdb366..f3eb4cce1b 100644 --- a/src/lib/libcrypto/evp/e_des3.c +++ b/src/lib/libcrypto/evp/e_des3.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: e_des3.c,v 1.30 2024/04/09 13:52:41 beck Exp $ */ | 1 | /* $OpenBSD: e_des3.c,v 1.31 2025/05/27 03:58:12 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -258,13 +258,14 @@ static const EVP_CIPHER des_ede_cbc = { | |||
| 258 | .block_size = 8, | 258 | .block_size = 8, |
| 259 | .key_len = 16, | 259 | .key_len = 16, |
| 260 | .iv_len = 8, | 260 | .iv_len = 8, |
| 261 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CBC_MODE, | 261 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CBC_MODE | |
| 262 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 262 | .init = des_ede_init_key, | 263 | .init = des_ede_init_key, |
| 263 | .do_cipher = des_ede_cbc_cipher, | 264 | .do_cipher = des_ede_cbc_cipher, |
| 264 | .cleanup = NULL, | 265 | .cleanup = NULL, |
| 265 | .ctx_size = sizeof(DES_EDE_KEY), | 266 | .ctx_size = sizeof(DES_EDE_KEY), |
| 266 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 267 | .set_asn1_parameters = NULL, |
| 267 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 268 | .get_asn1_parameters = NULL, |
| 268 | .ctrl = des3_ctrl, | 269 | .ctrl = des3_ctrl, |
| 269 | }; | 270 | }; |
| 270 | 271 | ||
| @@ -280,13 +281,14 @@ static const EVP_CIPHER des_ede_cfb64 = { | |||
| 280 | .block_size = 1, | 281 | .block_size = 1, |
| 281 | .key_len = 16, | 282 | .key_len = 16, |
| 282 | .iv_len = 8, | 283 | .iv_len = 8, |
| 283 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE, | 284 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE | |
| 285 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 284 | .init = des_ede_init_key, | 286 | .init = des_ede_init_key, |
| 285 | .do_cipher = des_ede_cfb64_cipher, | 287 | .do_cipher = des_ede_cfb64_cipher, |
| 286 | .cleanup = NULL, | 288 | .cleanup = NULL, |
| 287 | .ctx_size = sizeof(DES_EDE_KEY), | 289 | .ctx_size = sizeof(DES_EDE_KEY), |
| 288 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 290 | .set_asn1_parameters = NULL, |
| 289 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 291 | .get_asn1_parameters = NULL, |
| 290 | .ctrl = des3_ctrl, | 292 | .ctrl = des3_ctrl, |
| 291 | }; | 293 | }; |
| 292 | 294 | ||
| @@ -307,8 +309,8 @@ static const EVP_CIPHER des_ede_ofb = { | |||
| 307 | .do_cipher = des_ede_ofb_cipher, | 309 | .do_cipher = des_ede_ofb_cipher, |
| 308 | .cleanup = NULL, | 310 | .cleanup = NULL, |
| 309 | .ctx_size = sizeof(DES_EDE_KEY), | 311 | .ctx_size = sizeof(DES_EDE_KEY), |
| 310 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 312 | .set_asn1_parameters = NULL, |
| 311 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 313 | .get_asn1_parameters = NULL, |
| 312 | .ctrl = des3_ctrl, | 314 | .ctrl = des3_ctrl, |
| 313 | }; | 315 | }; |
| 314 | 316 | ||
| @@ -324,13 +326,14 @@ static const EVP_CIPHER des_ede_ecb = { | |||
| 324 | .block_size = 8, | 326 | .block_size = 8, |
| 325 | .key_len = 16, | 327 | .key_len = 16, |
| 326 | .iv_len = 0, | 328 | .iv_len = 0, |
| 327 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_ECB_MODE, | 329 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_ECB_MODE | |
| 330 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 328 | .init = des_ede_init_key, | 331 | .init = des_ede_init_key, |
| 329 | .do_cipher = des_ede_ecb_cipher, | 332 | .do_cipher = des_ede_ecb_cipher, |
| 330 | .cleanup = NULL, | 333 | .cleanup = NULL, |
| 331 | .ctx_size = sizeof(DES_EDE_KEY), | 334 | .ctx_size = sizeof(DES_EDE_KEY), |
| 332 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 335 | .set_asn1_parameters = NULL, |
| 333 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 336 | .get_asn1_parameters = NULL, |
| 334 | .ctrl = des3_ctrl, | 337 | .ctrl = des3_ctrl, |
| 335 | }; | 338 | }; |
| 336 | 339 | ||
| @@ -352,13 +355,14 @@ static const EVP_CIPHER des_ede3_cbc = { | |||
| 352 | .block_size = 8, | 355 | .block_size = 8, |
| 353 | .key_len = 24, | 356 | .key_len = 24, |
| 354 | .iv_len = 8, | 357 | .iv_len = 8, |
| 355 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CBC_MODE, | 358 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CBC_MODE | |
| 359 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 356 | .init = des_ede3_init_key, | 360 | .init = des_ede3_init_key, |
| 357 | .do_cipher = des_ede3_cbc_cipher, | 361 | .do_cipher = des_ede3_cbc_cipher, |
| 358 | .cleanup = NULL, | 362 | .cleanup = NULL, |
| 359 | .ctx_size = sizeof(DES_EDE_KEY), | 363 | .ctx_size = sizeof(DES_EDE_KEY), |
| 360 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 364 | .set_asn1_parameters = NULL, |
| 361 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 365 | .get_asn1_parameters = NULL, |
| 362 | .ctrl = des3_ctrl, | 366 | .ctrl = des3_ctrl, |
| 363 | }; | 367 | }; |
| 364 | 368 | ||
| @@ -374,13 +378,14 @@ static const EVP_CIPHER des_ede3_cfb64 = { | |||
| 374 | .block_size = 1, | 378 | .block_size = 1, |
| 375 | .key_len = 24, | 379 | .key_len = 24, |
| 376 | .iv_len = 8, | 380 | .iv_len = 8, |
| 377 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE, | 381 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE | |
| 382 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 378 | .init = des_ede3_init_key, | 383 | .init = des_ede3_init_key, |
| 379 | .do_cipher = des_ede3_cfb64_cipher, | 384 | .do_cipher = des_ede3_cfb64_cipher, |
| 380 | .cleanup = NULL, | 385 | .cleanup = NULL, |
| 381 | .ctx_size = sizeof(DES_EDE_KEY), | 386 | .ctx_size = sizeof(DES_EDE_KEY), |
| 382 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 387 | .set_asn1_parameters = NULL, |
| 383 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 388 | .get_asn1_parameters = NULL, |
| 384 | .ctrl = des3_ctrl, | 389 | .ctrl = des3_ctrl, |
| 385 | }; | 390 | }; |
| 386 | 391 | ||
| @@ -396,13 +401,14 @@ static const EVP_CIPHER des_ede3_ofb = { | |||
| 396 | .block_size = 1, | 401 | .block_size = 1, |
| 397 | .key_len = 24, | 402 | .key_len = 24, |
| 398 | .iv_len = 8, | 403 | .iv_len = 8, |
| 399 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_OFB_MODE, | 404 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_OFB_MODE | |
| 405 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 400 | .init = des_ede3_init_key, | 406 | .init = des_ede3_init_key, |
| 401 | .do_cipher = des_ede3_ofb_cipher, | 407 | .do_cipher = des_ede3_ofb_cipher, |
| 402 | .cleanup = NULL, | 408 | .cleanup = NULL, |
| 403 | .ctx_size = sizeof(DES_EDE_KEY), | 409 | .ctx_size = sizeof(DES_EDE_KEY), |
| 404 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 410 | .set_asn1_parameters = NULL, |
| 405 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 411 | .get_asn1_parameters = NULL, |
| 406 | .ctrl = des3_ctrl, | 412 | .ctrl = des3_ctrl, |
| 407 | }; | 413 | }; |
| 408 | 414 | ||
| @@ -418,13 +424,14 @@ static const EVP_CIPHER des_ede3_ecb = { | |||
| 418 | .block_size = 8, | 424 | .block_size = 8, |
| 419 | .key_len = 24, | 425 | .key_len = 24, |
| 420 | .iv_len = 0, | 426 | .iv_len = 0, |
| 421 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_ECB_MODE, | 427 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_ECB_MODE | |
| 428 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 422 | .init = des_ede3_init_key, | 429 | .init = des_ede3_init_key, |
| 423 | .do_cipher = des_ede3_ecb_cipher, | 430 | .do_cipher = des_ede3_ecb_cipher, |
| 424 | .cleanup = NULL, | 431 | .cleanup = NULL, |
| 425 | .ctx_size = sizeof(DES_EDE_KEY), | 432 | .ctx_size = sizeof(DES_EDE_KEY), |
| 426 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 433 | .set_asn1_parameters = NULL, |
| 427 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 434 | .get_asn1_parameters = NULL, |
| 428 | .ctrl = des3_ctrl, | 435 | .ctrl = des3_ctrl, |
| 429 | }; | 436 | }; |
| 430 | 437 | ||
| @@ -441,13 +448,14 @@ static const EVP_CIPHER des_ede3_cfb1 = { | |||
| 441 | .block_size = 1, | 448 | .block_size = 1, |
| 442 | .key_len = 24, | 449 | .key_len = 24, |
| 443 | .iv_len = 8, | 450 | .iv_len = 8, |
| 444 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE, | 451 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE | |
| 452 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 445 | .init = des_ede3_init_key, | 453 | .init = des_ede3_init_key, |
| 446 | .do_cipher = des_ede3_cfb1_cipher, | 454 | .do_cipher = des_ede3_cfb1_cipher, |
| 447 | .cleanup = NULL, | 455 | .cleanup = NULL, |
| 448 | .ctx_size = sizeof(DES_EDE_KEY), | 456 | .ctx_size = sizeof(DES_EDE_KEY), |
| 449 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 457 | .set_asn1_parameters = NULL, |
| 450 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 458 | .get_asn1_parameters = NULL, |
| 451 | .ctrl = des3_ctrl, | 459 | .ctrl = des3_ctrl, |
| 452 | }; | 460 | }; |
| 453 | 461 | ||
| @@ -464,13 +472,14 @@ static const EVP_CIPHER des_ede3_cfb8 = { | |||
| 464 | .block_size = 1, | 472 | .block_size = 1, |
| 465 | .key_len = 24, | 473 | .key_len = 24, |
| 466 | .iv_len = 8, | 474 | .iv_len = 8, |
| 467 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE, | 475 | .flags = EVP_CIPH_RAND_KEY | EVP_CIPH_CFB_MODE | |
| 476 | EVP_CIPH_FLAG_DEFAULT_ASN1, | ||
| 468 | .init = des_ede3_init_key, | 477 | .init = des_ede3_init_key, |
| 469 | .do_cipher = des_ede3_cfb8_cipher, | 478 | .do_cipher = des_ede3_cfb8_cipher, |
| 470 | .cleanup = NULL, | 479 | .cleanup = NULL, |
| 471 | .ctx_size = sizeof(DES_EDE_KEY), | 480 | .ctx_size = sizeof(DES_EDE_KEY), |
| 472 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 481 | .set_asn1_parameters = NULL, |
| 473 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 482 | .get_asn1_parameters = NULL, |
| 474 | .ctrl = des3_ctrl, | 483 | .ctrl = des3_ctrl, |
| 475 | }; | 484 | }; |
| 476 | 485 | ||
diff --git a/src/lib/libcrypto/evp/e_idea.c b/src/lib/libcrypto/evp/e_idea.c index 86cf77602a..5d33a110fd 100644 --- a/src/lib/libcrypto/evp/e_idea.c +++ b/src/lib/libcrypto/evp/e_idea.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: e_idea.c,v 1.22 2024/04/09 13:52:41 beck Exp $ */ | 1 | /* $OpenBSD: e_idea.c,v 1.23 2025/05/27 03:58:12 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -181,13 +181,13 @@ static const EVP_CIPHER idea_cbc = { | |||
| 181 | .block_size = 8, | 181 | .block_size = 8, |
| 182 | .key_len = 16, | 182 | .key_len = 16, |
| 183 | .iv_len = 8, | 183 | .iv_len = 8, |
| 184 | .flags = 0 | EVP_CIPH_CBC_MODE, | 184 | .flags = EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 185 | .init = idea_init_key, | 185 | .init = idea_init_key, |
| 186 | .do_cipher = idea_cbc_cipher, | 186 | .do_cipher = idea_cbc_cipher, |
| 187 | .cleanup = NULL, | 187 | .cleanup = NULL, |
| 188 | .ctx_size = sizeof(IDEA_KEY_SCHEDULE), | 188 | .ctx_size = sizeof(IDEA_KEY_SCHEDULE), |
| 189 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 189 | .set_asn1_parameters = NULL, |
| 190 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 190 | .get_asn1_parameters = NULL, |
| 191 | .ctrl = NULL, | 191 | .ctrl = NULL, |
| 192 | }; | 192 | }; |
| 193 | 193 | ||
| @@ -203,13 +203,13 @@ static const EVP_CIPHER idea_cfb64 = { | |||
| 203 | .block_size = 1, | 203 | .block_size = 1, |
| 204 | .key_len = 16, | 204 | .key_len = 16, |
| 205 | .iv_len = 8, | 205 | .iv_len = 8, |
| 206 | .flags = 0 | EVP_CIPH_CFB_MODE, | 206 | .flags = EVP_CIPH_CFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 207 | .init = idea_init_key, | 207 | .init = idea_init_key, |
| 208 | .do_cipher = idea_cfb64_cipher, | 208 | .do_cipher = idea_cfb64_cipher, |
| 209 | .cleanup = NULL, | 209 | .cleanup = NULL, |
| 210 | .ctx_size = sizeof(IDEA_KEY_SCHEDULE), | 210 | .ctx_size = sizeof(IDEA_KEY_SCHEDULE), |
| 211 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 211 | .set_asn1_parameters = NULL, |
| 212 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 212 | .get_asn1_parameters = NULL, |
| 213 | .ctrl = NULL, | 213 | .ctrl = NULL, |
| 214 | }; | 214 | }; |
| 215 | 215 | ||
| @@ -225,13 +225,13 @@ static const EVP_CIPHER idea_ofb = { | |||
| 225 | .block_size = 1, | 225 | .block_size = 1, |
| 226 | .key_len = 16, | 226 | .key_len = 16, |
| 227 | .iv_len = 8, | 227 | .iv_len = 8, |
| 228 | .flags = 0 | EVP_CIPH_OFB_MODE, | 228 | .flags = EVP_CIPH_OFB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 229 | .init = idea_init_key, | 229 | .init = idea_init_key, |
| 230 | .do_cipher = idea_ofb_cipher, | 230 | .do_cipher = idea_ofb_cipher, |
| 231 | .cleanup = NULL, | 231 | .cleanup = NULL, |
| 232 | .ctx_size = sizeof(IDEA_KEY_SCHEDULE), | 232 | .ctx_size = sizeof(IDEA_KEY_SCHEDULE), |
| 233 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 233 | .set_asn1_parameters = NULL, |
| 234 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 234 | .get_asn1_parameters = NULL, |
| 235 | .ctrl = NULL, | 235 | .ctrl = NULL, |
| 236 | }; | 236 | }; |
| 237 | 237 | ||
| @@ -247,13 +247,13 @@ static const EVP_CIPHER idea_ecb = { | |||
| 247 | .block_size = 8, | 247 | .block_size = 8, |
| 248 | .key_len = 16, | 248 | .key_len = 16, |
| 249 | .iv_len = 0, | 249 | .iv_len = 0, |
| 250 | .flags = 0 | EVP_CIPH_ECB_MODE, | 250 | .flags = EVP_CIPH_ECB_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 251 | .init = idea_init_key, | 251 | .init = idea_init_key, |
| 252 | .do_cipher = idea_ecb_cipher, | 252 | .do_cipher = idea_ecb_cipher, |
| 253 | .cleanup = NULL, | 253 | .cleanup = NULL, |
| 254 | .ctx_size = sizeof(IDEA_KEY_SCHEDULE), | 254 | .ctx_size = sizeof(IDEA_KEY_SCHEDULE), |
| 255 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 255 | .set_asn1_parameters = NULL, |
| 256 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 256 | .get_asn1_parameters = NULL, |
| 257 | .ctrl = NULL, | 257 | .ctrl = NULL, |
| 258 | }; | 258 | }; |
| 259 | 259 | ||
diff --git a/src/lib/libcrypto/evp/e_rc2.c b/src/lib/libcrypto/evp/e_rc2.c index dc404cff20..b7ba60297a 100644 --- a/src/lib/libcrypto/evp/e_rc2.c +++ b/src/lib/libcrypto/evp/e_rc2.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: e_rc2.c,v 1.29 2024/04/09 13:52:41 beck Exp $ */ | 1 | /* $OpenBSD: e_rc2.c,v 1.30 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -63,11 +63,11 @@ | |||
| 63 | 63 | ||
| 64 | #ifndef OPENSSL_NO_RC2 | 64 | #ifndef OPENSSL_NO_RC2 |
| 65 | 65 | ||
| 66 | #include <openssl/err.h> | ||
| 67 | #include <openssl/evp.h> | 66 | #include <openssl/evp.h> |
| 68 | #include <openssl/objects.h> | 67 | #include <openssl/objects.h> |
| 69 | #include <openssl/rc2.h> | 68 | #include <openssl/rc2.h> |
| 70 | 69 | ||
| 70 | #include "err_local.h" | ||
| 71 | #include "evp_local.h" | 71 | #include "evp_local.h" |
| 72 | 72 | ||
| 73 | static int rc2_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 73 | static int rc2_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
diff --git a/src/lib/libcrypto/evp/e_xcbc_d.c b/src/lib/libcrypto/evp/e_xcbc_d.c index 1e3bee0791..1c5e6c32b2 100644 --- a/src/lib/libcrypto/evp/e_xcbc_d.c +++ b/src/lib/libcrypto/evp/e_xcbc_d.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: e_xcbc_d.c,v 1.18 2024/04/09 13:52:41 beck Exp $ */ | 1 | /* $OpenBSD: e_xcbc_d.c,v 1.19 2025/05/27 03:58:12 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -88,13 +88,13 @@ static const EVP_CIPHER d_xcbc_cipher = { | |||
| 88 | .block_size = 8, | 88 | .block_size = 8, |
| 89 | .key_len = 24, | 89 | .key_len = 24, |
| 90 | .iv_len = 8, | 90 | .iv_len = 8, |
| 91 | .flags = EVP_CIPH_CBC_MODE, | 91 | .flags = EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1, |
| 92 | .init = desx_cbc_init_key, | 92 | .init = desx_cbc_init_key, |
| 93 | .do_cipher = desx_cbc_cipher, | 93 | .do_cipher = desx_cbc_cipher, |
| 94 | .cleanup = NULL, | 94 | .cleanup = NULL, |
| 95 | .ctx_size = sizeof(DESX_CBC_KEY), | 95 | .ctx_size = sizeof(DESX_CBC_KEY), |
| 96 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, | 96 | .set_asn1_parameters = NULL, |
| 97 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | 97 | .get_asn1_parameters = NULL, |
| 98 | .ctrl = NULL, | 98 | .ctrl = NULL, |
| 99 | }; | 99 | }; |
| 100 | 100 | ||
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h index c2b81d0576..94295e1262 100644 --- a/src/lib/libcrypto/evp/evp.h +++ b/src/lib/libcrypto/evp/evp.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: evp.h,v 1.137 2024/08/31 10:38:49 tb Exp $ */ | 1 | /* $OpenBSD: evp.h,v 1.138 2025/07/02 06:36:52 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -778,28 +778,24 @@ void *EVP_PKEY_get0(const EVP_PKEY *pkey); | |||
| 778 | const unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len); | 778 | const unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len); |
| 779 | 779 | ||
| 780 | #ifndef OPENSSL_NO_RSA | 780 | #ifndef OPENSSL_NO_RSA |
| 781 | struct rsa_st; | 781 | RSA *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey); |
| 782 | struct rsa_st *EVP_PKEY_get0_RSA(EVP_PKEY *pkey); | 782 | RSA *EVP_PKEY_get1_RSA(const EVP_PKEY *pkey); |
| 783 | struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); | 783 | int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, RSA *key); |
| 784 | int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key); | ||
| 785 | #endif | 784 | #endif |
| 786 | #ifndef OPENSSL_NO_DSA | 785 | #ifndef OPENSSL_NO_DSA |
| 787 | struct dsa_st; | 786 | DSA *EVP_PKEY_get0_DSA(const EVP_PKEY *pkey); |
| 788 | struct dsa_st *EVP_PKEY_get0_DSA(EVP_PKEY *pkey); | 787 | DSA *EVP_PKEY_get1_DSA(const EVP_PKEY *pkey); |
| 789 | struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); | 788 | int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, DSA *key); |
| 790 | int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, struct dsa_st *key); | ||
| 791 | #endif | 789 | #endif |
| 792 | #ifndef OPENSSL_NO_DH | 790 | #ifndef OPENSSL_NO_DH |
| 793 | struct dh_st; | 791 | DH *EVP_PKEY_get0_DH(const EVP_PKEY *pkey); |
| 794 | struct dh_st *EVP_PKEY_get0_DH(EVP_PKEY *pkey); | 792 | DH *EVP_PKEY_get1_DH(const EVP_PKEY *pkey); |
| 795 | struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); | 793 | int EVP_PKEY_set1_DH(EVP_PKEY *pkey, DH *key); |
| 796 | int EVP_PKEY_set1_DH(EVP_PKEY *pkey, struct dh_st *key); | ||
| 797 | #endif | 794 | #endif |
| 798 | #ifndef OPENSSL_NO_EC | 795 | #ifndef OPENSSL_NO_EC |
| 799 | struct ec_key_st; | 796 | EC_KEY *EVP_PKEY_get0_EC_KEY(const EVP_PKEY *pkey); |
| 800 | struct ec_key_st *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey); | 797 | EC_KEY *EVP_PKEY_get1_EC_KEY(const EVP_PKEY *pkey); |
| 801 | struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); | 798 | int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, EC_KEY *key); |
| 802 | int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, struct ec_key_st *key); | ||
| 803 | #endif | 799 | #endif |
| 804 | 800 | ||
| 805 | EVP_PKEY *EVP_PKEY_new(void); | 801 | EVP_PKEY *EVP_PKEY_new(void); |
diff --git a/src/lib/libcrypto/evp/evp_aead.c b/src/lib/libcrypto/evp/evp_aead.c index b35f5157ed..fdac082217 100644 --- a/src/lib/libcrypto/evp/evp_aead.c +++ b/src/lib/libcrypto/evp/evp_aead.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: evp_aead.c,v 1.11 2024/04/09 13:52:41 beck Exp $ */ | 1 | /* $OpenBSD: evp_aead.c,v 1.12 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014, Google Inc. | 3 | * Copyright (c) 2014, Google Inc. |
| 4 | * | 4 | * |
| @@ -19,8 +19,8 @@ | |||
| 19 | #include <string.h> | 19 | #include <string.h> |
| 20 | 20 | ||
| 21 | #include <openssl/evp.h> | 21 | #include <openssl/evp.h> |
| 22 | #include <openssl/err.h> | ||
| 23 | 22 | ||
| 23 | #include "err_local.h" | ||
| 24 | #include "evp_local.h" | 24 | #include "evp_local.h" |
| 25 | 25 | ||
| 26 | size_t | 26 | size_t |
diff --git a/src/lib/libcrypto/evp/evp_cipher.c b/src/lib/libcrypto/evp/evp_cipher.c index e9c266d1b9..04e0e1c0b0 100644 --- a/src/lib/libcrypto/evp/evp_cipher.c +++ b/src/lib/libcrypto/evp/evp_cipher.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: evp_cipher.c,v 1.23 2024/04/10 15:00:38 beck Exp $ */ | 1 | /* $OpenBSD: evp_cipher.c,v 1.28 2025/07/02 06:19:46 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -115,10 +115,10 @@ | |||
| 115 | #include <string.h> | 115 | #include <string.h> |
| 116 | 116 | ||
| 117 | #include <openssl/asn1.h> | 117 | #include <openssl/asn1.h> |
| 118 | #include <openssl/err.h> | ||
| 119 | #include <openssl/evp.h> | 118 | #include <openssl/evp.h> |
| 120 | 119 | ||
| 121 | #include "asn1_local.h" | 120 | #include "asn1_local.h" |
| 121 | #include "err_local.h" | ||
| 122 | #include "evp_local.h" | 122 | #include "evp_local.h" |
| 123 | 123 | ||
| 124 | int | 124 | int |
| @@ -167,7 +167,7 @@ EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *engine, | |||
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | if ((ctx->cipher->flags & EVP_CIPH_CTRL_INIT) != 0) { | 169 | if ((ctx->cipher->flags & EVP_CIPH_CTRL_INIT) != 0) { |
| 170 | if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_INIT, 0, NULL)) { | 170 | if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_INIT, 0, NULL) <= 0) { |
| 171 | EVPerror(EVP_R_INITIALIZATION_ERROR); | 171 | EVPerror(EVP_R_INITIALIZATION_ERROR); |
| 172 | return 0; | 172 | return 0; |
| 173 | } | 173 | } |
| @@ -944,14 +944,20 @@ EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx) | |||
| 944 | LCRYPTO_ALIAS(EVP_CIPHER_CTX_flags); | 944 | LCRYPTO_ALIAS(EVP_CIPHER_CTX_flags); |
| 945 | 945 | ||
| 946 | /* | 946 | /* |
| 947 | * Used by CMS and its predecessors. Only GOST and RC2 have a custom method. | 947 | * Used by CMS and its predecessors. Only RC2 has a custom method. |
| 948 | */ | 948 | */ |
| 949 | 949 | ||
| 950 | int | 950 | int |
| 951 | EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) | 951 | EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) |
| 952 | { | 952 | { |
| 953 | int iv_len; | 953 | int iv_len; |
| 954 | 954 | ||
| 955 | if (ctx->cipher->get_asn1_parameters != NULL) | ||
| 956 | return ctx->cipher->get_asn1_parameters(ctx, type); | ||
| 957 | |||
| 958 | if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) == 0) | ||
| 959 | return -1; | ||
| 960 | |||
| 955 | if (type == NULL) | 961 | if (type == NULL) |
| 956 | return 0; | 962 | return 0; |
| 957 | 963 | ||
| @@ -970,21 +976,15 @@ EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) | |||
| 970 | } | 976 | } |
| 971 | 977 | ||
| 972 | int | 978 | int |
| 973 | EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) | 979 | EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) |
| 974 | { | 980 | { |
| 975 | if (ctx->cipher->get_asn1_parameters != NULL) | 981 | int iv_len; |
| 976 | return ctx->cipher->get_asn1_parameters(ctx, type); | ||
| 977 | |||
| 978 | if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) != 0) | ||
| 979 | return EVP_CIPHER_get_asn1_iv(ctx, type); | ||
| 980 | 982 | ||
| 981 | return -1; | 983 | if (ctx->cipher->set_asn1_parameters != NULL) |
| 982 | } | 984 | return ctx->cipher->set_asn1_parameters(ctx, type); |
| 983 | 985 | ||
| 984 | int | 986 | if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) == 0) |
| 985 | EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) | 987 | return -1; |
| 986 | { | ||
| 987 | int iv_len; | ||
| 988 | 988 | ||
| 989 | if (type == NULL) | 989 | if (type == NULL) |
| 990 | return 0; | 990 | return 0; |
| @@ -998,18 +998,6 @@ EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) | |||
| 998 | return ASN1_TYPE_set_octetstring(type, ctx->oiv, iv_len); | 998 | return ASN1_TYPE_set_octetstring(type, ctx->oiv, iv_len); |
| 999 | } | 999 | } |
| 1000 | 1000 | ||
| 1001 | int | ||
| 1002 | EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) | ||
| 1003 | { | ||
| 1004 | if (ctx->cipher->set_asn1_parameters != NULL) | ||
| 1005 | return ctx->cipher->set_asn1_parameters(ctx, type); | ||
| 1006 | |||
| 1007 | if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) != 0) | ||
| 1008 | return EVP_CIPHER_set_asn1_iv(ctx, type); | ||
| 1009 | |||
| 1010 | return -1; | ||
| 1011 | } | ||
| 1012 | |||
| 1013 | /* Convert the various cipher NIDs and dummies to a proper OID NID */ | 1001 | /* Convert the various cipher NIDs and dummies to a proper OID NID */ |
| 1014 | int | 1002 | int |
| 1015 | EVP_CIPHER_type(const EVP_CIPHER *cipher) | 1003 | EVP_CIPHER_type(const EVP_CIPHER *cipher) |
diff --git a/src/lib/libcrypto/evp/evp_digest.c b/src/lib/libcrypto/evp/evp_digest.c index 0a97d25c7d..8bd6691fbf 100644 --- a/src/lib/libcrypto/evp/evp_digest.c +++ b/src/lib/libcrypto/evp/evp_digest.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: evp_digest.c,v 1.14 2024/04/10 15:00:38 beck Exp $ */ | 1 | /* $OpenBSD: evp_digest.c,v 1.15 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -114,10 +114,10 @@ | |||
| 114 | 114 | ||
| 115 | #include <openssl/opensslconf.h> | 115 | #include <openssl/opensslconf.h> |
| 116 | 116 | ||
| 117 | #include <openssl/err.h> | ||
| 118 | #include <openssl/evp.h> | 117 | #include <openssl/evp.h> |
| 119 | #include <openssl/objects.h> | 118 | #include <openssl/objects.h> |
| 120 | 119 | ||
| 120 | #include "err_local.h" | ||
| 121 | #include "evp_local.h" | 121 | #include "evp_local.h" |
| 122 | 122 | ||
| 123 | int | 123 | int |
diff --git a/src/lib/libcrypto/evp/evp_key.c b/src/lib/libcrypto/evp/evp_key.c index e7c7ec3294..128bec0ac3 100644 --- a/src/lib/libcrypto/evp/evp_key.c +++ b/src/lib/libcrypto/evp/evp_key.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: evp_key.c,v 1.36 2024/04/09 13:52:41 beck Exp $ */ | 1 | /* $OpenBSD: evp_key.c,v 1.37 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -59,12 +59,12 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <string.h> | 60 | #include <string.h> |
| 61 | 61 | ||
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
| 64 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
| 65 | #include <openssl/ui.h> | 64 | #include <openssl/ui.h> |
| 66 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
| 67 | 66 | ||
| 67 | #include "err_local.h" | ||
| 68 | #include "evp_local.h" | 68 | #include "evp_local.h" |
| 69 | 69 | ||
| 70 | /* should be init to zeros. */ | 70 | /* should be init to zeros. */ |
diff --git a/src/lib/libcrypto/evp/evp_local.h b/src/lib/libcrypto/evp/evp_local.h index 54cd65d0af..76465643c6 100644 --- a/src/lib/libcrypto/evp/evp_local.h +++ b/src/lib/libcrypto/evp/evp_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: evp_local.h,v 1.25 2024/08/29 16:58:19 tb Exp $ */ | 1 | /* $OpenBSD: evp_local.h,v 1.26 2025/05/27 03:58:12 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -353,9 +353,7 @@ struct evp_aead_ctx_st { | |||
| 353 | }; | 353 | }; |
| 354 | 354 | ||
| 355 | /* Legacy EVP_CIPHER methods used by CMS and its predecessors. */ | 355 | /* Legacy EVP_CIPHER methods used by CMS and its predecessors. */ |
| 356 | int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *cipher, ASN1_TYPE *type); | ||
| 357 | int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *cipher, ASN1_TYPE *type); | 356 | int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *cipher, ASN1_TYPE *type); |
| 358 | int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *cipher, ASN1_TYPE *type); | ||
| 359 | int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *cipher, ASN1_TYPE *type); | 357 | int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *cipher, ASN1_TYPE *type); |
| 360 | 358 | ||
| 361 | int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, | 359 | int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, |
diff --git a/src/lib/libcrypto/evp/evp_names.c b/src/lib/libcrypto/evp/evp_names.c index 817d33602c..8757d191dd 100644 --- a/src/lib/libcrypto/evp/evp_names.c +++ b/src/lib/libcrypto/evp/evp_names.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: evp_names.c,v 1.18 2024/08/31 10:38:49 tb Exp $ */ | 1 | /* $OpenBSD: evp_names.c,v 1.19 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Theo Buehler <tb@openbsd.org> | 3 | * Copyright (c) 2023 Theo Buehler <tb@openbsd.org> |
| 4 | * | 4 | * |
| @@ -15,7 +15,6 @@ | |||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include <openssl/err.h> | ||
| 19 | #include <openssl/evp.h> | 18 | #include <openssl/evp.h> |
| 20 | #include <openssl/objects.h> | 19 | #include <openssl/objects.h> |
| 21 | 20 | ||
diff --git a/src/lib/libcrypto/evp/evp_pbe.c b/src/lib/libcrypto/evp/evp_pbe.c index 88ceb14033..cb2ace1fd0 100644 --- a/src/lib/libcrypto/evp/evp_pbe.c +++ b/src/lib/libcrypto/evp/evp_pbe.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: evp_pbe.c,v 1.50 2024/04/09 13:52:41 beck Exp $ */ | 1 | /* $OpenBSD: evp_pbe.c,v 1.51 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -60,13 +60,13 @@ | |||
| 60 | #include <string.h> | 60 | #include <string.h> |
| 61 | 61 | ||
| 62 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/evp.h> | 63 | #include <openssl/evp.h> |
| 65 | #include <openssl/hmac.h> | 64 | #include <openssl/hmac.h> |
| 66 | #include <openssl/objects.h> | 65 | #include <openssl/objects.h> |
| 67 | #include <openssl/pkcs12.h> | 66 | #include <openssl/pkcs12.h> |
| 68 | #include <openssl/x509.h> | 67 | #include <openssl/x509.h> |
| 69 | 68 | ||
| 69 | #include "err_local.h" | ||
| 70 | #include "evp_local.h" | 70 | #include "evp_local.h" |
| 71 | #include "hmac_local.h" | 71 | #include "hmac_local.h" |
| 72 | #include "pkcs12_local.h" | 72 | #include "pkcs12_local.h" |
diff --git a/src/lib/libcrypto/evp/evp_pkey.c b/src/lib/libcrypto/evp/evp_pkey.c index a1e127352a..1c0b8b41e9 100644 --- a/src/lib/libcrypto/evp/evp_pkey.c +++ b/src/lib/libcrypto/evp/evp_pkey.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: evp_pkey.c,v 1.33 2025/02/04 04:51:34 tb Exp $ */ | 1 | /* $OpenBSD: evp_pkey.c,v 1.34 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -60,10 +60,10 @@ | |||
| 60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
| 61 | #include <string.h> | 61 | #include <string.h> |
| 62 | 62 | ||
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/x509.h> | 63 | #include <openssl/x509.h> |
| 65 | 64 | ||
| 66 | #include "asn1_local.h" | 65 | #include "asn1_local.h" |
| 66 | #include "err_local.h" | ||
| 67 | #include "evp_local.h" | 67 | #include "evp_local.h" |
| 68 | 68 | ||
| 69 | /* Extract a private key from a PKCS8 structure */ | 69 | /* Extract a private key from a PKCS8 structure */ |
diff --git a/src/lib/libcrypto/evp/m_sigver.c b/src/lib/libcrypto/evp/m_sigver.c index a3353854f1..66e4752242 100644 --- a/src/lib/libcrypto/evp/m_sigver.c +++ b/src/lib/libcrypto/evp/m_sigver.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: m_sigver.c,v 1.27 2024/04/09 13:52:41 beck Exp $ */ | 1 | /* $OpenBSD: m_sigver.c,v 1.28 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -58,11 +58,11 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | 60 | ||
| 61 | #include <openssl/err.h> | ||
| 62 | #include <openssl/evp.h> | 61 | #include <openssl/evp.h> |
| 63 | #include <openssl/objects.h> | 62 | #include <openssl/objects.h> |
| 64 | #include <openssl/x509.h> | 63 | #include <openssl/x509.h> |
| 65 | 64 | ||
| 65 | #include "err_local.h" | ||
| 66 | #include "evp_local.h" | 66 | #include "evp_local.h" |
| 67 | 67 | ||
| 68 | static int | 68 | static int |
diff --git a/src/lib/libcrypto/evp/p_legacy.c b/src/lib/libcrypto/evp/p_legacy.c index 01cfdbcd6a..7c958a16e3 100644 --- a/src/lib/libcrypto/evp/p_legacy.c +++ b/src/lib/libcrypto/evp/p_legacy.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: p_legacy.c,v 1.6 2024/04/09 13:52:41 beck Exp $ */ | 1 | /* $OpenBSD: p_legacy.c,v 1.7 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -59,10 +59,10 @@ | |||
| 59 | #include <stdlib.h> | 59 | #include <stdlib.h> |
| 60 | 60 | ||
| 61 | #include <openssl/evp.h> | 61 | #include <openssl/evp.h> |
| 62 | #include <openssl/err.h> | ||
| 63 | 62 | ||
| 64 | #include <openssl/rsa.h> | 63 | #include <openssl/rsa.h> |
| 65 | 64 | ||
| 65 | #include "err_local.h" | ||
| 66 | #include "evp_local.h" | 66 | #include "evp_local.h" |
| 67 | 67 | ||
| 68 | int | 68 | int |
diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c index 95c7721303..3f88185737 100644 --- a/src/lib/libcrypto/evp/p_lib.c +++ b/src/lib/libcrypto/evp/p_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: p_lib.c,v 1.61 2024/08/22 12:24:24 tb Exp $ */ | 1 | /* $OpenBSD: p_lib.c,v 1.63 2025/07/02 06:36:52 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -111,7 +111,6 @@ | |||
| 111 | #include <openssl/bio.h> | 111 | #include <openssl/bio.h> |
| 112 | #include <openssl/cmac.h> | 112 | #include <openssl/cmac.h> |
| 113 | #include <openssl/crypto.h> | 113 | #include <openssl/crypto.h> |
| 114 | #include <openssl/err.h> | ||
| 115 | #include <openssl/evp.h> | 114 | #include <openssl/evp.h> |
| 116 | #include <openssl/objects.h> | 115 | #include <openssl/objects.h> |
| 117 | #include <openssl/x509.h> | 116 | #include <openssl/x509.h> |
| @@ -129,6 +128,7 @@ | |||
| 129 | #include <openssl/rsa.h> | 128 | #include <openssl/rsa.h> |
| 130 | #endif | 129 | #endif |
| 131 | 130 | ||
| 131 | #include "err_local.h" | ||
| 132 | #include "evp_local.h" | 132 | #include "evp_local.h" |
| 133 | 133 | ||
| 134 | extern const EVP_PKEY_ASN1_METHOD cmac_asn1_meth; | 134 | extern const EVP_PKEY_ASN1_METHOD cmac_asn1_meth; |
| @@ -628,7 +628,7 @@ LCRYPTO_ALIAS(EVP_PKEY_get0_hmac); | |||
| 628 | 628 | ||
| 629 | #ifndef OPENSSL_NO_RSA | 629 | #ifndef OPENSSL_NO_RSA |
| 630 | RSA * | 630 | RSA * |
| 631 | EVP_PKEY_get0_RSA(EVP_PKEY *pkey) | 631 | EVP_PKEY_get0_RSA(const EVP_PKEY *pkey) |
| 632 | { | 632 | { |
| 633 | if (pkey->type == EVP_PKEY_RSA || pkey->type == EVP_PKEY_RSA_PSS) | 633 | if (pkey->type == EVP_PKEY_RSA || pkey->type == EVP_PKEY_RSA_PSS) |
| 634 | return pkey->pkey.rsa; | 634 | return pkey->pkey.rsa; |
| @@ -639,7 +639,7 @@ EVP_PKEY_get0_RSA(EVP_PKEY *pkey) | |||
| 639 | LCRYPTO_ALIAS(EVP_PKEY_get0_RSA); | 639 | LCRYPTO_ALIAS(EVP_PKEY_get0_RSA); |
| 640 | 640 | ||
| 641 | RSA * | 641 | RSA * |
| 642 | EVP_PKEY_get1_RSA(EVP_PKEY *pkey) | 642 | EVP_PKEY_get1_RSA(const EVP_PKEY *pkey) |
| 643 | { | 643 | { |
| 644 | RSA *rsa; | 644 | RSA *rsa; |
| 645 | 645 | ||
| @@ -665,7 +665,7 @@ LCRYPTO_ALIAS(EVP_PKEY_set1_RSA); | |||
| 665 | 665 | ||
| 666 | #ifndef OPENSSL_NO_DSA | 666 | #ifndef OPENSSL_NO_DSA |
| 667 | DSA * | 667 | DSA * |
| 668 | EVP_PKEY_get0_DSA(EVP_PKEY *pkey) | 668 | EVP_PKEY_get0_DSA(const EVP_PKEY *pkey) |
| 669 | { | 669 | { |
| 670 | if (pkey->type != EVP_PKEY_DSA) { | 670 | if (pkey->type != EVP_PKEY_DSA) { |
| 671 | EVPerror(EVP_R_EXPECTING_A_DSA_KEY); | 671 | EVPerror(EVP_R_EXPECTING_A_DSA_KEY); |
| @@ -676,7 +676,7 @@ EVP_PKEY_get0_DSA(EVP_PKEY *pkey) | |||
| 676 | LCRYPTO_ALIAS(EVP_PKEY_get0_DSA); | 676 | LCRYPTO_ALIAS(EVP_PKEY_get0_DSA); |
| 677 | 677 | ||
| 678 | DSA * | 678 | DSA * |
| 679 | EVP_PKEY_get1_DSA(EVP_PKEY *pkey) | 679 | EVP_PKEY_get1_DSA(const EVP_PKEY *pkey) |
| 680 | { | 680 | { |
| 681 | DSA *dsa; | 681 | DSA *dsa; |
| 682 | 682 | ||
| @@ -702,7 +702,7 @@ LCRYPTO_ALIAS(EVP_PKEY_set1_DSA); | |||
| 702 | 702 | ||
| 703 | #ifndef OPENSSL_NO_EC | 703 | #ifndef OPENSSL_NO_EC |
| 704 | EC_KEY * | 704 | EC_KEY * |
| 705 | EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey) | 705 | EVP_PKEY_get0_EC_KEY(const EVP_PKEY *pkey) |
| 706 | { | 706 | { |
| 707 | if (pkey->type != EVP_PKEY_EC) { | 707 | if (pkey->type != EVP_PKEY_EC) { |
| 708 | EVPerror(EVP_R_EXPECTING_A_EC_KEY); | 708 | EVPerror(EVP_R_EXPECTING_A_EC_KEY); |
| @@ -713,7 +713,7 @@ EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey) | |||
| 713 | LCRYPTO_ALIAS(EVP_PKEY_get0_EC_KEY); | 713 | LCRYPTO_ALIAS(EVP_PKEY_get0_EC_KEY); |
| 714 | 714 | ||
| 715 | EC_KEY * | 715 | EC_KEY * |
| 716 | EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey) | 716 | EVP_PKEY_get1_EC_KEY(const EVP_PKEY *pkey) |
| 717 | { | 717 | { |
| 718 | EC_KEY *key; | 718 | EC_KEY *key; |
| 719 | 719 | ||
| @@ -740,7 +740,7 @@ LCRYPTO_ALIAS(EVP_PKEY_set1_EC_KEY); | |||
| 740 | 740 | ||
| 741 | #ifndef OPENSSL_NO_DH | 741 | #ifndef OPENSSL_NO_DH |
| 742 | DH * | 742 | DH * |
| 743 | EVP_PKEY_get0_DH(EVP_PKEY *pkey) | 743 | EVP_PKEY_get0_DH(const EVP_PKEY *pkey) |
| 744 | { | 744 | { |
| 745 | if (pkey->type != EVP_PKEY_DH) { | 745 | if (pkey->type != EVP_PKEY_DH) { |
| 746 | EVPerror(EVP_R_EXPECTING_A_DH_KEY); | 746 | EVPerror(EVP_R_EXPECTING_A_DH_KEY); |
| @@ -751,7 +751,7 @@ EVP_PKEY_get0_DH(EVP_PKEY *pkey) | |||
| 751 | LCRYPTO_ALIAS(EVP_PKEY_get0_DH); | 751 | LCRYPTO_ALIAS(EVP_PKEY_get0_DH); |
| 752 | 752 | ||
| 753 | DH * | 753 | DH * |
| 754 | EVP_PKEY_get1_DH(EVP_PKEY *pkey) | 754 | EVP_PKEY_get1_DH(const EVP_PKEY *pkey) |
| 755 | { | 755 | { |
| 756 | DH *dh; | 756 | DH *dh; |
| 757 | 757 | ||
diff --git a/src/lib/libcrypto/evp/p_sign.c b/src/lib/libcrypto/evp/p_sign.c index 7f472ea716..775cf78d62 100644 --- a/src/lib/libcrypto/evp/p_sign.c +++ b/src/lib/libcrypto/evp/p_sign.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: p_sign.c,v 1.22 2024/04/09 13:52:41 beck Exp $ */ | 1 | /* $OpenBSD: p_sign.c,v 1.23 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -58,7 +58,6 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | 60 | ||
| 61 | #include <openssl/err.h> | ||
| 62 | #include <openssl/evp.h> | 61 | #include <openssl/evp.h> |
| 63 | #include <openssl/objects.h> | 62 | #include <openssl/objects.h> |
| 64 | #include <openssl/x509.h> | 63 | #include <openssl/x509.h> |
diff --git a/src/lib/libcrypto/evp/p_verify.c b/src/lib/libcrypto/evp/p_verify.c index 02132e2c38..cd7482df55 100644 --- a/src/lib/libcrypto/evp/p_verify.c +++ b/src/lib/libcrypto/evp/p_verify.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: p_verify.c,v 1.21 2024/04/09 13:52:41 beck Exp $ */ | 1 | /* $OpenBSD: p_verify.c,v 1.22 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -58,7 +58,6 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | 60 | ||
| 61 | #include <openssl/err.h> | ||
| 62 | #include <openssl/evp.h> | 61 | #include <openssl/evp.h> |
| 63 | #include <openssl/objects.h> | 62 | #include <openssl/objects.h> |
| 64 | #include <openssl/x509.h> | 63 | #include <openssl/x509.h> |
diff --git a/src/lib/libcrypto/evp/pmeth_fn.c b/src/lib/libcrypto/evp/pmeth_fn.c index 308c434f0d..ad6c04dabb 100644 --- a/src/lib/libcrypto/evp/pmeth_fn.c +++ b/src/lib/libcrypto/evp/pmeth_fn.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pmeth_fn.c,v 1.11 2024/04/12 09:41:39 tb Exp $ */ | 1 | /* $OpenBSD: pmeth_fn.c,v 1.12 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -59,10 +59,10 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
| 61 | 61 | ||
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
| 64 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
| 65 | 64 | ||
| 65 | #include "err_local.h" | ||
| 66 | #include "evp_local.h" | 66 | #include "evp_local.h" |
| 67 | 67 | ||
| 68 | #define M_check_autoarg(ctx, arg, arglen, err) \ | 68 | #define M_check_autoarg(ctx, arg, arglen, err) \ |
diff --git a/src/lib/libcrypto/evp/pmeth_gn.c b/src/lib/libcrypto/evp/pmeth_gn.c index bc1c5bd7d2..fa5b446124 100644 --- a/src/lib/libcrypto/evp/pmeth_gn.c +++ b/src/lib/libcrypto/evp/pmeth_gn.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pmeth_gn.c,v 1.21 2024/08/31 09:14:21 tb Exp $ */ | 1 | /* $OpenBSD: pmeth_gn.c,v 1.22 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -60,12 +60,12 @@ | |||
| 60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
| 61 | 61 | ||
| 62 | #include <openssl/bn.h> | 62 | #include <openssl/bn.h> |
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/evp.h> | 63 | #include <openssl/evp.h> |
| 65 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
| 66 | 65 | ||
| 67 | #include "asn1_local.h" | 66 | #include "asn1_local.h" |
| 68 | #include "bn_local.h" | 67 | #include "bn_local.h" |
| 68 | #include "err_local.h" | ||
| 69 | #include "evp_local.h" | 69 | #include "evp_local.h" |
| 70 | 70 | ||
| 71 | int | 71 | int |
diff --git a/src/lib/libcrypto/evp/pmeth_lib.c b/src/lib/libcrypto/evp/pmeth_lib.c index fbf4057c38..ce6beecad6 100644 --- a/src/lib/libcrypto/evp/pmeth_lib.c +++ b/src/lib/libcrypto/evp/pmeth_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pmeth_lib.c,v 1.42 2025/01/20 12:57:28 tb Exp $ */ | 1 | /* $OpenBSD: pmeth_lib.c,v 1.43 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -63,12 +63,12 @@ | |||
| 63 | 63 | ||
| 64 | #include <openssl/opensslconf.h> | 64 | #include <openssl/opensslconf.h> |
| 65 | 65 | ||
| 66 | #include <openssl/err.h> | ||
| 67 | #include <openssl/evp.h> | 66 | #include <openssl/evp.h> |
| 68 | #include <openssl/objects.h> | 67 | #include <openssl/objects.h> |
| 69 | #include <openssl/x509v3.h> | 68 | #include <openssl/x509v3.h> |
| 70 | 69 | ||
| 71 | #include "asn1_local.h" | 70 | #include "asn1_local.h" |
| 71 | #include "err_local.h" | ||
| 72 | #include "evp_local.h" | 72 | #include "evp_local.h" |
| 73 | 73 | ||
| 74 | extern const EVP_PKEY_METHOD cmac_pkey_meth; | 74 | extern const EVP_PKEY_METHOD cmac_pkey_meth; |
diff --git a/src/lib/libcrypto/format-pem.pl b/src/lib/libcrypto/format-pem.pl index 5a96fe5b1d..fba3470344 100644 --- a/src/lib/libcrypto/format-pem.pl +++ b/src/lib/libcrypto/format-pem.pl | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | #!/usr/bin/perl | 1 | #!/usr/bin/perl |
| 2 | # $OpenBSD: format-pem.pl,v 1.7 2024/11/01 11:19:13 sthen Exp $ | 2 | # $OpenBSD: format-pem.pl,v 1.8 2025/06/16 10:24:55 sthen Exp $ |
| 3 | # | 3 | # |
| 4 | # Copyright (c) 2016 Stuart Henderson <sthen@openbsd.org> | 4 | # Copyright (c) 2016 Stuart Henderson <sthen@openbsd.org> |
| 5 | # | 5 | # |
| @@ -99,6 +99,7 @@ while(<>) { | |||
| 99 | 99 | ||
| 100 | my $verify = qx/openssl verify -CAfile $t $t 2>&1/; | 100 | my $verify = qx/openssl verify -CAfile $t $t 2>&1/; |
| 101 | if (not $verify =~ /^$t: OK$/) { | 101 | if (not $verify =~ /^$t: OK$/) { |
| 102 | $verify =~ s,$t: ,,; | ||
| 102 | print STDERR "ERROR: '$subj' cannot be verified with libressl\n---\n$verify---\n"; | 103 | print STDERR "ERROR: '$subj' cannot be verified with libressl\n---\n$verify---\n"; |
| 103 | $ca{$o}{$subj}{'valid'} = 0; | 104 | $ca{$o}{$subj}{'valid'} = 0; |
| 104 | } | 105 | } |
diff --git a/src/lib/libcrypto/hidden/crypto_namespace.h b/src/lib/libcrypto/hidden/crypto_namespace.h index 741ad08549..43c8718ed0 100644 --- a/src/lib/libcrypto/hidden/crypto_namespace.h +++ b/src/lib/libcrypto/hidden/crypto_namespace.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_namespace.h,v 1.4 2024/07/11 21:31:52 miod Exp $ */ | 1 | /* $OpenBSD: crypto_namespace.h,v 1.5 2025/08/18 16:00:05 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2016 Philip Guenther <guenther@openbsd.org> | 3 | * Copyright (c) 2016 Philip Guenther <guenther@openbsd.org> |
| 4 | * | 4 | * |
| @@ -45,7 +45,11 @@ | |||
| 45 | # define LCRYPTO_UNUSED(x) | 45 | # define LCRYPTO_UNUSED(x) |
| 46 | # define LCRYPTO_USED(x) | 46 | # define LCRYPTO_USED(x) |
| 47 | # define LCRYPTO_ALIAS1(pre,x) | 47 | # define LCRYPTO_ALIAS1(pre,x) |
| 48 | #ifdef _MSC_VER | ||
| 49 | # define LCRYPTO_ALIAS(x) | ||
| 50 | #else | ||
| 48 | # define LCRYPTO_ALIAS(x) asm("") | 51 | # define LCRYPTO_ALIAS(x) asm("") |
| 52 | #endif /* _MSC_VER */ | ||
| 49 | #endif | 53 | #endif |
| 50 | 54 | ||
| 51 | #endif /* _LIBCRYPTO_CRYPTO_NAMESPACE_H_ */ | 55 | #endif /* _LIBCRYPTO_CRYPTO_NAMESPACE_H_ */ |
diff --git a/src/lib/libcrypto/hidden/openssl/asn1t.h b/src/lib/libcrypto/hidden/openssl/asn1t.h index 17bcb4e453..8f5f09b09f 100644 --- a/src/lib/libcrypto/hidden/openssl/asn1t.h +++ b/src/lib/libcrypto/hidden/openssl/asn1t.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: asn1t.h,v 1.5 2024/07/08 17:01:54 beck Exp $ */ | 1 | /* $OpenBSD: asn1t.h,v 1.6 2025/08/22 14:07:34 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2023 Bob Beck <beck@openbsd.org> |
| 4 | * | 4 | * |
| @@ -30,6 +30,9 @@ LCRYPTO_USED(ASN1_item_ex_free); | |||
| 30 | LCRYPTO_USED(ASN1_item_ex_d2i); | 30 | LCRYPTO_USED(ASN1_item_ex_d2i); |
| 31 | LCRYPTO_USED(ASN1_item_ex_i2d); | 31 | LCRYPTO_USED(ASN1_item_ex_i2d); |
| 32 | #if defined(LIBRESSL_NAMESPACE) | 32 | #if defined(LIBRESSL_NAMESPACE) |
| 33 | extern LCRYPTO_USED(ASN1_BOOLEAN_it); | ||
| 34 | extern LCRYPTO_USED(ASN1_TBOOLEAN_it); | ||
| 35 | extern LCRYPTO_USED(ASN1_FBOOLEAN_it); | ||
| 33 | extern LCRYPTO_USED(ASN1_SEQUENCE_it); | 36 | extern LCRYPTO_USED(ASN1_SEQUENCE_it); |
| 34 | extern LCRYPTO_USED(BIGNUM_it); | 37 | extern LCRYPTO_USED(BIGNUM_it); |
| 35 | extern LCRYPTO_USED(LONG_it); | 38 | extern LCRYPTO_USED(LONG_it); |
diff --git a/src/lib/libcrypto/hidden/openssl/bio.h b/src/lib/libcrypto/hidden/openssl/bio.h index 03da75a795..69651cf3cb 100644 --- a/src/lib/libcrypto/hidden/openssl/bio.h +++ b/src/lib/libcrypto/hidden/openssl/bio.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bio.h,v 1.8 2024/07/09 06:14:59 beck Exp $ */ | 1 | /* $OpenBSD: bio.h,v 1.9 2025/07/16 15:59:26 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2023 Bob Beck <beck@openbsd.org> |
| 4 | * | 4 | * |
| @@ -103,7 +103,6 @@ LCRYPTO_USED(BIO_s_socket); | |||
| 103 | LCRYPTO_USED(BIO_s_connect); | 103 | LCRYPTO_USED(BIO_s_connect); |
| 104 | LCRYPTO_USED(BIO_s_accept); | 104 | LCRYPTO_USED(BIO_s_accept); |
| 105 | LCRYPTO_USED(BIO_s_fd); | 105 | LCRYPTO_USED(BIO_s_fd); |
| 106 | LCRYPTO_USED(BIO_s_log); | ||
| 107 | LCRYPTO_USED(BIO_s_bio); | 106 | LCRYPTO_USED(BIO_s_bio); |
| 108 | LCRYPTO_USED(BIO_s_null); | 107 | LCRYPTO_USED(BIO_s_null); |
| 109 | LCRYPTO_USED(BIO_f_null); | 108 | LCRYPTO_USED(BIO_f_null); |
diff --git a/src/lib/libcrypto/hidden/openssl/mlkem.h b/src/lib/libcrypto/hidden/openssl/mlkem.h index 8cd80eb3af..e5f1fc0634 100644 --- a/src/lib/libcrypto/hidden/openssl/mlkem.h +++ b/src/lib/libcrypto/hidden/openssl/mlkem.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* $OpenBSD: mlkem.h,v 1.4 2024/12/20 15:10:31 tb Exp $ */ | 1 | /* $OpenBSD: mlkem.h,v 1.6 2025/08/19 21:37:08 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Bob Beck <beck@obtuse.com> | 3 | * Copyright (c) 2025 Bob Beck <beck@openbsd.org> |
| 4 | * | 4 | * |
| 5 | * Permission to use, copy, modify, and distribute this software for any | 5 | * Permission to use, copy, modify, and distribute this software for any |
| 6 | * purpose with or without fee is hereby granted, provided that the above | 6 | * purpose with or without fee is hereby granted, provided that the above |
| @@ -18,9 +18,6 @@ | |||
| 18 | #ifndef _LIBCRYPTO_MLKEM_H | 18 | #ifndef _LIBCRYPTO_MLKEM_H |
| 19 | #define _LIBCRYPTO_MLKEM_H | 19 | #define _LIBCRYPTO_MLKEM_H |
| 20 | 20 | ||
| 21 | /* Undo when making public */ | ||
| 22 | #ifdef LIBRESSL_HAS_MLKEM | ||
| 23 | |||
| 24 | #ifndef _MSC_VER | 21 | #ifndef _MSC_VER |
| 25 | #include_next <openssl/mlkem.h> | 22 | #include_next <openssl/mlkem.h> |
| 26 | #else | 23 | #else |
| @@ -28,22 +25,22 @@ | |||
| 28 | #endif | 25 | #endif |
| 29 | #include "crypto_namespace.h" | 26 | #include "crypto_namespace.h" |
| 30 | 27 | ||
| 31 | LCRYPTO_USED(MLKEM768_generate_key); | 28 | LCRYPTO_USED(MLKEM_private_key_new); |
| 32 | LCRYPTO_USED(MLKEM768_public_from_private); | 29 | LCRYPTO_USED(MLKEM_private_key_free); |
| 33 | LCRYPTO_USED(MLKEM768_encap); | 30 | LCRYPTO_USED(MLKEM_private_key_ciphertext_length); |
| 34 | LCRYPTO_USED(MLKEM768_decap); | 31 | LCRYPTO_USED(MLKEM_private_key_encoded_length); |
| 35 | LCRYPTO_USED(MLKEM768_marshal_public_key); | 32 | LCRYPTO_USED(MLKEM_public_key_new); |
| 36 | LCRYPTO_USED(MLKEM768_parse_public_key); | 33 | LCRYPTO_USED(MLKEM_public_key_free); |
| 37 | LCRYPTO_USED(MLKEM768_private_key_from_seed); | 34 | LCRYPTO_USED(MLKEM_public_key_ciphertext_length); |
| 38 | LCRYPTO_USED(MLKEM768_parse_private_key); | 35 | LCRYPTO_USED(MLKEM_public_key_encoded_length); |
| 39 | LCRYPTO_USED(MLKEM1024_generate_key); | 36 | LCRYPTO_USED(MLKEM_generate_key); |
| 40 | LCRYPTO_USED(MLKEM1024_public_from_private); | 37 | LCRYPTO_USED(MLKEM_private_key_from_seed); |
| 41 | LCRYPTO_USED(MLKEM1024_encap); | 38 | LCRYPTO_USED(MLKEM_public_from_private); |
| 42 | LCRYPTO_USED(MLKEM1024_decap); | 39 | LCRYPTO_USED(MLKEM_encap); |
| 43 | LCRYPTO_USED(MLKEM1024_marshal_public_key); | 40 | LCRYPTO_USED(MLKEM_decap); |
| 44 | LCRYPTO_USED(MLKEM1024_parse_public_key); | 41 | LCRYPTO_USED(MLKEM_marshal_public_key); |
| 45 | LCRYPTO_USED(MLKEM1024_private_key_from_seed); | 42 | LCRYPTO_USED(MLKEM_parse_public_key); |
| 46 | LCRYPTO_USED(MLKEM1024_parse_private_key); | 43 | LCRYPTO_USED(MLKEM_marshal_private_key); |
| 47 | #endif /* LIBRESSL_HAS_MLKEM */ | 44 | LCRYPTO_USED(MLKEM_parse_private_key); |
| 48 | 45 | ||
| 49 | #endif /* _LIBCRYPTO_MLKEM_H */ | 46 | #endif /* _LIBCRYPTO_MLKEM_H */ |
diff --git a/src/lib/libcrypto/hidden/openssl/pem.h b/src/lib/libcrypto/hidden/openssl/pem.h index 5838f07f4d..233fd8859b 100644 --- a/src/lib/libcrypto/hidden/openssl/pem.h +++ b/src/lib/libcrypto/hidden/openssl/pem.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pem.h,v 1.2 2023/07/07 19:37:54 beck Exp $ */ | 1 | /* $OpenBSD: pem.h,v 1.3 2025/07/16 15:59:26 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2023 Bob Beck <beck@openbsd.org> |
| 4 | * | 4 | * |
| @@ -33,12 +33,10 @@ LCRYPTO_USED(PEM_bytes_read_bio); | |||
| 33 | LCRYPTO_USED(PEM_ASN1_read_bio); | 33 | LCRYPTO_USED(PEM_ASN1_read_bio); |
| 34 | LCRYPTO_USED(PEM_ASN1_write_bio); | 34 | LCRYPTO_USED(PEM_ASN1_write_bio); |
| 35 | LCRYPTO_USED(PEM_X509_INFO_read_bio); | 35 | LCRYPTO_USED(PEM_X509_INFO_read_bio); |
| 36 | LCRYPTO_USED(PEM_X509_INFO_write_bio); | ||
| 37 | LCRYPTO_USED(PEM_read); | 36 | LCRYPTO_USED(PEM_read); |
| 38 | LCRYPTO_USED(PEM_write); | 37 | LCRYPTO_USED(PEM_write); |
| 39 | LCRYPTO_USED(PEM_ASN1_read); | 38 | LCRYPTO_USED(PEM_ASN1_read); |
| 40 | LCRYPTO_USED(PEM_ASN1_write); | 39 | LCRYPTO_USED(PEM_ASN1_write); |
| 41 | LCRYPTO_USED(PEM_X509_INFO_read); | ||
| 42 | LCRYPTO_USED(PEM_SignInit); | 40 | LCRYPTO_USED(PEM_SignInit); |
| 43 | LCRYPTO_USED(PEM_SignUpdate); | 41 | LCRYPTO_USED(PEM_SignUpdate); |
| 44 | LCRYPTO_USED(PEM_SignFinal); | 42 | LCRYPTO_USED(PEM_SignFinal); |
diff --git a/src/lib/libcrypto/hidden/openssl/x509.h b/src/lib/libcrypto/hidden/openssl/x509.h index e6104cd451..5e78f7af97 100644 --- a/src/lib/libcrypto/hidden/openssl/x509.h +++ b/src/lib/libcrypto/hidden/openssl/x509.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509.h,v 1.15 2025/03/09 15:17:22 tb Exp $ */ | 1 | /* $OpenBSD: x509.h,v 1.16 2025/07/16 15:59:26 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2022 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2022 Bob Beck <beck@openbsd.org> |
| 4 | * | 4 | * |
| @@ -401,8 +401,6 @@ LCRYPTO_USED(i2d_X509_CRL); | |||
| 401 | LCRYPTO_USED(X509_CRL_add0_revoked); | 401 | LCRYPTO_USED(X509_CRL_add0_revoked); |
| 402 | LCRYPTO_USED(X509_CRL_get0_by_serial); | 402 | LCRYPTO_USED(X509_CRL_get0_by_serial); |
| 403 | LCRYPTO_USED(X509_CRL_get0_by_cert); | 403 | LCRYPTO_USED(X509_CRL_get0_by_cert); |
| 404 | LCRYPTO_USED(X509_PKEY_new); | ||
| 405 | LCRYPTO_USED(X509_PKEY_free); | ||
| 406 | LCRYPTO_USED(NETSCAPE_SPKI_new); | 404 | LCRYPTO_USED(NETSCAPE_SPKI_new); |
| 407 | LCRYPTO_USED(NETSCAPE_SPKI_free); | 405 | LCRYPTO_USED(NETSCAPE_SPKI_free); |
| 408 | LCRYPTO_USED(d2i_NETSCAPE_SPKI); | 406 | LCRYPTO_USED(d2i_NETSCAPE_SPKI); |
diff --git a/src/lib/libcrypto/hidden/openssl/x509_vfy.h b/src/lib/libcrypto/hidden/openssl/x509_vfy.h index cc0991518f..d0c46b655e 100644 --- a/src/lib/libcrypto/hidden/openssl/x509_vfy.h +++ b/src/lib/libcrypto/hidden/openssl/x509_vfy.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_vfy.h,v 1.10 2025/03/09 15:20:20 tb Exp $ */ | 1 | /* $OpenBSD: x509_vfy.h,v 1.11 2025/10/24 11:33:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2022 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2022 Bob Beck <beck@openbsd.org> |
| 4 | * | 4 | * |
| @@ -122,6 +122,7 @@ LCRYPTO_USED(X509_VERIFY_PARAM_set1_name); | |||
| 122 | LCRYPTO_USED(X509_VERIFY_PARAM_set_flags); | 122 | LCRYPTO_USED(X509_VERIFY_PARAM_set_flags); |
| 123 | LCRYPTO_USED(X509_VERIFY_PARAM_clear_flags); | 123 | LCRYPTO_USED(X509_VERIFY_PARAM_clear_flags); |
| 124 | LCRYPTO_USED(X509_VERIFY_PARAM_get_flags); | 124 | LCRYPTO_USED(X509_VERIFY_PARAM_get_flags); |
| 125 | LCRYPTO_USED(X509_VERIFY_PARAM_get_hostflags); | ||
| 125 | LCRYPTO_USED(X509_VERIFY_PARAM_set_purpose); | 126 | LCRYPTO_USED(X509_VERIFY_PARAM_set_purpose); |
| 126 | LCRYPTO_USED(X509_VERIFY_PARAM_set_trust); | 127 | LCRYPTO_USED(X509_VERIFY_PARAM_set_trust); |
| 127 | LCRYPTO_USED(X509_VERIFY_PARAM_set_depth); | 128 | LCRYPTO_USED(X509_VERIFY_PARAM_set_depth); |
diff --git a/src/lib/libcrypto/hkdf/hkdf.c b/src/lib/libcrypto/hkdf/hkdf.c index 6104ef0cc7..f68df4bea4 100644 --- a/src/lib/libcrypto/hkdf/hkdf.c +++ b/src/lib/libcrypto/hkdf/hkdf.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: hkdf.c,v 1.11 2024/03/25 13:09:13 jsing Exp $ */ | 1 | /* $OpenBSD: hkdf.c,v 1.12 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014, Google Inc. | 3 | * Copyright (c) 2014, Google Inc. |
| 4 | * | 4 | * |
| @@ -19,10 +19,10 @@ | |||
| 19 | 19 | ||
| 20 | #include <string.h> | 20 | #include <string.h> |
| 21 | 21 | ||
| 22 | #include <openssl/err.h> | ||
| 23 | #include <openssl/hmac.h> | 22 | #include <openssl/hmac.h> |
| 24 | 23 | ||
| 25 | #include "bytestring.h" | 24 | #include "bytestring.h" |
| 25 | #include "err_local.h" | ||
| 26 | #include "evp_local.h" | 26 | #include "evp_local.h" |
| 27 | #include "hmac_local.h" | 27 | #include "hmac_local.h" |
| 28 | 28 | ||
diff --git a/src/lib/libcrypto/hmac/hmac.c b/src/lib/libcrypto/hmac/hmac.c index dc1614d3ce..e3d5664143 100644 --- a/src/lib/libcrypto/hmac/hmac.c +++ b/src/lib/libcrypto/hmac/hmac.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: hmac.c,v 1.36 2024/08/31 10:42:21 tb Exp $ */ | 1 | /* $OpenBSD: hmac.c,v 1.37 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -60,9 +60,9 @@ | |||
| 60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
| 61 | #include <string.h> | 61 | #include <string.h> |
| 62 | 62 | ||
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/hmac.h> | 63 | #include <openssl/hmac.h> |
| 65 | 64 | ||
| 65 | #include "err_local.h" | ||
| 66 | #include "evp_local.h" | 66 | #include "evp_local.h" |
| 67 | #include "hmac_local.h" | 67 | #include "hmac_local.h" |
| 68 | 68 | ||
diff --git a/src/lib/libcrypto/idea/idea.h b/src/lib/libcrypto/idea/idea.h index 2bdd3647fd..fccef8fc73 100644 --- a/src/lib/libcrypto/idea/idea.h +++ b/src/lib/libcrypto/idea/idea.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: idea.h,v 1.13 2025/01/25 17:59:44 tb Exp $ */ | 1 | /* $OpenBSD: idea.h,v 1.14 2025/06/09 14:37:49 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -59,7 +59,12 @@ | |||
| 59 | #ifndef HEADER_IDEA_H | 59 | #ifndef HEADER_IDEA_H |
| 60 | #define HEADER_IDEA_H | 60 | #define HEADER_IDEA_H |
| 61 | 61 | ||
| 62 | #include <openssl/opensslconf.h> /* IDEA_INT, OPENSSL_NO_IDEA */ | 62 | #include <openssl/opensslconf.h> /* OPENSSL_NO_IDEA */ |
| 63 | |||
| 64 | #ifndef IDEA_INT | ||
| 65 | /* XXX - typedef */ | ||
| 66 | #define IDEA_INT unsigned int | ||
| 67 | #endif | ||
| 63 | 68 | ||
| 64 | #define IDEA_ENCRYPT 1 | 69 | #define IDEA_ENCRYPT 1 |
| 65 | #define IDEA_DECRYPT 0 | 70 | #define IDEA_DECRYPT 0 |
diff --git a/src/lib/libcrypto/idea/idea_local.h b/src/lib/libcrypto/idea/idea_local.h index c7fd3271a7..c0a592ab1c 100644 --- a/src/lib/libcrypto/idea/idea_local.h +++ b/src/lib/libcrypto/idea/idea_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: idea_local.h,v 1.2 2023/07/07 12:51:58 beck Exp $ */ | 1 | /* $OpenBSD: idea_local.h,v 1.3 2025/11/26 10:19:57 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -56,6 +56,9 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #ifndef HEADER_IDEA_LOCAL_H | ||
| 60 | #define HEADER_IDEA_LOCAL_H | ||
| 61 | |||
| 59 | /* The new form of this macro (check if the a*b == 0) was suggested by | 62 | /* The new form of this macro (check if the a*b == 0) was suggested by |
| 60 | * Colin Plumb <colin@nyx10.cs.du.edu> */ | 63 | * Colin Plumb <colin@nyx10.cs.du.edu> */ |
| 61 | /* Removal of the inner if from from Wei Dai 24/4/96 */ | 64 | /* Removal of the inner if from from Wei Dai 24/4/96 */ |
| @@ -147,3 +150,5 @@ else \ | |||
| 147 | ul=x2^t0; /* do the swap to x3 */ \ | 150 | ul=x2^t0; /* do the swap to x3 */ \ |
| 148 | x2=x3^t1; \ | 151 | x2=x3^t1; \ |
| 149 | x3=ul; | 152 | x3=ul; |
| 153 | |||
| 154 | #endif /* HEADER_IDEA_LOCAL_H */ | ||
diff --git a/src/lib/libcrypto/kdf/hkdf_evp.c b/src/lib/libcrypto/kdf/hkdf_evp.c index b33e2e0a26..dee6e35d82 100644 --- a/src/lib/libcrypto/kdf/hkdf_evp.c +++ b/src/lib/libcrypto/kdf/hkdf_evp.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: hkdf_evp.c,v 1.20 2023/06/26 08:57:17 tb Exp $ */ | 1 | /* $OpenBSD: hkdf_evp.c,v 1.22 2025/05/21 03:53:20 kenjiro Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 2016-2018 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2016-2018 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -50,12 +50,11 @@ | |||
| 50 | #include <stdlib.h> | 50 | #include <stdlib.h> |
| 51 | #include <string.h> | 51 | #include <string.h> |
| 52 | 52 | ||
| 53 | #include <openssl/err.h> | ||
| 54 | #include <openssl/evp.h> | ||
| 55 | #include <openssl/hmac.h> | 53 | #include <openssl/hmac.h> |
| 56 | #include <openssl/hkdf.h> | 54 | #include <openssl/hkdf.h> |
| 57 | #include <openssl/kdf.h> | 55 | #include <openssl/kdf.h> |
| 58 | 56 | ||
| 57 | #include "err_local.h" | ||
| 59 | #include "evp_local.h" | 58 | #include "evp_local.h" |
| 60 | 59 | ||
| 61 | #define HKDF_MAXBUF 1024 | 60 | #define HKDF_MAXBUF 1024 |
| @@ -91,6 +90,9 @@ pkey_hkdf_cleanup(EVP_PKEY_CTX *ctx) | |||
| 91 | { | 90 | { |
| 92 | HKDF_PKEY_CTX *kctx = ctx->data; | 91 | HKDF_PKEY_CTX *kctx = ctx->data; |
| 93 | 92 | ||
| 93 | if (kctx == NULL) | ||
| 94 | return; | ||
| 95 | |||
| 94 | freezero(kctx->salt, kctx->salt_len); | 96 | freezero(kctx->salt, kctx->salt_len); |
| 95 | freezero(kctx->key, kctx->key_len); | 97 | freezero(kctx->key, kctx->key_len); |
| 96 | freezero(kctx, sizeof(*kctx)); | 98 | freezero(kctx, sizeof(*kctx)); |
diff --git a/src/lib/libcrypto/kdf/tls1_prf.c b/src/lib/libcrypto/kdf/tls1_prf.c index 7d6231e3c7..2b86ff744f 100644 --- a/src/lib/libcrypto/kdf/tls1_prf.c +++ b/src/lib/libcrypto/kdf/tls1_prf.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls1_prf.c,v 1.40 2024/07/10 06:53:27 tb Exp $ */ | 1 | /* $OpenBSD: tls1_prf.c,v 1.42 2025/05/21 03:53:20 kenjiro Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project |
| 4 | * 2016. | 4 | * 2016. |
| @@ -61,10 +61,10 @@ | |||
| 61 | #include <stdio.h> | 61 | #include <stdio.h> |
| 62 | #include <string.h> | 62 | #include <string.h> |
| 63 | 63 | ||
| 64 | #include <openssl/err.h> | ||
| 65 | #include <openssl/evp.h> | 64 | #include <openssl/evp.h> |
| 66 | #include <openssl/kdf.h> | 65 | #include <openssl/kdf.h> |
| 67 | 66 | ||
| 67 | #include "err_local.h" | ||
| 68 | #include "evp_local.h" | 68 | #include "evp_local.h" |
| 69 | 69 | ||
| 70 | #define TLS1_PRF_MAXBUF 1024 | 70 | #define TLS1_PRF_MAXBUF 1024 |
| @@ -96,6 +96,9 @@ pkey_tls1_prf_cleanup(EVP_PKEY_CTX *ctx) | |||
| 96 | { | 96 | { |
| 97 | struct tls1_prf_ctx *kctx = ctx->data; | 97 | struct tls1_prf_ctx *kctx = ctx->data; |
| 98 | 98 | ||
| 99 | if (kctx == NULL) | ||
| 100 | return; | ||
| 101 | |||
| 99 | freezero(kctx->secret, kctx->secret_len); | 102 | freezero(kctx->secret, kctx->secret_len); |
| 100 | freezero(kctx, sizeof(*kctx)); | 103 | freezero(kctx, sizeof(*kctx)); |
| 101 | } | 104 | } |
diff --git a/src/lib/libcrypto/lhash/lhash.c b/src/lib/libcrypto/lhash/lhash.c index aa532267de..ad6ece543b 100644 --- a/src/lib/libcrypto/lhash/lhash.c +++ b/src/lib/libcrypto/lhash/lhash.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: lhash.c,v 1.28 2024/07/14 14:32:45 jsing Exp $ */ | 1 | /* $OpenBSD: lhash.c,v 1.29 2025/05/01 00:35:23 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -115,11 +115,11 @@ expand(_LHASH *lh) | |||
| 115 | #endif | 115 | #endif |
| 116 | if ((hash % nni) != p) { /* move it */ | 116 | if ((hash % nni) != p) { /* move it */ |
| 117 | *n1 = (*n1)->next; | 117 | *n1 = (*n1)->next; |
| 118 | np->next= *n2; | 118 | np->next = *n2; |
| 119 | *n2 = np; | 119 | *n2 = np; |
| 120 | } else | 120 | } else |
| 121 | n1 = &((*n1)->next); | 121 | n1 = &((*n1)->next); |
| 122 | np= *n1; | 122 | np = *n1; |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | if ((lh->p) >= lh->pmax) { | 125 | if ((lh->p) >= lh->pmax) { |
| @@ -305,7 +305,7 @@ lh_delete(_LHASH *lh, const void *data) | |||
| 305 | if (*rn == NULL) { | 305 | if (*rn == NULL) { |
| 306 | return (NULL); | 306 | return (NULL); |
| 307 | } else { | 307 | } else { |
| 308 | nn= *rn; | 308 | nn = *rn; |
| 309 | *rn = nn->next; | 309 | *rn = nn->next; |
| 310 | ret = nn->data; | 310 | ret = nn->data; |
| 311 | free(nn); | 311 | free(nn); |
diff --git a/src/lib/libcrypto/man/ACCESS_DESCRIPTION_new.3 b/src/lib/libcrypto/man/ACCESS_DESCRIPTION_new.3 index 15156ffca3..bfa915c8af 100644 --- a/src/lib/libcrypto/man/ACCESS_DESCRIPTION_new.3 +++ b/src/lib/libcrypto/man/ACCESS_DESCRIPTION_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ACCESS_DESCRIPTION_new.3,v 1.6 2022/03/31 17:27:16 naddy Exp $ | 1 | .\" $OpenBSD: ACCESS_DESCRIPTION_new.3,v 1.7 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 31 2022 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt ACCESS_DESCRIPTION_NEW 3 | 18 | .Dt ACCESS_DESCRIPTION_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -24,6 +24,7 @@ | |||
| 24 | .Nm AUTHORITY_INFO_ACCESS_free | 24 | .Nm AUTHORITY_INFO_ACCESS_free |
| 25 | .Nd X.509 information access extensions | 25 | .Nd X.509 information access extensions |
| 26 | .Sh SYNOPSIS | 26 | .Sh SYNOPSIS |
| 27 | .Lb libcrypto | ||
| 27 | .In openssl/x509v3.h | 28 | .In openssl/x509v3.h |
| 28 | .Ft ACCESS_DESCRIPTION * | 29 | .Ft ACCESS_DESCRIPTION * |
| 29 | .Fn ACCESS_DESCRIPTION_new void | 30 | .Fn ACCESS_DESCRIPTION_new void |
diff --git a/src/lib/libcrypto/man/AES_encrypt.3 b/src/lib/libcrypto/man/AES_encrypt.3 index f022848a61..0a3c63dce2 100644 --- a/src/lib/libcrypto/man/AES_encrypt.3 +++ b/src/lib/libcrypto/man/AES_encrypt.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: AES_encrypt.3,v 1.1 2019/08/28 10:37:42 schwarze Exp $ | 1 | .\" $OpenBSD: AES_encrypt.3,v 1.3 2025/12/20 08:51:56 tb Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: August 28 2019 $ | 17 | .Dd $Mdocdate: December 20 2025 $ |
| 18 | .Dt AES_ENCRYPT 3 | 18 | .Dt AES_ENCRYPT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -25,6 +25,7 @@ | |||
| 25 | .Nm AES_cbc_encrypt | 25 | .Nm AES_cbc_encrypt |
| 26 | .Nd low-level interface to the AES symmetric cipher | 26 | .Nd low-level interface to the AES symmetric cipher |
| 27 | .Sh SYNOPSIS | 27 | .Sh SYNOPSIS |
| 28 | .Lb libcrypto | ||
| 28 | .In openssl/aes.h | 29 | .In openssl/aes.h |
| 29 | .Ft int | 30 | .Ft int |
| 30 | .Fo AES_set_encrypt_key | 31 | .Fo AES_set_encrypt_key |
| @@ -60,7 +61,7 @@ | |||
| 60 | .Fa "const int enc" | 61 | .Fa "const int enc" |
| 61 | .Fc | 62 | .Fc |
| 62 | .Sh DESCRIPTION | 63 | .Sh DESCRIPTION |
| 63 | These function provide a low-level interface to the AES symmetric | 64 | These functions provide a low-level interface to the AES symmetric |
| 64 | cipher algorithm, also called Rijndael. | 65 | cipher algorithm, also called Rijndael. |
| 65 | For reasons of flexibility, it is recommended that application | 66 | For reasons of flexibility, it is recommended that application |
| 66 | programs use the high-level interface described in | 67 | programs use the high-level interface described in |
diff --git a/src/lib/libcrypto/man/ASIdentifiers_new.3 b/src/lib/libcrypto/man/ASIdentifiers_new.3 index d8473b81a0..f5f4a1215e 100644 --- a/src/lib/libcrypto/man/ASIdentifiers_new.3 +++ b/src/lib/libcrypto/man/ASIdentifiers_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASIdentifiers_new.3,v 1.11 2023/09/30 18:16:44 tb Exp $ | 1 | .\" $OpenBSD: ASIdentifiers_new.3,v 1.12 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> | 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: September 30 2023 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt ASIDENTIFIERS_NEW 3 | 18 | .Dt ASIDENTIFIERS_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -24,6 +24,7 @@ | |||
| 24 | .Nm i2d_ASIdentifiers | 24 | .Nm i2d_ASIdentifiers |
| 25 | .Nd RFC 3779 autonomous system identifier delegation extensions | 25 | .Nd RFC 3779 autonomous system identifier delegation extensions |
| 26 | .Sh SYNOPSIS | 26 | .Sh SYNOPSIS |
| 27 | .Lb libcrypto | ||
| 27 | .In openssl/x509v3.h | 28 | .In openssl/x509v3.h |
| 28 | .Ft ASIdentifiers * | 29 | .Ft ASIdentifiers * |
| 29 | .Fo ASIdentifiers_new | 30 | .Fo ASIdentifiers_new |
diff --git a/src/lib/libcrypto/man/ASN1_BIT_STRING_set.3 b/src/lib/libcrypto/man/ASN1_BIT_STRING_set.3 index a916ca3ab2..d3ab3b1ee0 100644 --- a/src/lib/libcrypto/man/ASN1_BIT_STRING_set.3 +++ b/src/lib/libcrypto/man/ASN1_BIT_STRING_set.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_BIT_STRING_set.3,v 1.5 2024/12/24 09:48:56 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_BIT_STRING_set.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 24 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt ASN1_BIT_STRING_SET 3 | 18 | .Dt ASN1_BIT_STRING_SET 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -23,6 +23,7 @@ | |||
| 23 | .Nm ASN1_BIT_STRING_get_bit | 23 | .Nm ASN1_BIT_STRING_get_bit |
| 24 | .Nd ASN.1 BIT STRING accessors | 24 | .Nd ASN.1 BIT STRING accessors |
| 25 | .Sh SYNOPSIS | 25 | .Sh SYNOPSIS |
| 26 | .Lb libcrypto | ||
| 26 | .In openssl/asn1.h | 27 | .In openssl/asn1.h |
| 27 | .Ft int | 28 | .Ft int |
| 28 | .Fo ASN1_BIT_STRING_set | 29 | .Fo ASN1_BIT_STRING_set |
diff --git a/src/lib/libcrypto/man/ASN1_INTEGER_get.3 b/src/lib/libcrypto/man/ASN1_INTEGER_get.3 index 84f566eda9..985e2e5084 100644 --- a/src/lib/libcrypto/man/ASN1_INTEGER_get.3 +++ b/src/lib/libcrypto/man/ASN1_INTEGER_get.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_INTEGER_get.3,v 1.7 2023/05/22 19:38:04 tb Exp $ | 1 | .\" $OpenBSD: ASN1_INTEGER_get.3,v 1.8 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" selective merge up to: | 2 | .\" selective merge up to: |
| 3 | .\" OpenSSL man3/ASN1_INTEGER_get_int64 24a535ea Sep 22 13:14:20 2020 +0100 | 3 | .\" OpenSSL man3/ASN1_INTEGER_get_int64 24a535ea Sep 22 13:14:20 2020 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: May 22 2023 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt ASN1_INTEGER_GET 3 | 70 | .Dt ASN1_INTEGER_GET 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -88,6 +88,7 @@ | |||
| 88 | .Nm ASN1_ENUMERATED_to_BN | 88 | .Nm ASN1_ENUMERATED_to_BN |
| 89 | .Nd ASN.1 INTEGER and ENUMERATED utilities | 89 | .Nd ASN.1 INTEGER and ENUMERATED utilities |
| 90 | .Sh SYNOPSIS | 90 | .Sh SYNOPSIS |
| 91 | .Lb libcrypto | ||
| 91 | .In openssl/asn1.h | 92 | .In openssl/asn1.h |
| 92 | .Ft int | 93 | .Ft int |
| 93 | .Fo ASN1_INTEGER_get_uint64 | 94 | .Fo ASN1_INTEGER_get_uint64 |
diff --git a/src/lib/libcrypto/man/ASN1_NULL_new.3 b/src/lib/libcrypto/man/ASN1_NULL_new.3 index b4d2428ed1..1244f2e252 100644 --- a/src/lib/libcrypto/man/ASN1_NULL_new.3 +++ b/src/lib/libcrypto/man/ASN1_NULL_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_NULL_new.3,v 1.3 2021/12/09 18:42:35 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_NULL_new.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 9 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt ASN1_NULL_NEW 3 | 18 | .Dt ASN1_NULL_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm ASN1_NULL_free | 22 | .Nm ASN1_NULL_free |
| 23 | .Nd ASN.1 NULL value | 23 | .Nd ASN.1 NULL value |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/asn1.h | 26 | .In openssl/asn1.h |
| 26 | .Ft ASN1_NULL * | 27 | .Ft ASN1_NULL * |
| 27 | .Fn ASN1_NULL_new void | 28 | .Fn ASN1_NULL_new void |
diff --git a/src/lib/libcrypto/man/ASN1_OBJECT_new.3 b/src/lib/libcrypto/man/ASN1_OBJECT_new.3 index 3e2eac02ee..3df3dd8e68 100644 --- a/src/lib/libcrypto/man/ASN1_OBJECT_new.3 +++ b/src/lib/libcrypto/man/ASN1_OBJECT_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_OBJECT_new.3,v 1.16 2023/09/05 15:01:39 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_OBJECT_new.3,v 1.17 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 99d63d4 Mar 19 12:28:58 2016 -0400 | 2 | .\" full merge up to: OpenSSL 99d63d4 Mar 19 12:28:58 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: September 5 2023 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt ASN1_OBJECT_NEW 3 | 69 | .Dt ASN1_OBJECT_NEW 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -74,6 +74,7 @@ | |||
| 74 | .Nm ASN1_OBJECT_free | 74 | .Nm ASN1_OBJECT_free |
| 75 | .Nd ASN.1 object identifiers | 75 | .Nd ASN.1 object identifiers |
| 76 | .Sh SYNOPSIS | 76 | .Sh SYNOPSIS |
| 77 | .Lb libcrypto | ||
| 77 | .In openssl/asn1.h | 78 | .In openssl/asn1.h |
| 78 | .Ft ASN1_OBJECT * | 79 | .Ft ASN1_OBJECT * |
| 79 | .Fo ASN1_OBJECT_new | 80 | .Fo ASN1_OBJECT_new |
diff --git a/src/lib/libcrypto/man/ASN1_PRINTABLE_type.3 b/src/lib/libcrypto/man/ASN1_PRINTABLE_type.3 index 391dd32e66..47288ee960 100644 --- a/src/lib/libcrypto/man/ASN1_PRINTABLE_type.3 +++ b/src/lib/libcrypto/man/ASN1_PRINTABLE_type.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_PRINTABLE_type.3,v 1.1 2021/11/15 13:39:40 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_PRINTABLE_type.3,v 1.2 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: November 15 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt ASN1_PRINTABLE_TYPE 3 | 18 | .Dt ASN1_PRINTABLE_TYPE 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm ASN1_PRINTABLE_type | 21 | .Nm ASN1_PRINTABLE_type |
| 22 | .Nd classify a single-byte character string | 22 | .Nd classify a single-byte character string |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/asn1.h | 25 | .In openssl/asn1.h |
| 25 | .Ft int | 26 | .Ft int |
| 26 | .Fo ASN1_PRINTABLE_type | 27 | .Fo ASN1_PRINTABLE_type |
diff --git a/src/lib/libcrypto/man/ASN1_STRING_TABLE_get.3 b/src/lib/libcrypto/man/ASN1_STRING_TABLE_get.3 index 2bf8831c12..f9e69a89e5 100644 --- a/src/lib/libcrypto/man/ASN1_STRING_TABLE_get.3 +++ b/src/lib/libcrypto/man/ASN1_STRING_TABLE_get.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_STRING_TABLE_get.3,v 1.4 2023/12/21 21:23:37 tb Exp $ | 1 | .\" $OpenBSD: ASN1_STRING_TABLE_get.3,v 1.6 2025/12/31 13:48:01 tb Exp $ |
| 2 | .\" checked up to: | 2 | .\" checked up to: |
| 3 | .\" OpenSSL ASN1_STRING_TABLE_add.pod 7b608d08 Jul 27 01:18:50 2017 +0800 | 3 | .\" OpenSSL ASN1_STRING_TABLE_add.pod 7b608d08 Jul 27 01:18:50 2017 +0800 |
| 4 | .\" | 4 | .\" |
| @@ -16,17 +16,14 @@ | |||
| 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 18 | .\" | 18 | .\" |
| 19 | .Dd $Mdocdate: December 21 2023 $ | 19 | .Dd $Mdocdate: December 31 2025 $ |
| 20 | .Dt ASN1_STRING_TABLE_GET 3 | 20 | .Dt ASN1_STRING_TABLE_GET 3 |
| 21 | .Os | 21 | .Os |
| 22 | .Sh NAME | 22 | .Sh NAME |
| 23 | .\" .Nm ASN1_STRING_TABLE_add0 and | ||
| 24 | .\" .Nm ASN1_STRING_TABLE_cleanup are intentionally undocumented | ||
| 25 | .\" because they will be removed in the next major bump | ||
| 26 | .\" .Dv STABLE_FLAGS_MALLOC is intentionally undocumented because it is unused | ||
| 27 | .Nm ASN1_STRING_TABLE_get | 23 | .Nm ASN1_STRING_TABLE_get |
| 28 | .Nd retrieve an entry from the global ASN.1 string table | 24 | .Nd retrieve an entry from the global ASN.1 string table |
| 29 | .Sh SYNOPSIS | 25 | .Sh SYNOPSIS |
| 26 | .Lb libcrypto | ||
| 30 | .In openssl/asn1.h | 27 | .In openssl/asn1.h |
| 31 | .Ft ASN1_STRING_TABLE * | 28 | .Ft ASN1_STRING_TABLE * |
| 32 | .Fo ASN1_STRING_TABLE_get | 29 | .Fo ASN1_STRING_TABLE_get |
diff --git a/src/lib/libcrypto/man/ASN1_STRING_length.3 b/src/lib/libcrypto/man/ASN1_STRING_length.3 index 0c397607a9..922ae89ac6 100644 --- a/src/lib/libcrypto/man/ASN1_STRING_length.3 +++ b/src/lib/libcrypto/man/ASN1_STRING_length.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_STRING_length.3,v 1.30 2024/12/27 15:30:17 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_STRING_length.3,v 1.31 2025/06/08 22:37:23 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 | 2 | .\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: December 27 2024 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt ASN1_STRING_LENGTH 3 | 70 | .Dt ASN1_STRING_LENGTH 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -84,10 +84,9 @@ | |||
| 84 | .Nm ASN1_STRING_copy , | 84 | .Nm ASN1_STRING_copy , |
| 85 | .Nm ASN1_STRING_to_UTF8 , | 85 | .Nm ASN1_STRING_to_UTF8 , |
| 86 | .Nm ASN1_STRING_type | 86 | .Nm ASN1_STRING_type |
| 87 | .\" deprecated aliases, intentionally undocumented: | ||
| 88 | .\" M_ASN1_STRING_data, M_ASN1_STRING_length | ||
| 89 | .Nd ASN1_STRING utility functions | 87 | .Nd ASN1_STRING utility functions |
| 90 | .Sh SYNOPSIS | 88 | .Sh SYNOPSIS |
| 89 | .Lb libcrypto | ||
| 91 | .In openssl/asn1.h | 90 | .In openssl/asn1.h |
| 92 | .Ft int | 91 | .Ft int |
| 93 | .Fo ASN1_STRING_cmp | 92 | .Fo ASN1_STRING_cmp |
diff --git a/src/lib/libcrypto/man/ASN1_STRING_new.3 b/src/lib/libcrypto/man/ASN1_STRING_new.3 index 212bacd413..d653b70dda 100644 --- a/src/lib/libcrypto/man/ASN1_STRING_new.3 +++ b/src/lib/libcrypto/man/ASN1_STRING_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_STRING_new.3,v 1.27 2024/12/27 15:30:17 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_STRING_new.3,v 1.28 2025/06/08 22:37:23 schwarze Exp $ |
| 2 | .\" OpenSSL 99d63d46 Tue Mar 24 07:52:24 2015 -0400 | 2 | .\" OpenSSL 99d63d46 Tue Mar 24 07:52:24 2015 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> | 4 | .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> |
| @@ -15,7 +15,7 @@ | |||
| 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 | .\" | 17 | .\" |
| 18 | .Dd $Mdocdate: December 27 2024 $ | 18 | .Dd $Mdocdate: June 8 2025 $ |
| 19 | .Dt ASN1_STRING_NEW 3 | 19 | .Dt ASN1_STRING_NEW 3 |
| 20 | .Os | 20 | .Os |
| 21 | .Sh NAME | 21 | .Sh NAME |
| @@ -58,10 +58,9 @@ | |||
| 58 | .Nm ASN1_UTCTIME_free , | 58 | .Nm ASN1_UTCTIME_free , |
| 59 | .Nm ASN1_TIME_new , | 59 | .Nm ASN1_TIME_new , |
| 60 | .Nm ASN1_TIME_free | 60 | .Nm ASN1_TIME_free |
| 61 | .\" deprecated aliases, intentionally undocumented: M_ASN1_IA5STRING_new, | ||
| 62 | .\" M_ASN1_ENUMERATED_free, M_ASN1_INTEGER_free, M_ASN1_OCTET_STRING_free | ||
| 63 | .Nd allocate and free ASN1_STRING objects | 61 | .Nd allocate and free ASN1_STRING objects |
| 64 | .Sh SYNOPSIS | 62 | .Sh SYNOPSIS |
| 63 | .Lb libcrypto | ||
| 65 | .In openssl/asn1.h | 64 | .In openssl/asn1.h |
| 66 | .Ft ASN1_STRING * | 65 | .Ft ASN1_STRING * |
| 67 | .Fn ASN1_STRING_new void | 66 | .Fn ASN1_STRING_new void |
diff --git a/src/lib/libcrypto/man/ASN1_STRING_print_ex.3 b/src/lib/libcrypto/man/ASN1_STRING_print_ex.3 index eb43b2fe5c..8295b3e9dd 100644 --- a/src/lib/libcrypto/man/ASN1_STRING_print_ex.3 +++ b/src/lib/libcrypto/man/ASN1_STRING_print_ex.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_STRING_print_ex.3,v 1.18 2021/12/14 19:36:18 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_STRING_print_ex.3,v 1.19 2025/06/08 22:37:23 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400 | 2 | .\" full merge up to: OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400 |
| 3 | .\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 | 3 | .\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 |
| 4 | .\" | 4 | .\" |
| @@ -50,7 +50,7 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: December 14 2021 $ | 53 | .Dd $Mdocdate: June 8 2025 $ |
| 54 | .Dt ASN1_STRING_PRINT_EX 3 | 54 | .Dt ASN1_STRING_PRINT_EX 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| @@ -58,9 +58,9 @@ | |||
| 58 | .Nm ASN1_STRING_print_ex_fp , | 58 | .Nm ASN1_STRING_print_ex_fp , |
| 59 | .Nm ASN1_STRING_print , | 59 | .Nm ASN1_STRING_print , |
| 60 | .Nm ASN1_tag2str | 60 | .Nm ASN1_tag2str |
| 61 | .\" M_ASN1_OCTET_STRING_print is a deprecated alias, intentionally undocumented | ||
| 62 | .Nd ASN1_STRING output routines | 61 | .Nd ASN1_STRING output routines |
| 63 | .Sh SYNOPSIS | 62 | .Sh SYNOPSIS |
| 63 | .Lb libcrypto | ||
| 64 | .In openssl/asn1.h | 64 | .In openssl/asn1.h |
| 65 | .Ft int | 65 | .Ft int |
| 66 | .Fo ASN1_STRING_print_ex | 66 | .Fo ASN1_STRING_print_ex |
diff --git a/src/lib/libcrypto/man/ASN1_TIME_set.3 b/src/lib/libcrypto/man/ASN1_TIME_set.3 index 233cb13f2c..8cfcf4339b 100644 --- a/src/lib/libcrypto/man/ASN1_TIME_set.3 +++ b/src/lib/libcrypto/man/ASN1_TIME_set.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_TIME_set.3,v 1.23 2024/03/05 18:30:40 tb Exp $ | 1 | .\" $OpenBSD: ASN1_TIME_set.3,v 1.24 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 3d0f1cb9 Jul 11 03:01:24 2017 +0800 | 2 | .\" full merge up to: OpenSSL 3d0f1cb9 Jul 11 03:01:24 2017 +0800 |
| 3 | .\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 | 3 | .\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -68,7 +68,7 @@ | |||
| 68 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 68 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 69 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 69 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 70 | .\" | 70 | .\" |
| 71 | .Dd $Mdocdate: March 5 2024 $ | 71 | .Dd $Mdocdate: June 8 2025 $ |
| 72 | .Dt ASN1_TIME_SET 3 | 72 | .Dt ASN1_TIME_SET 3 |
| 73 | .Os | 73 | .Os |
| 74 | .Sh NAME | 74 | .Sh NAME |
| @@ -101,6 +101,7 @@ | |||
| 101 | .Nm OPENSSL_tm_to_posix | 101 | .Nm OPENSSL_tm_to_posix |
| 102 | .Nd ASN.1 Time functions | 102 | .Nd ASN.1 Time functions |
| 103 | .Sh SYNOPSIS | 103 | .Sh SYNOPSIS |
| 104 | .Lb libcrypto | ||
| 104 | .In openssl/asn1.h | 105 | .In openssl/asn1.h |
| 105 | .Ft ASN1_TIME * | 106 | .Ft ASN1_TIME * |
| 106 | .Fo ASN1_TIME_set | 107 | .Fo ASN1_TIME_set |
diff --git a/src/lib/libcrypto/man/ASN1_TYPE_get.3 b/src/lib/libcrypto/man/ASN1_TYPE_get.3 index 16af168d91..3b3359b6ff 100644 --- a/src/lib/libcrypto/man/ASN1_TYPE_get.3 +++ b/src/lib/libcrypto/man/ASN1_TYPE_get.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_TYPE_get.3,v 1.19 2023/10/09 16:06:01 tb Exp $ | 1 | .\" $OpenBSD: ASN1_TYPE_get.3,v 1.20 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" selective merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 | 2 | .\" selective merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: October 9 2023 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt ASN1_TYPE_GET 3 | 69 | .Dt ASN1_TYPE_GET 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -81,6 +81,7 @@ | |||
| 81 | .Nm ASN1_TYPE_cmp | 81 | .Nm ASN1_TYPE_cmp |
| 82 | .Nd ASN.1 objects of arbitrary type | 82 | .Nd ASN.1 objects of arbitrary type |
| 83 | .Sh SYNOPSIS | 83 | .Sh SYNOPSIS |
| 84 | .Lb libcrypto | ||
| 84 | .In openssl/asn1.h | 85 | .In openssl/asn1.h |
| 85 | .Ft ASN1_TYPE * | 86 | .Ft ASN1_TYPE * |
| 86 | .Fn ASN1_TYPE_new void | 87 | .Fn ASN1_TYPE_new void |
diff --git a/src/lib/libcrypto/man/ASN1_UNIVERSALSTRING_to_string.3 b/src/lib/libcrypto/man/ASN1_UNIVERSALSTRING_to_string.3 index 2af675295b..c76956107f 100644 --- a/src/lib/libcrypto/man/ASN1_UNIVERSALSTRING_to_string.3 +++ b/src/lib/libcrypto/man/ASN1_UNIVERSALSTRING_to_string.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_UNIVERSALSTRING_to_string.3,v 1.1 2021/11/15 13:39:40 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_UNIVERSALSTRING_to_string.3,v 1.2 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: November 15 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt ASN1_UNIVERSALSTRING_TO_STRING 3 | 18 | .Dt ASN1_UNIVERSALSTRING_TO_STRING 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm ASN1_UNIVERSALSTRING_to_string | 21 | .Nm ASN1_UNIVERSALSTRING_to_string |
| 22 | .Nd recode UTF-32 to ISO Latin-1 | 22 | .Nd recode UTF-32 to ISO Latin-1 |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/asn1.h | 25 | .In openssl/asn1.h |
| 25 | .Ft int | 26 | .Ft int |
| 26 | .Fo ASN1_UNIVERSALSTRING_to_string | 27 | .Fo ASN1_UNIVERSALSTRING_to_string |
diff --git a/src/lib/libcrypto/man/ASN1_generate_nconf.3 b/src/lib/libcrypto/man/ASN1_generate_nconf.3 index b15d4295a9..ed92bb13b6 100644 --- a/src/lib/libcrypto/man/ASN1_generate_nconf.3 +++ b/src/lib/libcrypto/man/ASN1_generate_nconf.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_generate_nconf.3,v 1.13 2019/06/10 14:58:48 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_generate_nconf.3,v 1.14 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL 05ea606a Fri May 20 20:52:46 2016 -0400 | 2 | .\" OpenSSL 05ea606a Fri May 20 20:52:46 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson. | 4 | .\" This file was written by Dr. Stephen Henson. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: June 10 2019 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt ASN1_GENERATE_NCONF 3 | 53 | .Dt ASN1_GENERATE_NCONF 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm ASN1_generate_v3 | 57 | .Nm ASN1_generate_v3 |
| 58 | .Nd ASN.1 generation functions | 58 | .Nd ASN.1 generation functions |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/asn1.h | 61 | .In openssl/asn1.h |
| 61 | .Ft ASN1_TYPE * | 62 | .Ft ASN1_TYPE * |
| 62 | .Fo ASN1_generate_nconf | 63 | .Fo ASN1_generate_nconf |
diff --git a/src/lib/libcrypto/man/ASN1_get_object.3 b/src/lib/libcrypto/man/ASN1_get_object.3 index 781b12ad5a..7f92ff6d05 100644 --- a/src/lib/libcrypto/man/ASN1_get_object.3 +++ b/src/lib/libcrypto/man/ASN1_get_object.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_get_object.3,v 1.2 2021/07/11 19:03:45 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_get_object.3,v 1.3 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: July 11 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt ASN1_GET_OBJECT 3 | 18 | .Dt ASN1_GET_OBJECT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm ASN1_get_object | 21 | .Nm ASN1_get_object |
| 22 | .Nd parse identifier and length octets | 22 | .Nd parse identifier and length octets |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/asn1.h | 25 | .In openssl/asn1.h |
| 25 | .Ft int | 26 | .Ft int |
| 26 | .Fo ASN1_get_object | 27 | .Fo ASN1_get_object |
diff --git a/src/lib/libcrypto/man/ASN1_item_d2i.3 b/src/lib/libcrypto/man/ASN1_item_d2i.3 index bc99f4a6da..cb5fd19f28 100644 --- a/src/lib/libcrypto/man/ASN1_item_d2i.3 +++ b/src/lib/libcrypto/man/ASN1_item_d2i.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_item_d2i.3,v 1.18 2023/05/01 07:37:45 tb Exp $ | 1 | .\" $OpenBSD: ASN1_item_d2i.3,v 1.19 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" selective merge up to: | 2 | .\" selective merge up to: |
| 3 | .\" OpenSSL doc/man3/d2i_X509.pod 256989ce Jun 19 15:00:32 2020 +0200 | 3 | .\" OpenSSL doc/man3/d2i_X509.pod 256989ce Jun 19 15:00:32 2020 +0200 |
| 4 | .\" | 4 | .\" |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: May 1 2023 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt ASN1_ITEM_D2I 3 | 70 | .Dt ASN1_ITEM_D2I 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -82,6 +82,7 @@ | |||
| 82 | .Nm ASN1_item_print | 82 | .Nm ASN1_item_print |
| 83 | .Nd decode and encode ASN.1 objects | 83 | .Nd decode and encode ASN.1 objects |
| 84 | .Sh SYNOPSIS | 84 | .Sh SYNOPSIS |
| 85 | .Lb libcrypto | ||
| 85 | .In openssl/asn1.h | 86 | .In openssl/asn1.h |
| 86 | .Ft ASN1_VALUE * | 87 | .Ft ASN1_VALUE * |
| 87 | .Fo ASN1_item_d2i | 88 | .Fo ASN1_item_d2i |
diff --git a/src/lib/libcrypto/man/ASN1_item_digest.3 b/src/lib/libcrypto/man/ASN1_item_digest.3 index 56a97555e9..829b82a56b 100644 --- a/src/lib/libcrypto/man/ASN1_item_digest.3 +++ b/src/lib/libcrypto/man/ASN1_item_digest.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_item_digest.3,v 1.2 2022/09/11 04:39:46 jsg Exp $ | 1 | .\" $OpenBSD: ASN1_item_digest.3,v 1.3 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: September 11 2022 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt ASN1_ITEM_DIGEST 3 | 18 | .Dt ASN1_ITEM_DIGEST 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm ASN1_item_digest | 21 | .Nm ASN1_item_digest |
| 22 | .Nd DER-encode and hash an ASN.1 value | 22 | .Nd DER-encode and hash an ASN.1 value |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/x509.h | 25 | .In openssl/x509.h |
| 25 | .Ft int | 26 | .Ft int |
| 26 | .Fo ASN1_item_digest | 27 | .Fo ASN1_item_digest |
diff --git a/src/lib/libcrypto/man/ASN1_item_new.3 b/src/lib/libcrypto/man/ASN1_item_new.3 index 7015ed6319..42e9dd8f68 100644 --- a/src/lib/libcrypto/man/ASN1_item_new.3 +++ b/src/lib/libcrypto/man/ASN1_item_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_item_new.3,v 1.11 2022/01/12 17:54:51 tb Exp $ | 1 | .\" $OpenBSD: ASN1_item_new.3,v 1.12 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016, 2018 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016, 2018 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: January 12 2022 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt ASN1_ITEM_NEW 3 | 18 | .Dt ASN1_ITEM_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm ASN1_item_free | 22 | .Nm ASN1_item_free |
| 23 | .Nd generic ASN.1 value constructor and destructor | 23 | .Nd generic ASN.1 value constructor and destructor |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/asn1.h | 26 | .In openssl/asn1.h |
| 26 | .Ft ASN1_VALUE * | 27 | .Ft ASN1_VALUE * |
| 27 | .Fo ASN1_item_new | 28 | .Fo ASN1_item_new |
diff --git a/src/lib/libcrypto/man/ASN1_item_pack.3 b/src/lib/libcrypto/man/ASN1_item_pack.3 index 4c87530622..d0023f599d 100644 --- a/src/lib/libcrypto/man/ASN1_item_pack.3 +++ b/src/lib/libcrypto/man/ASN1_item_pack.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_item_pack.3,v 1.1 2021/11/15 11:51:09 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_item_pack.3,v 1.2 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: November 15 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt ASN1_ITEM_PACK 3 | 18 | .Dt ASN1_ITEM_PACK 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm ASN1_item_unpack | 22 | .Nm ASN1_item_unpack |
| 23 | .Nd pack an ASN.1 object into an ASN1_STRING | 23 | .Nd pack an ASN.1 object into an ASN1_STRING |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/asn1.h | 26 | .In openssl/asn1.h |
| 26 | .Ft ASN1_STRING * | 27 | .Ft ASN1_STRING * |
| 27 | .Fo ASN1_item_pack | 28 | .Fo ASN1_item_pack |
diff --git a/src/lib/libcrypto/man/ASN1_item_sign.3 b/src/lib/libcrypto/man/ASN1_item_sign.3 index 8c09fe77ff..72e317c310 100644 --- a/src/lib/libcrypto/man/ASN1_item_sign.3 +++ b/src/lib/libcrypto/man/ASN1_item_sign.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_item_sign.3,v 1.3 2024/12/06 12:51:13 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_item_sign.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 6 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt ASN1_ITEM_SIGN 3 | 18 | .Dt ASN1_ITEM_SIGN 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm ASN1_item_sign_ctx | 22 | .Nm ASN1_item_sign_ctx |
| 23 | .Nd DER-encode and sign an ASN.1 value | 23 | .Nd DER-encode and sign an ASN.1 value |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/x509.h | 26 | .In openssl/x509.h |
| 26 | .Ft int | 27 | .Ft int |
| 27 | .Fo ASN1_item_sign | 28 | .Fo ASN1_item_sign |
diff --git a/src/lib/libcrypto/man/ASN1_item_verify.3 b/src/lib/libcrypto/man/ASN1_item_verify.3 index d2810879e3..282db875bb 100644 --- a/src/lib/libcrypto/man/ASN1_item_verify.3 +++ b/src/lib/libcrypto/man/ASN1_item_verify.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_item_verify.3,v 1.3 2021/12/18 17:47:44 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_item_verify.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 18 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt ASN1_ITEM_VERIFY 3 | 18 | .Dt ASN1_ITEM_VERIFY 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm ASN1_item_verify | 21 | .Nm ASN1_item_verify |
| 22 | .Nd signature verification for ASN.1 values | 22 | .Nd signature verification for ASN.1 values |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/x509.h | 25 | .In openssl/x509.h |
| 25 | .Ft int | 26 | .Ft int |
| 26 | .Fo ASN1_item_verify | 27 | .Fo ASN1_item_verify |
diff --git a/src/lib/libcrypto/man/ASN1_mbstring_copy.3 b/src/lib/libcrypto/man/ASN1_mbstring_copy.3 index e0b48aaa62..6a64bc7464 100644 --- a/src/lib/libcrypto/man/ASN1_mbstring_copy.3 +++ b/src/lib/libcrypto/man/ASN1_mbstring_copy.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_mbstring_copy.3,v 1.6 2022/02/21 00:22:03 jsg Exp $ | 1 | .\" $OpenBSD: ASN1_mbstring_copy.3,v 1.7 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: February 21 2022 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt ASN1_MBSTRING_COPY 3 | 18 | .Dt ASN1_MBSTRING_COPY 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -27,6 +27,7 @@ | |||
| 27 | .Nm ASN1_tag2bit | 27 | .Nm ASN1_tag2bit |
| 28 | .Nd copy a multibyte string into an ASN.1 string object | 28 | .Nd copy a multibyte string into an ASN.1 string object |
| 29 | .Sh SYNOPSIS | 29 | .Sh SYNOPSIS |
| 30 | .Lb libcrypto | ||
| 30 | .In openssl/asn1.h | 31 | .In openssl/asn1.h |
| 31 | .Ft int | 32 | .Ft int |
| 32 | .Fo ASN1_mbstring_copy | 33 | .Fo ASN1_mbstring_copy |
diff --git a/src/lib/libcrypto/man/ASN1_parse_dump.3 b/src/lib/libcrypto/man/ASN1_parse_dump.3 index 50761f38aa..45aa673d4c 100644 --- a/src/lib/libcrypto/man/ASN1_parse_dump.3 +++ b/src/lib/libcrypto/man/ASN1_parse_dump.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_parse_dump.3,v 1.3 2021/12/09 18:52:09 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_parse_dump.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 9 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt ASN1_PARSE_DUMP 3 | 18 | .Dt ASN1_PARSE_DUMP 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm ASN1_parse | 22 | .Nm ASN1_parse |
| 23 | .Nd parse BER and print information about it | 23 | .Nd parse BER and print information about it |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/asn1.h | 26 | .In openssl/asn1.h |
| 26 | .Ft int | 27 | .Ft int |
| 27 | .Fo ASN1_parse_dump | 28 | .Fo ASN1_parse_dump |
diff --git a/src/lib/libcrypto/man/ASN1_put_object.3 b/src/lib/libcrypto/man/ASN1_put_object.3 index 97a352724c..94fa55366a 100644 --- a/src/lib/libcrypto/man/ASN1_put_object.3 +++ b/src/lib/libcrypto/man/ASN1_put_object.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_put_object.3,v 1.5 2022/01/12 17:54:51 tb Exp $ | 1 | .\" $OpenBSD: ASN1_put_object.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2019, 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2019, 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: January 12 2022 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt ASN1_PUT_OBJECT 3 | 18 | .Dt ASN1_PUT_OBJECT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -23,6 +23,7 @@ | |||
| 23 | .Nm ASN1_object_size | 23 | .Nm ASN1_object_size |
| 24 | .Nd start and end the BER encoding of an arbitrary ASN.1 data element | 24 | .Nd start and end the BER encoding of an arbitrary ASN.1 data element |
| 25 | .Sh SYNOPSIS | 25 | .Sh SYNOPSIS |
| 26 | .Lb libcrypto | ||
| 26 | .In openssl/asn1.h | 27 | .In openssl/asn1.h |
| 27 | .Ft void | 28 | .Ft void |
| 28 | .Fo ASN1_put_object | 29 | .Fo ASN1_put_object |
diff --git a/src/lib/libcrypto/man/ASRange_new.3 b/src/lib/libcrypto/man/ASRange_new.3 index dc58c98e58..b507213b48 100644 --- a/src/lib/libcrypto/man/ASRange_new.3 +++ b/src/lib/libcrypto/man/ASRange_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASRange_new.3,v 1.8 2023/10/11 12:06:11 tb Exp $ | 1 | .\" $OpenBSD: ASRange_new.3,v 1.10 2025/06/13 18:34:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> | 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: October 11 2023 $ | 17 | .Dd $Mdocdate: June 13 2025 $ |
| 18 | .Dt ASRANGE_NEW 3 | 18 | .Dt ASRANGE_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -32,8 +32,9 @@ | |||
| 32 | .Nm i2d_ASIdentifierChoice | 32 | .Nm i2d_ASIdentifierChoice |
| 33 | .Nd RFC 3779 autonomous system identifiers and ranges | 33 | .Nd RFC 3779 autonomous system identifiers and ranges |
| 34 | .Sh SYNOPSIS | 34 | .Sh SYNOPSIS |
| 35 | .Lb libcrypto | ||
| 35 | .In openssl/x509v3.h | 36 | .In openssl/x509v3.h |
| 36 | .Ft "ASRange *" | 37 | .Ft ASRange * |
| 37 | .Fn ASRange_new void | 38 | .Fn ASRange_new void |
| 38 | .Ft void | 39 | .Ft void |
| 39 | .Fn ASRange_free "ASRange *asrange" | 40 | .Fn ASRange_free "ASRange *asrange" |
| @@ -48,7 +49,7 @@ | |||
| 48 | .Fa "ASRange *asrange" | 49 | .Fa "ASRange *asrange" |
| 49 | .Fa "unsigned char **der_out" | 50 | .Fa "unsigned char **der_out" |
| 50 | .Fc | 51 | .Fc |
| 51 | .Ft "ASIdOrRange *" | 52 | .Ft ASIdOrRange * |
| 52 | .Fn ASIdOrRange_new void | 53 | .Fn ASIdOrRange_new void |
| 53 | .Ft void | 54 | .Ft void |
| 54 | .Fn ASIdOrRange_free "ASIdOrRange *aor" | 55 | .Fn ASIdOrRange_free "ASIdOrRange *aor" |
| @@ -63,7 +64,7 @@ | |||
| 63 | .Fa "ASIdOrRange *aor" | 64 | .Fa "ASIdOrRange *aor" |
| 64 | .Fa "unsigned char **der_out" | 65 | .Fa "unsigned char **der_out" |
| 65 | .Fc | 66 | .Fc |
| 66 | .Ft "ASIdentifierChoice *" | 67 | .Ft ASIdentifierChoice * |
| 67 | .Fn ASIdentifierChoice_new void | 68 | .Fn ASIdentifierChoice_new void |
| 68 | .Ft void | 69 | .Ft void |
| 69 | .Fn ASIdentifierChoice_free "ASIdentifierChoice *aic" | 70 | .Fn ASIdentifierChoice_free "ASIdentifierChoice *aic" |
diff --git a/src/lib/libcrypto/man/AUTHORITY_KEYID_new.3 b/src/lib/libcrypto/man/AUTHORITY_KEYID_new.3 index bff451ff36..982685d17f 100644 --- a/src/lib/libcrypto/man/AUTHORITY_KEYID_new.3 +++ b/src/lib/libcrypto/man/AUTHORITY_KEYID_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: AUTHORITY_KEYID_new.3,v 1.4 2019/06/06 01:06:58 schwarze Exp $ | 1 | .\" $OpenBSD: AUTHORITY_KEYID_new.3,v 1.5 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: June 6 2019 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt AUTHORITY_KEYID_NEW 3 | 18 | .Dt AUTHORITY_KEYID_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm AUTHORITY_KEYID_free | 22 | .Nm AUTHORITY_KEYID_free |
| 23 | .Nd X.509 authority key identifier extension | 23 | .Nd X.509 authority key identifier extension |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/x509v3.h | 26 | .In openssl/x509v3.h |
| 26 | .Ft AUTHORITY_KEYID * | 27 | .Ft AUTHORITY_KEYID * |
| 27 | .Fn AUTHORITY_KEYID_new void | 28 | .Fn AUTHORITY_KEYID_new void |
diff --git a/src/lib/libcrypto/man/BASIC_CONSTRAINTS_new.3 b/src/lib/libcrypto/man/BASIC_CONSTRAINTS_new.3 index e60b0d223c..f1b1486a8a 100644 --- a/src/lib/libcrypto/man/BASIC_CONSTRAINTS_new.3 +++ b/src/lib/libcrypto/man/BASIC_CONSTRAINTS_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BASIC_CONSTRAINTS_new.3,v 1.6 2021/10/27 11:24:47 schwarze Exp $ | 1 | .\" $OpenBSD: BASIC_CONSTRAINTS_new.3,v 1.7 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: October 27 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt BASIC_CONSTRAINTS_NEW 3 | 18 | .Dt BASIC_CONSTRAINTS_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm BASIC_CONSTRAINTS_free | 22 | .Nm BASIC_CONSTRAINTS_free |
| 23 | .Nd X.509 extension to mark CA certificates | 23 | .Nd X.509 extension to mark CA certificates |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/x509v3.h | 26 | .In openssl/x509v3.h |
| 26 | .Ft BASIC_CONSTRAINTS * | 27 | .Ft BASIC_CONSTRAINTS * |
| 27 | .Fn BASIC_CONSTRAINTS_new void | 28 | .Fn BASIC_CONSTRAINTS_new void |
diff --git a/src/lib/libcrypto/man/BF_set_key.3 b/src/lib/libcrypto/man/BF_set_key.3 index 5f4c7a689b..1299a0f2ef 100644 --- a/src/lib/libcrypto/man/BF_set_key.3 +++ b/src/lib/libcrypto/man/BF_set_key.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BF_set_key.3,v 1.12 2023/08/05 18:27:55 jmc Exp $ | 1 | .\" $OpenBSD: BF_set_key.3,v 1.13 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL 99d63d46 Jul 19 09:27:53 2016 -0400 | 2 | .\" OpenSSL 99d63d46 Jul 19 09:27:53 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Richard Levitte <levitte@openssl.org>. | 4 | .\" This file was written by Richard Levitte <levitte@openssl.org>. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: August 5 2023 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt BF_SET_KEY 3 | 53 | .Dt BF_SET_KEY 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -62,6 +62,7 @@ | |||
| 62 | .Nm BF_ofb64_encrypt | 62 | .Nm BF_ofb64_encrypt |
| 63 | .Nd Blowfish encryption | 63 | .Nd Blowfish encryption |
| 64 | .Sh SYNOPSIS | 64 | .Sh SYNOPSIS |
| 65 | .Lb libcrypto | ||
| 65 | .In openssl/blowfish.h | 66 | .In openssl/blowfish.h |
| 66 | .Ft void | 67 | .Ft void |
| 67 | .Fo BF_set_key | 68 | .Fo BF_set_key |
diff --git a/src/lib/libcrypto/man/BIO_accept.3 b/src/lib/libcrypto/man/BIO_accept.3 index e2547ac0dd..73b415017f 100644 --- a/src/lib/libcrypto/man/BIO_accept.3 +++ b/src/lib/libcrypto/man/BIO_accept.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_accept.3,v 1.2 2023/04/30 13:38:48 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_accept.3,v 1.3 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: April 30 2023 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt BIO_ACCEPT 3 | 18 | .Dt BIO_ACCEPT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -43,6 +43,7 @@ | |||
| 43 | .\" .Nm BIO_sock_cleanup | 43 | .\" .Nm BIO_sock_cleanup |
| 44 | .Nd wrappers for socket operations | 44 | .Nd wrappers for socket operations |
| 45 | .Sh SYNOPSIS | 45 | .Sh SYNOPSIS |
| 46 | .Lb libcrypto | ||
| 46 | .In openssl/bio.h | 47 | .In openssl/bio.h |
| 47 | .Ft int | 48 | .Ft int |
| 48 | .Fo BIO_get_host_ip | 49 | .Fo BIO_get_host_ip |
diff --git a/src/lib/libcrypto/man/BIO_ctrl.3 b/src/lib/libcrypto/man/BIO_ctrl.3 index 2c537956e1..ca13f2067b 100644 --- a/src/lib/libcrypto/man/BIO_ctrl.3 +++ b/src/lib/libcrypto/man/BIO_ctrl.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_ctrl.3,v 1.25 2023/11/16 20:19:23 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_ctrl.3,v 1.26 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 24a535eaf Tue Sep 22 13:14:20 2020 +0100 | 2 | .\" full merge up to: OpenSSL 24a535eaf Tue Sep 22 13:14:20 2020 +0100 |
| 3 | .\" selective merge up to: OpenSSL 0c5bc96f Tue Mar 15 13:57:22 2022 +0000 | 3 | .\" selective merge up to: OpenSSL 0c5bc96f Tue Mar 15 13:57:22 2022 +0000 |
| 4 | .\" | 4 | .\" |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: November 16 2023 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt BIO_CTRL 3 | 70 | .Dt BIO_CTRL 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -91,6 +91,7 @@ | |||
| 91 | .Nm bio_info_cb | 91 | .Nm bio_info_cb |
| 92 | .Nd BIO control operations | 92 | .Nd BIO control operations |
| 93 | .Sh SYNOPSIS | 93 | .Sh SYNOPSIS |
| 94 | .Lb libcrypto | ||
| 94 | .In openssl/bio.h | 95 | .In openssl/bio.h |
| 95 | .Ft long | 96 | .Ft long |
| 96 | .Fo BIO_ctrl | 97 | .Fo BIO_ctrl |
diff --git a/src/lib/libcrypto/man/BIO_dump.3 b/src/lib/libcrypto/man/BIO_dump.3 index 8817f0c4ca..2c06c8cc9c 100644 --- a/src/lib/libcrypto/man/BIO_dump.3 +++ b/src/lib/libcrypto/man/BIO_dump.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_dump.3,v 1.4 2022/12/20 15:34:03 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_dump.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,19 +14,15 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 20 2022 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt BIO_DUMP 3 | 18 | .Dt BIO_DUMP 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm BIO_dump , | 21 | .Nm BIO_dump , |
| 22 | .Nm BIO_dump_indent , | 22 | .Nm BIO_dump_indent |
| 23 | .Nm BIO_dump_fp , | ||
| 24 | .Nm BIO_dump_indent_fp | ||
| 25 | .\" intentionally undocumented because nothing uses these two functions: | ||
| 26 | .\" .Nm BIO_dump_cb | ||
| 27 | .\" .Nm BIO_dump_indent_cb | ||
| 28 | .Nd hexadecimal printout of arbitrary byte arrays | 23 | .Nd hexadecimal printout of arbitrary byte arrays |
| 29 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 30 | .In openssl/bio.h | 26 | .In openssl/bio.h |
| 31 | .Ft int | 27 | .Ft int |
| 32 | .Fo BIO_dump | 28 | .Fo BIO_dump |
| @@ -41,19 +37,6 @@ | |||
| 41 | .Fa "int len" | 37 | .Fa "int len" |
| 42 | .Fa "int indent" | 38 | .Fa "int indent" |
| 43 | .Fc | 39 | .Fc |
| 44 | .Ft int | ||
| 45 | .Fo BIO_dump_fp | ||
| 46 | .Fa "FILE *fp" | ||
| 47 | .Fa "const char *s" | ||
| 48 | .Fa "int len" | ||
| 49 | .Fc | ||
| 50 | .Ft int | ||
| 51 | .Fo BIO_dump_indent_fp | ||
| 52 | .Fa "FILE *fp" | ||
| 53 | .Fa "const char *s" | ||
| 54 | .Fa "int len" | ||
| 55 | .Fa "int indent" | ||
| 56 | .Fc | ||
| 57 | .Sh DESCRIPTION | 40 | .Sh DESCRIPTION |
| 58 | .Fn BIO_dump | 41 | .Fn BIO_dump |
| 59 | prints | 42 | prints |
| @@ -92,14 +75,6 @@ If | |||
| 92 | .Fa indent | 75 | .Fa indent |
| 93 | is 7 or more, the number of data columns is reduced such that the | 76 | is 7 or more, the number of data columns is reduced such that the |
| 94 | total width of the output does not exceed 79 characters per line. | 77 | total width of the output does not exceed 79 characters per line. |
| 95 | .Pp | ||
| 96 | .Fn BIO_dump_fp | ||
| 97 | and | ||
| 98 | .Fn BIO_dump_indent_fp | ||
| 99 | are similar except that | ||
| 100 | .Xr fwrite 3 | ||
| 101 | is used instead of | ||
| 102 | .Xr BIO_write 3 . | ||
| 103 | .Sh RETURN VALUES | 78 | .Sh RETURN VALUES |
| 104 | On success these functions return the total number of bytes written by | 79 | On success these functions return the total number of bytes written by |
| 105 | .Xr BIO_write 3 | 80 | .Xr BIO_write 3 |
| @@ -120,9 +95,3 @@ first appeared in SSLeay 0.6.5 and has been available since | |||
| 120 | .Fn BIO_dump_indent | 95 | .Fn BIO_dump_indent |
| 121 | first appeared in OpenSSL 0.9.6 and has been available since | 96 | first appeared in OpenSSL 0.9.6 and has been available since |
| 122 | .Ox 2.9 . | 97 | .Ox 2.9 . |
| 123 | .Pp | ||
| 124 | .Fn BIO_dump_fp | ||
| 125 | and | ||
| 126 | .Fn BIO_dump_indent_fp | ||
| 127 | first appeared in OpenSSL 0.9.8 and have been available since | ||
| 128 | .Ox 4.5 . | ||
diff --git a/src/lib/libcrypto/man/BIO_dup_chain.3 b/src/lib/libcrypto/man/BIO_dup_chain.3 index 5c5e8c6533..ad753e71a5 100644 --- a/src/lib/libcrypto/man/BIO_dup_chain.3 +++ b/src/lib/libcrypto/man/BIO_dup_chain.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_dup_chain.3,v 1.2 2023/04/09 06:27:52 jsg Exp $ | 1 | .\" $OpenBSD: BIO_dup_chain.3,v 1.3 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: April 9 2023 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt BIO_DUP_CHAIN 3 | 18 | .Dt BIO_DUP_CHAIN 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm BIO_dup_state | 22 | .Nm BIO_dup_state |
| 23 | .Nd copy a BIO chain | 23 | .Nd copy a BIO chain |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/bio.h | 26 | .In openssl/bio.h |
| 26 | .Ft BIO * | 27 | .Ft BIO * |
| 27 | .Fn BIO_dup_chain "BIO *b" | 28 | .Fn BIO_dup_chain "BIO *b" |
diff --git a/src/lib/libcrypto/man/BIO_f_base64.3 b/src/lib/libcrypto/man/BIO_f_base64.3 index e4589de035..f652dac100 100644 --- a/src/lib/libcrypto/man/BIO_f_base64.3 +++ b/src/lib/libcrypto/man/BIO_f_base64.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_f_base64.3,v 1.15 2023/09/11 04:00:40 jsg Exp $ | 1 | .\" $OpenBSD: BIO_f_base64.3,v 1.16 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL fc1d88f0 Wed Jul 2 22:42:40 2014 -0400 | 2 | .\" OpenSSL fc1d88f0 Wed Jul 2 22:42:40 2014 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: September 11 2023 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt BIO_F_BASE64 3 | 53 | .Dt BIO_F_BASE64 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -60,6 +60,7 @@ | |||
| 60 | .\" and practically unused outside evp/bio_b64.c. | 60 | .\" and practically unused outside evp/bio_b64.c. |
| 61 | .Nd base64 BIO filter | 61 | .Nd base64 BIO filter |
| 62 | .Sh SYNOPSIS | 62 | .Sh SYNOPSIS |
| 63 | .Lb libcrypto | ||
| 63 | .In openssl/bio.h | 64 | .In openssl/bio.h |
| 64 | .In openssl/evp.h | 65 | .In openssl/evp.h |
| 65 | .Ft const BIO_METHOD * | 66 | .Ft const BIO_METHOD * |
diff --git a/src/lib/libcrypto/man/BIO_f_buffer.3 b/src/lib/libcrypto/man/BIO_f_buffer.3 index a3012c5c5d..28c4f3166f 100644 --- a/src/lib/libcrypto/man/BIO_f_buffer.3 +++ b/src/lib/libcrypto/man/BIO_f_buffer.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_f_buffer.3,v 1.17 2023/04/29 12:22:08 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_f_buffer.3,v 1.18 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: April 29 2023 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt BIO_F_BUFFER 3 | 70 | .Dt BIO_F_BUFFER 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -82,6 +82,7 @@ | |||
| 82 | .\" whatever that is supposed to be, but are NOOPs, and nothing uses them. | 82 | .\" whatever that is supposed to be, but are NOOPs, and nothing uses them. |
| 83 | .Nd buffering BIO | 83 | .Nd buffering BIO |
| 84 | .Sh SYNOPSIS | 84 | .Sh SYNOPSIS |
| 85 | .Lb libcrypto | ||
| 85 | .In openssl/bio.h | 86 | .In openssl/bio.h |
| 86 | .Ft const BIO_METHOD * | 87 | .Ft const BIO_METHOD * |
| 87 | .Fo BIO_f_buffer | 88 | .Fo BIO_f_buffer |
diff --git a/src/lib/libcrypto/man/BIO_f_cipher.3 b/src/lib/libcrypto/man/BIO_f_cipher.3 index c5d00c6981..3f7fe7bfaf 100644 --- a/src/lib/libcrypto/man/BIO_f_cipher.3 +++ b/src/lib/libcrypto/man/BIO_f_cipher.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_f_cipher.3,v 1.16 2023/04/29 12:01:53 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_f_cipher.3,v 1.17 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 | 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: April 29 2023 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt BIO_F_CIPHER 3 | 53 | .Dt BIO_F_CIPHER 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -60,6 +60,7 @@ | |||
| 60 | .\" .Nm BIO_CTRL_SET is intentionally undocumented because it has no effect. | 60 | .\" .Nm BIO_CTRL_SET is intentionally undocumented because it has no effect. |
| 61 | .Nd cipher BIO filter | 61 | .Nd cipher BIO filter |
| 62 | .Sh SYNOPSIS | 62 | .Sh SYNOPSIS |
| 63 | .Lb libcrypto | ||
| 63 | .In openssl/bio.h | 64 | .In openssl/bio.h |
| 64 | .In openssl/evp.h | 65 | .In openssl/evp.h |
| 65 | .Ft const BIO_METHOD * | 66 | .Ft const BIO_METHOD * |
diff --git a/src/lib/libcrypto/man/BIO_f_md.3 b/src/lib/libcrypto/man/BIO_f_md.3 index 279aabc980..ba5a0d9b85 100644 --- a/src/lib/libcrypto/man/BIO_f_md.3 +++ b/src/lib/libcrypto/man/BIO_f_md.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_f_md.3,v 1.15 2023/04/28 16:20:01 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_f_md.3,v 1.16 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 | 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: April 28 2023 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt BIO_F_MD 3 | 70 | .Dt BIO_F_MD 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -77,6 +77,7 @@ | |||
| 77 | .Nm BIO_set_md_ctx | 77 | .Nm BIO_set_md_ctx |
| 78 | .Nd message digest BIO filter | 78 | .Nd message digest BIO filter |
| 79 | .Sh SYNOPSIS | 79 | .Sh SYNOPSIS |
| 80 | .Lb libcrypto | ||
| 80 | .In openssl/bio.h | 81 | .In openssl/bio.h |
| 81 | .In openssl/evp.h | 82 | .In openssl/evp.h |
| 82 | .Ft const BIO_METHOD * | 83 | .Ft const BIO_METHOD * |
diff --git a/src/lib/libcrypto/man/BIO_f_null.3 b/src/lib/libcrypto/man/BIO_f_null.3 index 687d991b52..ea75a242a4 100644 --- a/src/lib/libcrypto/man/BIO_f_null.3 +++ b/src/lib/libcrypto/man/BIO_f_null.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_f_null.3,v 1.12 2023/04/11 16:58:43 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_f_null.3,v 1.13 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 | 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: April 11 2023 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt BIO_F_NULL 3 | 52 | .Dt BIO_F_NULL 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .\" except in openssl(1) s_client/s_server -nbio_test. | 58 | .\" except in openssl(1) s_client/s_server -nbio_test. |
| 59 | .Nd null filter | 59 | .Nd null filter |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libcrypto | ||
| 61 | .In openssl/bio.h | 62 | .In openssl/bio.h |
| 62 | .Ft const BIO_METHOD * | 63 | .Ft const BIO_METHOD * |
| 63 | .Fo BIO_f_null | 64 | .Fo BIO_f_null |
diff --git a/src/lib/libcrypto/man/BIO_find_type.3 b/src/lib/libcrypto/man/BIO_find_type.3 index 4a9eee7832..88f36032c7 100644 --- a/src/lib/libcrypto/man/BIO_find_type.3 +++ b/src/lib/libcrypto/man/BIO_find_type.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_find_type.3,v 1.12 2023/07/26 20:01:04 tb Exp $ | 1 | .\" $OpenBSD: BIO_find_type.3,v 1.13 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 1cb7eff4 Sep 10 13:56:40 2019 +0100 | 2 | .\" full merge up to: OpenSSL 1cb7eff4 Sep 10 13:56:40 2019 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: July 26 2023 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt BIO_FIND_TYPE 3 | 69 | .Dt BIO_FIND_TYPE 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -75,6 +75,7 @@ | |||
| 75 | .Nm BIO_method_name | 75 | .Nm BIO_method_name |
| 76 | .Nd BIO chain traversal | 76 | .Nd BIO chain traversal |
| 77 | .Sh SYNOPSIS | 77 | .Sh SYNOPSIS |
| 78 | .Lb libcrypto | ||
| 78 | .In openssl/bio.h | 79 | .In openssl/bio.h |
| 79 | .Ft BIO * | 80 | .Ft BIO * |
| 80 | .Fo BIO_find_type | 81 | .Fo BIO_find_type |
diff --git a/src/lib/libcrypto/man/BIO_get_data.3 b/src/lib/libcrypto/man/BIO_get_data.3 index 63750ac37b..26783929b1 100644 --- a/src/lib/libcrypto/man/BIO_get_data.3 +++ b/src/lib/libcrypto/man/BIO_get_data.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_get_data.3,v 1.8 2023/11/16 20:27:43 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_get_data.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 | 2 | .\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: November 16 2023 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt BIO_GET_DATA 3 | 69 | .Dt BIO_GET_DATA 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -87,6 +87,7 @@ | |||
| 87 | .Nm BIO_get_shutdown | 87 | .Nm BIO_get_shutdown |
| 88 | .Nd manage BIO state information | 88 | .Nd manage BIO state information |
| 89 | .Sh SYNOPSIS | 89 | .Sh SYNOPSIS |
| 90 | .Lb libcrypto | ||
| 90 | .In openssl/bio.h | 91 | .In openssl/bio.h |
| 91 | .Ft void | 92 | .Ft void |
| 92 | .Fo BIO_set_data | 93 | .Fo BIO_set_data |
diff --git a/src/lib/libcrypto/man/BIO_get_ex_new_index.3 b/src/lib/libcrypto/man/BIO_get_ex_new_index.3 index 54d00775e7..13d20e14a8 100644 --- a/src/lib/libcrypto/man/BIO_get_ex_new_index.3 +++ b/src/lib/libcrypto/man/BIO_get_ex_new_index.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_get_ex_new_index.3,v 1.17 2023/11/19 10:26:36 tb Exp $ | 1 | .\" $OpenBSD: BIO_get_ex_new_index.3,v 1.18 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 | 2 | .\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Rich Salz <rsalz@akamai.com>. | 4 | .\" This file was written by Rich Salz <rsalz@akamai.com>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: November 19 2023 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt BIO_GET_EX_NEW_INDEX 3 | 52 | .Dt BIO_GET_EX_NEW_INDEX 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -68,6 +68,7 @@ | |||
| 68 | .Nm EC_KEY_set_ex_data | 68 | .Nm EC_KEY_set_ex_data |
| 69 | .Nd application-specific data | 69 | .Nd application-specific data |
| 70 | .Sh SYNOPSIS | 70 | .Sh SYNOPSIS |
| 71 | .Lb libcrypto | ||
| 71 | .In openssl/bio.h | 72 | .In openssl/bio.h |
| 72 | .In openssl/ui.h | 73 | .In openssl/ui.h |
| 73 | .In openssl/x509.h | 74 | .In openssl/x509.h |
diff --git a/src/lib/libcrypto/man/BIO_meth_new.3 b/src/lib/libcrypto/man/BIO_meth_new.3 index 2159560596..98feac5bcc 100644 --- a/src/lib/libcrypto/man/BIO_meth_new.3 +++ b/src/lib/libcrypto/man/BIO_meth_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_meth_new.3,v 1.5 2018/07/09 09:52:18 tb Exp $ | 1 | .\" $OpenBSD: BIO_meth_new.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 | 3 | .\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 |
| 4 | .\" | 4 | .\" |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: July 9 2018 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt BIO_METH_NEW 3 | 70 | .Dt BIO_METH_NEW 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -91,6 +91,7 @@ | |||
| 91 | .Nm BIO_meth_set_callback_ctrl | 91 | .Nm BIO_meth_set_callback_ctrl |
| 92 | .Nd manipulate BIO_METHOD structures | 92 | .Nd manipulate BIO_METHOD structures |
| 93 | .Sh SYNOPSIS | 93 | .Sh SYNOPSIS |
| 94 | .Lb libcrypto | ||
| 94 | .In openssl/bio.h | 95 | .In openssl/bio.h |
| 95 | .Ft int | 96 | .Ft int |
| 96 | .Fn BIO_get_new_index void | 97 | .Fn BIO_get_new_index void |
diff --git a/src/lib/libcrypto/man/BIO_new.3 b/src/lib/libcrypto/man/BIO_new.3 index f97a314826..f0079948fb 100644 --- a/src/lib/libcrypto/man/BIO_new.3 +++ b/src/lib/libcrypto/man/BIO_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_new.3,v 1.28 2023/07/26 20:01:04 tb Exp $ | 1 | .\" $OpenBSD: BIO_new.3,v 1.29 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: | 2 | .\" full merge up to: |
| 3 | .\" OpenSSL man3/BIO_new.pod fb46be03 Feb 26 11:51:31 2016 +0000 | 3 | .\" OpenSSL man3/BIO_new.pod fb46be03 Feb 26 11:51:31 2016 +0000 |
| 4 | .\" OpenSSL man7/bio.pod 631c37be Dec 12 16:56:50 2017 +0100 | 4 | .\" OpenSSL man7/bio.pod 631c37be Dec 12 16:56:50 2017 +0100 |
| @@ -52,7 +52,7 @@ | |||
| 52 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 52 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 53 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 53 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 54 | .\" | 54 | .\" |
| 55 | .Dd $Mdocdate: July 26 2023 $ | 55 | .Dd $Mdocdate: June 8 2025 $ |
| 56 | .Dt BIO_NEW 3 | 56 | .Dt BIO_NEW 3 |
| 57 | .Os | 57 | .Os |
| 58 | .Sh NAME | 58 | .Sh NAME |
| @@ -64,6 +64,7 @@ | |||
| 64 | .Nm BIO_free_all | 64 | .Nm BIO_free_all |
| 65 | .Nd construct and destruct I/O abstraction objects | 65 | .Nd construct and destruct I/O abstraction objects |
| 66 | .Sh SYNOPSIS | 66 | .Sh SYNOPSIS |
| 67 | .Lb libcrypto | ||
| 67 | .In openssl/bio.h | 68 | .In openssl/bio.h |
| 68 | .Ft BIO * | 69 | .Ft BIO * |
| 69 | .Fo BIO_new | 70 | .Fo BIO_new |
diff --git a/src/lib/libcrypto/man/BIO_new_CMS.3 b/src/lib/libcrypto/man/BIO_new_CMS.3 index ab93e1c00c..0279f704f4 100644 --- a/src/lib/libcrypto/man/BIO_new_CMS.3 +++ b/src/lib/libcrypto/man/BIO_new_CMS.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_new_CMS.3,v 1.9 2023/05/01 07:28:11 tb Exp $ | 1 | .\" $OpenBSD: BIO_new_CMS.3,v 1.10 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL df75c2bfc Dec 9 01:02:36 2018 +0100 | 2 | .\" full merge up to: OpenSSL df75c2bfc Dec 9 01:02:36 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: May 1 2023 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt BIO_NEW_CMS 3 | 52 | .Dt BIO_NEW_CMS 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm BIO_new_CMS | 55 | .Nm BIO_new_CMS |
| 56 | .Nd CMS streaming filter BIO | 56 | .Nd CMS streaming filter BIO |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/cms.h | 59 | .In openssl/cms.h |
| 59 | .Ft BIO * | 60 | .Ft BIO * |
| 60 | .Fo BIO_new_CMS | 61 | .Fo BIO_new_CMS |
diff --git a/src/lib/libcrypto/man/BIO_printf.3 b/src/lib/libcrypto/man/BIO_printf.3 index 32dec0a828..6df31ad24c 100644 --- a/src/lib/libcrypto/man/BIO_printf.3 +++ b/src/lib/libcrypto/man/BIO_printf.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_printf.3,v 1.4 2024/03/02 09:18:28 tb Exp $ | 1 | .\" $OpenBSD: BIO_printf.3,v 1.5 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL 2ca2e917 Mon Mar 20 16:25:22 2017 -0400 | 2 | .\" OpenSSL 2ca2e917 Mon Mar 20 16:25:22 2017 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> | 4 | .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> |
| @@ -15,13 +15,14 @@ | |||
| 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 | .\" | 17 | .\" |
| 18 | .Dd $Mdocdate: March 2 2024 $ | 18 | .Dd $Mdocdate: June 8 2025 $ |
| 19 | .Dt BIO_PRINTF 3 | 19 | .Dt BIO_PRINTF 3 |
| 20 | .Os | 20 | .Os |
| 21 | .Sh NAME | 21 | .Sh NAME |
| 22 | .Nm BIO_printf | 22 | .Nm BIO_printf |
| 23 | .Nd formatted output to a BIO | 23 | .Nd formatted output to a BIO |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/bio.h | 26 | .In openssl/bio.h |
| 26 | .Ft int | 27 | .Ft int |
| 27 | .Fo BIO_printf | 28 | .Fo BIO_printf |
diff --git a/src/lib/libcrypto/man/BIO_push.3 b/src/lib/libcrypto/man/BIO_push.3 index 46c736e2c2..21b798a54f 100644 --- a/src/lib/libcrypto/man/BIO_push.3 +++ b/src/lib/libcrypto/man/BIO_push.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_push.3,v 1.14 2022/12/16 16:02:17 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_push.3,v 1.15 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: | 2 | .\" full merge up to: |
| 3 | .\" OpenSSL doc/man3/BIO_push.pod 791bfd91 Nov 19 20:38:27 2021 +0100 | 3 | .\" OpenSSL doc/man3/BIO_push.pod 791bfd91 Nov 19 20:38:27 2021 +0100 |
| 4 | .\" OpenSSL doc/man7/bio.pod 1cb7eff4 Sep 10 13:56:40 2019 +0100 | 4 | .\" OpenSSL doc/man7/bio.pod 1cb7eff4 Sep 10 13:56:40 2019 +0100 |
| @@ -67,7 +67,7 @@ | |||
| 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 69 | .\" | 69 | .\" |
| 70 | .Dd $Mdocdate: December 16 2022 $ | 70 | .Dd $Mdocdate: June 8 2025 $ |
| 71 | .Dt BIO_PUSH 3 | 71 | .Dt BIO_PUSH 3 |
| 72 | .Os | 72 | .Os |
| 73 | .Sh NAME | 73 | .Sh NAME |
| @@ -76,6 +76,7 @@ | |||
| 76 | .Nm BIO_set_next | 76 | .Nm BIO_set_next |
| 77 | .Nd manipulate BIO chains | 77 | .Nd manipulate BIO chains |
| 78 | .Sh SYNOPSIS | 78 | .Sh SYNOPSIS |
| 79 | .Lb libcrypto | ||
| 79 | .In openssl/bio.h | 80 | .In openssl/bio.h |
| 80 | .Ft BIO * | 81 | .Ft BIO * |
| 81 | .Fo BIO_push | 82 | .Fo BIO_push |
diff --git a/src/lib/libcrypto/man/BIO_read.3 b/src/lib/libcrypto/man/BIO_read.3 index 5fea9f728a..2a65b18535 100644 --- a/src/lib/libcrypto/man/BIO_read.3 +++ b/src/lib/libcrypto/man/BIO_read.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_read.3,v 1.11 2022/12/18 17:40:55 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_read.3,v 1.12 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: December 18 2022 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt BIO_READ 3 | 69 | .Dt BIO_READ 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -78,6 +78,7 @@ | |||
| 78 | .Nm BIO_number_written | 78 | .Nm BIO_number_written |
| 79 | .Nd BIO I/O functions | 79 | .Nd BIO I/O functions |
| 80 | .Sh SYNOPSIS | 80 | .Sh SYNOPSIS |
| 81 | .Lb libcrypto | ||
| 81 | .In openssl/bio.h | 82 | .In openssl/bio.h |
| 82 | .Ft int | 83 | .Ft int |
| 83 | .Fo BIO_read | 84 | .Fo BIO_read |
diff --git a/src/lib/libcrypto/man/BIO_s_accept.3 b/src/lib/libcrypto/man/BIO_s_accept.3 index 8e88fe1c52..c5a8f6d293 100644 --- a/src/lib/libcrypto/man/BIO_s_accept.3 +++ b/src/lib/libcrypto/man/BIO_s_accept.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_s_accept.3,v 1.16 2023/04/29 13:06:10 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_s_accept.3,v 1.17 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL c03726ca Thu Aug 27 12:28:08 2015 -0400 | 2 | .\" full merge up to: OpenSSL c03726ca Thu Aug 27 12:28:08 2015 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: April 29 2023 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt BIO_S_ACCEPT 3 | 69 | .Dt BIO_S_ACCEPT 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -80,6 +80,7 @@ | |||
| 80 | .Nm BIO_do_accept | 80 | .Nm BIO_do_accept |
| 81 | .Nd accept BIO | 81 | .Nd accept BIO |
| 82 | .Sh SYNOPSIS | 82 | .Sh SYNOPSIS |
| 83 | .Lb libcrypto | ||
| 83 | .In openssl/bio.h | 84 | .In openssl/bio.h |
| 84 | .Ft const BIO_METHOD * | 85 | .Ft const BIO_METHOD * |
| 85 | .Fo BIO_s_accept | 86 | .Fo BIO_s_accept |
diff --git a/src/lib/libcrypto/man/BIO_s_bio.3 b/src/lib/libcrypto/man/BIO_s_bio.3 index efda019df3..6590ff81ec 100644 --- a/src/lib/libcrypto/man/BIO_s_bio.3 +++ b/src/lib/libcrypto/man/BIO_s_bio.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_s_bio.3,v 1.20 2024/05/19 07:12:50 jsg Exp $ | 1 | .\" $OpenBSD: BIO_s_bio.3,v 1.21 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by | 4 | .\" This file was written by |
| @@ -53,7 +53,7 @@ | |||
| 53 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 53 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 54 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 54 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 55 | .\" | 55 | .\" |
| 56 | .Dd $Mdocdate: May 19 2024 $ | 56 | .Dd $Mdocdate: June 8 2025 $ |
| 57 | .Dt BIO_S_BIO 3 | 57 | .Dt BIO_S_BIO 3 |
| 58 | .Os | 58 | .Os |
| 59 | .Sh NAME | 59 | .Sh NAME |
| @@ -71,6 +71,7 @@ | |||
| 71 | .Nm BIO_ctrl_reset_read_request | 71 | .Nm BIO_ctrl_reset_read_request |
| 72 | .Nd BIO pair BIO | 72 | .Nd BIO pair BIO |
| 73 | .Sh SYNOPSIS | 73 | .Sh SYNOPSIS |
| 74 | .Lb libcrypto | ||
| 74 | .In openssl/bio.h | 75 | .In openssl/bio.h |
| 75 | .Ft const BIO_METHOD * | 76 | .Ft const BIO_METHOD * |
| 76 | .Fo BIO_s_bio | 77 | .Fo BIO_s_bio |
diff --git a/src/lib/libcrypto/man/BIO_s_connect.3 b/src/lib/libcrypto/man/BIO_s_connect.3 index bce68a26b9..ca7ee6d988 100644 --- a/src/lib/libcrypto/man/BIO_s_connect.3 +++ b/src/lib/libcrypto/man/BIO_s_connect.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_s_connect.3,v 1.19 2023/04/30 13:53:54 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_s_connect.3,v 1.20 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 0e474b8b Nov 1 15:45:49 2015 +0100 | 2 | .\" full merge up to: OpenSSL 0e474b8b Nov 1 15:45:49 2015 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: April 30 2023 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt BIO_S_CONNECT 3 | 69 | .Dt BIO_S_CONNECT 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -83,6 +83,7 @@ | |||
| 83 | .Nm BIO_do_connect | 83 | .Nm BIO_do_connect |
| 84 | .Nd connect BIO | 84 | .Nd connect BIO |
| 85 | .Sh SYNOPSIS | 85 | .Sh SYNOPSIS |
| 86 | .Lb libcrypto | ||
| 86 | .In openssl/bio.h | 87 | .In openssl/bio.h |
| 87 | .Ft const BIO_METHOD * | 88 | .Ft const BIO_METHOD * |
| 88 | .Fo BIO_s_connect | 89 | .Fo BIO_s_connect |
diff --git a/src/lib/libcrypto/man/BIO_s_datagram.3 b/src/lib/libcrypto/man/BIO_s_datagram.3 index 104823e7a7..bbe80b259c 100644 --- a/src/lib/libcrypto/man/BIO_s_datagram.3 +++ b/src/lib/libcrypto/man/BIO_s_datagram.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_s_datagram.3,v 1.3 2023/04/28 16:49:00 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_s_datagram.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: April 28 2023 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt BIO_S_DATAGRAM 3 | 18 | .Dt BIO_S_DATAGRAM 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -32,6 +32,7 @@ | |||
| 32 | .\" They are almost unused, and OpenBSD does not appear to support them. | 32 | .\" They are almost unused, and OpenBSD does not appear to support them. |
| 33 | .Nd datagram socket BIO | 33 | .Nd datagram socket BIO |
| 34 | .Sh SYNOPSIS | 34 | .Sh SYNOPSIS |
| 35 | .Lb libcrypto | ||
| 35 | .In openssl/bio.h | 36 | .In openssl/bio.h |
| 36 | .Ft const BIO_METHOD * | 37 | .Ft const BIO_METHOD * |
| 37 | .Fn BIO_s_datagram void | 38 | .Fn BIO_s_datagram void |
diff --git a/src/lib/libcrypto/man/BIO_s_fd.3 b/src/lib/libcrypto/man/BIO_s_fd.3 index 852a06756a..b1165f30a1 100644 --- a/src/lib/libcrypto/man/BIO_s_fd.3 +++ b/src/lib/libcrypto/man/BIO_s_fd.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_s_fd.3,v 1.13 2023/11/16 20:19:23 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_s_fd.3,v 1.14 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: November 16 2023 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt BIO_S_FD 3 | 69 | .Dt BIO_S_FD 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -77,6 +77,7 @@ | |||
| 77 | .Nm BIO_fd_should_retry | 77 | .Nm BIO_fd_should_retry |
| 78 | .Nd file descriptor BIO | 78 | .Nd file descriptor BIO |
| 79 | .Sh SYNOPSIS | 79 | .Sh SYNOPSIS |
| 80 | .Lb libcrypto | ||
| 80 | .In openssl/bio.h | 81 | .In openssl/bio.h |
| 81 | .Ft const BIO_METHOD * | 82 | .Ft const BIO_METHOD * |
| 82 | .Fo BIO_s_fd | 83 | .Fo BIO_s_fd |
diff --git a/src/lib/libcrypto/man/BIO_s_file.3 b/src/lib/libcrypto/man/BIO_s_file.3 index 14950cad13..d59e157c33 100644 --- a/src/lib/libcrypto/man/BIO_s_file.3 +++ b/src/lib/libcrypto/man/BIO_s_file.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_s_file.3,v 1.17 2023/11/16 20:19:23 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_s_file.3,v 1.18 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" selective merge up to: OpenSSL 1212818e Sep 11 13:22:14 2018 +0100 | 3 | .\" selective merge up to: OpenSSL 1212818e Sep 11 13:22:14 2018 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: November 16 2023 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt BIO_S_FILE 3 | 70 | .Dt BIO_S_FILE 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -82,6 +82,7 @@ | |||
| 82 | .\" Nm BIO_CTRL_SET_FILENAME is unused and intentionally undocumented. | 82 | .\" Nm BIO_CTRL_SET_FILENAME is unused and intentionally undocumented. |
| 83 | .Nd FILE BIO | 83 | .Nd FILE BIO |
| 84 | .Sh SYNOPSIS | 84 | .Sh SYNOPSIS |
| 85 | .Lb libcrypto | ||
| 85 | .In openssl/bio.h | 86 | .In openssl/bio.h |
| 86 | .Ft const BIO_METHOD * | 87 | .Ft const BIO_METHOD * |
| 87 | .Fo BIO_s_file | 88 | .Fo BIO_s_file |
diff --git a/src/lib/libcrypto/man/BIO_s_mem.3 b/src/lib/libcrypto/man/BIO_s_mem.3 index d7bbf6af43..e43be66e2f 100644 --- a/src/lib/libcrypto/man/BIO_s_mem.3 +++ b/src/lib/libcrypto/man/BIO_s_mem.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_s_mem.3,v 1.19 2023/11/16 20:19:23 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_s_mem.3,v 1.20 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 8711efb4 Mon Apr 20 11:33:12 2009 +0000 | 2 | .\" full merge up to: OpenSSL 8711efb4 Mon Apr 20 11:33:12 2009 +0000 |
| 3 | .\" selective merge up to: OpenSSL 36359cec Mar 7 14:37:23 2018 +0100 | 3 | .\" selective merge up to: OpenSSL 36359cec Mar 7 14:37:23 2018 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: November 16 2023 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt BIO_S_MEM 3 | 53 | .Dt BIO_S_MEM 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -61,6 +61,7 @@ | |||
| 61 | .Nm BIO_new_mem_buf | 61 | .Nm BIO_new_mem_buf |
| 62 | .Nd memory BIO | 62 | .Nd memory BIO |
| 63 | .Sh SYNOPSIS | 63 | .Sh SYNOPSIS |
| 64 | .Lb libcrypto | ||
| 64 | .In openssl/bio.h | 65 | .In openssl/bio.h |
| 65 | .Ft const BIO_METHOD * | 66 | .Ft const BIO_METHOD * |
| 66 | .Fo BIO_s_mem | 67 | .Fo BIO_s_mem |
diff --git a/src/lib/libcrypto/man/BIO_s_null.3 b/src/lib/libcrypto/man/BIO_s_null.3 index 6e7cad6d37..7198797b99 100644 --- a/src/lib/libcrypto/man/BIO_s_null.3 +++ b/src/lib/libcrypto/man/BIO_s_null.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_s_null.3,v 1.10 2023/04/11 16:58:43 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_s_null.3,v 1.12 2025/07/16 18:10:53 tb Exp $ |
| 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 | 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,14 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: April 11 2023 $ | 51 | .Dd $Mdocdate: July 16 2025 $ |
| 52 | .Dt BIO_S_NULL 3 | 52 | .Dt BIO_S_NULL 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm BIO_s_null | 55 | .Nm BIO_s_null |
| 56 | .\" .Nm BIO_s_log is intentionally undocumented because it is unused | ||
| 57 | .Nd null data sink | 56 | .Nd null data sink |
| 58 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 59 | .In openssl/bio.h | 59 | .In openssl/bio.h |
| 60 | .Ft const BIO_METHOD * | 60 | .Ft const BIO_METHOD * |
| 61 | .Fo BIO_s_null | 61 | .Fo BIO_s_null |
diff --git a/src/lib/libcrypto/man/BIO_s_socket.3 b/src/lib/libcrypto/man/BIO_s_socket.3 index 402622b3bd..aebf399b2b 100644 --- a/src/lib/libcrypto/man/BIO_s_socket.3 +++ b/src/lib/libcrypto/man/BIO_s_socket.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_s_socket.3,v 1.10 2023/04/11 16:58:43 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_s_socket.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL bbdc9c98 Oct 19 22:02:21 2000 +0000 | 2 | .\" OpenSSL bbdc9c98 Oct 19 22:02:21 2000 +0000 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: April 11 2023 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt BIO_S_SOCKET 3 | 52 | .Dt BIO_S_SOCKET 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm BIO_new_socket | 56 | .Nm BIO_new_socket |
| 57 | .Nd socket BIO | 57 | .Nd socket BIO |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 59 | .In openssl/bio.h | 60 | .In openssl/bio.h |
| 60 | .Ft const BIO_METHOD * | 61 | .Ft const BIO_METHOD * |
| 61 | .Fo BIO_s_socket | 62 | .Fo BIO_s_socket |
diff --git a/src/lib/libcrypto/man/BIO_set_callback.3 b/src/lib/libcrypto/man/BIO_set_callback.3 index 56a0102be6..f3f40cba8e 100644 --- a/src/lib/libcrypto/man/BIO_set_callback.3 +++ b/src/lib/libcrypto/man/BIO_set_callback.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_set_callback.3,v 1.12 2023/04/30 13:57:29 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_set_callback.3,v 1.13 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 | 2 | .\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: April 30 2023 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt BIO_SET_CALLBACK 3 | 69 | .Dt BIO_SET_CALLBACK 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -85,6 +85,7 @@ | |||
| 85 | .\" .Nm BIO_cb_post | 85 | .\" .Nm BIO_cb_post |
| 86 | .Nd BIO callback functions | 86 | .Nd BIO callback functions |
| 87 | .Sh SYNOPSIS | 87 | .Sh SYNOPSIS |
| 88 | .Lb libcrypto | ||
| 88 | .In openssl/bio.h | 89 | .In openssl/bio.h |
| 89 | .Ft typedef long | 90 | .Ft typedef long |
| 90 | .Fo (*BIO_callback_fn_ex) | 91 | .Fo (*BIO_callback_fn_ex) |
diff --git a/src/lib/libcrypto/man/BIO_should_retry.3 b/src/lib/libcrypto/man/BIO_should_retry.3 index 9b93743516..4a0948ff86 100644 --- a/src/lib/libcrypto/man/BIO_should_retry.3 +++ b/src/lib/libcrypto/man/BIO_should_retry.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_should_retry.3,v 1.11 2023/04/30 14:03:47 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_should_retry.3,v 1.12 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" selective merge up to: OpenSSL 57fd5170 May 13 11:24:11 2018 +0200 | 3 | .\" selective merge up to: OpenSSL 57fd5170 May 13 11:24:11 2018 +0200 |
| 4 | .\" | 4 | .\" |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: April 30 2023 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt BIO_SHOULD_RETRY 3 | 70 | .Dt BIO_SHOULD_RETRY 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -80,6 +80,7 @@ | |||
| 80 | .Nm BIO_set_retry_reason | 80 | .Nm BIO_set_retry_reason |
| 81 | .Nd BIO retry functions | 81 | .Nd BIO retry functions |
| 82 | .Sh SYNOPSIS | 82 | .Sh SYNOPSIS |
| 83 | .Lb libcrypto | ||
| 83 | .In openssl/bio.h | 84 | .In openssl/bio.h |
| 84 | .Ft int | 85 | .Ft int |
| 85 | .Fo BIO_should_read | 86 | .Fo BIO_should_read |
diff --git a/src/lib/libcrypto/man/BN_CTX_new.3 b/src/lib/libcrypto/man/BN_CTX_new.3 index 336b918896..0d5a3e847c 100644 --- a/src/lib/libcrypto/man/BN_CTX_new.3 +++ b/src/lib/libcrypto/man/BN_CTX_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BN_CTX_new.3,v 1.10 2023/04/25 17:21:51 tb Exp $ | 1 | .\" $OpenBSD: BN_CTX_new.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL aafbe1cc Jun 12 23:42:08 2013 +0100 | 2 | .\" OpenSSL aafbe1cc Jun 12 23:42:08 2013 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: April 25 2023 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt BN_CTX_NEW 3 | 52 | .Dt BN_CTX_NEW 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm BN_CTX_free | 56 | .Nm BN_CTX_free |
| 57 | .Nd allocate and free BN_CTX structures | 57 | .Nd allocate and free BN_CTX structures |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 59 | .In openssl/bn.h | 60 | .In openssl/bn.h |
| 60 | .Ft BN_CTX * | 61 | .Ft BN_CTX * |
| 61 | .Fo BN_CTX_new | 62 | .Fo BN_CTX_new |
diff --git a/src/lib/libcrypto/man/BN_CTX_start.3 b/src/lib/libcrypto/man/BN_CTX_start.3 index a2b62eff5c..27159ce90d 100644 --- a/src/lib/libcrypto/man/BN_CTX_start.3 +++ b/src/lib/libcrypto/man/BN_CTX_start.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BN_CTX_start.3,v 1.8 2019/08/20 10:59:09 schwarze Exp $ | 1 | .\" $OpenBSD: BN_CTX_start.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 35fd9953 May 28 14:49:38 2019 +0200 | 2 | .\" full merge up to: OpenSSL 35fd9953 May 28 14:49:38 2019 +0200 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: August 20 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt BN_CTX_START 3 | 52 | .Dt BN_CTX_START 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm BN_CTX_end | 57 | .Nm BN_CTX_end |
| 58 | .Nd use temporary BIGNUM variables | 58 | .Nd use temporary BIGNUM variables |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/bn.h | 61 | .In openssl/bn.h |
| 61 | .Ft void | 62 | .Ft void |
| 62 | .Fo BN_CTX_start | 63 | .Fo BN_CTX_start |
diff --git a/src/lib/libcrypto/man/BN_add.3 b/src/lib/libcrypto/man/BN_add.3 index e7de441b7a..32378f6940 100644 --- a/src/lib/libcrypto/man/BN_add.3 +++ b/src/lib/libcrypto/man/BN_add.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BN_add.3,v 1.20 2023/04/27 09:47:03 tb Exp $ | 1 | .\" $OpenBSD: BN_add.3,v 1.21 2025/06/08 22:37:23 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 | 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: April 27 2023 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt BN_ADD 3 | 70 | .Dt BN_ADD 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -94,13 +94,11 @@ | |||
| 94 | .\" The following are public, but intentionally undocumented for now: | 94 | .\" The following are public, but intentionally undocumented for now: |
| 95 | .\" .Nm BN_mod_exp_mont , r \(== a ^ p (mod m) | 95 | .\" .Nm BN_mod_exp_mont , r \(== a ^ p (mod m) |
| 96 | .\" .Nm BN_mod_exp_mont_consttime , | 96 | .\" .Nm BN_mod_exp_mont_consttime , |
| 97 | .\" .Nm BN_mod_exp_mont_word , | ||
| 98 | .\" .Nm BN_mod_exp_simple , | ||
| 99 | .\" .Nm BN_mod_exp2_mont r \(== (a1 ^ p1) * (a2 ^ p2) (mod m) | ||
| 100 | .\" Maybe they should be deleted from <openssl/bn.h>. | 97 | .\" Maybe they should be deleted from <openssl/bn.h>. |
| 101 | .Nm BN_gcd | 98 | .Nm BN_gcd |
| 102 | .Nd arithmetic operations on BIGNUMs | 99 | .Nd arithmetic operations on BIGNUMs |
| 103 | .Sh SYNOPSIS | 100 | .Sh SYNOPSIS |
| 101 | .Lb libcrypto | ||
| 104 | .In openssl/bn.h | 102 | .In openssl/bn.h |
| 105 | .Ft int | 103 | .Ft int |
| 106 | .Fo BN_add | 104 | .Fo BN_add |
diff --git a/src/lib/libcrypto/man/BN_add_word.3 b/src/lib/libcrypto/man/BN_add_word.3 index 161029c302..b8b45bfb2c 100644 --- a/src/lib/libcrypto/man/BN_add_word.3 +++ b/src/lib/libcrypto/man/BN_add_word.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BN_add_word.3,v 1.10 2022/11/22 19:02:07 schwarze Exp $ | 1 | .\" $OpenBSD: BN_add_word.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 9e183d22 Mar 11 08:56:44 2017 -0500 | 2 | .\" full merge up to: OpenSSL 9e183d22 Mar 11 08:56:44 2017 -0500 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: November 22 2022 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt BN_ADD_WORD 3 | 52 | .Dt BN_ADD_WORD 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -59,6 +59,7 @@ | |||
| 59 | .Nm BN_mod_word | 59 | .Nm BN_mod_word |
| 60 | .Nd arithmetic functions on BIGNUMs with integers | 60 | .Nd arithmetic functions on BIGNUMs with integers |
| 61 | .Sh SYNOPSIS | 61 | .Sh SYNOPSIS |
| 62 | .Lb libcrypto | ||
| 62 | .In openssl/bn.h | 63 | .In openssl/bn.h |
| 63 | .Ft int | 64 | .Ft int |
| 64 | .Fo BN_add_word | 65 | .Fo BN_add_word |
diff --git a/src/lib/libcrypto/man/BN_bn2bin.3 b/src/lib/libcrypto/man/BN_bn2bin.3 index 0fe9a90738..cf72e6dd1b 100644 --- a/src/lib/libcrypto/man/BN_bn2bin.3 +++ b/src/lib/libcrypto/man/BN_bn2bin.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BN_bn2bin.3,v 1.16 2023/07/09 06:45:03 tb Exp $ | 1 | .\" $OpenBSD: BN_bn2bin.3,v 1.17 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 | 2 | .\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: July 9 2023 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt BN_BN2BIN 3 | 53 | .Dt BN_BN2BIN 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -69,6 +69,7 @@ | |||
| 69 | .Nm BN_mpi2bn | 69 | .Nm BN_mpi2bn |
| 70 | .Nd format conversions | 70 | .Nd format conversions |
| 71 | .Sh SYNOPSIS | 71 | .Sh SYNOPSIS |
| 72 | .Lb libcrypto | ||
| 72 | .In openssl/bn.h | 73 | .In openssl/bn.h |
| 73 | .Ft int | 74 | .Ft int |
| 74 | .Fo BN_bn2bin | 75 | .Fo BN_bn2bin |
diff --git a/src/lib/libcrypto/man/BN_cmp.3 b/src/lib/libcrypto/man/BN_cmp.3 index ba973313f0..3837ffcd1a 100644 --- a/src/lib/libcrypto/man/BN_cmp.3 +++ b/src/lib/libcrypto/man/BN_cmp.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BN_cmp.3,v 1.10 2022/11/22 19:02:07 schwarze Exp $ | 1 | .\" $OpenBSD: BN_cmp.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 5b31b9df Aug 4 10:45:52 2021 +0300 | 2 | .\" full merge up to: OpenSSL 5b31b9df Aug 4 10:45:52 2021 +0300 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: November 22 2022 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt BN_CMP 3 | 52 | .Dt BN_CMP 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -61,6 +61,7 @@ | |||
| 61 | .Nm BN_is_odd | 61 | .Nm BN_is_odd |
| 62 | .Nd BIGNUM comparison and test functions | 62 | .Nd BIGNUM comparison and test functions |
| 63 | .Sh SYNOPSIS | 63 | .Sh SYNOPSIS |
| 64 | .Lb libcrypto | ||
| 64 | .In openssl/bn.h | 65 | .In openssl/bn.h |
| 65 | .Ft int | 66 | .Ft int |
| 66 | .Fo BN_cmp | 67 | .Fo BN_cmp |
diff --git a/src/lib/libcrypto/man/BN_copy.3 b/src/lib/libcrypto/man/BN_copy.3 index 383255e382..5481431e97 100644 --- a/src/lib/libcrypto/man/BN_copy.3 +++ b/src/lib/libcrypto/man/BN_copy.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BN_copy.3,v 1.10 2021/12/06 19:45:27 schwarze Exp $ | 1 | .\" $OpenBSD: BN_copy.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: December 6 2021 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt BN_COPY 3 | 53 | .Dt BN_COPY 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm BN_with_flags | 58 | .Nm BN_with_flags |
| 59 | .Nd copy BIGNUMs | 59 | .Nd copy BIGNUMs |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libcrypto | ||
| 61 | .In openssl/bn.h | 62 | .In openssl/bn.h |
| 62 | .Ft BIGNUM * | 63 | .Ft BIGNUM * |
| 63 | .Fo BN_copy | 64 | .Fo BN_copy |
diff --git a/src/lib/libcrypto/man/BN_generate_prime.3 b/src/lib/libcrypto/man/BN_generate_prime.3 index d9144155c6..55eed14e75 100644 --- a/src/lib/libcrypto/man/BN_generate_prime.3 +++ b/src/lib/libcrypto/man/BN_generate_prime.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BN_generate_prime.3,v 1.25 2023/12/29 19:12:46 tb Exp $ | 1 | .\" $OpenBSD: BN_generate_prime.3,v 1.26 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL f987a4dd Jun 27 10:12:08 2019 +0200 | 2 | .\" full merge up to: OpenSSL f987a4dd Jun 27 10:12:08 2019 +0200 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -67,7 +67,7 @@ | |||
| 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 69 | .\" | 69 | .\" |
| 70 | .Dd $Mdocdate: December 29 2023 $ | 70 | .Dd $Mdocdate: June 8 2025 $ |
| 71 | .Dt BN_GENERATE_PRIME 3 | 71 | .Dt BN_GENERATE_PRIME 3 |
| 72 | .Os | 72 | .Os |
| 73 | .Sh NAME | 73 | .Sh NAME |
| @@ -84,6 +84,7 @@ | |||
| 84 | .\" because it should not be used outside of libcrypto. | 84 | .\" because it should not be used outside of libcrypto. |
| 85 | .Nd generate primes and test for primality | 85 | .Nd generate primes and test for primality |
| 86 | .Sh SYNOPSIS | 86 | .Sh SYNOPSIS |
| 87 | .Lb libcrypto | ||
| 87 | .In openssl/bn.h | 88 | .In openssl/bn.h |
| 88 | .Ft int | 89 | .Ft int |
| 89 | .Fo BN_is_prime_ex | 90 | .Fo BN_is_prime_ex |
diff --git a/src/lib/libcrypto/man/BN_get_rfc3526_prime_8192.3 b/src/lib/libcrypto/man/BN_get_rfc3526_prime_8192.3 index abaf80ef20..41345de274 100644 --- a/src/lib/libcrypto/man/BN_get_rfc3526_prime_8192.3 +++ b/src/lib/libcrypto/man/BN_get_rfc3526_prime_8192.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BN_get_rfc3526_prime_8192.3,v 1.1 2023/07/20 16:26:40 tb Exp $ | 1 | .\" $OpenBSD: BN_get_rfc3526_prime_8192.3,v 1.2 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" checked up to: OpenSSL DH_get_1024_160 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" checked up to: OpenSSL DH_get_1024_160 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> | 4 | .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> |
| @@ -15,7 +15,7 @@ | |||
| 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 | .\" | 17 | .\" |
| 18 | .Dd $Mdocdate: July 20 2023 $ | 18 | .Dd $Mdocdate: June 8 2025 $ |
| 19 | .Dt BN_GET_RFC3526_PRIME_8192 3 | 19 | .Dt BN_GET_RFC3526_PRIME_8192 3 |
| 20 | .Os | 20 | .Os |
| 21 | .Sh NAME | 21 | .Sh NAME |
| @@ -29,6 +29,7 @@ | |||
| 29 | .Nm BN_get_rfc3526_prime_8192 | 29 | .Nm BN_get_rfc3526_prime_8192 |
| 30 | .Nd standard moduli for Diffie-Hellman key exchange | 30 | .Nd standard moduli for Diffie-Hellman key exchange |
| 31 | .Sh SYNOPSIS | 31 | .Sh SYNOPSIS |
| 32 | .Lb libcrypto | ||
| 32 | .In openssl/bn.h | 33 | .In openssl/bn.h |
| 33 | .Ft BIGNUM * | 34 | .Ft BIGNUM * |
| 34 | .Fn BN_get_rfc2409_prime_768 "BIGNUM *bn" | 35 | .Fn BN_get_rfc2409_prime_768 "BIGNUM *bn" |
diff --git a/src/lib/libcrypto/man/BN_kronecker.3 b/src/lib/libcrypto/man/BN_kronecker.3 index 90b7f43230..6a5b7ecd88 100644 --- a/src/lib/libcrypto/man/BN_kronecker.3 +++ b/src/lib/libcrypto/man/BN_kronecker.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BN_kronecker.3,v 1.2 2022/11/15 17:55:00 schwarze Exp $ | 1 | .\" $OpenBSD: BN_kronecker.3,v 1.3 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: November 15 2022 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt BN_KRONECKER 3 | 18 | .Dt BN_KRONECKER 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm BN_kronecker | 21 | .Nm BN_kronecker |
| 22 | .Nd Kronecker symbol | 22 | .Nd Kronecker symbol |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/bn.h | 25 | .In openssl/bn.h |
| 25 | .Ft int | 26 | .Ft int |
| 26 | .Fo BN_kronecker | 27 | .Fo BN_kronecker |
diff --git a/src/lib/libcrypto/man/BN_mod_inverse.3 b/src/lib/libcrypto/man/BN_mod_inverse.3 index d0a4b458f4..ce10fa216e 100644 --- a/src/lib/libcrypto/man/BN_mod_inverse.3 +++ b/src/lib/libcrypto/man/BN_mod_inverse.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BN_mod_inverse.3,v 1.13 2023/10/21 13:53:43 schwarze Exp $ | 1 | .\" $OpenBSD: BN_mod_inverse.3,v 1.14 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: October 21 2023 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt BN_MOD_INVERSE 3 | 52 | .Dt BN_MOD_INVERSE 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm BN_mod_inverse | 55 | .Nm BN_mod_inverse |
| 56 | .Nd compute inverse modulo m | 56 | .Nd compute inverse modulo m |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/bn.h | 59 | .In openssl/bn.h |
| 59 | .Ft BIGNUM * | 60 | .Ft BIGNUM * |
| 60 | .Fo BN_mod_inverse | 61 | .Fo BN_mod_inverse |
diff --git a/src/lib/libcrypto/man/BN_mod_mul_montgomery.3 b/src/lib/libcrypto/man/BN_mod_mul_montgomery.3 index ed004c2549..2f9e3a532e 100644 --- a/src/lib/libcrypto/man/BN_mod_mul_montgomery.3 +++ b/src/lib/libcrypto/man/BN_mod_mul_montgomery.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BN_mod_mul_montgomery.3,v 1.16 2025/03/09 15:24:25 tb Exp $ | 1 | .\" $OpenBSD: BN_mod_mul_montgomery.3,v 1.17 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 6859cf74 Sep 25 13:33:28 2002 +0000 | 2 | .\" full merge up to: OpenSSL 6859cf74 Sep 25 13:33:28 2002 +0000 |
| 3 | .\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 | 3 | .\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: March 9 2025 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt BN_MOD_MUL_MONTGOMERY 3 | 70 | .Dt BN_MOD_MUL_MONTGOMERY 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -80,6 +80,7 @@ | |||
| 80 | .Nm BN_to_montgomery | 80 | .Nm BN_to_montgomery |
| 81 | .Nd Montgomery multiplication | 81 | .Nd Montgomery multiplication |
| 82 | .Sh SYNOPSIS | 82 | .Sh SYNOPSIS |
| 83 | .Lb libcrypto | ||
| 83 | .In openssl/bn.h | 84 | .In openssl/bn.h |
| 84 | .Ft BN_MONT_CTX * | 85 | .Ft BN_MONT_CTX * |
| 85 | .Fo BN_MONT_CTX_new | 86 | .Fo BN_MONT_CTX_new |
diff --git a/src/lib/libcrypto/man/BN_mod_sqrt.3 b/src/lib/libcrypto/man/BN_mod_sqrt.3 index 7247d907a0..f2cd80e658 100644 --- a/src/lib/libcrypto/man/BN_mod_sqrt.3 +++ b/src/lib/libcrypto/man/BN_mod_sqrt.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BN_mod_sqrt.3,v 1.2 2022/12/06 22:22:42 tb Exp $ | 1 | .\" $OpenBSD: BN_mod_sqrt.3,v 1.3 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 6 2022 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt BN_MOD_SQRT 3 | 18 | .Dt BN_MOD_SQRT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm BN_mod_sqrt | 21 | .Nm BN_mod_sqrt |
| 22 | .Nd square root in a prime field | 22 | .Nd square root in a prime field |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/bn.h | 25 | .In openssl/bn.h |
| 25 | .Ft BIGNUM * | 26 | .Ft BIGNUM * |
| 26 | .Fo BN_mod_sqrt | 27 | .Fo BN_mod_sqrt |
diff --git a/src/lib/libcrypto/man/BN_new.3 b/src/lib/libcrypto/man/BN_new.3 index 088048c622..8e61a1fcc3 100644 --- a/src/lib/libcrypto/man/BN_new.3 +++ b/src/lib/libcrypto/man/BN_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BN_new.3,v 1.31 2023/07/26 20:08:59 tb Exp $ | 1 | .\" $OpenBSD: BN_new.3,v 1.33 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL man3/BN_new 2457c19d Mar 6 08:43:36 2004 +0000 | 2 | .\" full merge up to: OpenSSL man3/BN_new 2457c19d Mar 6 08:43:36 2004 +0000 |
| 3 | .\" selective merge up to: man3/BN_new 681acb31 Sep 29 13:10:34 2017 +0200 | 3 | .\" selective merge up to: man3/BN_new 681acb31 Sep 29 13:10:34 2017 +0200 |
| 4 | .\" full merge up to: OpenSSL man7/bn 05ea606a May 20 20:52:46 2016 -0400 | 4 | .\" full merge up to: OpenSSL man7/bn 05ea606a May 20 20:52:46 2016 -0400 |
| @@ -50,7 +50,7 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: July 26 2023 $ | 53 | .Dd $Mdocdate: June 8 2025 $ |
| 54 | .Dt BN_NEW 3 | 54 | .Dt BN_NEW 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| @@ -60,6 +60,7 @@ | |||
| 60 | .Nm BN_clear_free | 60 | .Nm BN_clear_free |
| 61 | .Nd allocate and free BIGNUMs | 61 | .Nd allocate and free BIGNUMs |
| 62 | .Sh SYNOPSIS | 62 | .Sh SYNOPSIS |
| 63 | .Lb libcrypto | ||
| 63 | .In openssl/bn.h | 64 | .In openssl/bn.h |
| 64 | .Ft BIGNUM * | 65 | .Ft BIGNUM * |
| 65 | .Fo BN_new | 66 | .Fo BN_new |
| @@ -91,8 +92,6 @@ memory allocation error has occurred. | |||
| 91 | The basic object in this library is a | 92 | The basic object in this library is a |
| 92 | .Vt BIGNUM . | 93 | .Vt BIGNUM . |
| 93 | It is used to hold a single large integer. | 94 | It is used to hold a single large integer. |
| 94 | This type should be considered opaque and fields should not be modified | ||
| 95 | or accessed directly. | ||
| 96 | .Pp | 95 | .Pp |
| 97 | .Fn BN_new | 96 | .Fn BN_new |
| 98 | allocates and initializes a | 97 | allocates and initializes a |
diff --git a/src/lib/libcrypto/man/BN_num_bytes.3 b/src/lib/libcrypto/man/BN_num_bytes.3 index 785f43e2f0..608bb2ebb8 100644 --- a/src/lib/libcrypto/man/BN_num_bytes.3 +++ b/src/lib/libcrypto/man/BN_num_bytes.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BN_num_bytes.3,v 1.9 2022/11/22 18:55:04 schwarze Exp $ | 1 | .\" $OpenBSD: BN_num_bytes.3,v 1.10 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 9e183d22 Mar 11 08:56:44 2017 -0500 | 2 | .\" full merge up to: OpenSSL 9e183d22 Mar 11 08:56:44 2017 -0500 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: November 22 2022 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt BN_NUM_BYTES 3 | 70 | .Dt BN_NUM_BYTES 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -75,6 +75,7 @@ | |||
| 75 | .Nm BN_num_bytes | 75 | .Nm BN_num_bytes |
| 76 | .Nd get BIGNUM size | 76 | .Nd get BIGNUM size |
| 77 | .Sh SYNOPSIS | 77 | .Sh SYNOPSIS |
| 78 | .Lb libcrypto | ||
| 78 | .In openssl/bn.h | 79 | .In openssl/bn.h |
| 79 | .Ft int | 80 | .Ft int |
| 80 | .Fo BN_num_bits_word | 81 | .Fo BN_num_bits_word |
diff --git a/src/lib/libcrypto/man/BN_rand.3 b/src/lib/libcrypto/man/BN_rand.3 index 3d4401a429..b21155af0d 100644 --- a/src/lib/libcrypto/man/BN_rand.3 +++ b/src/lib/libcrypto/man/BN_rand.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BN_rand.3,v 1.18 2021/11/30 18:34:35 tb Exp $ | 1 | .\" $OpenBSD: BN_rand.3,v 1.19 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 05ea606a May 20 20:52:46 2016 -0400 | 2 | .\" full merge up to: OpenSSL 05ea606a May 20 20:52:46 2016 -0400 |
| 3 | .\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 | 3 | .\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -50,7 +50,7 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: November 30 2021 $ | 53 | .Dd $Mdocdate: June 8 2025 $ |
| 54 | .Dt BN_RAND 3 | 54 | .Dt BN_RAND 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| @@ -60,6 +60,7 @@ | |||
| 60 | .Nm BN_pseudo_rand_range | 60 | .Nm BN_pseudo_rand_range |
| 61 | .Nd generate pseudo-random number | 61 | .Nd generate pseudo-random number |
| 62 | .Sh SYNOPSIS | 62 | .Sh SYNOPSIS |
| 63 | .Lb libcrypto | ||
| 63 | .In openssl/bn.h | 64 | .In openssl/bn.h |
| 64 | .Ft int | 65 | .Ft int |
| 65 | .Fo BN_rand | 66 | .Fo BN_rand |
diff --git a/src/lib/libcrypto/man/BN_set_bit.3 b/src/lib/libcrypto/man/BN_set_bit.3 index 2c53066777..c13122b729 100644 --- a/src/lib/libcrypto/man/BN_set_bit.3 +++ b/src/lib/libcrypto/man/BN_set_bit.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BN_set_bit.3,v 1.8 2021/11/30 18:34:35 tb Exp $ | 1 | .\" $OpenBSD: BN_set_bit.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: November 30 2021 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt BN_SET_BIT 3 | 52 | .Dt BN_SET_BIT 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -62,6 +62,7 @@ | |||
| 62 | .Nm BN_rshift1 | 62 | .Nm BN_rshift1 |
| 63 | .Nd bit operations on BIGNUMs | 63 | .Nd bit operations on BIGNUMs |
| 64 | .Sh SYNOPSIS | 64 | .Sh SYNOPSIS |
| 65 | .Lb libcrypto | ||
| 65 | .In openssl/bn.h | 66 | .In openssl/bn.h |
| 66 | .Ft int | 67 | .Ft int |
| 67 | .Fo BN_set_bit | 68 | .Fo BN_set_bit |
diff --git a/src/lib/libcrypto/man/BN_set_flags.3 b/src/lib/libcrypto/man/BN_set_flags.3 index 1285ae2b28..eb4840a54b 100644 --- a/src/lib/libcrypto/man/BN_set_flags.3 +++ b/src/lib/libcrypto/man/BN_set_flags.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BN_set_flags.3,v 1.6 2023/04/27 07:22:22 tb Exp $ | 1 | .\" $OpenBSD: BN_set_flags.3,v 1.7 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: April 27 2023 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt BN_SET_FLAGS 3 | 18 | .Dt BN_SET_FLAGS 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm BN_get_flags | 22 | .Nm BN_get_flags |
| 23 | .Nd enable and inspect flags on BIGNUM objects | 23 | .Nd enable and inspect flags on BIGNUM objects |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/bn.h | 26 | .In openssl/bn.h |
| 26 | .Ft void | 27 | .Ft void |
| 27 | .Fo BN_set_flags | 28 | .Fo BN_set_flags |
diff --git a/src/lib/libcrypto/man/BN_set_negative.3 b/src/lib/libcrypto/man/BN_set_negative.3 index 6cdff5c974..579bcf2123 100644 --- a/src/lib/libcrypto/man/BN_set_negative.3 +++ b/src/lib/libcrypto/man/BN_set_negative.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BN_set_negative.3,v 1.6 2021/12/06 19:45:27 schwarze Exp $ | 1 | .\" $OpenBSD: BN_set_negative.3,v 1.7 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 6 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt BN_SET_NEGATIVE 3 | 18 | .Dt BN_SET_NEGATIVE 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm BN_is_negative | 22 | .Nm BN_is_negative |
| 23 | .Nd change and inspect the sign of a BIGNUM | 23 | .Nd change and inspect the sign of a BIGNUM |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/bn.h | 26 | .In openssl/bn.h |
| 26 | .Ft void | 27 | .Ft void |
| 27 | .Fo BN_set_negative | 28 | .Fo BN_set_negative |
diff --git a/src/lib/libcrypto/man/BN_swap.3 b/src/lib/libcrypto/man/BN_swap.3 index 218ca1cf02..a6a5fa95ba 100644 --- a/src/lib/libcrypto/man/BN_swap.3 +++ b/src/lib/libcrypto/man/BN_swap.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BN_swap.3,v 1.6 2021/12/19 22:06:35 schwarze Exp $ | 1 | .\" $OpenBSD: BN_swap.3,v 1.7 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 | 2 | .\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: December 19 2021 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt BN_SWAP 3 | 69 | .Dt BN_SWAP 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -73,6 +73,7 @@ | |||
| 73 | .Nm BN_consttime_swap | 73 | .Nm BN_consttime_swap |
| 74 | .Nd exchange BIGNUMs | 74 | .Nd exchange BIGNUMs |
| 75 | .Sh SYNOPSIS | 75 | .Sh SYNOPSIS |
| 76 | .Lb libcrypto | ||
| 76 | .In openssl/bn.h | 77 | .In openssl/bn.h |
| 77 | .Ft void | 78 | .Ft void |
| 78 | .Fo BN_swap | 79 | .Fo BN_swap |
diff --git a/src/lib/libcrypto/man/BN_zero.3 b/src/lib/libcrypto/man/BN_zero.3 index 0b677b246f..d94a2a10da 100644 --- a/src/lib/libcrypto/man/BN_zero.3 +++ b/src/lib/libcrypto/man/BN_zero.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BN_zero.3,v 1.13 2023/04/30 19:23:54 tb Exp $ | 1 | .\" $OpenBSD: BN_zero.3,v 1.16 2025/12/15 12:09:46 tb Exp $ |
| 2 | .\" full merge up to: OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 | 2 | .\" full merge up to: OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 |
| 3 | .\" selective merge up to: OpenSSL b713c4ff Jan 22 14:41:09 2018 -0500 | 3 | .\" selective merge up to: OpenSSL b713c4ff Jan 22 14:41:09 2018 -0500 |
| 4 | .\" | 4 | .\" |
| @@ -67,7 +67,7 @@ | |||
| 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 69 | .\" | 69 | .\" |
| 70 | .Dd $Mdocdate: April 30 2023 $ | 70 | .Dd $Mdocdate: December 15 2025 $ |
| 71 | .Dt BN_ZERO 3 | 71 | .Dt BN_ZERO 3 |
| 72 | .Os | 72 | .Os |
| 73 | .Sh NAME | 73 | .Sh NAME |
| @@ -78,8 +78,9 @@ | |||
| 78 | .Nm BN_get_word | 78 | .Nm BN_get_word |
| 79 | .Nd BIGNUM assignment operations | 79 | .Nd BIGNUM assignment operations |
| 80 | .Sh SYNOPSIS | 80 | .Sh SYNOPSIS |
| 81 | .Lb libcrypto | ||
| 81 | .In openssl/bn.h | 82 | .In openssl/bn.h |
| 82 | .Ft int | 83 | .Ft void |
| 83 | .Fo BN_zero | 84 | .Fo BN_zero |
| 84 | .Fa "BIGNUM *a" | 85 | .Fa "BIGNUM *a" |
| 85 | .Fc | 86 | .Fc |
| @@ -131,13 +132,12 @@ This constant is useful for comparisons and assignments. | |||
| 131 | .Fn BN_get_word | 132 | .Fn BN_get_word |
| 132 | returns the value | 133 | returns the value |
| 133 | .Fa a , | 134 | .Fa a , |
| 134 | or a number with all bits set if | 135 | or (BN_ULONG)\-1 if |
| 135 | .Fa a | 136 | .Fa a |
| 136 | cannot be represented as a | 137 | cannot be represented as a |
| 137 | .Vt BN_ULONG . | 138 | .Vt BN_ULONG . |
| 138 | .Pp | 139 | .Pp |
| 139 | .Fn BN_zero , | 140 | .Fn BN_one |
| 140 | .Fn BN_one , | ||
| 141 | and | 141 | and |
| 142 | .Fn BN_set_word | 142 | .Fn BN_set_word |
| 143 | return 1 on success, 0 otherwise. | 143 | return 1 on success, 0 otherwise. |
diff --git a/src/lib/libcrypto/man/BUF_MEM_new.3 b/src/lib/libcrypto/man/BUF_MEM_new.3 index 8c72091abe..ef9e473cc3 100644 --- a/src/lib/libcrypto/man/BUF_MEM_new.3 +++ b/src/lib/libcrypto/man/BUF_MEM_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BUF_MEM_new.3,v 1.19 2024/07/24 08:57:58 tb Exp $ | 1 | .\" $OpenBSD: BUF_MEM_new.3,v 1.20 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL doc/crypto/buffer.pod 18edda0f Sep 20 03:28:54 2000 +0000 | 2 | .\" OpenSSL doc/crypto/buffer.pod 18edda0f Sep 20 03:28:54 2000 +0000 |
| 3 | .\" not merged: 74924dcb, 58e3457a, 21b0fa91, 7644a9ae | 3 | .\" not merged: 74924dcb, 58e3457a, 21b0fa91, 7644a9ae |
| 4 | .\" OpenSSL doc/crypto/BUF_MEM_new.pod 53934822 Jun 9 16:39:19 2016 -0400 | 4 | .\" OpenSSL doc/crypto/BUF_MEM_new.pod 53934822 Jun 9 16:39:19 2016 -0400 |
| @@ -52,7 +52,7 @@ | |||
| 52 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 52 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 53 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 53 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 54 | .\" | 54 | .\" |
| 55 | .Dd $Mdocdate: July 24 2024 $ | 55 | .Dd $Mdocdate: June 8 2025 $ |
| 56 | .Dt BUF_MEM_NEW 3 | 56 | .Dt BUF_MEM_NEW 3 |
| 57 | .Os | 57 | .Os |
| 58 | .Sh NAME | 58 | .Sh NAME |
| @@ -62,6 +62,7 @@ | |||
| 62 | .Nm BUF_MEM_grow_clean | 62 | .Nm BUF_MEM_grow_clean |
| 63 | .Nd simple character arrays structure | 63 | .Nd simple character arrays structure |
| 64 | .Sh SYNOPSIS | 64 | .Sh SYNOPSIS |
| 65 | .Lb libcrypto | ||
| 65 | .In openssl/buffer.h | 66 | .In openssl/buffer.h |
| 66 | .Ft BUF_MEM * | 67 | .Ft BUF_MEM * |
| 67 | .Fo BUF_MEM_new | 68 | .Fo BUF_MEM_new |
diff --git a/src/lib/libcrypto/man/CMAC_Init.3 b/src/lib/libcrypto/man/CMAC_Init.3 index fd32ca085a..b1b62a6359 100644 --- a/src/lib/libcrypto/man/CMAC_Init.3 +++ b/src/lib/libcrypto/man/CMAC_Init.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CMAC_Init.3,v 1.9 2024/11/12 00:42:28 schwarze Exp $ | 1 | .\" $OpenBSD: CMAC_Init.3,v 1.10 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: November 12 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt CMAC_INIT 3 | 18 | .Dt CMAC_INIT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -28,6 +28,7 @@ | |||
| 28 | .Nm CMAC_CTX_free | 28 | .Nm CMAC_CTX_free |
| 29 | .Nd Cipher-based message authentication code | 29 | .Nd Cipher-based message authentication code |
| 30 | .Sh SYNOPSIS | 30 | .Sh SYNOPSIS |
| 31 | .Lb libcrypto | ||
| 31 | .In openssl/cmac.h | 32 | .In openssl/cmac.h |
| 32 | .Ft CMAC_CTX * | 33 | .Ft CMAC_CTX * |
| 33 | .Fn CMAC_CTX_new void | 34 | .Fn CMAC_CTX_new void |
diff --git a/src/lib/libcrypto/man/CMS_ContentInfo_new.3 b/src/lib/libcrypto/man/CMS_ContentInfo_new.3 index d5117fa4ae..611521193d 100644 --- a/src/lib/libcrypto/man/CMS_ContentInfo_new.3 +++ b/src/lib/libcrypto/man/CMS_ContentInfo_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CMS_ContentInfo_new.3,v 1.4 2024/01/22 14:00:13 tb Exp $ | 1 | .\" $OpenBSD: CMS_ContentInfo_new.3,v 1.7 2025/12/20 11:51:28 tb Exp $ |
| 2 | .\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> | 2 | .\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> |
| 3 | .\" | 3 | .\" |
| 4 | .\" Permission to use, copy, modify, and distribute this software for any | 4 | .\" Permission to use, copy, modify, and distribute this software for any |
| @@ -13,7 +13,7 @@ | |||
| 13 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 13 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 14 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | .\" | 15 | .\" |
| 16 | .Dd $Mdocdate: January 22 2024 $ | 16 | .Dd $Mdocdate: December 20 2025 $ |
| 17 | .Dt CMS_CONTENTINFO_NEW 3 | 17 | .Dt CMS_CONTENTINFO_NEW 3 |
| 18 | .Os | 18 | .Os |
| 19 | .Sh NAME | 19 | .Sh NAME |
| @@ -24,6 +24,7 @@ | |||
| 24 | .Nm CMS_ReceiptRequest_free | 24 | .Nm CMS_ReceiptRequest_free |
| 25 | .Nd Cryptographic Message Syntax data structures | 25 | .Nd Cryptographic Message Syntax data structures |
| 26 | .Sh SYNOPSIS | 26 | .Sh SYNOPSIS |
| 27 | .Lb libcrypto | ||
| 27 | .In openssl/cms.h | 28 | .In openssl/cms.h |
| 28 | .Ft CMS_ContentInfo * | 29 | .Ft CMS_ContentInfo * |
| 29 | .Fn CMS_ContentInfo_new void | 30 | .Fn CMS_ContentInfo_new void |
| @@ -131,5 +132,5 @@ and | |||
| 131 | first appeared in OpenSSL 0.9.8h and | 132 | first appeared in OpenSSL 0.9.8h and |
| 132 | .Fn CMS_ContentInfo_print_ctx | 133 | .Fn CMS_ContentInfo_print_ctx |
| 133 | in OpenSSL 1.0.0. | 134 | in OpenSSL 1.0.0. |
| 134 | This functions have been available since | 135 | This function has been available since |
| 135 | .Ox 6.7 . | 136 | .Ox 6.7 . |
diff --git a/src/lib/libcrypto/man/CMS_add0_cert.3 b/src/lib/libcrypto/man/CMS_add0_cert.3 index be9357cc9a..d0e9be6bd5 100644 --- a/src/lib/libcrypto/man/CMS_add0_cert.3 +++ b/src/lib/libcrypto/man/CMS_add0_cert.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CMS_add0_cert.3,v 1.10 2024/11/30 21:21:40 tb Exp $ | 1 | .\" $OpenBSD: CMS_add0_cert.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 | 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: November 30 2024 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt CMS_ADD0_CERT 3 | 69 | .Dt CMS_ADD0_CERT 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -77,6 +77,7 @@ | |||
| 77 | .Nm CMS_get1_crls | 77 | .Nm CMS_get1_crls |
| 78 | .Nd CMS certificate and CRL utility functions | 78 | .Nd CMS certificate and CRL utility functions |
| 79 | .Sh SYNOPSIS | 79 | .Sh SYNOPSIS |
| 80 | .Lb libcrypto | ||
| 80 | .In openssl/cms.h | 81 | .In openssl/cms.h |
| 81 | .Ft int | 82 | .Ft int |
| 82 | .Fo CMS_add0_cert | 83 | .Fo CMS_add0_cert |
diff --git a/src/lib/libcrypto/man/CMS_add1_recipient_cert.3 b/src/lib/libcrypto/man/CMS_add1_recipient_cert.3 index 465119397d..7c0c3fae90 100644 --- a/src/lib/libcrypto/man/CMS_add1_recipient_cert.3 +++ b/src/lib/libcrypto/man/CMS_add1_recipient_cert.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CMS_add1_recipient_cert.3,v 1.7 2019/11/02 15:39:46 schwarze Exp $ | 1 | .\" $OpenBSD: CMS_add1_recipient_cert.3,v 1.8 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 | 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: November 2 2019 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt CMS_ADD1_RECIPIENT_CERT 3 | 69 | .Dt CMS_ADD1_RECIPIENT_CERT 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -73,6 +73,7 @@ | |||
| 73 | .Nm CMS_add0_recipient_key | 73 | .Nm CMS_add0_recipient_key |
| 74 | .Nd add recipients to a CMS EnvelopedData structure | 74 | .Nd add recipients to a CMS EnvelopedData structure |
| 75 | .Sh SYNOPSIS | 75 | .Sh SYNOPSIS |
| 76 | .Lb libcrypto | ||
| 76 | .In openssl/cms.h | 77 | .In openssl/cms.h |
| 77 | .Ft CMS_RecipientInfo * | 78 | .Ft CMS_RecipientInfo * |
| 78 | .Fo CMS_add1_recipient_cert | 79 | .Fo CMS_add1_recipient_cert |
diff --git a/src/lib/libcrypto/man/CMS_add1_signer.3 b/src/lib/libcrypto/man/CMS_add1_signer.3 index 316d63c5ad..68bdb12c73 100644 --- a/src/lib/libcrypto/man/CMS_add1_signer.3 +++ b/src/lib/libcrypto/man/CMS_add1_signer.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CMS_add1_signer.3,v 1.10 2024/04/18 16:50:22 tb Exp $ | 1 | .\" $OpenBSD: CMS_add1_signer.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 | 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: April 18 2024 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt CMS_ADD1_SIGNER 3 | 69 | .Dt CMS_ADD1_SIGNER 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -73,6 +73,7 @@ | |||
| 73 | .Nm CMS_SignerInfo_sign | 73 | .Nm CMS_SignerInfo_sign |
| 74 | .Nd add a signer to a CMS SignedData structure | 74 | .Nd add a signer to a CMS SignedData structure |
| 75 | .Sh SYNOPSIS | 75 | .Sh SYNOPSIS |
| 76 | .Lb libcrypto | ||
| 76 | .In openssl/cms.h | 77 | .In openssl/cms.h |
| 77 | .Ft CMS_SignerInfo * | 78 | .Ft CMS_SignerInfo * |
| 78 | .Fo CMS_add1_signer | 79 | .Fo CMS_add1_signer |
diff --git a/src/lib/libcrypto/man/CMS_compress.3 b/src/lib/libcrypto/man/CMS_compress.3 index 242e4e96cb..9026837fc8 100644 --- a/src/lib/libcrypto/man/CMS_compress.3 +++ b/src/lib/libcrypto/man/CMS_compress.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CMS_compress.3,v 1.7 2019/11/02 15:39:46 schwarze Exp $ | 1 | .\" $OpenBSD: CMS_compress.3,v 1.8 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,13 +65,14 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: November 2 2019 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt CMS_COMPRESS 3 | 69 | .Dt CMS_COMPRESS 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| 72 | .Nm CMS_compress | 72 | .Nm CMS_compress |
| 73 | .Nd create a CMS CompressedData structure | 73 | .Nd create a CMS CompressedData structure |
| 74 | .Sh SYNOPSIS | 74 | .Sh SYNOPSIS |
| 75 | .Lb libcrypto | ||
| 75 | .In openssl/cms.h | 76 | .In openssl/cms.h |
| 76 | .Ft CMS_ContentInfo * | 77 | .Ft CMS_ContentInfo * |
| 77 | .Fo CMS_compress | 78 | .Fo CMS_compress |
diff --git a/src/lib/libcrypto/man/CMS_decrypt.3 b/src/lib/libcrypto/man/CMS_decrypt.3 index 243ab2f30e..2141098084 100644 --- a/src/lib/libcrypto/man/CMS_decrypt.3 +++ b/src/lib/libcrypto/man/CMS_decrypt.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CMS_decrypt.3,v 1.8 2019/11/02 15:39:46 schwarze Exp $ | 1 | .\" $OpenBSD: CMS_decrypt.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 | 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: November 2 2019 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt CMS_DECRYPT 3 | 69 | .Dt CMS_DECRYPT 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -74,6 +74,7 @@ | |||
| 74 | .Nm CMS_decrypt_set1_key | 74 | .Nm CMS_decrypt_set1_key |
| 75 | .Nd decrypt content from a CMS EnvelopedData structure | 75 | .Nd decrypt content from a CMS EnvelopedData structure |
| 76 | .Sh SYNOPSIS | 76 | .Sh SYNOPSIS |
| 77 | .Lb libcrypto | ||
| 77 | .In openssl/cms.h | 78 | .In openssl/cms.h |
| 78 | .Ft int | 79 | .Ft int |
| 79 | .Fo CMS_decrypt | 80 | .Fo CMS_decrypt |
diff --git a/src/lib/libcrypto/man/CMS_encrypt.3 b/src/lib/libcrypto/man/CMS_encrypt.3 index 03d8b4edbb..5eda883857 100644 --- a/src/lib/libcrypto/man/CMS_encrypt.3 +++ b/src/lib/libcrypto/man/CMS_encrypt.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CMS_encrypt.3,v 1.7 2019/11/02 15:39:46 schwarze Exp $ | 1 | .\" $OpenBSD: CMS_encrypt.3,v 1.8 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 | 2 | .\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: November 2 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt CMS_ENCRYPT 3 | 52 | .Dt CMS_ENCRYPT 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm CMS_encrypt | 55 | .Nm CMS_encrypt |
| 56 | .Nd create a CMS EnvelopedData structure | 56 | .Nd create a CMS EnvelopedData structure |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/cms.h | 59 | .In openssl/cms.h |
| 59 | .Ft CMS_ContentInfo * | 60 | .Ft CMS_ContentInfo * |
| 60 | .Fo CMS_encrypt | 61 | .Fo CMS_encrypt |
diff --git a/src/lib/libcrypto/man/CMS_final.3 b/src/lib/libcrypto/man/CMS_final.3 index 4ca8945923..f2b5755fa9 100644 --- a/src/lib/libcrypto/man/CMS_final.3 +++ b/src/lib/libcrypto/man/CMS_final.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CMS_final.3,v 1.6 2019/11/02 15:39:46 schwarze Exp $ | 1 | .\" $OpenBSD: CMS_final.3,v 1.7 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 25ccb589 Jul 1 02:02:06 2019 +0800 | 2 | .\" full merge up to: OpenSSL 25ccb589 Jul 1 02:02:06 2019 +0800 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: November 2 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt CMS_FINAL 3 | 52 | .Dt CMS_FINAL 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm CMS_final | 55 | .Nm CMS_final |
| 56 | .Nd finalise a CMS_ContentInfo structure | 56 | .Nd finalise a CMS_ContentInfo structure |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/cms.h | 59 | .In openssl/cms.h |
| 59 | .Ft int | 60 | .Ft int |
| 60 | .Fo CMS_final | 61 | .Fo CMS_final |
diff --git a/src/lib/libcrypto/man/CMS_get0_RecipientInfos.3 b/src/lib/libcrypto/man/CMS_get0_RecipientInfos.3 index 094d6ec487..beb54bdccc 100644 --- a/src/lib/libcrypto/man/CMS_get0_RecipientInfos.3 +++ b/src/lib/libcrypto/man/CMS_get0_RecipientInfos.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CMS_get0_RecipientInfos.3,v 1.8 2022/03/31 17:27:16 naddy Exp $ | 1 | .\" $OpenBSD: CMS_get0_RecipientInfos.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 | 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 31 2022 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt CMS_GET0_RECIPIENTINFOS 3 | 52 | .Dt CMS_GET0_RECIPIENTINFOS 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -64,6 +64,7 @@ | |||
| 64 | .Nm CMS_RecipientInfo_encrypt | 64 | .Nm CMS_RecipientInfo_encrypt |
| 65 | .Nd CMS EnvelopedData RecipientInfo routines | 65 | .Nd CMS EnvelopedData RecipientInfo routines |
| 66 | .Sh SYNOPSIS | 66 | .Sh SYNOPSIS |
| 67 | .Lb libcrypto | ||
| 67 | .In openssl/cms.h | 68 | .In openssl/cms.h |
| 68 | .Ft STACK_OF(CMS_RecipientInfo) * | 69 | .Ft STACK_OF(CMS_RecipientInfo) * |
| 69 | .Fo CMS_get0_RecipientInfos | 70 | .Fo CMS_get0_RecipientInfos |
diff --git a/src/lib/libcrypto/man/CMS_get0_SignerInfos.3 b/src/lib/libcrypto/man/CMS_get0_SignerInfos.3 index 017fdd40f2..f141508eb1 100644 --- a/src/lib/libcrypto/man/CMS_get0_SignerInfos.3 +++ b/src/lib/libcrypto/man/CMS_get0_SignerInfos.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CMS_get0_SignerInfos.3,v 1.9 2024/01/22 14:00:13 tb Exp $ | 1 | .\" $OpenBSD: CMS_get0_SignerInfos.3,v 1.10 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 | 2 | .\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: January 22 2024 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt CMS_GET0_SIGNERINFOS 3 | 52 | .Dt CMS_GET0_SIGNERINFOS 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -60,6 +60,7 @@ | |||
| 60 | .Nm CMS_SignerInfo_set1_signer_cert | 60 | .Nm CMS_SignerInfo_set1_signer_cert |
| 61 | .Nd CMS SignedData signer functions | 61 | .Nd CMS SignedData signer functions |
| 62 | .Sh SYNOPSIS | 62 | .Sh SYNOPSIS |
| 63 | .Lb libcrypto | ||
| 63 | .In openssl/cms.h | 64 | .In openssl/cms.h |
| 64 | .Ft STACK_OF(CMS_SignerInfo) * | 65 | .Ft STACK_OF(CMS_SignerInfo) * |
| 65 | .Fo CMS_get0_SignerInfos | 66 | .Fo CMS_get0_SignerInfos |
diff --git a/src/lib/libcrypto/man/CMS_get0_type.3 b/src/lib/libcrypto/man/CMS_get0_type.3 index 55adacd86d..5547de494a 100644 --- a/src/lib/libcrypto/man/CMS_get0_type.3 +++ b/src/lib/libcrypto/man/CMS_get0_type.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CMS_get0_type.3,v 1.9 2023/07/27 05:31:28 tb Exp $ | 1 | .\" $OpenBSD: CMS_get0_type.3,v 1.10 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 72a7a702 Feb 26 14:05:09 2019 +0000 | 2 | .\" full merge up to: OpenSSL 72a7a702 Feb 26 14:05:09 2019 +0000 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: July 27 2023 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt CMS_GET0_TYPE 3 | 69 | .Dt CMS_GET0_TYPE 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -76,6 +76,7 @@ | |||
| 76 | .Nm CMS_get0_content | 76 | .Nm CMS_get0_content |
| 77 | .Nd get and set CMS content types and content | 77 | .Nd get and set CMS content types and content |
| 78 | .Sh SYNOPSIS | 78 | .Sh SYNOPSIS |
| 79 | .Lb libcrypto | ||
| 79 | .In openssl/cms.h | 80 | .In openssl/cms.h |
| 80 | .Ft const ASN1_OBJECT * | 81 | .Ft const ASN1_OBJECT * |
| 81 | .Fo CMS_get0_type | 82 | .Fo CMS_get0_type |
diff --git a/src/lib/libcrypto/man/CMS_get1_ReceiptRequest.3 b/src/lib/libcrypto/man/CMS_get1_ReceiptRequest.3 index 9feedd13a2..17a14c47e3 100644 --- a/src/lib/libcrypto/man/CMS_get1_ReceiptRequest.3 +++ b/src/lib/libcrypto/man/CMS_get1_ReceiptRequest.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CMS_get1_ReceiptRequest.3,v 1.7 2019/11/02 15:39:46 schwarze Exp $ | 1 | .\" $OpenBSD: CMS_get1_ReceiptRequest.3,v 1.8 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 | 2 | .\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: November 2 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt CMS_GET1_RECEIPTREQUEST 3 | 52 | .Dt CMS_GET1_RECEIPTREQUEST 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm CMS_ReceiptRequest_get0_values | 58 | .Nm CMS_ReceiptRequest_get0_values |
| 59 | .Nd CMS signed receipt request functions | 59 | .Nd CMS signed receipt request functions |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libcrypto | ||
| 61 | .In openssl/cms.h | 62 | .In openssl/cms.h |
| 62 | .Ft CMS_ReceiptRequest * | 63 | .Ft CMS_ReceiptRequest * |
| 63 | .Fo CMS_ReceiptRequest_create0 | 64 | .Fo CMS_ReceiptRequest_create0 |
diff --git a/src/lib/libcrypto/man/CMS_sign.3 b/src/lib/libcrypto/man/CMS_sign.3 index 5261c190a6..82f9ff9896 100644 --- a/src/lib/libcrypto/man/CMS_sign.3 +++ b/src/lib/libcrypto/man/CMS_sign.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CMS_sign.3,v 1.11 2024/04/18 16:50:22 tb Exp $ | 1 | .\" $OpenBSD: CMS_sign.3,v 1.13 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 | 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: April 18 2024 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt CMS_SIGN 3 | 52 | .Dt CMS_SIGN 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm CMS_sign | 55 | .Nm CMS_sign |
| 56 | .Nd create a CMS SignedData structure | 56 | .Nd create a CMS SignedData structure |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/cms.h | 59 | .In openssl/cms.h |
| 59 | .Ft CMS_ContentInfo * | 60 | .Ft CMS_ContentInfo * |
| 60 | .Fo CMS_sign | 61 | .Fo CMS_sign |
| @@ -176,7 +177,7 @@ added before finalization. | |||
| 176 | .Pp | 177 | .Pp |
| 177 | If a signer is specified, it will use the default digest for the signing | 178 | If a signer is specified, it will use the default digest for the signing |
| 178 | algorithm. | 179 | algorithm. |
| 179 | This is SHA1 for both RSA and DSA keys. | 180 | This is SHA-1 for both RSA and DSA keys. |
| 180 | .Pp | 181 | .Pp |
| 181 | If | 182 | If |
| 182 | .Fa signcert | 183 | .Fa signcert |
diff --git a/src/lib/libcrypto/man/CMS_sign_receipt.3 b/src/lib/libcrypto/man/CMS_sign_receipt.3 index 6394957846..7702ab365d 100644 --- a/src/lib/libcrypto/man/CMS_sign_receipt.3 +++ b/src/lib/libcrypto/man/CMS_sign_receipt.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CMS_sign_receipt.3,v 1.7 2019/11/02 15:39:46 schwarze Exp $ | 1 | .\" $OpenBSD: CMS_sign_receipt.3,v 1.9 2025/12/20 08:40:47 tb Exp $ |
| 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 | 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: November 2 2019 $ | 51 | .Dd $Mdocdate: December 20 2025 $ |
| 52 | .Dt CMS_SIGN_RECEIPT 3 | 52 | .Dt CMS_SIGN_RECEIPT 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm CMS_sign_receipt | 55 | .Nm CMS_sign_receipt |
| 56 | .Nd create a CMS signed receipt | 56 | .Nd create a CMS signed receipt |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/cms.h | 59 | .In openssl/cms.h |
| 59 | .Ft CMS_ContentInfo * | 60 | .Ft CMS_ContentInfo * |
| 60 | .Fo CMS_sign_receipt | 61 | .Fo CMS_sign_receipt |
| @@ -83,7 +84,7 @@ is the corresponding private key. | |||
| 83 | is an optional additional set of certificates to include in the CMS | 84 | is an optional additional set of certificates to include in the CMS |
| 84 | structure (for example any intermediate CAs in the chain). | 85 | structure (for example any intermediate CAs in the chain). |
| 85 | .Pp | 86 | .Pp |
| 86 | This functions behaves in a similar way to | 87 | This function behaves in a similar way to |
| 87 | .Xr CMS_sign 3 | 88 | .Xr CMS_sign 3 |
| 88 | except that the | 89 | except that the |
| 89 | .Fa flags | 90 | .Fa flags |
diff --git a/src/lib/libcrypto/man/CMS_signed_add1_attr.3 b/src/lib/libcrypto/man/CMS_signed_add1_attr.3 index 1a50c0b9d1..10a959bba6 100644 --- a/src/lib/libcrypto/man/CMS_signed_add1_attr.3 +++ b/src/lib/libcrypto/man/CMS_signed_add1_attr.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CMS_signed_add1_attr.3,v 1.5 2024/09/02 07:54:21 tb Exp $ | 1 | .\" $OpenBSD: CMS_signed_add1_attr.3,v 1.7 2025/06/13 18:34:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2024 Job Snijders <job@openbsd.org> | 3 | .\" Copyright (c) 2024 Job Snijders <job@openbsd.org> |
| 4 | .\" Copyright (c) 2024 Theo Buehler <tb@openbsd.org> | 4 | .\" Copyright (c) 2024 Theo Buehler <tb@openbsd.org> |
| @@ -16,7 +16,7 @@ | |||
| 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 18 | .\" | 18 | .\" |
| 19 | .Dd $Mdocdate: September 2 2024 $ | 19 | .Dd $Mdocdate: June 13 2025 $ |
| 20 | .Dt CMS_SIGNED_ADD1_ATTR 3 | 20 | .Dt CMS_SIGNED_ADD1_ATTR 3 |
| 21 | .Os | 21 | .Os |
| 22 | .Sh NAME | 22 | .Sh NAME |
| @@ -42,6 +42,7 @@ | |||
| 42 | .Nm CMS_unsigned_get_attr_count | 42 | .Nm CMS_unsigned_get_attr_count |
| 43 | .Nd change signed and unsigned attributes of a CMS SignerInfo object | 43 | .Nd change signed and unsigned attributes of a CMS SignerInfo object |
| 44 | .Sh SYNOPSIS | 44 | .Sh SYNOPSIS |
| 45 | .Lb libcrypto | ||
| 45 | .In openssl/cms.h | 46 | .In openssl/cms.h |
| 46 | .Ft int | 47 | .Ft int |
| 47 | .Fo CMS_signed_add1_attr | 48 | .Fo CMS_signed_add1_attr |
| @@ -72,19 +73,19 @@ | |||
| 72 | .Fa "const void *bytes" | 73 | .Fa "const void *bytes" |
| 73 | .Fa "int len" | 74 | .Fa "int len" |
| 74 | .Fc | 75 | .Fc |
| 75 | .Ft "X509_ATTRIBUTE *" | 76 | .Ft X509_ATTRIBUTE * |
| 76 | .Fo CMS_signed_delete_attr | 77 | .Fo CMS_signed_delete_attr |
| 77 | .Fa "CMS_SignerInfo *si" | 78 | .Fa "CMS_SignerInfo *si" |
| 78 | .Fa "int loc" | 79 | .Fa "int loc" |
| 79 | .Fc | 80 | .Fc |
| 80 | .Ft "void *" | 81 | .Ft void * |
| 81 | .Fo CMS_signed_get0_data_by_OBJ | 82 | .Fo CMS_signed_get0_data_by_OBJ |
| 82 | .Fa "CMS_SignerInfo *si" | 83 | .Fa "CMS_SignerInfo *si" |
| 83 | .Fa "const ASN1_OBJECT *oid" | 84 | .Fa "const ASN1_OBJECT *oid" |
| 84 | .Fa "int start_after" | 85 | .Fa "int start_after" |
| 85 | .Fa "int type" | 86 | .Fa "int type" |
| 86 | .Fc | 87 | .Fc |
| 87 | .Ft "X509_ATTRIBUTE *" | 88 | .Ft X509_ATTRIBUTE * |
| 88 | .Fo CMS_signed_get_attr | 89 | .Fo CMS_signed_get_attr |
| 89 | .Fa "const CMS_SignerInfo *si" | 90 | .Fa "const CMS_SignerInfo *si" |
| 90 | .Fa "int loc" | 91 | .Fa "int loc" |
| @@ -134,19 +135,19 @@ | |||
| 134 | .Fa "const void *bytes" | 135 | .Fa "const void *bytes" |
| 135 | .Fa "int len" | 136 | .Fa "int len" |
| 136 | .Fc | 137 | .Fc |
| 137 | .Ft "X509_ATTRIBUTE *" | 138 | .Ft X509_ATTRIBUTE * |
| 138 | .Fo CMS_unsigned_delete_attr | 139 | .Fo CMS_unsigned_delete_attr |
| 139 | .Fa "CMS_SignerInfo *si" | 140 | .Fa "CMS_SignerInfo *si" |
| 140 | .Fa "int loc" | 141 | .Fa "int loc" |
| 141 | .Fc | 142 | .Fc |
| 142 | .Ft "void *" | 143 | .Ft void * |
| 143 | .Fo CMS_unsigned_get0_data_by_OBJ | 144 | .Fo CMS_unsigned_get0_data_by_OBJ |
| 144 | .Fa "CMS_SignerInfo *si" | 145 | .Fa "CMS_SignerInfo *si" |
| 145 | .Fa "ASN1_OBJECT *oid" | 146 | .Fa "ASN1_OBJECT *oid" |
| 146 | .Fa "int start_after" | 147 | .Fa "int start_after" |
| 147 | .Fa "int type" | 148 | .Fa "int type" |
| 148 | .Fc | 149 | .Fc |
| 149 | .Ft "X509_ATTRIBUTE *" | 150 | .Ft X509_ATTRIBUTE * |
| 150 | .Fo CMS_unsigned_get_attr | 151 | .Fo CMS_unsigned_get_attr |
| 151 | .Fa "const CMS_SignerInfo *si" | 152 | .Fa "const CMS_SignerInfo *si" |
| 152 | .Fa "int loc" | 153 | .Fa "int loc" |
diff --git a/src/lib/libcrypto/man/CMS_uncompress.3 b/src/lib/libcrypto/man/CMS_uncompress.3 index ed2172521e..2a5e2f593b 100644 --- a/src/lib/libcrypto/man/CMS_uncompress.3 +++ b/src/lib/libcrypto/man/CMS_uncompress.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CMS_uncompress.3,v 1.7 2019/11/02 15:39:46 schwarze Exp $ | 1 | .\" $OpenBSD: CMS_uncompress.3,v 1.8 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: November 2 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt CMS_UNCOMPRESS 3 | 52 | .Dt CMS_UNCOMPRESS 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm CMS_uncompress | 55 | .Nm CMS_uncompress |
| 56 | .Nd uncompress a CMS CompressedData structure | 56 | .Nd uncompress a CMS CompressedData structure |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/cms.h | 59 | .In openssl/cms.h |
| 59 | .Ft int | 60 | .Ft int |
| 60 | .Fo CMS_uncompress | 61 | .Fo CMS_uncompress |
diff --git a/src/lib/libcrypto/man/CMS_verify.3 b/src/lib/libcrypto/man/CMS_verify.3 index 63f1b8bb18..a8803b0595 100644 --- a/src/lib/libcrypto/man/CMS_verify.3 +++ b/src/lib/libcrypto/man/CMS_verify.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CMS_verify.3,v 1.10 2024/03/29 06:43:12 tb Exp $ | 1 | .\" $OpenBSD: CMS_verify.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 35fd9953 May 28 14:49:38 2019 +0200 | 2 | .\" full merge up to: OpenSSL 35fd9953 May 28 14:49:38 2019 +0200 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 29 2024 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt CMS_VERIFY 3 | 52 | .Dt CMS_VERIFY 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm CMS_get0_signers | 56 | .Nm CMS_get0_signers |
| 57 | .Nd verify a CMS SignedData structure | 57 | .Nd verify a CMS SignedData structure |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 59 | .In openssl/cms.h | 60 | .In openssl/cms.h |
| 60 | .Ft int | 61 | .Ft int |
| 61 | .Fo CMS_verify | 62 | .Fo CMS_verify |
diff --git a/src/lib/libcrypto/man/CMS_verify_receipt.3 b/src/lib/libcrypto/man/CMS_verify_receipt.3 index ac50087a4c..738d976c15 100644 --- a/src/lib/libcrypto/man/CMS_verify_receipt.3 +++ b/src/lib/libcrypto/man/CMS_verify_receipt.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CMS_verify_receipt.3,v 1.7 2019/11/02 15:39:46 schwarze Exp $ | 1 | .\" $OpenBSD: CMS_verify_receipt.3,v 1.9 2025/12/20 08:40:47 tb Exp $ |
| 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 | 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: November 2 2019 $ | 51 | .Dd $Mdocdate: December 20 2025 $ |
| 52 | .Dt CMS_VERIFY_RECEIPT 3 | 52 | .Dt CMS_VERIFY_RECEIPT 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm CMS_verify_receipt | 55 | .Nm CMS_verify_receipt |
| 56 | .Nd verify a CMS signed receipt | 56 | .Nd verify a CMS signed receipt |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/cms.h | 59 | .In openssl/cms.h |
| 59 | .Ft int | 60 | .Ft int |
| 60 | .Fo CMS_verify_receipt | 61 | .Fo CMS_verify_receipt |
| @@ -78,7 +79,7 @@ is a set of certificates in which to search for the signing certificate. | |||
| 78 | .Fa store | 79 | .Fa store |
| 79 | is a trusted certificate store (used for chain verification). | 80 | is a trusted certificate store (used for chain verification). |
| 80 | .Pp | 81 | .Pp |
| 81 | This functions behaves in a similar way to | 82 | This function behaves in a similar way to |
| 82 | .Xr CMS_verify 3 | 83 | .Xr CMS_verify 3 |
| 83 | except that the | 84 | except that the |
| 84 | .Fa flags | 85 | .Fa flags |
diff --git a/src/lib/libcrypto/man/CONF_modules_free.3 b/src/lib/libcrypto/man/CONF_modules_free.3 index c5fb840942..ab299bcbda 100644 --- a/src/lib/libcrypto/man/CONF_modules_free.3 +++ b/src/lib/libcrypto/man/CONF_modules_free.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CONF_modules_free.3,v 1.6 2023/07/21 10:46:54 tb Exp $ | 1 | .\" $OpenBSD: CONF_modules_free.3,v 1.7 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 | 2 | .\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: July 21 2023 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt CONF_MODULES_FREE 3 | 52 | .Dt CONF_MODULES_FREE 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm CONF_modules_unload | 57 | .Nm CONF_modules_unload |
| 58 | .Nd OpenSSL configuration cleanup functions | 58 | .Nd OpenSSL configuration cleanup functions |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/conf.h | 61 | .In openssl/conf.h |
| 61 | .Ft void | 62 | .Ft void |
| 62 | .Fo CONF_modules_free | 63 | .Fo CONF_modules_free |
diff --git a/src/lib/libcrypto/man/CONF_modules_load_file.3 b/src/lib/libcrypto/man/CONF_modules_load_file.3 index d1bcd49a38..78cfc32f0d 100644 --- a/src/lib/libcrypto/man/CONF_modules_load_file.3 +++ b/src/lib/libcrypto/man/CONF_modules_load_file.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CONF_modules_load_file.3,v 1.14 2023/11/19 20:58:07 tb Exp $ | 1 | .\" $OpenBSD: CONF_modules_load_file.3,v 1.16 2025/06/09 12:43:53 schwarze Exp $ |
| 2 | .\" full merge up to: e9b77246 Jan 20 19:58:49 2017 +0100 | 2 | .\" full merge up to: e9b77246 Jan 20 19:58:49 2017 +0100 |
| 3 | .\" selective merge up to: d090fc00 Feb 26 13:11:10 2019 +0800 | 3 | .\" selective merge up to: d090fc00 Feb 26 13:11:10 2019 +0800 |
| 4 | .\" | 4 | .\" |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: November 19 2023 $ | 69 | .Dd $Mdocdate: June 9 2025 $ |
| 70 | .Dt CONF_MODULES_LOAD_FILE 3 | 70 | .Dt CONF_MODULES_LOAD_FILE 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -75,6 +75,7 @@ | |||
| 75 | .Nm X509_get_default_cert_area | 75 | .Nm X509_get_default_cert_area |
| 76 | .Nd OpenSSL configuration functions | 76 | .Nd OpenSSL configuration functions |
| 77 | .Sh SYNOPSIS | 77 | .Sh SYNOPSIS |
| 78 | .Lb libcrypto | ||
| 78 | .In openssl/conf.h | 79 | .In openssl/conf.h |
| 79 | .Ft int | 80 | .Ft int |
| 80 | .Fo CONF_modules_load_file | 81 | .Fo CONF_modules_load_file |
| @@ -222,7 +223,6 @@ Load custom configuration file and section instead of the standard one, | |||
| 222 | only print warnings on error, missing configuration file ignored: | 223 | only print warnings on error, missing configuration file ignored: |
| 223 | .Bd -literal | 224 | .Bd -literal |
| 224 | OPENSSL_no_config(); | 225 | OPENSSL_no_config(); |
| 225 | OPENSSL_load_builtin_modules(); | ||
| 226 | if (CONF_modules_load_file("/something/app.cnf", "myapp", | 226 | if (CONF_modules_load_file("/something/app.cnf", "myapp", |
| 227 | CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) { | 227 | CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) { |
| 228 | fprintf(stderr, "WARNING: error loading configuration file\en"); | 228 | fprintf(stderr, "WARNING: error loading configuration file\en"); |
| @@ -233,11 +233,7 @@ if (CONF_modules_load_file("/something/app.cnf", "myapp", | |||
| 233 | In the previous example, the call to | 233 | In the previous example, the call to |
| 234 | .Xr OPENSSL_no_config 3 | 234 | .Xr OPENSSL_no_config 3 |
| 235 | is required first to suppress automatic loading | 235 | is required first to suppress automatic loading |
| 236 | of the standard configuration file, and the call to | 236 | of the standard configuration file. |
| 237 | .Xr OPENSSL_load_builtin_modules 3 | ||
| 238 | is needed so that the configuration of builtin modules | ||
| 239 | is loaded in addition to the configuration of | ||
| 240 | .Qq myapp . | ||
| 241 | .Pp | 237 | .Pp |
| 242 | Load and parse configuration file manually, custom error handling: | 238 | Load and parse configuration file manually, custom error handling: |
| 243 | .Bd -literal | 239 | .Bd -literal |
| @@ -268,8 +264,7 @@ if (fp == NULL) { | |||
| 268 | .Sh SEE ALSO | 264 | .Sh SEE ALSO |
| 269 | .Xr CONF_modules_free 3 , | 265 | .Xr CONF_modules_free 3 , |
| 270 | .Xr ERR 3 , | 266 | .Xr ERR 3 , |
| 271 | .Xr OPENSSL_config 3 , | 267 | .Xr OPENSSL_config 3 |
| 272 | .Xr OPENSSL_load_builtin_modules 3 | ||
| 273 | .Sh HISTORY | 268 | .Sh HISTORY |
| 274 | .Fn X509_get_default_cert_area | 269 | .Fn X509_get_default_cert_area |
| 275 | first appeared in SSLeay 0.4.1 and has been available since | 270 | first appeared in SSLeay 0.4.1 and has been available since |
diff --git a/src/lib/libcrypto/man/CRYPTO_lock.3 b/src/lib/libcrypto/man/CRYPTO_lock.3 index afc5eb54c5..7877dd5804 100644 --- a/src/lib/libcrypto/man/CRYPTO_lock.3 +++ b/src/lib/libcrypto/man/CRYPTO_lock.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CRYPTO_lock.3,v 1.3 2024/03/14 22:09:40 tb Exp $ | 1 | .\" $OpenBSD: CRYPTO_lock.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL doc/crypto/threads.pod fb552ac6 Sep 30 23:43:01 2009 +0000 | 2 | .\" OpenSSL doc/crypto/threads.pod fb552ac6 Sep 30 23:43:01 2009 +0000 |
| 3 | .\" | 3 | .\" |
| 4 | .\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> | 4 | .\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> |
| @@ -15,7 +15,7 @@ | |||
| 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 | .\" | 17 | .\" |
| 18 | .Dd $Mdocdate: March 14 2024 $ | 18 | .Dd $Mdocdate: June 8 2025 $ |
| 19 | .Dt CRYPTO_LOCK 3 | 19 | .Dt CRYPTO_LOCK 3 |
| 20 | .Os | 20 | .Os |
| 21 | .Sh NAME | 21 | .Sh NAME |
| @@ -27,6 +27,7 @@ | |||
| 27 | .Nm CRYPTO_add | 27 | .Nm CRYPTO_add |
| 28 | .Nd thread support | 28 | .Nd thread support |
| 29 | .Sh SYNOPSIS | 29 | .Sh SYNOPSIS |
| 30 | .Lb libcrypto | ||
| 30 | .In openssl/crypto.h | 31 | .In openssl/crypto.h |
| 31 | .Ft void | 32 | .Ft void |
| 32 | .Fo CRYPTO_lock | 33 | .Fo CRYPTO_lock |
diff --git a/src/lib/libcrypto/man/CRYPTO_memcmp.3 b/src/lib/libcrypto/man/CRYPTO_memcmp.3 index cbc0030c55..fbe092cb90 100644 --- a/src/lib/libcrypto/man/CRYPTO_memcmp.3 +++ b/src/lib/libcrypto/man/CRYPTO_memcmp.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CRYPTO_memcmp.3,v 1.1 2019/08/25 06:20:22 schwarze Exp $ | 1 | .\" $OpenBSD: CRYPTO_memcmp.3,v 1.2 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 1075139c Jun 24 09:18:48 2019 +1000 | 2 | .\" full merge up to: OpenSSL 1075139c Jun 24 09:18:48 2019 +1000 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Pauli <paul.dale@oracle.com>. | 4 | .\" This file was written by Pauli <paul.dale@oracle.com>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: August 25 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt CRYPTO_MEMCMP 3 | 52 | .Dt CRYPTO_MEMCMP 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm CRYPTO_memcmp | 55 | .Nm CRYPTO_memcmp |
| 56 | .Nd constant time memory comparison | 56 | .Nd constant time memory comparison |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/crypto.h | 59 | .In openssl/crypto.h |
| 59 | .Ft int | 60 | .Ft int |
| 60 | .Fo CRYPTO_memcmp | 61 | .Fo CRYPTO_memcmp |
diff --git a/src/lib/libcrypto/man/CRYPTO_set_ex_data.3 b/src/lib/libcrypto/man/CRYPTO_set_ex_data.3 index c22fb22352..57cdbfb4ca 100644 --- a/src/lib/libcrypto/man/CRYPTO_set_ex_data.3 +++ b/src/lib/libcrypto/man/CRYPTO_set_ex_data.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CRYPTO_set_ex_data.3,v 1.15 2023/09/18 14:49:43 schwarze Exp $ | 1 | .\" $OpenBSD: CRYPTO_set_ex_data.3,v 1.16 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: September 18 2023 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt CRYPTO_SET_EX_DATA 3 | 18 | .Dt CRYPTO_SET_EX_DATA 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -28,6 +28,7 @@ | |||
| 28 | .Nm CRYPTO_free_ex_data | 28 | .Nm CRYPTO_free_ex_data |
| 29 | .Nd low-level functions for application specific data | 29 | .Nd low-level functions for application specific data |
| 30 | .Sh SYNOPSIS | 30 | .Sh SYNOPSIS |
| 31 | .Lb libcrypto | ||
| 31 | .In openssl/crypto.h | 32 | .In openssl/crypto.h |
| 32 | .Ft int | 33 | .Ft int |
| 33 | .Fo CRYPTO_get_ex_new_index | 34 | .Fo CRYPTO_get_ex_new_index |
diff --git a/src/lib/libcrypto/man/CRYPTO_set_mem_functions.3 b/src/lib/libcrypto/man/CRYPTO_set_mem_functions.3 index d020d10ff6..4fc88339a8 100644 --- a/src/lib/libcrypto/man/CRYPTO_set_mem_functions.3 +++ b/src/lib/libcrypto/man/CRYPTO_set_mem_functions.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: CRYPTO_set_mem_functions.3,v 1.2 2025/03/08 17:17:09 tb Exp $ | 1 | .\" $OpenBSD: CRYPTO_set_mem_functions.3,v 1.3 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 8 2025 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt CRYPTO_SET_MEM_FUNCTIONS 3 | 18 | .Dt CRYPTO_SET_MEM_FUNCTIONS 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -25,6 +25,7 @@ | |||
| 25 | .Nm CRYPTO_mem_leaks_cb | 25 | .Nm CRYPTO_mem_leaks_cb |
| 26 | .Nd legacy OpenSSL memory allocation control | 26 | .Nd legacy OpenSSL memory allocation control |
| 27 | .Sh SYNOPSIS | 27 | .Sh SYNOPSIS |
| 28 | .Lb libcrypto | ||
| 28 | .In openssl/crypto.h | 29 | .In openssl/crypto.h |
| 29 | .Ft int | 30 | .Ft int |
| 30 | .Fo CRYPTO_set_mem_functions | 31 | .Fo CRYPTO_set_mem_functions |
diff --git a/src/lib/libcrypto/man/ChaCha.3 b/src/lib/libcrypto/man/ChaCha.3 index 9aae6d70cf..54cd597f6c 100644 --- a/src/lib/libcrypto/man/ChaCha.3 +++ b/src/lib/libcrypto/man/ChaCha.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ChaCha.3,v 1.3 2022/02/18 10:24:32 jsg Exp $ | 1 | .\" $OpenBSD: ChaCha.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: February 18 2022 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt CHACHA 3 | 18 | .Dt CHACHA 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -26,6 +26,7 @@ | |||
| 26 | .Nm CRYPTO_xchacha_20 | 26 | .Nm CRYPTO_xchacha_20 |
| 27 | .Nd ChaCha20 stream cipher | 27 | .Nd ChaCha20 stream cipher |
| 28 | .Sh SYNOPSIS | 28 | .Sh SYNOPSIS |
| 29 | .Lb libcrypto | ||
| 29 | .In openssl/chacha.h | 30 | .In openssl/chacha.h |
| 30 | .Ft void | 31 | .Ft void |
| 31 | .Fo ChaCha_set_key | 32 | .Fo ChaCha_set_key |
diff --git a/src/lib/libcrypto/man/DES_set_key.3 b/src/lib/libcrypto/man/DES_set_key.3 index fd09d77730..3794285006 100644 --- a/src/lib/libcrypto/man/DES_set_key.3 +++ b/src/lib/libcrypto/man/DES_set_key.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: DES_set_key.3,v 1.17 2024/05/24 19:18:07 tb Exp $ | 1 | .\" $OpenBSD: DES_set_key.3,v 1.18 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: | 2 | .\" full merge up to: |
| 3 | .\" OpenSSL man3/DES_random_key 521738e9 Oct 5 14:58:30 2018 -0400 | 3 | .\" OpenSSL man3/DES_random_key 521738e9 Oct 5 14:58:30 2018 -0400 |
| 4 | .\" | 4 | .\" |
| @@ -115,7 +115,7 @@ | |||
| 115 | .\" copied and put under another distribution licence | 115 | .\" copied and put under another distribution licence |
| 116 | .\" [including the GNU Public Licence.] | 116 | .\" [including the GNU Public Licence.] |
| 117 | .\" | 117 | .\" |
| 118 | .Dd $Mdocdate: May 24 2024 $ | 118 | .Dd $Mdocdate: June 8 2025 $ |
| 119 | .Dt DES_SET_KEY 3 | 119 | .Dt DES_SET_KEY 3 |
| 120 | .Os | 120 | .Os |
| 121 | .Sh NAME | 121 | .Sh NAME |
| @@ -151,6 +151,7 @@ | |||
| 151 | .Nm DES_crypt | 151 | .Nm DES_crypt |
| 152 | .Nd DES encryption | 152 | .Nd DES encryption |
| 153 | .Sh SYNOPSIS | 153 | .Sh SYNOPSIS |
| 154 | .Lb libcrypto | ||
| 154 | .In openssl/des.h | 155 | .In openssl/des.h |
| 155 | .Ft void | 156 | .Ft void |
| 156 | .Fo DES_random_key | 157 | .Fo DES_random_key |
diff --git a/src/lib/libcrypto/man/DH_generate_key.3 b/src/lib/libcrypto/man/DH_generate_key.3 index 076b49f7a1..c3158b8132 100644 --- a/src/lib/libcrypto/man/DH_generate_key.3 +++ b/src/lib/libcrypto/man/DH_generate_key.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: DH_generate_key.3,v 1.12 2019/08/19 13:08:26 schwarze Exp $ | 1 | .\" $OpenBSD: DH_generate_key.3,v 1.13 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: August 19 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt DH_GENERATE_KEY 3 | 52 | .Dt DH_GENERATE_KEY 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm DH_compute_key | 56 | .Nm DH_compute_key |
| 57 | .Nd perform Diffie-Hellman key exchange | 57 | .Nd perform Diffie-Hellman key exchange |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 59 | .In openssl/dh.h | 60 | .In openssl/dh.h |
| 60 | .Ft int | 61 | .Ft int |
| 61 | .Fo DH_generate_key | 62 | .Fo DH_generate_key |
diff --git a/src/lib/libcrypto/man/DH_generate_parameters.3 b/src/lib/libcrypto/man/DH_generate_parameters.3 index ac29521ec4..f47475e3b1 100644 --- a/src/lib/libcrypto/man/DH_generate_parameters.3 +++ b/src/lib/libcrypto/man/DH_generate_parameters.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: DH_generate_parameters.3,v 1.14 2022/07/13 13:47:59 schwarze Exp $ | 1 | .\" $OpenBSD: DH_generate_parameters.3,v 1.15 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" selective merge up to: OpenSSL b0edda11 Mar 20 13:00:17 2018 +0000 | 3 | .\" selective merge up to: OpenSSL b0edda11 Mar 20 13:00:17 2018 +0000 |
| 4 | .\" | 4 | .\" |
| @@ -67,7 +67,7 @@ | |||
| 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 69 | .\" | 69 | .\" |
| 70 | .Dd $Mdocdate: July 13 2022 $ | 70 | .Dd $Mdocdate: June 8 2025 $ |
| 71 | .Dt DH_GENERATE_PARAMETERS 3 | 71 | .Dt DH_GENERATE_PARAMETERS 3 |
| 72 | .Os | 72 | .Os |
| 73 | .Sh NAME | 73 | .Sh NAME |
| @@ -77,6 +77,7 @@ | |||
| 77 | .Nm DH_generate_parameters | 77 | .Nm DH_generate_parameters |
| 78 | .Nd generate and check Diffie-Hellman parameters | 78 | .Nd generate and check Diffie-Hellman parameters |
| 79 | .Sh SYNOPSIS | 79 | .Sh SYNOPSIS |
| 80 | .Lb libcrypto | ||
| 80 | .In openssl/dh.h | 81 | .In openssl/dh.h |
| 81 | .Ft int | 82 | .Ft int |
| 82 | .Fo DH_generate_parameters_ex | 83 | .Fo DH_generate_parameters_ex |
diff --git a/src/lib/libcrypto/man/DH_get0_pqg.3 b/src/lib/libcrypto/man/DH_get0_pqg.3 index eb012980f9..e30d628c7f 100644 --- a/src/lib/libcrypto/man/DH_get0_pqg.3 +++ b/src/lib/libcrypto/man/DH_get0_pqg.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: DH_get0_pqg.3,v 1.8 2024/07/21 08:36:43 tb Exp $ | 1 | .\" $OpenBSD: DH_get0_pqg.3,v 1.10 2025/06/13 18:34:00 schwarze Exp $ |
| 2 | .\" selective merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 | 2 | .\" selective merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Matt Caswell <matt@openssl.org>. | 4 | .\" This file was written by Matt Caswell <matt@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: July 21 2024 $ | 51 | .Dd $Mdocdate: June 13 2025 $ |
| 52 | .Dt DH_GET0_PQG 3 | 52 | .Dt DH_GET0_PQG 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -68,6 +68,7 @@ | |||
| 68 | .Nm DH_set_length | 68 | .Nm DH_set_length |
| 69 | .Nd get data from and set data in a DH object | 69 | .Nd get data from and set data in a DH object |
| 70 | .Sh SYNOPSIS | 70 | .Sh SYNOPSIS |
| 71 | .Lb libcrypto | ||
| 71 | .In openssl/dh.h | 72 | .In openssl/dh.h |
| 72 | .Ft void | 73 | .Ft void |
| 73 | .Fo DH_get0_pqg | 74 | .Fo DH_get0_pqg |
| @@ -76,15 +77,15 @@ | |||
| 76 | .Fa "const BIGNUM **q" | 77 | .Fa "const BIGNUM **q" |
| 77 | .Fa "const BIGNUM **g" | 78 | .Fa "const BIGNUM **g" |
| 78 | .Fc | 79 | .Fc |
| 79 | .Ft "const BIGNUM *" | 80 | .Ft const BIGNUM * |
| 80 | .Fo DH_get0_p | 81 | .Fo DH_get0_p |
| 81 | .Fa "const DH *dh" | 82 | .Fa "const DH *dh" |
| 82 | .Fc | 83 | .Fc |
| 83 | .Ft "const BIGNUM *" | 84 | .Ft const BIGNUM * |
| 84 | .Fo DH_get0_q | 85 | .Fo DH_get0_q |
| 85 | .Fa "const DH *dh" | 86 | .Fa "const DH *dh" |
| 86 | .Fc | 87 | .Fc |
| 87 | .Ft "const BIGNUM *" | 88 | .Ft const BIGNUM * |
| 88 | .Fo DH_get0_g | 89 | .Fo DH_get0_g |
| 89 | .Fa "const DH *dh" | 90 | .Fa "const DH *dh" |
| 90 | .Fc | 91 | .Fc |
| @@ -101,11 +102,11 @@ | |||
| 101 | .Fa "const BIGNUM **pub_key" | 102 | .Fa "const BIGNUM **pub_key" |
| 102 | .Fa "const BIGNUM **priv_key" | 103 | .Fa "const BIGNUM **priv_key" |
| 103 | .Fc | 104 | .Fc |
| 104 | .Ft "const BIGNUM *" | 105 | .Ft const BIGNUM * |
| 105 | .Fo DH_get0_pub_key | 106 | .Fo DH_get0_pub_key |
| 106 | .Fa "const DH *dh" | 107 | .Fa "const DH *dh" |
| 107 | .Fc | 108 | .Fc |
| 108 | .Ft "const BIGNUM *" | 109 | .Ft const BIGNUM * |
| 109 | .Fo DH_get0_priv_key | 110 | .Fo DH_get0_priv_key |
| 110 | .Fa "const DH *dh" | 111 | .Fa "const DH *dh" |
| 111 | .Fc | 112 | .Fc |
diff --git a/src/lib/libcrypto/man/DH_get_ex_new_index.3 b/src/lib/libcrypto/man/DH_get_ex_new_index.3 index 81a0aff8ec..e0d1f1b813 100644 --- a/src/lib/libcrypto/man/DH_get_ex_new_index.3 +++ b/src/lib/libcrypto/man/DH_get_ex_new_index.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: DH_get_ex_new_index.3,v 1.5 2018/03/23 23:18:17 schwarze Exp $ | 1 | .\" $OpenBSD: DH_get_ex_new_index.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 | 2 | .\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 23 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt DH_GET_EX_NEW_INDEX 3 | 52 | .Dt DH_GET_EX_NEW_INDEX 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm DH_get_ex_data | 57 | .Nm DH_get_ex_data |
| 58 | .Nd add application specific data to DH structures | 58 | .Nd add application specific data to DH structures |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/dh.h | 61 | .In openssl/dh.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fo DH_get_ex_new_index | 63 | .Fo DH_get_ex_new_index |
diff --git a/src/lib/libcrypto/man/DH_new.3 b/src/lib/libcrypto/man/DH_new.3 index 4993456897..0e01a26733 100644 --- a/src/lib/libcrypto/man/DH_new.3 +++ b/src/lib/libcrypto/man/DH_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: DH_new.3,v 1.12 2022/07/13 21:51:35 schwarze Exp $ | 1 | .\" $OpenBSD: DH_new.3,v 1.13 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: July 13 2022 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt DH_NEW 3 | 52 | .Dt DH_NEW 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm DH_free | 57 | .Nm DH_free |
| 58 | .Nd allocate and free DH objects | 58 | .Nd allocate and free DH objects |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/dh.h | 61 | .In openssl/dh.h |
| 61 | .Ft DH* | 62 | .Ft DH* |
| 62 | .Fn DH_new void | 63 | .Fn DH_new void |
diff --git a/src/lib/libcrypto/man/DH_set_method.3 b/src/lib/libcrypto/man/DH_set_method.3 index 70cf367c9d..3491cf8f6e 100644 --- a/src/lib/libcrypto/man/DH_set_method.3 +++ b/src/lib/libcrypto/man/DH_set_method.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: DH_set_method.3,v 1.9 2023/11/19 10:34:26 tb Exp $ | 1 | .\" $OpenBSD: DH_set_method.3,v 1.10 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: November 19 2023 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt DH_SET_METHOD 3 | 52 | .Dt DH_SET_METHOD 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -59,6 +59,7 @@ | |||
| 59 | .Nm DH_OpenSSL | 59 | .Nm DH_OpenSSL |
| 60 | .Nd select DH method | 60 | .Nd select DH method |
| 61 | .Sh SYNOPSIS | 61 | .Sh SYNOPSIS |
| 62 | .Lb libcrypto | ||
| 62 | .In openssl/dh.h | 63 | .In openssl/dh.h |
| 63 | .Ft void | 64 | .Ft void |
| 64 | .Fo DH_set_default_method | 65 | .Fo DH_set_default_method |
diff --git a/src/lib/libcrypto/man/DH_size.3 b/src/lib/libcrypto/man/DH_size.3 index 4e6dbc0cba..09c019f366 100644 --- a/src/lib/libcrypto/man/DH_size.3 +++ b/src/lib/libcrypto/man/DH_size.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: DH_size.3,v 1.10 2022/07/13 21:51:35 schwarze Exp $ | 1 | .\" $OpenBSD: DH_size.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: July 13 2022 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt DH_SIZE 3 | 53 | .Dt DH_SIZE 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm DH_bits | 57 | .Nm DH_bits |
| 58 | .Nd get Diffie-Hellman prime size | 58 | .Nd get Diffie-Hellman prime size |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/dh.h | 61 | .In openssl/dh.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fo DH_size | 63 | .Fo DH_size |
diff --git a/src/lib/libcrypto/man/DIST_POINT_new.3 b/src/lib/libcrypto/man/DIST_POINT_new.3 index 6a5cc40468..e5aeb2a5d5 100644 --- a/src/lib/libcrypto/man/DIST_POINT_new.3 +++ b/src/lib/libcrypto/man/DIST_POINT_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: DIST_POINT_new.3,v 1.5 2019/06/06 01:06:58 schwarze Exp $ | 1 | .\" $OpenBSD: DIST_POINT_new.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: June 6 2019 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt DIST_POINT_NEW 3 | 18 | .Dt DIST_POINT_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -28,6 +28,7 @@ | |||
| 28 | .Nm ISSUING_DIST_POINT_free | 28 | .Nm ISSUING_DIST_POINT_free |
| 29 | .Nd X.509 CRL distribution point extensions | 29 | .Nd X.509 CRL distribution point extensions |
| 30 | .Sh SYNOPSIS | 30 | .Sh SYNOPSIS |
| 31 | .Lb libcrypto | ||
| 31 | .In openssl/x509v3.h | 32 | .In openssl/x509v3.h |
| 32 | .Ft DIST_POINT * | 33 | .Ft DIST_POINT * |
| 33 | .Fn DIST_POINT_new void | 34 | .Fn DIST_POINT_new void |
diff --git a/src/lib/libcrypto/man/DSA_SIG_new.3 b/src/lib/libcrypto/man/DSA_SIG_new.3 index 160b453939..003f71f0f1 100644 --- a/src/lib/libcrypto/man/DSA_SIG_new.3 +++ b/src/lib/libcrypto/man/DSA_SIG_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: DSA_SIG_new.3,v 1.8 2019/06/10 14:58:48 schwarze Exp $ | 1 | .\" $OpenBSD: DSA_SIG_new.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>, | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>, |
| @@ -50,7 +50,7 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: June 10 2019 $ | 53 | .Dd $Mdocdate: June 8 2025 $ |
| 54 | .Dt DSA_SIG_NEW 3 | 54 | .Dt DSA_SIG_NEW 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| @@ -60,6 +60,7 @@ | |||
| 60 | .Nm DSA_SIG_set0 | 60 | .Nm DSA_SIG_set0 |
| 61 | .Nd manipulate DSA signature objects | 61 | .Nd manipulate DSA signature objects |
| 62 | .Sh SYNOPSIS | 62 | .Sh SYNOPSIS |
| 63 | .Lb libcrypto | ||
| 63 | .In openssl/dsa.h | 64 | .In openssl/dsa.h |
| 64 | .Ft DSA_SIG * | 65 | .Ft DSA_SIG * |
| 65 | .Fn DSA_SIG_new void | 66 | .Fn DSA_SIG_new void |
diff --git a/src/lib/libcrypto/man/DSA_do_sign.3 b/src/lib/libcrypto/man/DSA_do_sign.3 index 4602bed872..f7de537bf9 100644 --- a/src/lib/libcrypto/man/DSA_do_sign.3 +++ b/src/lib/libcrypto/man/DSA_do_sign.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: DSA_do_sign.3,v 1.10 2019/06/10 14:58:48 schwarze Exp $ | 1 | .\" $OpenBSD: DSA_do_sign.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 10 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt DSA_DO_SIGN 3 | 52 | .Dt DSA_DO_SIGN 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm DSA_do_verify | 56 | .Nm DSA_do_verify |
| 57 | .Nd raw DSA signature operations | 57 | .Nd raw DSA signature operations |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 59 | .In openssl/dsa.h | 60 | .In openssl/dsa.h |
| 60 | .Ft DSA_SIG * | 61 | .Ft DSA_SIG * |
| 61 | .Fo DSA_do_sign | 62 | .Fo DSA_do_sign |
diff --git a/src/lib/libcrypto/man/DSA_dup_DH.3 b/src/lib/libcrypto/man/DSA_dup_DH.3 index d6163fd3c3..a3ec94f628 100644 --- a/src/lib/libcrypto/man/DSA_dup_DH.3 +++ b/src/lib/libcrypto/man/DSA_dup_DH.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: DSA_dup_DH.3,v 1.9 2023/08/12 08:26:38 tb Exp $ | 1 | .\" $OpenBSD: DSA_dup_DH.3,v 1.10 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: August 12 2023 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt DSA_DUP_DH 3 | 52 | .Dt DSA_DUP_DH 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm DSA_dup_DH | 55 | .Nm DSA_dup_DH |
| 56 | .Nd create a DH structure out of DSA structure | 56 | .Nd create a DH structure out of DSA structure |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/dsa.h | 59 | .In openssl/dsa.h |
| 59 | .Ft DH * | 60 | .Ft DH * |
| 60 | .Fo DSA_dup_DH | 61 | .Fo DSA_dup_DH |
diff --git a/src/lib/libcrypto/man/DSA_generate_key.3 b/src/lib/libcrypto/man/DSA_generate_key.3 index 37d8ec1c0f..161e0680cc 100644 --- a/src/lib/libcrypto/man/DSA_generate_key.3 +++ b/src/lib/libcrypto/man/DSA_generate_key.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: DSA_generate_key.3,v 1.11 2023/12/29 19:12:47 tb Exp $ | 1 | .\" $OpenBSD: DSA_generate_key.3,v 1.12 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: December 29 2023 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt DSA_GENERATE_KEY 3 | 52 | .Dt DSA_GENERATE_KEY 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm DSA_generate_key | 55 | .Nm DSA_generate_key |
| 56 | .Nd generate DSA key pair | 56 | .Nd generate DSA key pair |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/dsa.h | 59 | .In openssl/dsa.h |
| 59 | .Ft int | 60 | .Ft int |
| 60 | .Fo DSA_generate_key | 61 | .Fo DSA_generate_key |
diff --git a/src/lib/libcrypto/man/DSA_generate_parameters_ex.3 b/src/lib/libcrypto/man/DSA_generate_parameters_ex.3 index a318bf8298..fb610b8191 100644 --- a/src/lib/libcrypto/man/DSA_generate_parameters_ex.3 +++ b/src/lib/libcrypto/man/DSA_generate_parameters_ex.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: DSA_generate_parameters_ex.3,v 1.1 2023/12/29 19:15:15 tb Exp $ | 1 | .\" $OpenBSD: DSA_generate_parameters_ex.3,v 1.2 2025/06/08 22:37:23 schwarze Exp $ |
| 2 | .\" OpenSSL 9b86974e Aug 7 22:14:47 2015 -0400 | 2 | .\" OpenSSL 9b86974e Aug 7 22:14:47 2015 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>, | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>, |
| @@ -49,15 +49,14 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: December 29 2023 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt DSA_GENERATE_PARAMETERS_EX 3 | 53 | .Dt DSA_GENERATE_PARAMETERS_EX 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| 56 | .\" .Nm DSA_generate_parameters is intentionally undocumented | ||
| 57 | .\" because it will be removed in the next major bump | ||
| 58 | .Nm DSA_generate_parameters_ex | 56 | .Nm DSA_generate_parameters_ex |
| 59 | .Nd generate DSA parameters | 57 | .Nd generate DSA parameters |
| 60 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 61 | .In openssl/dsa.h | 60 | .In openssl/dsa.h |
| 62 | .Ft int | 61 | .Ft int |
| 63 | .Fo DSA_generate_parameters_ex | 62 | .Fo DSA_generate_parameters_ex |
diff --git a/src/lib/libcrypto/man/DSA_get0_pqg.3 b/src/lib/libcrypto/man/DSA_get0_pqg.3 index b82affba66..e609b6250d 100644 --- a/src/lib/libcrypto/man/DSA_get0_pqg.3 +++ b/src/lib/libcrypto/man/DSA_get0_pqg.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: DSA_get0_pqg.3,v 1.11 2024/07/21 08:36:43 tb Exp $ | 1 | .\" $OpenBSD: DSA_get0_pqg.3,v 1.13 2025/06/13 18:34:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL e90fc053 Jul 15 09:39:45 2017 -0400 | 2 | .\" full merge up to: OpenSSL e90fc053 Jul 15 09:39:45 2017 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Matt Caswell <matt@openssl.org>. | 4 | .\" This file was written by Matt Caswell <matt@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: July 21 2024 $ | 51 | .Dd $Mdocdate: June 13 2025 $ |
| 52 | .Dt DSA_GET0_PQG 3 | 52 | .Dt DSA_GET0_PQG 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -67,6 +67,7 @@ | |||
| 67 | .Nm DSA_get0_engine | 67 | .Nm DSA_get0_engine |
| 68 | .Nd get data from and set data in a DSA object | 68 | .Nd get data from and set data in a DSA object |
| 69 | .Sh SYNOPSIS | 69 | .Sh SYNOPSIS |
| 70 | .Lb libcrypto | ||
| 70 | .In openssl/dsa.h | 71 | .In openssl/dsa.h |
| 71 | .Ft void | 72 | .Ft void |
| 72 | .Fo DSA_get0_pqg | 73 | .Fo DSA_get0_pqg |
| @@ -75,15 +76,15 @@ | |||
| 75 | .Fa "const BIGNUM **q" | 76 | .Fa "const BIGNUM **q" |
| 76 | .Fa "const BIGNUM **g" | 77 | .Fa "const BIGNUM **g" |
| 77 | .Fc | 78 | .Fc |
| 78 | .Ft "const BIGNUM *" | 79 | .Ft const BIGNUM * |
| 79 | .Fo DSA_get0_p | 80 | .Fo DSA_get0_p |
| 80 | .Fa "const DSA *d" | 81 | .Fa "const DSA *d" |
| 81 | .Fc | 82 | .Fc |
| 82 | .Ft "const BIGNUM *" | 83 | .Ft const BIGNUM * |
| 83 | .Fo DSA_get0_q | 84 | .Fo DSA_get0_q |
| 84 | .Fa "const DSA *d" | 85 | .Fa "const DSA *d" |
| 85 | .Fc | 86 | .Fc |
| 86 | .Ft "const BIGNUM *" | 87 | .Ft const BIGNUM * |
| 87 | .Fo DSA_get0_g | 88 | .Fo DSA_get0_g |
| 88 | .Fa "const DSA *d" | 89 | .Fa "const DSA *d" |
| 89 | .Fc | 90 | .Fc |
| @@ -100,11 +101,11 @@ | |||
| 100 | .Fa "const BIGNUM **pub_key" | 101 | .Fa "const BIGNUM **pub_key" |
| 101 | .Fa "const BIGNUM **priv_key" | 102 | .Fa "const BIGNUM **priv_key" |
| 102 | .Fc | 103 | .Fc |
| 103 | .Ft "const BIGNUM *" | 104 | .Ft const BIGNUM * |
| 104 | .Fo DSA_get0_pub_key | 105 | .Fo DSA_get0_pub_key |
| 105 | .Fa "const DSA *d" | 106 | .Fa "const DSA *d" |
| 106 | .Fc | 107 | .Fc |
| 107 | .Ft "const BIGNUM *" | 108 | .Ft const BIGNUM * |
| 108 | .Fo DSA_get0_priv_key | 109 | .Fo DSA_get0_priv_key |
| 109 | .Fa "const DSA *d" | 110 | .Fa "const DSA *d" |
| 110 | .Fc | 111 | .Fc |
diff --git a/src/lib/libcrypto/man/DSA_get_ex_new_index.3 b/src/lib/libcrypto/man/DSA_get_ex_new_index.3 index 8fe055f337..477c011c53 100644 --- a/src/lib/libcrypto/man/DSA_get_ex_new_index.3 +++ b/src/lib/libcrypto/man/DSA_get_ex_new_index.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: DSA_get_ex_new_index.3,v 1.5 2018/03/22 16:06:33 schwarze Exp $ | 1 | .\" $OpenBSD: DSA_get_ex_new_index.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 | 2 | .\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 22 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt DSA_GET_EX_NEW_INDEX 3 | 52 | .Dt DSA_GET_EX_NEW_INDEX 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm DSA_get_ex_data | 57 | .Nm DSA_get_ex_data |
| 58 | .Nd add application specific data to DSA structures | 58 | .Nd add application specific data to DSA structures |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/dsa.h | 61 | .In openssl/dsa.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fo DSA_get_ex_new_index | 63 | .Fo DSA_get_ex_new_index |
diff --git a/src/lib/libcrypto/man/DSA_meth_new.3 b/src/lib/libcrypto/man/DSA_meth_new.3 index d89cd397b0..abd023346e 100644 --- a/src/lib/libcrypto/man/DSA_meth_new.3 +++ b/src/lib/libcrypto/man/DSA_meth_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: DSA_meth_new.3,v 1.3 2022/07/10 13:41:59 schwarze Exp $ | 1 | .\" $OpenBSD: DSA_meth_new.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" selective merge up to: OpenSSL c4d3c19b Apr 3 13:57:12 2018 +0100 | 2 | .\" selective merge up to: OpenSSL c4d3c19b Apr 3 13:57:12 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: July 10 2022 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt DSA_METH_NEW 3 | 69 | .Dt DSA_METH_NEW 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -78,6 +78,7 @@ | |||
| 78 | .Nm DSA_meth_set_finish | 78 | .Nm DSA_meth_set_finish |
| 79 | .Nd build up DSA methods | 79 | .Nd build up DSA methods |
| 80 | .Sh SYNOPSIS | 80 | .Sh SYNOPSIS |
| 81 | .Lb libcrypto | ||
| 81 | .In openssl/dsa.h | 82 | .In openssl/dsa.h |
| 82 | .Ft DSA_METHOD * | 83 | .Ft DSA_METHOD * |
| 83 | .Fo DSA_meth_new | 84 | .Fo DSA_meth_new |
diff --git a/src/lib/libcrypto/man/DSA_new.3 b/src/lib/libcrypto/man/DSA_new.3 index 5a958b58c4..5340bec4bd 100644 --- a/src/lib/libcrypto/man/DSA_new.3 +++ b/src/lib/libcrypto/man/DSA_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: DSA_new.3,v 1.14 2023/12/29 19:12:47 tb Exp $ | 1 | .\" $OpenBSD: DSA_new.3,v 1.15 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: December 29 2023 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt DSA_NEW 3 | 52 | .Dt DSA_NEW 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm DSA_free | 57 | .Nm DSA_free |
| 58 | .Nd allocate and free DSA objects | 58 | .Nd allocate and free DSA objects |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/dsa.h | 61 | .In openssl/dsa.h |
| 61 | .Ft DSA* | 62 | .Ft DSA* |
| 62 | .Fn DSA_new void | 63 | .Fn DSA_new void |
diff --git a/src/lib/libcrypto/man/DSA_set_method.3 b/src/lib/libcrypto/man/DSA_set_method.3 index c60a3e29c3..f2a6eca57c 100644 --- a/src/lib/libcrypto/man/DSA_set_method.3 +++ b/src/lib/libcrypto/man/DSA_set_method.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: DSA_set_method.3,v 1.12 2024/05/11 06:53:19 tb Exp $ | 1 | .\" $OpenBSD: DSA_set_method.3,v 1.13 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: May 11 2024 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt DSA_SET_METHOD 3 | 52 | .Dt DSA_SET_METHOD 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -59,6 +59,7 @@ | |||
| 59 | .Nm DSA_OpenSSL | 59 | .Nm DSA_OpenSSL |
| 60 | .Nd select DSA method | 60 | .Nd select DSA method |
| 61 | .Sh SYNOPSIS | 61 | .Sh SYNOPSIS |
| 62 | .Lb libcrypto | ||
| 62 | .In openssl/dsa.h | 63 | .In openssl/dsa.h |
| 63 | .Ft void | 64 | .Ft void |
| 64 | .Fo DSA_set_default_method | 65 | .Fo DSA_set_default_method |
diff --git a/src/lib/libcrypto/man/DSA_sign.3 b/src/lib/libcrypto/man/DSA_sign.3 index 59f9042ba6..787dc903ea 100644 --- a/src/lib/libcrypto/man/DSA_sign.3 +++ b/src/lib/libcrypto/man/DSA_sign.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: DSA_sign.3,v 1.10 2019/06/10 14:58:48 schwarze Exp $ | 1 | .\" $OpenBSD: DSA_sign.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 10 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt DSA_SIGN 3 | 52 | .Dt DSA_SIGN 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm DSA_verify | 57 | .Nm DSA_verify |
| 58 | .Nd DSA signatures | 58 | .Nd DSA signatures |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/dsa.h | 61 | .In openssl/dsa.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fo DSA_sign | 63 | .Fo DSA_sign |
diff --git a/src/lib/libcrypto/man/DSA_size.3 b/src/lib/libcrypto/man/DSA_size.3 index 4786acc7e9..09ce80e132 100644 --- a/src/lib/libcrypto/man/DSA_size.3 +++ b/src/lib/libcrypto/man/DSA_size.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: DSA_size.3,v 1.8 2022/07/13 21:44:23 schwarze Exp $ | 1 | .\" $OpenBSD: DSA_size.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 | 2 | .\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: July 13 2022 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt DSA_SIZE 3 | 70 | .Dt DSA_SIZE 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -74,6 +74,7 @@ | |||
| 74 | .Nm DSA_bits | 74 | .Nm DSA_bits |
| 75 | .Nd get DSA signature or key size | 75 | .Nd get DSA signature or key size |
| 76 | .Sh SYNOPSIS | 76 | .Sh SYNOPSIS |
| 77 | .Lb libcrypto | ||
| 77 | .In openssl/dsa.h | 78 | .In openssl/dsa.h |
| 78 | .Ft int | 79 | .Ft int |
| 79 | .Fo DSA_size | 80 | .Fo DSA_size |
diff --git a/src/lib/libcrypto/man/ECDH_compute_key.3 b/src/lib/libcrypto/man/ECDH_compute_key.3 index c49988e141..b0ae6ad34c 100644 --- a/src/lib/libcrypto/man/ECDH_compute_key.3 +++ b/src/lib/libcrypto/man/ECDH_compute_key.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ECDH_compute_key.3,v 1.3 2023/08/29 10:07:42 tb Exp $ | 1 | .\" $OpenBSD: ECDH_compute_key.3,v 1.5 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> | 2 | .\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> |
| 3 | .\" | 3 | .\" |
| 4 | .\" Permission to use, copy, modify, and distribute this software for any | 4 | .\" Permission to use, copy, modify, and distribute this software for any |
| @@ -13,7 +13,7 @@ | |||
| 13 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 13 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 14 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | .\" | 15 | .\" |
| 16 | .Dd $Mdocdate: August 29 2023 $ | 16 | .Dd $Mdocdate: June 8 2025 $ |
| 17 | .Dt ECDH_COMPUTE_KEY 3 | 17 | .Dt ECDH_COMPUTE_KEY 3 |
| 18 | .Os | 18 | .Os |
| 19 | .Sh NAME | 19 | .Sh NAME |
| @@ -21,6 +21,7 @@ | |||
| 21 | .Nm ECDH_size | 21 | .Nm ECDH_size |
| 22 | .Nd Elliptic Curve Diffie-Hellman key exchange | 22 | .Nd Elliptic Curve Diffie-Hellman key exchange |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/ec.h | 25 | .In openssl/ec.h |
| 25 | .Ft int | 26 | .Ft int |
| 26 | .Fo ECDH_compute_key | 27 | .Fo ECDH_compute_key |
| @@ -74,7 +75,7 @@ returns the number of bytes needed to store an affine coordinate. | |||
| 74 | .Sh SEE ALSO | 75 | .Sh SEE ALSO |
| 75 | .Xr DH_generate_key 3 , | 76 | .Xr DH_generate_key 3 , |
| 76 | .Xr DH_size 3 , | 77 | .Xr DH_size 3 , |
| 77 | .Xr EC_GROUP_new 3 , | 78 | .Xr EC_GROUP_new_by_curve_name 3 , |
| 78 | .Xr EC_KEY_new 3 , | 79 | .Xr EC_KEY_new 3 , |
| 79 | .Xr EC_POINT_new 3 , | 80 | .Xr EC_POINT_new 3 , |
| 80 | .Xr X25519 3 | 81 | .Xr X25519 3 |
diff --git a/src/lib/libcrypto/man/ECDSA_SIG_new.3 b/src/lib/libcrypto/man/ECDSA_SIG_new.3 index 2b72e6f1b9..4554af035c 100644 --- a/src/lib/libcrypto/man/ECDSA_SIG_new.3 +++ b/src/lib/libcrypto/man/ECDSA_SIG_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ECDSA_SIG_new.3,v 1.21 2024/11/15 20:14:58 tb Exp $ | 1 | .\" $OpenBSD: ECDSA_SIG_new.3,v 1.24 2025/06/13 18:34:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 | 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 |
| 3 | .\" selective merge up to: OpenSSL da4ea0cf Aug 5 16:13:24 2019 +0100 | 3 | .\" selective merge up to: OpenSSL da4ea0cf Aug 5 16:13:24 2019 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -50,7 +50,7 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: November 15 2024 $ | 53 | .Dd $Mdocdate: June 13 2025 $ |
| 54 | .Dt ECDSA_SIG_NEW 3 | 54 | .Dt ECDSA_SIG_NEW 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| @@ -69,8 +69,9 @@ | |||
| 69 | .Nm ECDSA_do_verify | 69 | .Nm ECDSA_do_verify |
| 70 | .Nd Elliptic Curve Digital Signature Algorithm | 70 | .Nd Elliptic Curve Digital Signature Algorithm |
| 71 | .Sh SYNOPSIS | 71 | .Sh SYNOPSIS |
| 72 | .Lb libcrypto | ||
| 72 | .In openssl/ec.h | 73 | .In openssl/ec.h |
| 73 | .Ft ECDSA_SIG* | 74 | .Ft ECDSA_SIG * |
| 74 | .Fo ECDSA_SIG_new | 75 | .Fo ECDSA_SIG_new |
| 75 | .Fa void | 76 | .Fa void |
| 76 | .Fc | 77 | .Fc |
| @@ -84,11 +85,11 @@ | |||
| 84 | .Fa "const BIGNUM **r" | 85 | .Fa "const BIGNUM **r" |
| 85 | .Fa "const BIGNUM **s" | 86 | .Fa "const BIGNUM **s" |
| 86 | .Fc | 87 | .Fc |
| 87 | .Ft "const BIGNUM *" | 88 | .Ft const BIGNUM * |
| 88 | .Fo ECDSA_SIG_get0_r | 89 | .Fo ECDSA_SIG_get0_r |
| 89 | .Fa "const ECDSA_SIG *sig" | 90 | .Fa "const ECDSA_SIG *sig" |
| 90 | .Fc | 91 | .Fc |
| 91 | .Ft "const BIGNUM *" | 92 | .Ft const BIGNUM * |
| 92 | .Fo ECDSA_SIG_get0_s | 93 | .Fo ECDSA_SIG_get0_s |
| 93 | .Fa "const ECDSA_SIG *sig" | 94 | .Fa "const ECDSA_SIG *sig" |
| 94 | .Fc | 95 | .Fc |
| @@ -103,7 +104,7 @@ | |||
| 103 | .Fa "const ECDSA_SIG *sig_in" | 104 | .Fa "const ECDSA_SIG *sig_in" |
| 104 | .Fa "unsigned char **der_out" | 105 | .Fa "unsigned char **der_out" |
| 105 | .Fc | 106 | .Fc |
| 106 | .Ft ECDSA_SIG* | 107 | .Ft ECDSA_SIG * |
| 107 | .Fo d2i_ECDSA_SIG | 108 | .Fo d2i_ECDSA_SIG |
| 108 | .Fa "ECDSA_SIG **sig_out" | 109 | .Fa "ECDSA_SIG **sig_out" |
| 109 | .Fa "const unsigned char **der_in" | 110 | .Fa "const unsigned char **der_in" |
| @@ -131,7 +132,7 @@ | |||
| 131 | .Fa "int siglen" | 132 | .Fa "int siglen" |
| 132 | .Fa "EC_KEY *eckey" | 133 | .Fa "EC_KEY *eckey" |
| 133 | .Fc | 134 | .Fc |
| 134 | .Ft ECDSA_SIG* | 135 | .Ft ECDSA_SIG * |
| 135 | .Fo ECDSA_do_sign | 136 | .Fo ECDSA_do_sign |
| 136 | .Fa "const unsigned char *dgst" | 137 | .Fa "const unsigned char *dgst" |
| 137 | .Fa "int dgst_len" | 138 | .Fa "int dgst_len" |
| @@ -413,7 +414,7 @@ if (ret == -1) { | |||
| 413 | .Xr crypto 3 , | 414 | .Xr crypto 3 , |
| 414 | .Xr d2i_ECPKParameters 3 , | 415 | .Xr d2i_ECPKParameters 3 , |
| 415 | .Xr DSA_new 3 , | 416 | .Xr DSA_new 3 , |
| 416 | .Xr EC_GROUP_new 3 , | 417 | .Xr EC_GROUP_new_by_curve_name 3 , |
| 417 | .Xr EC_KEY_METHOD_new 3 , | 418 | .Xr EC_KEY_METHOD_new 3 , |
| 418 | .Xr EC_KEY_new 3 , | 419 | .Xr EC_KEY_new 3 , |
| 419 | .Xr EC_KEY_set_ex_data 3 , | 420 | .Xr EC_KEY_set_ex_data 3 , |
diff --git a/src/lib/libcrypto/man/EC_GROUP_check.3 b/src/lib/libcrypto/man/EC_GROUP_check.3 new file mode 100644 index 0000000000..146c3d255d --- /dev/null +++ b/src/lib/libcrypto/man/EC_GROUP_check.3 | |||
| @@ -0,0 +1,160 @@ | |||
| 1 | .\" $OpenBSD: EC_GROUP_check.3,v 1.6 2025/07/04 05:16:56 jsg Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2025 Theo Buehler <tb@openbsd.org> | ||
| 4 | .\" | ||
| 5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 7 | .\" copyright notice and this permission notice appear in all copies. | ||
| 8 | .\" | ||
| 9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | .\" | ||
| 17 | .Dd $Mdocdate: July 4 2025 $ | ||
| 18 | .Dt EC_GROUP_CHECK 3 | ||
| 19 | .Os | ||
| 20 | .Sh NAME | ||
| 21 | .Nm EC_GROUP_check_discriminant , | ||
| 22 | .Nm EC_GROUP_check | ||
| 23 | .Nd partially check validity of | ||
| 24 | .Vt EC_GROUP | ||
| 25 | objects | ||
| 26 | .Sh SYNOPSIS | ||
| 27 | .Lb libcrypto | ||
| 28 | .In openssl/bn.h | ||
| 29 | .In openssl/ec.h | ||
| 30 | .Pp | ||
| 31 | Deprecated: | ||
| 32 | .Pp | ||
| 33 | .Ft int | ||
| 34 | .Fo EC_GROUP_check_discriminant | ||
| 35 | .Fa "const EC_GROUP *group" | ||
| 36 | .Fa "BN_CTX *ctx" | ||
| 37 | .Fc | ||
| 38 | .Ft int | ||
| 39 | .Fo EC_GROUP_check | ||
| 40 | .Fa "const EC_GROUP *group" | ||
| 41 | .Fa "BN_CTX *ctx" | ||
| 42 | .Fc | ||
| 43 | .Sh DESCRIPTION | ||
| 44 | These functions are deprecated. | ||
| 45 | Only standardized curves built into the library should be used, see | ||
| 46 | .Xr EC_GROUP_new_by_curve_name 3 . | ||
| 47 | Builtin curves went through far more thorough checking than | ||
| 48 | the minimal, incomplete tests performed by these functions. | ||
| 49 | .Pp | ||
| 50 | These functions have an optional | ||
| 51 | .Fa ctx | ||
| 52 | argument which is used to avoid the cost of repeated allocation of | ||
| 53 | auxiliary | ||
| 54 | .Vt BIGNUM | ||
| 55 | objects. | ||
| 56 | .Pp | ||
| 57 | .Fn EC_GROUP_check_discriminant | ||
| 58 | can be called after | ||
| 59 | .Xr EC_GROUP_new_curve_GFp 3 | ||
| 60 | to verify that | ||
| 61 | .Fa group Ns 's | ||
| 62 | parameters have non-zero discriminant 4a^3 + 27b^2 modulo p. | ||
| 63 | Assuming that | ||
| 64 | .Fa p | ||
| 65 | is a prime number larger than three | ||
| 66 | this implies that the Weierstrass equation defines an elliptic curve. | ||
| 67 | .Pp | ||
| 68 | .Fn EC_GROUP_check | ||
| 69 | partially verifies that | ||
| 70 | .Fa group | ||
| 71 | represents an elliptic curve and that | ||
| 72 | .Fa generator | ||
| 73 | is a point on the curve whose order divides | ||
| 74 | .Fa order . | ||
| 75 | It checks with | ||
| 76 | .Fn EC_GROUP_check_discriminant | ||
| 77 | that the discriminant is non-zero | ||
| 78 | and then verifies that that | ||
| 79 | .Fa order | ||
| 80 | is non-zero and that the product | ||
| 81 | .Fa generator No * Fa order | ||
| 82 | is the point at infinity. | ||
| 83 | This implies that the | ||
| 84 | .Fa order | ||
| 85 | set on | ||
| 86 | .Fa group | ||
| 87 | is an integer multiple of the | ||
| 88 | .Fa generator Ns 's | ||
| 89 | order. | ||
| 90 | The verification that | ||
| 91 | .Fa p | ||
| 92 | is a prime | ||
| 93 | and that | ||
| 94 | .Fa order | ||
| 95 | is equal to the | ||
| 96 | .Fa generator Ns 's | ||
| 97 | order are skipped because they are too expensive. | ||
| 98 | .Sh RETURN VALUES | ||
| 99 | .Fn EC_GROUP_check_discriminant | ||
| 100 | returns 1 on success and 0 on failure. | ||
| 101 | Failure modes include that the discriminant is zero modulo | ||
| 102 | .Fa p | ||
| 103 | and memory allocation failure. | ||
| 104 | .Pp | ||
| 105 | .Fn EC_GROUP_check | ||
| 106 | returns 1 on success and 0 on failure. | ||
| 107 | .Sh ERRORS | ||
| 108 | Diagnostics for | ||
| 109 | .Fn EC_GROUP_check | ||
| 110 | that can be retrieved with | ||
| 111 | .Xr ERR_get_error 3 , | ||
| 112 | .Xr ERR_GET_REASON 3 , | ||
| 113 | and | ||
| 114 | .Xr ERR_reason_error_string 3 | ||
| 115 | include: | ||
| 116 | .Bl -tag -width Ds | ||
| 117 | .It Dv EC_R_DISCRIMINANT_IS_ZERO Qq "discriminant is zero" | ||
| 118 | .Fn EC_GROUP_check_discriminant | ||
| 119 | failed because the discriminant is zero or for some other reason. | ||
| 120 | .It Dv EC_R_UNDEFINED_GENERATOR Qq "undefined generator" | ||
| 121 | no generator is set on | ||
| 122 | .Fa group , | ||
| 123 | for example because a call to | ||
| 124 | .Xr EC_GROUP_set_generator 3 | ||
| 125 | is missing. | ||
| 126 | .It Dv EC_R_POINT_IS_NOT_ON_CURVE Qq "point is not on curve" | ||
| 127 | a generator is set, but it is not a point on the curve represented by | ||
| 128 | .Fa group . | ||
| 129 | .It Dv EC_R_UNDEFINED_ORDER Qq "undefined order" | ||
| 130 | the | ||
| 131 | .Fa order | ||
| 132 | set on | ||
| 133 | .Fa group | ||
| 134 | is zero. | ||
| 135 | .It Dv EC_R_INVALID_GROUP_ORDER Qq "invalid group order" | ||
| 136 | .Fa generator No * Fa order | ||
| 137 | is not the point at infinity. | ||
| 138 | .El | ||
| 139 | .Sh SEE ALSO | ||
| 140 | .Xr BN_CTX_new 3 , | ||
| 141 | .Xr BN_is_zero 3 , | ||
| 142 | .Xr crypto 3 , | ||
| 143 | .Xr d2i_ECPKParameters 3 , | ||
| 144 | .Xr EC_GROUP_get_curve_name 3 , | ||
| 145 | .Xr EC_GROUP_new_by_curve_name 3 , | ||
| 146 | .Xr EC_GROUP_new_curve_GFp 3 , | ||
| 147 | .Xr EC_KEY_METHOD_new 3 , | ||
| 148 | .Xr EC_KEY_new 3 , | ||
| 149 | .Xr EC_POINT_add 3 , | ||
| 150 | .Xr EC_POINT_get_affine_coordinates 3 , | ||
| 151 | .Xr EC_POINT_new 3 , | ||
| 152 | .Xr EC_POINT_point2oct 3 , | ||
| 153 | .Xr ECDH_compute_key 3 , | ||
| 154 | .Xr ECDSA_SIG_new 3 | ||
| 155 | .Sh HISTORY | ||
| 156 | .Fn EC_GROUP_check | ||
| 157 | and | ||
| 158 | .Fn EC_GROUP_check_discriminant | ||
| 159 | first appeared in OpenSSL 0.9.8 and have been available since | ||
| 160 | .Ox 4.5 . | ||
diff --git a/src/lib/libcrypto/man/EC_GROUP_copy.3 b/src/lib/libcrypto/man/EC_GROUP_copy.3 deleted file mode 100644 index 2e5e798236..0000000000 --- a/src/lib/libcrypto/man/EC_GROUP_copy.3 +++ /dev/null | |||
| @@ -1,492 +0,0 @@ | |||
| 1 | .\" $OpenBSD: EC_GROUP_copy.3,v 1.16 2025/03/08 16:40:59 tb Exp $ | ||
| 2 | .\" full merge up to: OpenSSL d900a015 Oct 8 14:40:42 2015 +0200 | ||
| 3 | .\" selective merge up to: OpenSSL 24c23e1f Aug 22 10:51:25 2019 +0530 | ||
| 4 | .\" | ||
| 5 | .\" This file was written by Matt Caswell <matt@openssl.org>, | ||
| 6 | .\" Dr. Stephen Henson <steve@openssl.org>, | ||
| 7 | .\" and Jayaram X Matta <jayaramx.matta@intel.com>. | ||
| 8 | .\" Copyright (c) 2013, 2015, 2019 The OpenSSL Project. All rights reserved. | ||
| 9 | .\" | ||
| 10 | .\" Redistribution and use in source and binary forms, with or without | ||
| 11 | .\" modification, are permitted provided that the following conditions | ||
| 12 | .\" are met: | ||
| 13 | .\" | ||
| 14 | .\" 1. Redistributions of source code must retain the above copyright | ||
| 15 | .\" notice, this list of conditions and the following disclaimer. | ||
| 16 | .\" | ||
| 17 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
| 18 | .\" notice, this list of conditions and the following disclaimer in | ||
| 19 | .\" the documentation and/or other materials provided with the | ||
| 20 | .\" distribution. | ||
| 21 | .\" | ||
| 22 | .\" 3. All advertising materials mentioning features or use of this | ||
| 23 | .\" software must display the following acknowledgment: | ||
| 24 | .\" "This product includes software developed by the OpenSSL Project | ||
| 25 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 26 | .\" | ||
| 27 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 28 | .\" endorse or promote products derived from this software without | ||
| 29 | .\" prior written permission. For written permission, please contact | ||
| 30 | .\" openssl-core@openssl.org. | ||
| 31 | .\" | ||
| 32 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
| 33 | .\" nor may "OpenSSL" appear in their names without prior written | ||
| 34 | .\" permission of the OpenSSL Project. | ||
| 35 | .\" | ||
| 36 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
| 37 | .\" acknowledgment: | ||
| 38 | .\" "This product includes software developed by the OpenSSL Project | ||
| 39 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 40 | .\" | ||
| 41 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 42 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 44 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 45 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 46 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 47 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 48 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 49 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 50 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 53 | .\" | ||
| 54 | .Dd $Mdocdate: March 8 2025 $ | ||
| 55 | .Dt EC_GROUP_COPY 3 | ||
| 56 | .Os | ||
| 57 | .Sh NAME | ||
| 58 | .Nm EC_GROUP_copy , | ||
| 59 | .Nm EC_GROUP_dup , | ||
| 60 | .Nm EC_GROUP_set_generator , | ||
| 61 | .Nm EC_GROUP_get0_generator , | ||
| 62 | .Nm EC_GROUP_get_order , | ||
| 63 | .Nm EC_GROUP_order_bits , | ||
| 64 | .Nm EC_GROUP_get_cofactor , | ||
| 65 | .Nm EC_GROUP_set_curve_name , | ||
| 66 | .Nm EC_GROUP_get_curve_name , | ||
| 67 | .Nm EC_GROUP_set_asn1_flag , | ||
| 68 | .Nm EC_GROUP_get_asn1_flag , | ||
| 69 | .Nm EC_GROUP_set_point_conversion_form , | ||
| 70 | .Nm EC_GROUP_get_point_conversion_form , | ||
| 71 | .Nm EC_GROUP_get0_seed , | ||
| 72 | .Nm EC_GROUP_get_seed_len , | ||
| 73 | .Nm EC_GROUP_set_seed , | ||
| 74 | .Nm EC_GROUP_get_degree , | ||
| 75 | .Nm EC_GROUP_check , | ||
| 76 | .Nm EC_GROUP_check_discriminant , | ||
| 77 | .Nm EC_GROUP_cmp , | ||
| 78 | .Nm EC_GROUP_get_basis_type | ||
| 79 | .Nd manipulate EC_GROUP objects | ||
| 80 | .Sh SYNOPSIS | ||
| 81 | .In openssl/ec.h | ||
| 82 | .In openssl/bn.h | ||
| 83 | .Ft int | ||
| 84 | .Fo EC_GROUP_copy | ||
| 85 | .Fa "EC_GROUP *dst" | ||
| 86 | .Fa "const EC_GROUP *src" | ||
| 87 | .Fc | ||
| 88 | .Ft EC_GROUP * | ||
| 89 | .Fo EC_GROUP_dup | ||
| 90 | .Fa "const EC_GROUP *src" | ||
| 91 | .Fc | ||
| 92 | .Ft int | ||
| 93 | .Fo EC_GROUP_set_generator | ||
| 94 | .Fa "EC_GROUP *group" | ||
| 95 | .Fa "const EC_POINT *generator" | ||
| 96 | .Fa "const BIGNUM *order" | ||
| 97 | .Fa "const BIGNUM *cofactor" | ||
| 98 | .Fc | ||
| 99 | .Ft const EC_POINT * | ||
| 100 | .Fo EC_GROUP_get0_generator | ||
| 101 | .Fa "const EC_GROUP *group" | ||
| 102 | .Fc | ||
| 103 | .Ft int | ||
| 104 | .Fo EC_GROUP_get_order | ||
| 105 | .Fa "const EC_GROUP *group" | ||
| 106 | .Fa "BIGNUM *order" | ||
| 107 | .Fa "BN_CTX *ctx" | ||
| 108 | .Fc | ||
| 109 | .Ft int | ||
| 110 | .Fo EC_GROUP_order_bits | ||
| 111 | .Fa "const EC_GROUP *group" | ||
| 112 | .Fc | ||
| 113 | .Ft int | ||
| 114 | .Fo EC_GROUP_get_cofactor | ||
| 115 | .Fa "const EC_GROUP *group" | ||
| 116 | .Fa "BIGNUM *cofactor" | ||
| 117 | .Fa "BN_CTX *ctx" | ||
| 118 | .Fc | ||
| 119 | .Ft void | ||
| 120 | .Fo EC_GROUP_set_curve_name | ||
| 121 | .Fa "EC_GROUP *group" | ||
| 122 | .Fa "int nid" | ||
| 123 | .Fc | ||
| 124 | .Ft int | ||
| 125 | .Fo EC_GROUP_get_curve_name | ||
| 126 | .Fa "const EC_GROUP *group" | ||
| 127 | .Fc | ||
| 128 | .Ft void | ||
| 129 | .Fo EC_GROUP_set_asn1_flag | ||
| 130 | .Fa "EC_GROUP *group" | ||
| 131 | .Fa "int flag" | ||
| 132 | .Fc | ||
| 133 | .Ft int | ||
| 134 | .Fo EC_GROUP_get_asn1_flag | ||
| 135 | .Fa "const EC_GROUP *group" | ||
| 136 | .Fc | ||
| 137 | .Ft void | ||
| 138 | .Fo EC_GROUP_set_point_conversion_form | ||
| 139 | .Fa "EC_GROUP *group" | ||
| 140 | .Fa "point_conversion_form_t form" | ||
| 141 | .Fc | ||
| 142 | .Ft point_conversion_form_t | ||
| 143 | .Fo EC_GROUP_get_point_conversion_form | ||
| 144 | .Fa "const EC_GROUP *" | ||
| 145 | .Fc | ||
| 146 | .Ft unsigned char * | ||
| 147 | .Fo EC_GROUP_get0_seed | ||
| 148 | .Fa "const EC_GROUP *x" | ||
| 149 | .Fc | ||
| 150 | .Ft size_t | ||
| 151 | .Fo EC_GROUP_get_seed_len | ||
| 152 | .Fa "const EC_GROUP *" | ||
| 153 | .Fc | ||
| 154 | .Ft size_t | ||
| 155 | .Fo EC_GROUP_set_seed | ||
| 156 | .Fa "EC_GROUP *" | ||
| 157 | .Fa "const unsigned char *" | ||
| 158 | .Fa "size_t len" | ||
| 159 | .Fc | ||
| 160 | .Ft int | ||
| 161 | .Fo EC_GROUP_get_degree | ||
| 162 | .Fa "const EC_GROUP *group" | ||
| 163 | .Fc | ||
| 164 | .Ft int | ||
| 165 | .Fo EC_GROUP_check | ||
| 166 | .Fa "const EC_GROUP *group" | ||
| 167 | .Fa "BN_CTX *ctx" | ||
| 168 | .Fc | ||
| 169 | .Ft int | ||
| 170 | .Fo EC_GROUP_check_discriminant | ||
| 171 | .Fa "const EC_GROUP *group" | ||
| 172 | .Fa "BN_CTX *ctx" | ||
| 173 | .Fc | ||
| 174 | .Ft int | ||
| 175 | .Fo EC_GROUP_cmp | ||
| 176 | .Fa "const EC_GROUP *a" | ||
| 177 | .Fa "const EC_GROUP *b" | ||
| 178 | .Fa "BN_CTX *ctx" | ||
| 179 | .Fc | ||
| 180 | .Ft int | ||
| 181 | .Fo EC_GROUP_get_basis_type | ||
| 182 | .Fa "const EC_GROUP *" | ||
| 183 | .Fc | ||
| 184 | .Sh DESCRIPTION | ||
| 185 | These functions operate on | ||
| 186 | .Vt EC_GROUP | ||
| 187 | objects created by the functions described in | ||
| 188 | .Xr EC_GROUP_new 3 . | ||
| 189 | .Pp | ||
| 190 | .Fn EC_GROUP_copy | ||
| 191 | copies the curve | ||
| 192 | .Fa src | ||
| 193 | into | ||
| 194 | .Fa dst . | ||
| 195 | Both | ||
| 196 | .Fa src | ||
| 197 | and | ||
| 198 | .Fa dst | ||
| 199 | must use the same | ||
| 200 | .Vt EC_METHOD . | ||
| 201 | .Pp | ||
| 202 | .Fn EC_GROUP_dup | ||
| 203 | creates a new | ||
| 204 | .Vt EC_GROUP | ||
| 205 | object and copies the content from | ||
| 206 | .Fa src | ||
| 207 | to the newly created | ||
| 208 | .Vt EC_GROUP | ||
| 209 | object. | ||
| 210 | .Pp | ||
| 211 | .Fn EC_GROUP_set_generator | ||
| 212 | sets curve parameters that must be agreed by all participants using | ||
| 213 | the curve. | ||
| 214 | These parameters include the | ||
| 215 | .Fa generator , | ||
| 216 | the | ||
| 217 | .Fa order | ||
| 218 | and the | ||
| 219 | .Fa cofactor . | ||
| 220 | The | ||
| 221 | .Fa generator | ||
| 222 | is a well defined point on the curve chosen for cryptographic | ||
| 223 | operations. | ||
| 224 | Integers used for point multiplications will be between 0 and | ||
| 225 | .Fa order No - 1 . | ||
| 226 | The | ||
| 227 | .Fa order | ||
| 228 | multiplied by the | ||
| 229 | .Fa cofactor | ||
| 230 | gives the number of points on the curve. | ||
| 231 | .Pp | ||
| 232 | .Fn EC_GROUP_get0_generator | ||
| 233 | returns the generator for the identified | ||
| 234 | .Fa group . | ||
| 235 | .Pp | ||
| 236 | .Fn EC_GROUP_get_order | ||
| 237 | retrieves the order of the | ||
| 238 | .Fa group | ||
| 239 | and copies its value into | ||
| 240 | .Fa order . | ||
| 241 | It fails if the order of the | ||
| 242 | .Fa group | ||
| 243 | is not set or set to zero. | ||
| 244 | .Pp | ||
| 245 | .Fn EC_GROUP_get_cofactor | ||
| 246 | retrieves the cofactor of the | ||
| 247 | .Fa group | ||
| 248 | and copies its value into | ||
| 249 | .Fa cofactor . | ||
| 250 | It fails if the cofactor of the | ||
| 251 | .Fa group | ||
| 252 | is not set or set to zero. | ||
| 253 | .Pp | ||
| 254 | The functions | ||
| 255 | .Fn EC_GROUP_set_curve_name | ||
| 256 | and | ||
| 257 | .Fn EC_GROUP_get_curve_name | ||
| 258 | set and get the NID for the curve, respectively (see | ||
| 259 | .Xr EC_GROUP_new 3 ) . | ||
| 260 | If a curve does not have a NID associated with it, then | ||
| 261 | .Fn EC_GROUP_get_curve_name | ||
| 262 | will return | ||
| 263 | .Dv NID_undef . | ||
| 264 | .Pp | ||
| 265 | The asn1_flag value is used to determine whether the curve encoding | ||
| 266 | uses explicit parameters or a named curve using an ASN.1 OID: | ||
| 267 | many applications only support the latter form. | ||
| 268 | If asn1_flag is the default value | ||
| 269 | .Dv OPENSSL_EC_NAMED_CURVE , | ||
| 270 | then the named curve form is used and the parameters must have a | ||
| 271 | corresponding named curve NID set. | ||
| 272 | If asn1_flags is | ||
| 273 | .Dv OPENSSL_EC_EXPLICIT_CURVE , | ||
| 274 | the parameters are explicitly encoded. | ||
| 275 | The functions | ||
| 276 | .Fn EC_GROUP_get_asn1_flag | ||
| 277 | and | ||
| 278 | .Fn EC_GROUP_set_asn1_flag | ||
| 279 | get and set the status of the asn1_flag for the curve. | ||
| 280 | .Pp | ||
| 281 | The point_conversion_form for a curve controls how | ||
| 282 | .Vt EC_POINT | ||
| 283 | data is encoded as ASN.1 as defined in X9.62 (ECDSA). | ||
| 284 | .Vt point_conversion_form_t | ||
| 285 | is an enum defined as follows: | ||
| 286 | .Bd -literal | ||
| 287 | typedef enum { | ||
| 288 | /** the point is encoded as z||x, where the octet z specifies | ||
| 289 | * which solution of the quadratic equation y is */ | ||
| 290 | POINT_CONVERSION_COMPRESSED = 2, | ||
| 291 | /** the point is encoded as z||x||y, where z is the octet 0x04 */ | ||
| 292 | POINT_CONVERSION_UNCOMPRESSED = 4, | ||
| 293 | /** the point is encoded as z||x||y, where the octet z specifies | ||
| 294 | * which solution of the quadratic equation y is */ | ||
| 295 | POINT_CONVERSION_HYBRID = 6 | ||
| 296 | } point_conversion_form_t; | ||
| 297 | .Ed | ||
| 298 | .Pp | ||
| 299 | For | ||
| 300 | .Dv POINT_CONVERSION_UNCOMPRESSED | ||
| 301 | the point is encoded as an octet signifying the UNCOMPRESSED form | ||
| 302 | has been used followed by the octets for x, followed by the octets | ||
| 303 | for y. | ||
| 304 | .Pp | ||
| 305 | For any given x coordinate for a point on a curve it is possible to | ||
| 306 | derive two possible y values. | ||
| 307 | For | ||
| 308 | .Dv POINT_CONVERSION_COMPRESSED | ||
| 309 | the point is encoded as an octet signifying that the COMPRESSED | ||
| 310 | form has been used AND which of the two possible solutions for y | ||
| 311 | has been used, followed by the octets for x. | ||
| 312 | .Pp | ||
| 313 | For | ||
| 314 | .Dv POINT_CONVERSION_HYBRID | ||
| 315 | the point is encoded as an octet signifying the HYBRID form has | ||
| 316 | been used AND which of the two possible solutions for y has been | ||
| 317 | used, followed by the octets for x, followed by the octets for y. | ||
| 318 | .Pp | ||
| 319 | The functions | ||
| 320 | .Fn EC_GROUP_set_point_conversion_form | ||
| 321 | and | ||
| 322 | .Fn EC_GROUP_get_point_conversion_form | ||
| 323 | set and get the point_conversion_form for the curve, respectively. | ||
| 324 | .Pp | ||
| 325 | ANSI X9.62 (ECDSA standard) defines a method of generating the curve | ||
| 326 | parameter b from a random number. | ||
| 327 | This provides advantages in that a parameter obtained in this way is | ||
| 328 | highly unlikely to be susceptible to special purpose attacks, or have | ||
| 329 | any trapdoors in it. | ||
| 330 | If the seed is present for a curve then the b parameter was generated in | ||
| 331 | a verifiable fashion using that seed. | ||
| 332 | The OpenSSL EC library does not use this seed value but does enable you | ||
| 333 | to inspect it using | ||
| 334 | .Fn EC_GROUP_get0_seed . | ||
| 335 | This returns a pointer to a memory block containing the seed that was | ||
| 336 | used. | ||
| 337 | The length of the memory block can be obtained using | ||
| 338 | .Fn EC_GROUP_get_seed_len . | ||
| 339 | A number of the builtin curves within the library provide seed values | ||
| 340 | that can be obtained. | ||
| 341 | It is also possible to set a custom seed using | ||
| 342 | .Fn EC_GROUP_set_seed | ||
| 343 | and passing a pointer to a memory block, along with the length of | ||
| 344 | the seed. | ||
| 345 | Again, the EC library will not use this seed value, although it will be | ||
| 346 | preserved in any ASN.1 based communications. | ||
| 347 | .Pp | ||
| 348 | .Fn EC_GROUP_get_degree | ||
| 349 | gets the degree of the field. | ||
| 350 | For Fp fields this will be the number of bits in p. | ||
| 351 | For F2^m fields this will be the value m. | ||
| 352 | .Pp | ||
| 353 | The function | ||
| 354 | .Fn EC_GROUP_check_discriminant | ||
| 355 | calculates the discriminant for the curve and verifies that it is | ||
| 356 | valid. | ||
| 357 | For a curve defined over Fp the discriminant is given by the formula | ||
| 358 | 4*a^3 + 27*b^2 whilst for F2^m curves the discriminant is simply b. | ||
| 359 | In either case for the curve to be valid the discriminant must be | ||
| 360 | non-zero. | ||
| 361 | .Pp | ||
| 362 | The function | ||
| 363 | .Fn EC_GROUP_check | ||
| 364 | performs a number of checks on a curve to verify that it is valid. | ||
| 365 | Checks performed include verifying that the discriminant is non-zero; | ||
| 366 | that a generator has been defined; that the generator is on the curve | ||
| 367 | and has the correct order. | ||
| 368 | .Pp | ||
| 369 | .Fn EC_GROUP_cmp | ||
| 370 | compares | ||
| 371 | .Fa a | ||
| 372 | and | ||
| 373 | .Fa b | ||
| 374 | to determine whether they represent the same curve or not. | ||
| 375 | .Pp | ||
| 376 | .Fn EC_GROUP_get_basis_type | ||
| 377 | always returns 0 and is only provided for compatibility. | ||
| 378 | .Sh RETURN VALUES | ||
| 379 | The following functions return 1 on success or 0 on error: | ||
| 380 | .Fn EC_GROUP_copy , | ||
| 381 | .Fn EC_GROUP_set_generator , | ||
| 382 | .Fn EC_GROUP_check , | ||
| 383 | and | ||
| 384 | .Fn EC_GROUP_check_discriminant . | ||
| 385 | .Pp | ||
| 386 | .Fn EC_GROUP_dup | ||
| 387 | returns a pointer to the duplicated curve or | ||
| 388 | .Dv NULL | ||
| 389 | on error. | ||
| 390 | .Pp | ||
| 391 | .Fn EC_GROUP_get0_generator | ||
| 392 | returns the generator for the given curve or | ||
| 393 | .Dv NULL | ||
| 394 | on error. | ||
| 395 | .Pp | ||
| 396 | .Fn EC_GROUP_get_order | ||
| 397 | returns 0 if the order is not set or set to zero for the | ||
| 398 | .Fa group | ||
| 399 | or if copying into | ||
| 400 | .Fa order | ||
| 401 | fails, or 1 otherwise. | ||
| 402 | .Pp | ||
| 403 | .Fn EC_GROUP_order_bits | ||
| 404 | returns the number of bits in the group order. | ||
| 405 | .Pp | ||
| 406 | .Fn EC_GROUP_get_cofactor | ||
| 407 | returns 0 if the cofactor is not set or set to zero for the | ||
| 408 | .Fa group | ||
| 409 | or if copying into | ||
| 410 | .Fa cofactor | ||
| 411 | fails, or 1 otherwise. | ||
| 412 | .Pp | ||
| 413 | .Fn EC_GROUP_get_curve_name | ||
| 414 | returns the curve name (NID) for the | ||
| 415 | .Fa group | ||
| 416 | or | ||
| 417 | .Dv NID_undef | ||
| 418 | if no curve name is associated. | ||
| 419 | .Pp | ||
| 420 | .Fn EC_GROUP_get_asn1_flag | ||
| 421 | returns the ASN.1 flag for the specified | ||
| 422 | .Fa group . | ||
| 423 | .Pp | ||
| 424 | .Fn EC_GROUP_get_point_conversion_form | ||
| 425 | returns the point_conversion_form for the | ||
| 426 | .Fa group . | ||
| 427 | .Pp | ||
| 428 | .Fn EC_GROUP_get_degree | ||
| 429 | returns the degree for the | ||
| 430 | .Fa group | ||
| 431 | or 0 if the operation is not supported | ||
| 432 | by the underlying group implementation. | ||
| 433 | .Pp | ||
| 434 | .Fn EC_GROUP_get0_seed | ||
| 435 | returns a pointer to the seed that was used to generate the parameter | ||
| 436 | b, or | ||
| 437 | .Dv NULL | ||
| 438 | if the seed is not specified. | ||
| 439 | .Fn EC_GROUP_get_seed_len | ||
| 440 | returns the length of the seed or 0 if the seed is not specified. | ||
| 441 | .Pp | ||
| 442 | .Fn EC_GROUP_set_seed | ||
| 443 | returns the length of the seed that has been set. | ||
| 444 | If the supplied seed is | ||
| 445 | .Dv NULL | ||
| 446 | or the supplied seed length is 0, the return value will be 1. | ||
| 447 | On error 0 is returned. | ||
| 448 | .Pp | ||
| 449 | .Fn EC_GROUP_cmp | ||
| 450 | returns 0 if the curves are equal, 1 if they are not equal, | ||
| 451 | or -1 on error. | ||
| 452 | .Pp | ||
| 453 | .Fn EC_GROUP_get_basis_type | ||
| 454 | always returns 0. | ||
| 455 | .Sh SEE ALSO | ||
| 456 | .Xr d2i_ECPKParameters 3 , | ||
| 457 | .Xr EC_GROUP_new 3 , | ||
| 458 | .Xr EC_KEY_new 3 , | ||
| 459 | .Xr EC_POINT_add 3 , | ||
| 460 | .Xr EC_POINT_new 3 | ||
| 461 | .Sh HISTORY | ||
| 462 | .Fn EC_GROUP_copy , | ||
| 463 | .Fn EC_GROUP_set_generator , | ||
| 464 | .Fn EC_GROUP_get0_generator , | ||
| 465 | .Fn EC_GROUP_get_order , | ||
| 466 | and | ||
| 467 | .Fn EC_GROUP_get_cofactor | ||
| 468 | first appeared in OpenSSL 0.9.7 and have been available since | ||
| 469 | .Ox 3.2 . | ||
| 470 | .Pp | ||
| 471 | .Fn EC_GROUP_dup , | ||
| 472 | .Fn EC_GROUP_set_curve_name , | ||
| 473 | .Fn EC_GROUP_get_curve_name , | ||
| 474 | .Fn EC_GROUP_set_asn1_flag , | ||
| 475 | .Fn EC_GROUP_get_asn1_flag , | ||
| 476 | .Fn EC_GROUP_set_point_conversion_form , | ||
| 477 | .Fn EC_GROUP_get_point_conversion_form , | ||
| 478 | .Fn EC_GROUP_get0_seed , | ||
| 479 | .Fn EC_GROUP_get_seed_len , | ||
| 480 | .Fn EC_GROUP_set_seed , | ||
| 481 | .Fn EC_GROUP_get_degree , | ||
| 482 | .Fn EC_GROUP_check , | ||
| 483 | .Fn EC_GROUP_check_discriminant , | ||
| 484 | .Fn EC_GROUP_cmp , | ||
| 485 | and | ||
| 486 | .Fn EC_GROUP_get_basis_type | ||
| 487 | first appeared in OpenSSL 0.9.8 and have been available since | ||
| 488 | .Ox 4.5 . | ||
| 489 | .Pp | ||
| 490 | .Fn EC_GROUP_order_bits | ||
| 491 | first appeared in OpenSSL 1.1.0 and has been available since | ||
| 492 | .Ox 7.0 . | ||
diff --git a/src/lib/libcrypto/man/EC_GROUP_get_curve_name.3 b/src/lib/libcrypto/man/EC_GROUP_get_curve_name.3 new file mode 100644 index 0000000000..940aa3c1a1 --- /dev/null +++ b/src/lib/libcrypto/man/EC_GROUP_get_curve_name.3 | |||
| @@ -0,0 +1,266 @@ | |||
| 1 | .\" $OpenBSD: EC_GROUP_get_curve_name.3,v 1.4 2025/06/13 18:34:00 schwarze Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2025 Theo Buehler <tb@openbsd.org> | ||
| 4 | .\" | ||
| 5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 7 | .\" copyright notice and this permission notice appear in all copies. | ||
| 8 | .\" | ||
| 9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | .\" | ||
| 17 | .Dd $Mdocdate: June 13 2025 $ | ||
| 18 | .Dt EC_GROUP_GET_CURVE_NAME 3 | ||
| 19 | .Os | ||
| 20 | .Sh NAME | ||
| 21 | .Nm EC_GROUP_get_curve_name , | ||
| 22 | .Nm EC_GROUP_set_curve_name , | ||
| 23 | .Nm EC_GROUP_get_asn1_flag , | ||
| 24 | .Nm EC_GROUP_set_asn1_flag , | ||
| 25 | .Nm EC_GROUP_get0_seed , | ||
| 26 | .Nm EC_GROUP_get_seed_len , | ||
| 27 | .Nm EC_GROUP_set_seed , | ||
| 28 | .Nm EC_GROUP_get_point_conversion_form , | ||
| 29 | .Nm EC_GROUP_set_point_conversion_form , | ||
| 30 | .Nm EC_GROUP_get_basis_type | ||
| 31 | .Nd configure and inspect details of the ASN.1 encoding of | ||
| 32 | .Vt EC_GROUP | ||
| 33 | and related objects | ||
| 34 | .Sh SYNOPSIS | ||
| 35 | .Lb libcrypto | ||
| 36 | .In openssl/ec.h | ||
| 37 | .Ft int | ||
| 38 | .Fo EC_GROUP_get_curve_name | ||
| 39 | .Fa "const EC_GROUP *group" | ||
| 40 | .Fc | ||
| 41 | .Ft void | ||
| 42 | .Fo EC_GROUP_set_curve_name | ||
| 43 | .Fa "EC_GROUP *group" | ||
| 44 | .Fa "int nid" | ||
| 45 | .Fc | ||
| 46 | .Ft int | ||
| 47 | .Fo EC_GROUP_get_asn1_flag | ||
| 48 | .Fa "const EC_GROUP *group" | ||
| 49 | .Fc | ||
| 50 | .Ft void | ||
| 51 | .Fo EC_GROUP_set_asn1_flag | ||
| 52 | .Fa "EC_GROUP *group" | ||
| 53 | .Fa "int flag" | ||
| 54 | .Fc | ||
| 55 | .Ft unsigned char * | ||
| 56 | .Fo EC_GROUP_get0_seed | ||
| 57 | .Fa "const EC_GROUP *group" | ||
| 58 | .Fc | ||
| 59 | .Ft size_t | ||
| 60 | .Fo EC_GROUP_get_seed_len | ||
| 61 | .Fa "const EC_GROUP *group" | ||
| 62 | .Fc | ||
| 63 | .Ft size_t | ||
| 64 | .Fo EC_GROUP_set_seed | ||
| 65 | .Fa "EC_GROUP *group" | ||
| 66 | .Fa "const unsigned char *seed" | ||
| 67 | .Fa "size_t len" | ||
| 68 | .Fc | ||
| 69 | .Bd -literal | ||
| 70 | typedef enum { | ||
| 71 | POINT_CONVERSION_COMPRESSED = 2, | ||
| 72 | POINT_CONVERSION_UNCOMPRESSED = 4, | ||
| 73 | POINT_CONVERSION_HYBRID = 6 | ||
| 74 | } point_conversion_form_t; | ||
| 75 | |||
| 76 | .Ed | ||
| 77 | .Ft point_conversion_form_t | ||
| 78 | .Fo EC_GROUP_get_point_conversion_form | ||
| 79 | .Fa "const EC_GROUP *group" | ||
| 80 | .Fc | ||
| 81 | .Ft void | ||
| 82 | .Fo EC_GROUP_set_point_conversion_form | ||
| 83 | .Fa "EC_GROUP *group" | ||
| 84 | .Fa "point_conversion_form_t form" | ||
| 85 | .Fc | ||
| 86 | .Pp | ||
| 87 | Deprecated: | ||
| 88 | .Pp | ||
| 89 | .Ft int | ||
| 90 | .Fo EC_GROUP_get_basis_type | ||
| 91 | .Fa "const EC_GROUP *group" | ||
| 92 | .Fc | ||
| 93 | .Sh DESCRIPTION | ||
| 94 | The functions in this manual affect or allow the inspection of | ||
| 95 | the details of the ASN.1 encoding produced by the | ||
| 96 | .Xr i2d_ECPKParameters 3 | ||
| 97 | family of functions. | ||
| 98 | Modern applications use named curves and uncompressed point encoding, | ||
| 99 | which are the default for | ||
| 100 | .Xr EC_GROUP_new_by_curve_name 3 . | ||
| 101 | .Pp | ||
| 102 | In this library, Elliptic curve parameters are either encoded as a | ||
| 103 | .Em named curve , | ||
| 104 | using an ASN.1 Object Identifier (OID) to refer to | ||
| 105 | standardized parameters that need to be built into the library, | ||
| 106 | or using | ||
| 107 | .Em explicit curve parameters | ||
| 108 | where the field, the curve equation, the base point's coordinates | ||
| 109 | and other data are encoded explicitly. | ||
| 110 | The | ||
| 111 | .Em implicitly CA | ||
| 112 | variant is not supported. | ||
| 113 | .Pp | ||
| 114 | .Fn EC_GROUP_get_curve_name | ||
| 115 | gets the Numerical Identifier (NID) representation of the | ||
| 116 | ASN.1 Object Identifier used for the named curve encoding of | ||
| 117 | .Fa group . | ||
| 118 | .Fn EC_GROUP_set_curve_name | ||
| 119 | sets it to | ||
| 120 | .Fa nid . | ||
| 121 | .Pp | ||
| 122 | .Fn EC_GROUP_get_asn1_flag | ||
| 123 | retrieves the value of the | ||
| 124 | .Fa asn1_flag | ||
| 125 | member of | ||
| 126 | .Fa group . | ||
| 127 | If the bit corresponding to | ||
| 128 | .Dv OPENSSL_EC_NAMED_CURVE | ||
| 129 | is set, named curve encoding is used for | ||
| 130 | .Fa group , | ||
| 131 | otherwise explicit encoding is used. | ||
| 132 | .Fn EC_GROUP_set_asn1_flag | ||
| 133 | sets the | ||
| 134 | .Fa asn1_flag | ||
| 135 | member of group to | ||
| 136 | .Fa flag , | ||
| 137 | which should be either | ||
| 138 | .Dv OPENSSL_EC_NAMED_CURVE | ||
| 139 | to use named curve encoding or | ||
| 140 | .Dv OPENSSL_EC_EXPLICIT_CURVE | ||
| 141 | to use explicit encoding. | ||
| 142 | .Pp | ||
| 143 | The ASN.1 encoding of explicit curve parameters includes | ||
| 144 | an optional seed value for parameters generated verifiably at random. | ||
| 145 | If a seed value is set on | ||
| 146 | .Fa group , | ||
| 147 | .Fn EC_GROUP_get0_seed | ||
| 148 | returns a pointer to the internal byte string whose length is returned by | ||
| 149 | .Fn EC_GROUP_get_seed_len . | ||
| 150 | .Pp | ||
| 151 | .Fn EC_GROUP_set_seed | ||
| 152 | first clears any seed and length already stored in | ||
| 153 | .Fa group . | ||
| 154 | If | ||
| 155 | .Fa seed | ||
| 156 | is not | ||
| 157 | .Dv NULL | ||
| 158 | and | ||
| 159 | .Fa len | ||
| 160 | is not zero, it stores a copy of them in | ||
| 161 | .Fa group . | ||
| 162 | The | ||
| 163 | .Fa seed | ||
| 164 | should be a random byte string of | ||
| 165 | .Fa len | ||
| 166 | at least 20 bytes. | ||
| 167 | The seed can be unset by passing | ||
| 168 | .Dv NULL | ||
| 169 | as a | ||
| 170 | .Fa seed | ||
| 171 | and a | ||
| 172 | .Fa len | ||
| 173 | of zero. | ||
| 174 | The library does not perform any computation or validation with this seed, | ||
| 175 | it only includes it in its ASN.1 encoded parameters, | ||
| 176 | whether it contains a sensible value or not. | ||
| 177 | .Pp | ||
| 178 | Points on an elliptic curve, such as the generator or a public key, | ||
| 179 | can be encoded in compressed form, uncompressed form, | ||
| 180 | or in a hybrid form encompassing both, see | ||
| 181 | .Xr EC_POINT_point2oct 3 . | ||
| 182 | .Fn EC_GROUP_get_point_conversion_form | ||
| 183 | retrieves the encoding used for points on | ||
| 184 | .Fa group | ||
| 185 | and | ||
| 186 | .Fn EC_GROUP_set_point_conversion_form | ||
| 187 | sets it to | ||
| 188 | .Fa form . | ||
| 189 | .Pp | ||
| 190 | The deprecated | ||
| 191 | .Fn EC_GROUP_get_basis_type | ||
| 192 | only makes sense for curves over binary fields. | ||
| 193 | It is provided for compatibility only. | ||
| 194 | .Sh RETURN VALUES | ||
| 195 | .Fn EC_GROUP_get_curve_name | ||
| 196 | returns the NID to be used for named curve encoding of | ||
| 197 | .Fa group | ||
| 198 | or | ||
| 199 | .Dv NID_undef | ||
| 200 | if no NID is set. | ||
| 201 | .Pp | ||
| 202 | .Fn EC_GROUP_get_asn1_flag | ||
| 203 | returns the value most recently set by | ||
| 204 | .Fn EC_GROUP_set_asn1_flag | ||
| 205 | on | ||
| 206 | .Fa group . | ||
| 207 | .Pp | ||
| 208 | .Fn EC_GROUP_get0_seed | ||
| 209 | returns an internal pointer to the | ||
| 210 | .Fa seed | ||
| 211 | on | ||
| 212 | .Fa group | ||
| 213 | or | ||
| 214 | .Dv NULL | ||
| 215 | if none is set. | ||
| 216 | .Pp | ||
| 217 | .Fn EC_GROUP_get_seed_len | ||
| 218 | returns the byte length of the seed set on | ||
| 219 | .Fa group | ||
| 220 | or zero if none is set. | ||
| 221 | .Pp | ||
| 222 | .Fn EC_GROUP_set_seed | ||
| 223 | returns 0 on memory allocation failure. | ||
| 224 | It returns | ||
| 225 | .Fa len | ||
| 226 | on success unless | ||
| 227 | .Fa seed | ||
| 228 | is | ||
| 229 | .Dv NULL | ||
| 230 | or | ||
| 231 | .Fa len | ||
| 232 | is zero, in which case it returns 1. | ||
| 233 | .Pp | ||
| 234 | .Fn EC_GROUP_get_point_conversion_form | ||
| 235 | returns the point conversion form last set by | ||
| 236 | .Fn EC_GROUP_set_point_conversion_form | ||
| 237 | on | ||
| 238 | .Fa group . | ||
| 239 | .Pp | ||
| 240 | .Fn EC_GROUP_get_basis_type | ||
| 241 | always returns | ||
| 242 | .Dv NID_undef . | ||
| 243 | .Sh SEE ALSO | ||
| 244 | .Xr crypto 3 , | ||
| 245 | .Xr d2i_ECPKParameters 3 , | ||
| 246 | .Xr EC_GROUP_check 3 , | ||
| 247 | .Xr EC_GROUP_new_by_curve_name 3 , | ||
| 248 | .Xr EC_GROUP_new_curve_GFp 3 , | ||
| 249 | .Xr EC_KEY_METHOD_new 3 , | ||
| 250 | .Xr EC_KEY_new 3 , | ||
| 251 | .Xr EC_POINT_add 3 , | ||
| 252 | .Xr EC_POINT_get_affine_coordinates 3 , | ||
| 253 | .Xr EC_POINT_new 3 , | ||
| 254 | .Xr EC_POINT_point2oct 3 , | ||
| 255 | .Xr ECDH_compute_key 3 , | ||
| 256 | .Xr ECDSA_SIG_new 3 , | ||
| 257 | .Xr OBJ_obj2nid 3 | ||
| 258 | .Sh HISTORY | ||
| 259 | These functions first appeared in OpenSSL 0.9.8 and have been available since | ||
| 260 | .Ox 4.5 . | ||
| 261 | .Sh BUGS | ||
| 262 | Most of the setters cannot report errors and none of them perform proper | ||
| 263 | input validation and accept most of the values passed in. | ||
| 264 | This can result in invalid or nonsensical ASN.1 encoding produced by | ||
| 265 | .Xr i2d_ECPKParameters 3 | ||
| 266 | and related functions. | ||
diff --git a/src/lib/libcrypto/man/EC_GROUP_new.3 b/src/lib/libcrypto/man/EC_GROUP_new.3 deleted file mode 100644 index 83e3e4c870..0000000000 --- a/src/lib/libcrypto/man/EC_GROUP_new.3 +++ /dev/null | |||
| @@ -1,353 +0,0 @@ | |||
| 1 | .\" $OpenBSD: EC_GROUP_new.3,v 1.18 2025/03/08 16:38:13 tb Exp $ | ||
| 2 | .\" OpenSSL 6328d367 Sat Jul 4 21:58:30 2020 +0200 | ||
| 3 | .\" | ||
| 4 | .\" This file was written by Matt Caswell <matt@openssl.org>. | ||
| 5 | .\" Copyright (c) 2013 The OpenSSL Project. All rights reserved. | ||
| 6 | .\" | ||
| 7 | .\" Redistribution and use in source and binary forms, with or without | ||
| 8 | .\" modification, are permitted provided that the following conditions | ||
| 9 | .\" are met: | ||
| 10 | .\" | ||
| 11 | .\" 1. Redistributions of source code must retain the above copyright | ||
| 12 | .\" notice, this list of conditions and the following disclaimer. | ||
| 13 | .\" | ||
| 14 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
| 15 | .\" notice, this list of conditions and the following disclaimer in | ||
| 16 | .\" the documentation and/or other materials provided with the | ||
| 17 | .\" distribution. | ||
| 18 | .\" | ||
| 19 | .\" 3. All advertising materials mentioning features or use of this | ||
| 20 | .\" software must display the following acknowledgment: | ||
| 21 | .\" "This product includes software developed by the OpenSSL Project | ||
| 22 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 23 | .\" | ||
| 24 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 25 | .\" endorse or promote products derived from this software without | ||
| 26 | .\" prior written permission. For written permission, please contact | ||
| 27 | .\" openssl-core@openssl.org. | ||
| 28 | .\" | ||
| 29 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
| 30 | .\" nor may "OpenSSL" appear in their names without prior written | ||
| 31 | .\" permission of the OpenSSL Project. | ||
| 32 | .\" | ||
| 33 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
| 34 | .\" acknowledgment: | ||
| 35 | .\" "This product includes software developed by the OpenSSL Project | ||
| 36 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 37 | .\" | ||
| 38 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 39 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 40 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 41 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 42 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 43 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 44 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 45 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 46 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 47 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 50 | .\" | ||
| 51 | .Dd $Mdocdate: March 8 2025 $ | ||
| 52 | .Dt EC_GROUP_NEW 3 | ||
| 53 | .Os | ||
| 54 | .Sh NAME | ||
| 55 | .Nm EC_GROUP_new , | ||
| 56 | .Nm EC_GROUP_free , | ||
| 57 | .Nm EC_GROUP_clear_free , | ||
| 58 | .Nm EC_GROUP_new_curve_GFp , | ||
| 59 | .Nm EC_GROUP_new_by_curve_name , | ||
| 60 | .Nm EC_GROUP_set_curve , | ||
| 61 | .Nm EC_GROUP_get_curve , | ||
| 62 | .Nm EC_GROUP_set_curve_GFp , | ||
| 63 | .Nm EC_GROUP_get_curve_GFp , | ||
| 64 | .Nm EC_get_builtin_curves , | ||
| 65 | .Nm EC_curve_nid2nist , | ||
| 66 | .Nm EC_curve_nist2nid | ||
| 67 | .Nd create and destroy EC_GROUP objects | ||
| 68 | .Sh SYNOPSIS | ||
| 69 | .In openssl/ec.h | ||
| 70 | .In openssl/bn.h | ||
| 71 | .Ft EC_GROUP * | ||
| 72 | .Fo EC_GROUP_new | ||
| 73 | .Fa "const EC_METHOD *meth" | ||
| 74 | .Fc | ||
| 75 | .Ft void | ||
| 76 | .Fo EC_GROUP_free | ||
| 77 | .Fa "EC_GROUP *group" | ||
| 78 | .Fc | ||
| 79 | .Ft void | ||
| 80 | .Fo EC_GROUP_clear_free | ||
| 81 | .Fa "EC_GROUP *group" | ||
| 82 | .Fc | ||
| 83 | .Ft EC_GROUP * | ||
| 84 | .Fo EC_GROUP_new_curve_GFp | ||
| 85 | .Fa "const BIGNUM *p" | ||
| 86 | .Fa "const BIGNUM *a" | ||
| 87 | .Fa "const BIGNUM *b" | ||
| 88 | .Fa "BN_CTX *ctx" | ||
| 89 | .Fc | ||
| 90 | .Ft EC_GROUP * | ||
| 91 | .Fo EC_GROUP_new_by_curve_name | ||
| 92 | .Fa "int nid" | ||
| 93 | .Fc | ||
| 94 | .Ft int | ||
| 95 | .Fo EC_GROUP_set_curve | ||
| 96 | .Fa "EC_GROUP *group" | ||
| 97 | .Fa "const BIGNUM *p" | ||
| 98 | .Fa "const BIGNUM *a" | ||
| 99 | .Fa "const BIGNUM *b" | ||
| 100 | .Fa "BN_CTX *ctx" | ||
| 101 | .Fc | ||
| 102 | .Ft int | ||
| 103 | .Fo EC_GROUP_get_curve | ||
| 104 | .Fa "const EC_GROUP *group" | ||
| 105 | .Fa "BIGNUM *p" | ||
| 106 | .Fa "BIGNUM *a" | ||
| 107 | .Fa "BIGNUM *b" | ||
| 108 | .Fa "BN_CTX *ctx" | ||
| 109 | .Fc | ||
| 110 | .Ft int | ||
| 111 | .Fo EC_GROUP_set_curve_GFp | ||
| 112 | .Fa "EC_GROUP *group" | ||
| 113 | .Fa "const BIGNUM *p" | ||
| 114 | .Fa "const BIGNUM *a" | ||
| 115 | .Fa "const BIGNUM *b" | ||
| 116 | .Fa "BN_CTX *ctx" | ||
| 117 | .Fc | ||
| 118 | .Ft int | ||
| 119 | .Fo EC_GROUP_get_curve_GFp | ||
| 120 | .Fa "const EC_GROUP *group" | ||
| 121 | .Fa "BIGNUM *p" | ||
| 122 | .Fa "BIGNUM *a" | ||
| 123 | .Fa "BIGNUM *b" | ||
| 124 | .Fa "BN_CTX *ctx" | ||
| 125 | .Fc | ||
| 126 | .Ft size_t | ||
| 127 | .Fo EC_get_builtin_curves | ||
| 128 | .Fa "EC_builtin_curve *r" | ||
| 129 | .Fa "size_t nitems" | ||
| 130 | .Fc | ||
| 131 | .Ft "const char *" | ||
| 132 | .Fo EC_curve_nid2nist | ||
| 133 | .Fa "int nid" | ||
| 134 | .Fc | ||
| 135 | .Ft int | ||
| 136 | .Fo EC_curve_nist2nid | ||
| 137 | .Fa "const char *name" | ||
| 138 | .Fc | ||
| 139 | .Sh DESCRIPTION | ||
| 140 | The EC library provides functions for performing operations on | ||
| 141 | elliptic curves in Weierstrass form. | ||
| 142 | Such curves are defined over the prime field of order | ||
| 143 | .Fa p | ||
| 144 | and satisfy the Weierstrass equation with coefficients | ||
| 145 | .Fa a | ||
| 146 | and | ||
| 147 | .Fa b | ||
| 148 | .Pp | ||
| 149 | .Dl y^2 = x^3 + ax + b | ||
| 150 | .Pp | ||
| 151 | An | ||
| 152 | .Vt EC_GROUP | ||
| 153 | structure is used to represent the definition of an elliptic curve. | ||
| 154 | A new curve can be constructed by calling | ||
| 155 | .Fn EC_GROUP_new , | ||
| 156 | using the implementation provided by | ||
| 157 | .Fa meth . | ||
| 158 | It is then necessary to call | ||
| 159 | .Fn EC_GROUP_set_curve | ||
| 160 | to set the curve parameters. | ||
| 161 | .Pp | ||
| 162 | .Fn EC_GROUP_set_curve | ||
| 163 | sets the curve parameters | ||
| 164 | .Fa p , | ||
| 165 | .Fa a , | ||
| 166 | and | ||
| 167 | .Fa b , | ||
| 168 | where | ||
| 169 | .Fa a | ||
| 170 | and | ||
| 171 | .Fa b | ||
| 172 | represent the coefficients of the curve equation. | ||
| 173 | .Pp | ||
| 174 | .Fn EC_GROUP_set_curve_GFp | ||
| 175 | is a deprecated synonym for | ||
| 176 | .Fn EC_GROUP_set_curve . | ||
| 177 | .Pp | ||
| 178 | .Fn EC_GROUP_get_curve | ||
| 179 | obtains the previously set curve parameters. | ||
| 180 | .Pp | ||
| 181 | .Fn EC_GROUP_get_curve_GFp | ||
| 182 | is a deprecated synonym for | ||
| 183 | .Fn EC_GROUP_get_curve . | ||
| 184 | .Pp | ||
| 185 | The function | ||
| 186 | .Fn EC_GROUP_new_curve_GFp | ||
| 187 | is a shortcut for calling | ||
| 188 | .Fn EC_GROUP_new | ||
| 189 | and | ||
| 190 | .Fn EC_GROUP_set_curve . | ||
| 191 | An appropriate default implementation method will be used. | ||
| 192 | .Pp | ||
| 193 | Whilst the library can be used to create any curve using the functions | ||
| 194 | described above, there are also a number of predefined curves that are | ||
| 195 | available. | ||
| 196 | In order to obtain a list of all of the predefined curves, call the | ||
| 197 | function | ||
| 198 | .Fn EC_get_builtin_curves . | ||
| 199 | The parameter | ||
| 200 | .Fa r | ||
| 201 | should be an array of | ||
| 202 | .Vt EC_builtin_cure | ||
| 203 | structures of size | ||
| 204 | .Fa nitems . | ||
| 205 | The function will populate the | ||
| 206 | .Fa r | ||
| 207 | array with information about the builtin curves. | ||
| 208 | If | ||
| 209 | .Fa nitems | ||
| 210 | is less than the total number of curves available, then the first | ||
| 211 | .Fa nitems | ||
| 212 | curves will be returned. | ||
| 213 | Otherwise the total number of curves will be provided. | ||
| 214 | The return value is the total number of curves available (whether that | ||
| 215 | number has been populated in | ||
| 216 | .Fa r | ||
| 217 | or not). | ||
| 218 | Passing a | ||
| 219 | .Dv NULL | ||
| 220 | .Fa r , | ||
| 221 | or setting | ||
| 222 | .Fa nitems | ||
| 223 | to 0, will do nothing other than return the total number of curves | ||
| 224 | available. | ||
| 225 | The | ||
| 226 | .Vt EC_builtin_curve | ||
| 227 | structure is defined as follows: | ||
| 228 | .Bd -literal | ||
| 229 | typedef struct { | ||
| 230 | int nid; | ||
| 231 | const char *comment; | ||
| 232 | } EC_builtin_curve; | ||
| 233 | .Ed | ||
| 234 | .Pp | ||
| 235 | Each | ||
| 236 | .Vt EC_builtin_curve | ||
| 237 | item has a unique integer ID | ||
| 238 | .Pq Fa nid | ||
| 239 | and a human readable comment string describing the curve. | ||
| 240 | .Pp | ||
| 241 | In order to construct a builtin curve, use the function | ||
| 242 | .Fn EC_GROUP_new_by_curve_name | ||
| 243 | and provide the | ||
| 244 | .Fa nid | ||
| 245 | of the curve to be constructed. | ||
| 246 | .Pp | ||
| 247 | .Fn EC_GROUP_free | ||
| 248 | frees the memory associated with the | ||
| 249 | .Vt EC_GROUP . | ||
| 250 | If | ||
| 251 | .Fa group | ||
| 252 | is a | ||
| 253 | .Dv NULL | ||
| 254 | pointer, no action occurs. | ||
| 255 | .Pp | ||
| 256 | .Fn EC_GROUP_clear_free | ||
| 257 | destroys any sensitive data held within the | ||
| 258 | .Vt EC_GROUP | ||
| 259 | and then frees its memory. | ||
| 260 | If | ||
| 261 | .Fa group | ||
| 262 | is a | ||
| 263 | .Dv NULL | ||
| 264 | pointer, no action occurs. | ||
| 265 | .Pp | ||
| 266 | Some builtin curves can be identified by their NIST name | ||
| 267 | in addition to a numerical identifier (NID). | ||
| 268 | .Fn EC_curve_nid2nist | ||
| 269 | and | ||
| 270 | .Fn EC_curve_nist2nid | ||
| 271 | translate between the two. | ||
| 272 | The five built-in prime curves are: | ||
| 273 | .Pp | ||
| 274 | .Bl -column "NIST name" NID_X9_62_prime256v1 "deprecated in SP800-186" -compact | ||
| 275 | .It No NIST Fa name Ta Em ASN.1 NID Ta Em notes | ||
| 276 | .It Qq P-192 Ta Dv NID_X9_62_prime192v1 Ta No deprecated in SP800-186 | ||
| 277 | .It Qq P-224 Ta Dv NID_secp224r1 Ta | ||
| 278 | .It Qq P-256 Ta Dv NID_X9_62_prime256v1 Ta | ||
| 279 | .It Qq P-384 Ta Dv NID_secp384r1 Ta | ||
| 280 | .It Qq P-521 Ta Dv NID_secp521r1 Ta | ||
| 281 | .El | ||
| 282 | .Pp | ||
| 283 | .Fn EC_curve_nid2nist | ||
| 284 | and | ||
| 285 | .Fn EC_curve_nist2nid | ||
| 286 | also accept the ten binary curves defined in FIPS\& 186-4 | ||
| 287 | and deprecated in SP800-186, | ||
| 288 | although they no longer correspond to builtin curves in LibreSSL. | ||
| 289 | .Sh RETURN VALUES | ||
| 290 | All | ||
| 291 | .Fn EC_GROUP_new* | ||
| 292 | functions return a pointer to the newly constructed group or | ||
| 293 | .Dv NULL | ||
| 294 | on error. | ||
| 295 | .Pp | ||
| 296 | .Fn EC_get_builtin_curves | ||
| 297 | returns the number of builtin curves that are available. | ||
| 298 | .Pp | ||
| 299 | .Fn EC_curve_nid2nist | ||
| 300 | returns a string constant containing the NIST name if | ||
| 301 | .Fa nid | ||
| 302 | identifies a NIST curve or | ||
| 303 | .Dv NULL | ||
| 304 | otherwise. | ||
| 305 | .Pp | ||
| 306 | .Fn EC_curve_nist2nid | ||
| 307 | returns the NID corresponding to the NIST curve | ||
| 308 | .Fa name , | ||
| 309 | or | ||
| 310 | .Dv NID_undef . | ||
| 311 | .Pp | ||
| 312 | .Fn EC_GROUP_set_curve , | ||
| 313 | .Fn EC_GROUP_get_curve , | ||
| 314 | .Fn EC_GROUP_set_curve_GFp , | ||
| 315 | and | ||
| 316 | .Fn EC_GROUP_get_curve_GFp | ||
| 317 | return 1 on success or 0 on error. | ||
| 318 | .Sh SEE ALSO | ||
| 319 | .Xr crypto 3 , | ||
| 320 | .Xr d2i_ECPKParameters 3 , | ||
| 321 | .Xr EC_GROUP_copy 3 , | ||
| 322 | .Xr EC_KEY_new 3 , | ||
| 323 | .Xr EC_POINT_add 3 , | ||
| 324 | .Xr EC_POINT_new 3 , | ||
| 325 | .Xr ECDH_compute_key 3 , | ||
| 326 | .Xr ECDSA_SIG_new 3 | ||
| 327 | .Sh HISTORY | ||
| 328 | .Fn EC_GROUP_new , | ||
| 329 | .Fn EC_GROUP_free , | ||
| 330 | .Fn EC_GROUP_clear_free , | ||
| 331 | .Fn EC_GROUP_new_curve_GFp , | ||
| 332 | .Fn EC_GROUP_set_curve_GFp , | ||
| 333 | and | ||
| 334 | .Fn EC_GROUP_get_curve_GFp | ||
| 335 | first appeared in OpenSSL 0.9.7 and have been available since | ||
| 336 | .Ox 3.2 . | ||
| 337 | .Pp | ||
| 338 | .Fn EC_GROUP_new_by_curve_name | ||
| 339 | and | ||
| 340 | .Fn EC_get_builtin_curves | ||
| 341 | first appeared in OpenSSL 0.9.8 and have been available since | ||
| 342 | .Ox 4.5 . | ||
| 343 | .Fn EC_curve_nid2nist , | ||
| 344 | and | ||
| 345 | .Fn EC_curve_nist2nid | ||
| 346 | first appeared in OpenSSL 1.1.0 and have been available since | ||
| 347 | .Ox 5.8 . | ||
| 348 | .Pp | ||
| 349 | .Fn EC_GROUP_set_curve | ||
| 350 | and | ||
| 351 | .Fn EC_GROUP_get_curve | ||
| 352 | first appeared in OpenSSL 1.1.1 and have been available since | ||
| 353 | .Ox 7.0 . | ||
diff --git a/src/lib/libcrypto/man/EC_GROUP_new_by_curve_name.3 b/src/lib/libcrypto/man/EC_GROUP_new_by_curve_name.3 new file mode 100644 index 0000000000..e05365874f --- /dev/null +++ b/src/lib/libcrypto/man/EC_GROUP_new_by_curve_name.3 | |||
| @@ -0,0 +1,311 @@ | |||
| 1 | .\" $OpenBSD: EC_GROUP_new_by_curve_name.3,v 1.4 2025/06/13 18:34:00 schwarze Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2024, 2025 Theo Buehler <tb@openbsd.org> | ||
| 4 | .\" | ||
| 5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 7 | .\" copyright notice and this permission notice appear in all copies. | ||
| 8 | .\" | ||
| 9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | .\" | ||
| 17 | .Dd $Mdocdate: June 13 2025 $ | ||
| 18 | .Dt EC_GROUP_NEW_BY_CURVE_NAME 3 | ||
| 19 | .Os | ||
| 20 | .Sh NAME | ||
| 21 | .Nm EC_GROUP_new_by_curve_name , | ||
| 22 | .Nm EC_GROUP_free , | ||
| 23 | .Nm EC_GROUP_dup , | ||
| 24 | .Nm EC_GROUP_cmp , | ||
| 25 | .Nm EC_get_builtin_curves , | ||
| 26 | .Nm EC_curve_nid2nist , | ||
| 27 | .Nm EC_curve_nist2nid | ||
| 28 | .Nd instantiate named curves built into libcrypto | ||
| 29 | .Sh SYNOPSIS | ||
| 30 | .Lb libcrypto | ||
| 31 | .In openssl/bn.h | ||
| 32 | .In openssl/ec.h | ||
| 33 | .In openssl/objects.h | ||
| 34 | .Ft EC_GROUP * | ||
| 35 | .Fo EC_GROUP_new_by_curve_name | ||
| 36 | .Fa "int nid" | ||
| 37 | .Fc | ||
| 38 | .Ft void | ||
| 39 | .Fo EC_GROUP_free | ||
| 40 | .Fa "EC_GROUP *group" | ||
| 41 | .Fc | ||
| 42 | .Ft EC_GROUP * | ||
| 43 | .Fo EC_GROUP_dup | ||
| 44 | .Fa "const EC_GROUP *group" | ||
| 45 | .Fc | ||
| 46 | .Ft int | ||
| 47 | .Fo EC_GROUP_cmp | ||
| 48 | .Fa "const EC_GROUP *group1" | ||
| 49 | .Fa "const EC_GROUP *group2" | ||
| 50 | .Fa "BN_CTX *ctx" | ||
| 51 | .Fc | ||
| 52 | .Bd -literal | ||
| 53 | typedef struct { | ||
| 54 | int nid; | ||
| 55 | const char *comment; | ||
| 56 | } EC_builtin_curve; | ||
| 57 | |||
| 58 | .Ed | ||
| 59 | .Ft size_t | ||
| 60 | .Fo EC_get_builtin_curves | ||
| 61 | .Fa "EC_builtin_curve *curves" | ||
| 62 | .Fa "size_t ncurves" | ||
| 63 | .Fc | ||
| 64 | .Ft int | ||
| 65 | .Fo EC_curve_nist2nid | ||
| 66 | .Fa "const char *name" | ||
| 67 | .Fc | ||
| 68 | .Ft const char * | ||
| 69 | .Fo EC_curve_nid2nist | ||
| 70 | .Fa "int nid" | ||
| 71 | .Fc | ||
| 72 | .Sh DESCRIPTION | ||
| 73 | Most elliptic curves used in cryptographic protocols have a | ||
| 74 | standardized representation as a | ||
| 75 | .Em named curve , | ||
| 76 | where an ASN.1 Object Identifier (OID) is used instead of | ||
| 77 | detailed domain parameters. | ||
| 78 | This OID is represented internally by a Numerical Identifier (NID), | ||
| 79 | and the parameters themselves must be built into the library. | ||
| 80 | In the EC library the | ||
| 81 | .Em curve name | ||
| 82 | refers to this NID. | ||
| 83 | .Pp | ||
| 84 | .Fn EC_GROUP_new_by_curve_name | ||
| 85 | returns a new | ||
| 86 | .Vt EC_GROUP | ||
| 87 | object representing the named curve corresponding to | ||
| 88 | .Fa nid , | ||
| 89 | using the parameters built into the library. | ||
| 90 | It is equivalent to passing the appropriate parameters to | ||
| 91 | .Xr EC_GROUP_new_curve_GFp 3 , | ||
| 92 | .Xr EC_GROUP_set_curve_name 3 , | ||
| 93 | .Xr EC_GROUP_set_generator 3 | ||
| 94 | and | ||
| 95 | .Xr EC_GROUP_set_seed 3 . | ||
| 96 | .Pp | ||
| 97 | .Fn EC_GROUP_free | ||
| 98 | frees | ||
| 99 | .Fa group | ||
| 100 | and all the memory associated with it. | ||
| 101 | If | ||
| 102 | .Fa group | ||
| 103 | is | ||
| 104 | .Dv NULL , | ||
| 105 | no action occurs. | ||
| 106 | .Pp | ||
| 107 | .Fn EC_GROUP_dup | ||
| 108 | creates a deep copy of | ||
| 109 | .Fa group . | ||
| 110 | .Pp | ||
| 111 | .Fn EC_GROUP_cmp | ||
| 112 | is intended to determine whether | ||
| 113 | .Fa group1 | ||
| 114 | and | ||
| 115 | .Fa group2 | ||
| 116 | represent the same elliptic curve, | ||
| 117 | making use of the optional | ||
| 118 | .Fa ctx . | ||
| 119 | If the curve name is set on both curves, they are compared as integers, | ||
| 120 | then the prime field, | ||
| 121 | the coefficients of the Weierstrass equation, | ||
| 122 | the generators, their order and their cofactors are compared | ||
| 123 | using | ||
| 124 | .Xr BN_cmp 3 | ||
| 125 | or | ||
| 126 | .Xr EC_POINT_cmp 3 , | ||
| 127 | respectively. | ||
| 128 | .Pp | ||
| 129 | .Fn EC_get_builtin_curves | ||
| 130 | returns the number of builtin curves. | ||
| 131 | If | ||
| 132 | .Fa curves | ||
| 133 | is | ||
| 134 | .Dv NULL | ||
| 135 | or | ||
| 136 | .Fa ncurves | ||
| 137 | is zero, it performs no other action. | ||
| 138 | Otherwise, after reducing | ||
| 139 | .Fa ncurves | ||
| 140 | to the number of builtin curves if necessary, | ||
| 141 | it copies the | ||
| 142 | .Fa nid | ||
| 143 | and a pointer to the | ||
| 144 | .Fa comment | ||
| 145 | of the first | ||
| 146 | .Fa ncurves | ||
| 147 | built-in curves to the array of | ||
| 148 | .Vt EC_builtin_curve | ||
| 149 | objects pointed to by | ||
| 150 | .Fa curves | ||
| 151 | and leaves the remainder of the array uninitialized. | ||
| 152 | .Pp | ||
| 153 | Some curves can be identified by their NIST name | ||
| 154 | in addition to the numerical identifier (NID). | ||
| 155 | .Fn EC_curve_nist2nid | ||
| 156 | and | ||
| 157 | .Fn EC_curve_nid2nist | ||
| 158 | translate between the two. | ||
| 159 | The builtin NIST curves over a prime field are: | ||
| 160 | .Pp | ||
| 161 | .Bl -column "NIST name" NID_X9_62_prime256v1 "deprecated in SP800-186" -compact | ||
| 162 | .It No NIST Fa name Ta Em ASN.1 NID Ta Em notes | ||
| 163 | .It Qq P-224 Ta Dv NID_secp224r1 Ta | ||
| 164 | .It Qq P-256 Ta Dv NID_X9_62_prime256v1 Ta also known as secp256r1 | ||
| 165 | .It Qq P-384 Ta Dv NID_secp384r1 Ta | ||
| 166 | .It Qq P-521 Ta Dv NID_secp521r1 Ta | ||
| 167 | .El | ||
| 168 | .Pp | ||
| 169 | .Fn EC_curve_nist2nid | ||
| 170 | and | ||
| 171 | .Fn EC_curve_nid2nist | ||
| 172 | also accept the binary curves defined in FIPS\& 186-4 | ||
| 173 | and deprecated in SP800-186, | ||
| 174 | as well as | ||
| 175 | .Qq P-192 | ||
| 176 | and | ||
| 177 | .Dv NID_X9_62_prime192v1 , | ||
| 178 | although all these no longer correspond to builtin curves in LibreSSL. | ||
| 179 | .Sh RETURN VALUES | ||
| 180 | .Fn EC_GROUP_new_by_curve_name | ||
| 181 | returns a newly allocated group or | ||
| 182 | .Dv NULL | ||
| 183 | if there is no built-in group with NID | ||
| 184 | .Fa nid , | ||
| 185 | or if memory allocation fails. | ||
| 186 | .Pp | ||
| 187 | .Fn EC_GROUP_dup | ||
| 188 | returns a newly allocated group or | ||
| 189 | .Dv NULL | ||
| 190 | if memory allocation fails. | ||
| 191 | .Pp | ||
| 192 | .Fn EC_GROUP_cmp | ||
| 193 | returns 1 if the groups are distinct, 0 if the groups are | ||
| 194 | considered identical and \-1 on memory allocation error. | ||
| 195 | .Pp | ||
| 196 | .Fn EC_get_builtin_curves | ||
| 197 | returns the number of builtin curves. | ||
| 198 | .Pp | ||
| 199 | .Fn EC_curve_nid2nist | ||
| 200 | returns a string constant containing the NIST name if | ||
| 201 | .Fa nid | ||
| 202 | identifies a NIST curve or | ||
| 203 | .Dv NULL | ||
| 204 | otherwise. | ||
| 205 | .Pp | ||
| 206 | .Fn EC_curve_nist2nid | ||
| 207 | returns the NID corresponding to the NIST curve | ||
| 208 | .Fa name , | ||
| 209 | or | ||
| 210 | .Dv NID_undef . | ||
| 211 | .Sh EXAMPLES | ||
| 212 | Print the list of builtin curves, their NIDs, their NIST name and | ||
| 213 | a comment describing each curve: | ||
| 214 | .Bd -literal | ||
| 215 | #include <err.h> | ||
| 216 | #include <stdio.h> | ||
| 217 | #include <stdlib.h> | ||
| 218 | #include <unistd.h> | ||
| 219 | |||
| 220 | #include <openssl/ec.h> | ||
| 221 | |||
| 222 | int | ||
| 223 | main(void) | ||
| 224 | { | ||
| 225 | EC_builtin_curve *curves; | ||
| 226 | size_t ncurves, i; | ||
| 227 | |||
| 228 | if (pledge("stdio", NULL) == \-1) | ||
| 229 | err(1, "pledge"); | ||
| 230 | |||
| 231 | ncurves = EC_get_builtin_curves(NULL, 0); | ||
| 232 | if ((curves = calloc(ncurves, sizeof(*curves))) == NULL) | ||
| 233 | err(1, NULL); | ||
| 234 | (void)EC_get_builtin_curves(curves, ncurves); | ||
| 235 | |||
| 236 | printf("curve\etnid\etNIST\etcomment\en"); | ||
| 237 | for (i = 0; i < ncurves; i++) { | ||
| 238 | const char *nist_name = EC_curve_nid2nist(curves[i].nid); | ||
| 239 | |||
| 240 | printf("%2zu\et%d\et%s\et%s\en", i, curves[i].nid, | ||
| 241 | nist_name != NULL ? nist_name : "", curves[i].comment); | ||
| 242 | } | ||
| 243 | |||
| 244 | free(curves); | ||
| 245 | |||
| 246 | return 0; | ||
| 247 | } | ||
| 248 | .Ed | ||
| 249 | .Sh SEE ALSO | ||
| 250 | .Xr crypto 3 , | ||
| 251 | .Xr d2i_ECPKParameters 3 , | ||
| 252 | .Xr EC_GROUP_check 3 , | ||
| 253 | .Xr EC_GROUP_get_curve_name 3 , | ||
| 254 | .Xr EC_GROUP_new_curve_GFp 3 , | ||
| 255 | .Xr EC_KEY_METHOD_new 3 , | ||
| 256 | .Xr EC_KEY_new 3 , | ||
| 257 | .Xr EC_POINT_add 3 , | ||
| 258 | .Xr EC_POINT_get_affine_coordinates 3 , | ||
| 259 | .Xr EC_POINT_new 3 , | ||
| 260 | .Xr EC_POINT_point2oct 3 , | ||
| 261 | .Xr ECDH_compute_key 3 , | ||
| 262 | .Xr ECDSA_SIG_new 3 , | ||
| 263 | .Xr OBJ_nid2obj 3 | ||
| 264 | .Sh STANDARDS | ||
| 265 | .Rs | ||
| 266 | .%T SEC 1: Elliptic Curve Cryptography, Version 2.0 | ||
| 267 | .%U https://www.secg.org/sec1-v2.pdf | ||
| 268 | .%D May 21, 2009 | ||
| 269 | .Re | ||
| 270 | .Pp | ||
| 271 | .Rs | ||
| 272 | .%T SEC 2: Recommended Elliptic Curve Domain Parameters, Version 2.0 | ||
| 273 | .%U https://www.secg.org/sec2-v2.pdf | ||
| 274 | .%D Jan 27, 2010 | ||
| 275 | .Re | ||
| 276 | .Sh HISTORY | ||
| 277 | .Fn EC_GROUP_free | ||
| 278 | first appeared in OpenSSL 0.9.7 and has been available since | ||
| 279 | .Ox 3.2 . | ||
| 280 | .Pp | ||
| 281 | .Fn EC_GROUP_new_by_curve_name , | ||
| 282 | .Fn EC_GROUP_cmp , | ||
| 283 | .Fn EC_GROUP_dup , | ||
| 284 | and | ||
| 285 | .Fn EC_get_builtin_curves | ||
| 286 | first appeared in OpenSSL 0.9.8 and have been available since | ||
| 287 | .Ox 4.5 . | ||
| 288 | .Pp | ||
| 289 | .Fn EC_curve_nid2nist | ||
| 290 | and | ||
| 291 | .Fn EC_curve_nist2nid | ||
| 292 | first appeared in OpenSSL 1.1.0 and have been available since | ||
| 293 | .Ox 5.8 . | ||
| 294 | .Sh BUGS | ||
| 295 | .Fn EC_GROUP_cmp | ||
| 296 | compares the coefficients of the Weierstrass equation as | ||
| 297 | integers, not as elements of the prime field. | ||
| 298 | It also treats the generator as mandatory while it is generally | ||
| 299 | optional in the EC library. | ||
| 300 | Aspects of the ASN.1 encoding controlled by the functions in | ||
| 301 | .Xr EC_GROUP_get_asn1_flag 3 , | ||
| 302 | in particular seed, ASN.1 flag, and point conversion form, | ||
| 303 | are ignored in the comparison. | ||
| 304 | Group objects may therefore compare as equal and produce | ||
| 305 | completely different ASN.1 encodings via | ||
| 306 | .Xr i2d_ECPKParameters 3 | ||
| 307 | and related functions. | ||
| 308 | In fact, either of these encodings might be valid or not, | ||
| 309 | accepted or rejected by | ||
| 310 | .Xr d2i_ECPKParameters 3 , | ||
| 311 | or the encoding might fail on one or both of the group objects. | ||
diff --git a/src/lib/libcrypto/man/EC_GROUP_new_curve_GFp.3 b/src/lib/libcrypto/man/EC_GROUP_new_curve_GFp.3 new file mode 100644 index 0000000000..bf586bcb41 --- /dev/null +++ b/src/lib/libcrypto/man/EC_GROUP_new_curve_GFp.3 | |||
| @@ -0,0 +1,463 @@ | |||
| 1 | .\" $OpenBSD: EC_GROUP_new_curve_GFp.3,v 1.6 2025/08/31 11:32:03 tb Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2025 Theo Buehler <tb@openbsd.org> | ||
| 4 | .\" | ||
| 5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 7 | .\" copyright notice and this permission notice appear in all copies. | ||
| 8 | .\" | ||
| 9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | .\" | ||
| 17 | .Dd $Mdocdate: August 31 2025 $ | ||
| 18 | .Dt EC_GROUP_NEW_CURVE_GFP 3 | ||
| 19 | .Os | ||
| 20 | .Sh NAME | ||
| 21 | .Nm EC_GROUP_new_curve_GFp , | ||
| 22 | .Nm EC_GROUP_set_curve , | ||
| 23 | .Nm EC_GROUP_get_curve , | ||
| 24 | .Nm EC_GROUP_set_generator , | ||
| 25 | .Nm EC_GROUP_get0_generator , | ||
| 26 | .Nm EC_GROUP_get_degree , | ||
| 27 | .Nm EC_GROUP_get_order , | ||
| 28 | .Nm EC_GROUP_order_bits , | ||
| 29 | .Nm EC_GROUP_get_cofactor , | ||
| 30 | .Nm EC_GROUP_clear_free , | ||
| 31 | .Nm EC_GROUP_set_curve_GFp , | ||
| 32 | .Nm EC_GROUP_get_curve_GFp | ||
| 33 | .Nd define elliptic curves and retrieve information from them | ||
| 34 | .Sh SYNOPSIS | ||
| 35 | .Lb libcrypto | ||
| 36 | .In openssl/bn.h | ||
| 37 | .In openssl/ec.h | ||
| 38 | .Ft EC_GROUP * | ||
| 39 | .Fo EC_GROUP_new_curve_GFp | ||
| 40 | .Fa "const BIGNUM *p" | ||
| 41 | .Fa "const BIGNUM *a" | ||
| 42 | .Fa "const BIGNUM *b" | ||
| 43 | .Fa "BN_CTX *ctx" | ||
| 44 | .Fc | ||
| 45 | .Ft int | ||
| 46 | .Fo EC_GROUP_set_curve | ||
| 47 | .Fa "EC_GROUP *group" | ||
| 48 | .Fa "const BIGNUM *p" | ||
| 49 | .Fa "const BIGNUM *a" | ||
| 50 | .Fa "const BIGNUM *b" | ||
| 51 | .Fa "BN_CTX *ctx" | ||
| 52 | .Fc | ||
| 53 | .Ft int | ||
| 54 | .Fo EC_GROUP_get_curve | ||
| 55 | .Fa "const EC_GROUP *group" | ||
| 56 | .Fa "BIGNUM *p" | ||
| 57 | .Fa "BIGNUM *a" | ||
| 58 | .Fa "BIGNUM *b" | ||
| 59 | .Fa "BN_CTX *ctx" | ||
| 60 | .Fc | ||
| 61 | .Ft int | ||
| 62 | .Fo EC_GROUP_set_generator | ||
| 63 | .Fa "EC_GROUP *group" | ||
| 64 | .Fa "const EC_POINT *generator" | ||
| 65 | .Fa "const BIGNUM *order" | ||
| 66 | .Fa "const BIGNUM *cofactor" | ||
| 67 | .Fc | ||
| 68 | .Ft const EC_POINT * | ||
| 69 | .Fo EC_GROUP_get0_generator | ||
| 70 | .Fa "const EC_GROUP *group" | ||
| 71 | .Fc | ||
| 72 | .Ft int | ||
| 73 | .Fo EC_GROUP_get_degree | ||
| 74 | .Fa "const EC_GROUP *" | ||
| 75 | .Fc | ||
| 76 | .Ft int | ||
| 77 | .Fo EC_GROUP_get_order | ||
| 78 | .Fa "const EC_GROUP *group" | ||
| 79 | .Fa "BIGNUM *order" | ||
| 80 | .Fa "BN_CTX *ctx" | ||
| 81 | .Fc | ||
| 82 | .Ft int | ||
| 83 | .Fo EC_GROUP_order_bits | ||
| 84 | .Fa "const EC_GROUP *group" | ||
| 85 | .Fc | ||
| 86 | .Ft int | ||
| 87 | .Fo EC_GROUP_get_cofactor | ||
| 88 | .Fa "const EC_GROUP *group" | ||
| 89 | .Fa "BIGNUM *cofactor" | ||
| 90 | .Fa "BN_CTX *ctx" | ||
| 91 | .Fc | ||
| 92 | .Pp | ||
| 93 | Deprecated: | ||
| 94 | .Pp | ||
| 95 | .Ft void | ||
| 96 | .Fo EC_GROUP_clear_free | ||
| 97 | .Fa "EC_GROUP *group" | ||
| 98 | .Fc | ||
| 99 | .Ft int | ||
| 100 | .Fo EC_GROUP_set_curve_GFp | ||
| 101 | .Fa "EC_GROUP *group" | ||
| 102 | .Fa "const BIGNUM *p" | ||
| 103 | .Fa "const BIGNUM *a" | ||
| 104 | .Fa "const BIGNUM *b" | ||
| 105 | .Fa "BN_CTX *ctx" | ||
| 106 | .Fc | ||
| 107 | .Ft int | ||
| 108 | .Fo EC_GROUP_get_curve_GFp | ||
| 109 | .Fa "const EC_GROUP *group" | ||
| 110 | .Fa "BIGNUM *p" | ||
| 111 | .Fa "BIGNUM *a" | ||
| 112 | .Fa "BIGNUM *b" | ||
| 113 | .Fa "BN_CTX *ctx" | ||
| 114 | .Fc | ||
| 115 | .Sh DESCRIPTION | ||
| 116 | With the exception of the getters | ||
| 117 | the functions in this manual should not be used. | ||
| 118 | Use | ||
| 119 | .Xr EC_GROUP_new_by_curve_name 3 | ||
| 120 | instead. | ||
| 121 | .Pp | ||
| 122 | The EC library uses | ||
| 123 | .Vt EC_GROUP | ||
| 124 | objects to represent | ||
| 125 | elliptic curves in Weierstrass form. | ||
| 126 | These curves are defined over the prime field of order | ||
| 127 | .Fa p | ||
| 128 | via the Weierstrass equation | ||
| 129 | .Pp | ||
| 130 | .Dl y^2 = x^3 + ax + b | ||
| 131 | .Pp | ||
| 132 | where | ||
| 133 | .Fa a | ||
| 134 | and | ||
| 135 | .Fa b | ||
| 136 | are such that the discriminant 4a^3 - 27b^2 is non-zero. | ||
| 137 | They consist of | ||
| 138 | .Em affine points , | ||
| 139 | which are pairs of field elements (x, y) satisfying | ||
| 140 | the Weierstrass equation, and an extra | ||
| 141 | .Em point at infinity . | ||
| 142 | .Pp | ||
| 143 | The points on an elliptic curve form a group. | ||
| 144 | Cryptographic applications usually depend on the choice of a | ||
| 145 | .Fa generator | ||
| 146 | whose multiples form a cyclic subgroup of a certain | ||
| 147 | .Fa order . | ||
| 148 | By Lagrange's theorem, the number of points on the elliptic curve is | ||
| 149 | the product of | ||
| 150 | .Fa order | ||
| 151 | and another integer called the | ||
| 152 | .Fa cofactor . | ||
| 153 | Hasse's theorem is the inequality | ||
| 154 | .Pp | ||
| 155 | .Dl | Ns Fa order No * Fa cofactor No - (p + 1)| <= 2 sqrt(p) | ||
| 156 | .Pp | ||
| 157 | which implies an upper bound on | ||
| 158 | .Fa order | ||
| 159 | in terms of | ||
| 160 | .Fa p | ||
| 161 | and allows the computation of | ||
| 162 | .Fa cofactor | ||
| 163 | provided that | ||
| 164 | .Fa order | ||
| 165 | is large enough. | ||
| 166 | .Pp | ||
| 167 | .Fn EC_GROUP_new_curve_GFp | ||
| 168 | instantiates a new | ||
| 169 | .Vt EC_GROUP | ||
| 170 | object over the prime field of size | ||
| 171 | .Fa p | ||
| 172 | with Weierstrass equation given by the coefficients | ||
| 173 | .Fa a | ||
| 174 | and | ||
| 175 | .Fa b . | ||
| 176 | The optional | ||
| 177 | .Fa ctx | ||
| 178 | is used to transform the other arguments into internal representation. | ||
| 179 | It is the caller's responsibility to ensure that | ||
| 180 | .Fa p | ||
| 181 | is a prime number greater than three and that | ||
| 182 | the discriminant is non-zero. | ||
| 183 | This can be done with | ||
| 184 | .Xr EC_GROUP_check_discriminant 3 | ||
| 185 | or as part of | ||
| 186 | .Xr EC_GROUP_check 3 | ||
| 187 | after | ||
| 188 | .Fn EC_GROUP_set_generator . | ||
| 189 | .Pp | ||
| 190 | .Fn EC_GROUP_set_curve | ||
| 191 | sets the curve parameters of | ||
| 192 | .Fa group | ||
| 193 | to | ||
| 194 | .Fa p , | ||
| 195 | .Fa a , | ||
| 196 | .Fa b | ||
| 197 | using the optional | ||
| 198 | .Fa ctx | ||
| 199 | and the comments in | ||
| 200 | .Fn EC_GROUP_new_curve_GFp | ||
| 201 | apply. | ||
| 202 | Existing | ||
| 203 | .Fa generator , | ||
| 204 | .Fa order , | ||
| 205 | or | ||
| 206 | .Fa cofactor | ||
| 207 | on | ||
| 208 | .Fa group | ||
| 209 | are left unmodified and become most likely invalid. | ||
| 210 | They must therefore be set to legitimate values using | ||
| 211 | .Fn EC_GROUP_set_generator . | ||
| 212 | .Pp | ||
| 213 | .Fn EC_GROUP_get_curve | ||
| 214 | copies the curve parameters of | ||
| 215 | .Fa group | ||
| 216 | into the caller-owned | ||
| 217 | .Fa p , | ||
| 218 | .Fa a , | ||
| 219 | and | ||
| 220 | .Fa b , | ||
| 221 | possibly making use of the | ||
| 222 | .Fa ctx | ||
| 223 | for conversion from internal representations. | ||
| 224 | Except for | ||
| 225 | .Fa group , | ||
| 226 | all arguments are optional. | ||
| 227 | .Pp | ||
| 228 | .Fn EC_GROUP_set_generator | ||
| 229 | performs sanity checks based on Hasse's theorem | ||
| 230 | and copies | ||
| 231 | .Fa generator , | ||
| 232 | .Fa order | ||
| 233 | and the optional | ||
| 234 | .Fa cofactor | ||
| 235 | into | ||
| 236 | .Fa group , | ||
| 237 | replacing all existing entries. | ||
| 238 | It is the caller's responsibility to ensure that | ||
| 239 | .Fa generator | ||
| 240 | is a point on the curve and that | ||
| 241 | .Fa order | ||
| 242 | is its order, | ||
| 243 | which can partially be accomplished with a subsequent call to | ||
| 244 | .Xr EC_GROUP_check 3 . | ||
| 245 | If | ||
| 246 | .Fa cofactor | ||
| 247 | is | ||
| 248 | .Dv NULL , | ||
| 249 | it can be computed on curves of cryptographic interest, | ||
| 250 | in which case | ||
| 251 | .Fa cofactor | ||
| 252 | is set to the computed value, otherwise it is set to zero. | ||
| 253 | .Pp | ||
| 254 | .Fn EC_GROUP_get0_generator | ||
| 255 | returns an internal pointer to the | ||
| 256 | .Fa group Ns 's | ||
| 257 | .Fa generator , | ||
| 258 | which may be | ||
| 259 | .Dv NULL | ||
| 260 | if no generator was set. | ||
| 261 | .Pp | ||
| 262 | .Fn EC_GROUP_get_degree | ||
| 263 | returns the bit length of the prime | ||
| 264 | .Fa p | ||
| 265 | set on | ||
| 266 | .Fa group . | ||
| 267 | .Pp | ||
| 268 | .Fn EC_GROUP_get_order | ||
| 269 | copies the value of the | ||
| 270 | .Fa group Ns 's | ||
| 271 | .Fa order | ||
| 272 | into the caller-owned | ||
| 273 | .Fa order , | ||
| 274 | returning failure if the | ||
| 275 | .Fa group Ns 's | ||
| 276 | .Fa order | ||
| 277 | is zero. | ||
| 278 | The | ||
| 279 | .Fa ctx | ||
| 280 | argument is ignored. | ||
| 281 | .Pp | ||
| 282 | .Fn EC_GROUP_order_bits | ||
| 283 | returns the number of bits in the | ||
| 284 | .Fa group Ns 's | ||
| 285 | .Fa order , | ||
| 286 | which is the result of calling | ||
| 287 | .Xr BN_num_bits 3 | ||
| 288 | on | ||
| 289 | .Fa order . | ||
| 290 | Unlike | ||
| 291 | .Fn EC_GROUP_get_order , | ||
| 292 | it does not fail if | ||
| 293 | .Fa order | ||
| 294 | is zero. | ||
| 295 | .Pp | ||
| 296 | .Fn EC_GROUP_get_cofactor | ||
| 297 | copies the value of the | ||
| 298 | .Fa group Ns 's | ||
| 299 | .Fa cofactor | ||
| 300 | into the caller-owned | ||
| 301 | .Fa cofactor , | ||
| 302 | returning failure if the | ||
| 303 | .Fa group Ns 's | ||
| 304 | .Fa cofactor | ||
| 305 | is zero. | ||
| 306 | The | ||
| 307 | .Fa ctx | ||
| 308 | argument is ignored. | ||
| 309 | .Pp | ||
| 310 | The deprecated | ||
| 311 | .Fn EC_GROUP_clear_free | ||
| 312 | uses | ||
| 313 | .Xr explicit_bzero 3 | ||
| 314 | and | ||
| 315 | .Xr freezero 3 | ||
| 316 | to clear and free all data associated with | ||
| 317 | .Fa group . | ||
| 318 | If | ||
| 319 | .Fa group | ||
| 320 | is | ||
| 321 | .Dv NULL , | ||
| 322 | no action occurs. | ||
| 323 | Since there is no secret data in | ||
| 324 | .Fa group , | ||
| 325 | this API is useless. | ||
| 326 | In LibreSSL, | ||
| 327 | .Xr EC_GROUP_free 3 | ||
| 328 | and | ||
| 329 | .Fn EC_GROUP_clear_free | ||
| 330 | behave identically. | ||
| 331 | .Pp | ||
| 332 | .Fn EC_GROUP_set_curve_GFp | ||
| 333 | and | ||
| 334 | .Fn EC_GROUP_get_curve_GFp | ||
| 335 | are deprecated aliases for | ||
| 336 | .Fn EC_GROUP_set_curve | ||
| 337 | and | ||
| 338 | .Fn EC_GROUP_get_curve , | ||
| 339 | respectively. | ||
| 340 | .Sh RETURN VALUES | ||
| 341 | .Fn EC_GROUP_new_curve_GFp | ||
| 342 | returns a newly allocated group or | ||
| 343 | .Dv NULL | ||
| 344 | if memory allocation fails, | ||
| 345 | or if some minimal sanity checks on | ||
| 346 | .Fa p , | ||
| 347 | .Fa a , | ||
| 348 | and | ||
| 349 | .Fa b | ||
| 350 | fail. | ||
| 351 | .Pp | ||
| 352 | .Fn EC_GROUP_set_curve | ||
| 353 | and | ||
| 354 | .Fn EC_GROUP_set_curve_GFp | ||
| 355 | return 1 on success and 0 on failure. | ||
| 356 | Failure conditions include that | ||
| 357 | .Fa p | ||
| 358 | is smaller than or equal to three, or even, or | ||
| 359 | memory allocation failure. | ||
| 360 | .Pp | ||
| 361 | .Fn EC_GROUP_get_curve | ||
| 362 | and | ||
| 363 | .Fn EC_GROUP_get_curve_GFp | ||
| 364 | return 1 on success and 0 on memory allocation failure. | ||
| 365 | .Pp | ||
| 366 | .Fn EC_GROUP_set_generator | ||
| 367 | returns 1 on success and 0 on memory allocation failure, or if | ||
| 368 | .Fa order | ||
| 369 | or | ||
| 370 | .Fa cofactor | ||
| 371 | are larger than Hasse's theorem allows. | ||
| 372 | .Pp | ||
| 373 | .Fn EC_GROUP_get0_generator | ||
| 374 | returns an internal pointer to the | ||
| 375 | .Fa generator | ||
| 376 | or | ||
| 377 | .Dv NULL | ||
| 378 | if none was set on | ||
| 379 | .Fa group . | ||
| 380 | .Pp | ||
| 381 | .Fn EC_GROUP_get_order | ||
| 382 | returns 1 on success or 0 on memory allocation failure or if the | ||
| 383 | .Fa order | ||
| 384 | is zero. | ||
| 385 | .Pp | ||
| 386 | .Fn EC_GROUP_get_cofactor | ||
| 387 | returns 1 on success or 0 on memory allocation failure or if the | ||
| 388 | .Fa cofactor | ||
| 389 | is zero. | ||
| 390 | .Pp | ||
| 391 | .Fn EC_GROUP_get_degree , | ||
| 392 | and | ||
| 393 | .Fn EC_GROUP_order_bits | ||
| 394 | return the number of bits in the | ||
| 395 | .Fa group Ns 's | ||
| 396 | .Fa p , | ||
| 397 | and | ||
| 398 | .Fa order , | ||
| 399 | respectively. | ||
| 400 | .Sh SEE ALSO | ||
| 401 | .Xr BN_new 3 , | ||
| 402 | .Xr BN_num_bits 3 , | ||
| 403 | .Xr crypto 3 , | ||
| 404 | .Xr d2i_ECPKParameters 3 , | ||
| 405 | .Xr EC_GROUP_check 3 , | ||
| 406 | .Xr EC_GROUP_get_curve_name 3 , | ||
| 407 | .Xr EC_GROUP_new_by_curve_name 3 , | ||
| 408 | .Xr EC_KEY_METHOD_new 3 , | ||
| 409 | .Xr EC_KEY_new 3 , | ||
| 410 | .Xr EC_POINT_add 3 , | ||
| 411 | .Xr EC_POINT_get_affine_coordinates 3 , | ||
| 412 | .Xr EC_POINT_new 3 , | ||
| 413 | .Xr EC_POINT_point2oct 3 , | ||
| 414 | .Xr ECDH_compute_key 3 , | ||
| 415 | .Xr ECDSA_SIG_new 3 | ||
| 416 | .Sh STANDARDS | ||
| 417 | .Rs | ||
| 418 | .%T SEC 1: Elliptic Curve Cryptography, Version 2.0 | ||
| 419 | .%U https://www.secg.org/sec1-v2.pdf | ||
| 420 | .%D May 21, 2009 | ||
| 421 | .Re | ||
| 422 | .Pp | ||
| 423 | .Rs | ||
| 424 | .%T SEC 2: Recommended Elliptic Curve Domain Parameters, Version 2.0 | ||
| 425 | .%U https://www.secg.org/sec2-v2.pdf | ||
| 426 | .%D Jan 27, 2010 | ||
| 427 | .Re | ||
| 428 | .Sh HISTORY | ||
| 429 | .Fn EC_GROUP_new_curve_GFp , | ||
| 430 | .Fn EC_GROUP_clear_free , | ||
| 431 | .Fn EC_GROUP_set_curve_GFp , | ||
| 432 | .Fn EC_GROUP_get_curve_GFp , | ||
| 433 | .Fn EC_GROUP_set_generator , | ||
| 434 | .Fn EC_GROUP_get0_generator , | ||
| 435 | .Fn EC_GROUP_get_order , | ||
| 436 | and | ||
| 437 | .Fn EC_GROUP_get_cofactor | ||
| 438 | first appeared in OpenSSL 0.9.7 and | ||
| 439 | have been available since | ||
| 440 | .Ox 3.2 . | ||
| 441 | .Pp | ||
| 442 | .Fn EC_GROUP_get_degree | ||
| 443 | first appeared in OpenSSL 0.9.8 and | ||
| 444 | has been available since | ||
| 445 | .Ox 4.5 . | ||
| 446 | .Pp | ||
| 447 | .Fn EC_GROUP_set_curve , | ||
| 448 | .Fn EC_GROUP_get_curve , | ||
| 449 | and | ||
| 450 | .Fn EC_GROUP_order_bits | ||
| 451 | first appeared in OpenSSL 1.1.1 and | ||
| 452 | have been available since | ||
| 453 | .Ox 7.0 | ||
| 454 | .Sh BUGS | ||
| 455 | Too many. | ||
| 456 | The API is unergonomic and the design is very poor even by | ||
| 457 | OpenSSL's standards. | ||
| 458 | Naming is inconsistent, especially in regard to the _GFp suffix | ||
| 459 | and the _get_ infix. | ||
| 460 | Function signatures are inconsistent. | ||
| 461 | In particular, functions that should have a | ||
| 462 | .Vt BN_CTX | ||
| 463 | argument don't have one and functions that don't need it have one. | ||
diff --git a/src/lib/libcrypto/man/EC_KEY_METHOD_new.3 b/src/lib/libcrypto/man/EC_KEY_METHOD_new.3 index 79c16ef014..a0ab6bac9e 100644 --- a/src/lib/libcrypto/man/EC_KEY_METHOD_new.3 +++ b/src/lib/libcrypto/man/EC_KEY_METHOD_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EC_KEY_METHOD_new.3,v 1.4 2024/07/21 08:36:43 tb Exp $ | 1 | .\" $OpenBSD: EC_KEY_METHOD_new.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> | 2 | .\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> |
| 3 | .\" | 3 | .\" |
| 4 | .\" Permission to use, copy, modify, and distribute this software for any | 4 | .\" Permission to use, copy, modify, and distribute this software for any |
| @@ -13,7 +13,7 @@ | |||
| 13 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 13 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 14 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | .\" | 15 | .\" |
| 16 | .Dd $Mdocdate: July 21 2024 $ | 16 | .Dd $Mdocdate: June 8 2025 $ |
| 17 | .Dt EC_KEY_METHOD_NEW 3 | 17 | .Dt EC_KEY_METHOD_NEW 3 |
| 18 | .Os | 18 | .Os |
| 19 | .Sh NAME | 19 | .Sh NAME |
| @@ -37,6 +37,7 @@ | |||
| 37 | .Nm EC_KEY_get_method | 37 | .Nm EC_KEY_get_method |
| 38 | .Nd custom EC_KEY implementations | 38 | .Nd custom EC_KEY implementations |
| 39 | .Sh SYNOPSIS | 39 | .Sh SYNOPSIS |
| 40 | .Lb libcrypto | ||
| 40 | .In openssl/ec.h | 41 | .In openssl/ec.h |
| 41 | .Ft EC_KEY_METHOD * | 42 | .Ft EC_KEY_METHOD * |
| 42 | .Fo EC_KEY_METHOD_new | 43 | .Fo EC_KEY_METHOD_new |
| @@ -312,7 +313,16 @@ returns 1 for success or 0 for failure. | |||
| 312 | returns the EC_KEY implementation used by the given | 313 | returns the EC_KEY implementation used by the given |
| 313 | .Fa key . | 314 | .Fa key . |
| 314 | .Sh SEE ALSO | 315 | .Sh SEE ALSO |
| 316 | .Xr crypto 3 , | ||
| 317 | .Xr EC_GROUP_check 3 , | ||
| 318 | .Xr EC_GROUP_get_curve_name 3 , | ||
| 319 | .Xr EC_GROUP_new_by_curve_name 3 , | ||
| 320 | .Xr EC_GROUP_new_curve_GFp 3 , | ||
| 315 | .Xr EC_KEY_new 3 , | 321 | .Xr EC_KEY_new 3 , |
| 322 | .Xr EC_POINT_add 3 , | ||
| 323 | .Xr EC_POINT_get_affine_coordinates 3 , | ||
| 324 | .Xr EC_POINT_new 3 , | ||
| 325 | .Xr EC_POINT_point2oct 3 , | ||
| 316 | .Xr ECDSA_sign 3 | 326 | .Xr ECDSA_sign 3 |
| 317 | .Sh HISTORY | 327 | .Sh HISTORY |
| 318 | These functions first appeared in OpenSSL 1.1.0 | 328 | These functions first appeared in OpenSSL 1.1.0 |
diff --git a/src/lib/libcrypto/man/EC_KEY_new.3 b/src/lib/libcrypto/man/EC_KEY_new.3 index c24cb080ef..41ebbbe878 100644 --- a/src/lib/libcrypto/man/EC_KEY_new.3 +++ b/src/lib/libcrypto/man/EC_KEY_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EC_KEY_new.3,v 1.21 2025/03/08 16:38:13 tb Exp $ | 1 | .\" $OpenBSD: EC_KEY_new.3,v 1.23 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 3aef36ff Jan 5 13:06:03 2016 -0500 | 2 | .\" full merge up to: OpenSSL 3aef36ff Jan 5 13:06:03 2016 -0500 |
| 3 | .\" partial merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 | 3 | .\" partial merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: March 8 2025 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt EC_KEY_NEW 3 | 53 | .Dt EC_KEY_NEW 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -81,6 +81,7 @@ | |||
| 81 | .Nm EC_KEY_print_fp | 81 | .Nm EC_KEY_print_fp |
| 82 | .Nd create, destroy and manipulate EC_KEY objects | 82 | .Nd create, destroy and manipulate EC_KEY objects |
| 83 | .Sh SYNOPSIS | 83 | .Sh SYNOPSIS |
| 84 | .Lb libcrypto | ||
| 84 | .In openssl/ec.h | 85 | .In openssl/ec.h |
| 85 | .In openssl/bn.h | 86 | .In openssl/bn.h |
| 86 | .Ft EC_KEY * | 87 | .Ft EC_KEY * |
| @@ -234,7 +235,7 @@ and supplying the | |||
| 234 | .Fa nid | 235 | .Fa nid |
| 235 | of the associated curve. | 236 | of the associated curve. |
| 236 | Refer to | 237 | Refer to |
| 237 | .Xr EC_GROUP_new 3 | 238 | .Xr EC_GROUP_new_by_curve_name 3 |
| 238 | for a description of curve names. | 239 | for a description of curve names. |
| 239 | This function simply wraps calls to | 240 | This function simply wraps calls to |
| 240 | .Fn EC_KEY_new | 241 | .Fn EC_KEY_new |
| @@ -357,7 +358,7 @@ The format of the external representation of the public key written by | |||
| 357 | such as whether it is stored in a compressed form or not, | 358 | such as whether it is stored in a compressed form or not, |
| 358 | is described by the point_conversion_form. | 359 | is described by the point_conversion_form. |
| 359 | See | 360 | See |
| 360 | .Xr EC_GROUP_copy 3 | 361 | .Xr EC_POINT_point2oct 3 |
| 361 | for a description of point_conversion_form. | 362 | for a description of point_conversion_form. |
| 362 | .Pp | 363 | .Pp |
| 363 | When reading a private key encoded without an associated public key, | 364 | When reading a private key encoded without an associated public key, |
| @@ -378,7 +379,7 @@ and | |||
| 378 | get and set the point_conversion_form for the | 379 | get and set the point_conversion_form for the |
| 379 | .Fa key . | 380 | .Fa key . |
| 380 | For a description of point_conversion_form refer to | 381 | For a description of point_conversion_form refer to |
| 381 | .Xr EC_GROUP_copy 3 . | 382 | .Xr EC_POINT_point2oct 3 . |
| 382 | .Pp | 383 | .Pp |
| 383 | .Fn EC_KEY_set_flags | 384 | .Fn EC_KEY_set_flags |
| 384 | sets the flags in the | 385 | sets the flags in the |
| @@ -407,7 +408,7 @@ sets the asn1_flag on the underlying | |||
| 407 | .Vt EC_GROUP | 408 | .Vt EC_GROUP |
| 408 | object (if set). | 409 | object (if set). |
| 409 | Refer to | 410 | Refer to |
| 410 | .Xr EC_GROUP_copy 3 | 411 | .Xr EC_GROUP_get_curve_name 3 |
| 411 | for further information on the asn1_flag. | 412 | for further information on the asn1_flag. |
| 412 | .Pp | 413 | .Pp |
| 413 | .Fn EC_KEY_precompute_mult | 414 | .Fn EC_KEY_precompute_mult |
| @@ -488,11 +489,14 @@ returns the point_conversion_form for the | |||
| 488 | .Vt EC_KEY . | 489 | .Vt EC_KEY . |
| 489 | .Sh SEE ALSO | 490 | .Sh SEE ALSO |
| 490 | .Xr d2i_ECPKParameters 3 , | 491 | .Xr d2i_ECPKParameters 3 , |
| 491 | .Xr EC_GROUP_copy 3 , | 492 | .Xr EC_GROUP_check 3 , |
| 492 | .Xr EC_GROUP_new 3 , | 493 | .Xr EC_GROUP_get_curve_name 3 , |
| 494 | .Xr EC_GROUP_new_by_curve_name 3 , | ||
| 495 | .Xr EC_GROUP_new_curve_GFp 3 , | ||
| 493 | .Xr EC_KEY_METHOD_new 3 , | 496 | .Xr EC_KEY_METHOD_new 3 , |
| 494 | .Xr EC_POINT_add 3 , | 497 | .Xr EC_POINT_add 3 , |
| 495 | .Xr EC_POINT_new 3 , | 498 | .Xr EC_POINT_get_affine_coordinates 3 , |
| 499 | .Xr EC_POINT_point2oct 3 , | ||
| 496 | .Xr ECDH_compute_key 3 , | 500 | .Xr ECDH_compute_key 3 , |
| 497 | .Xr ECDSA_SIG_new 3 , | 501 | .Xr ECDSA_SIG_new 3 , |
| 498 | .Xr EVP_PKEY_set1_EC_KEY 3 | 502 | .Xr EVP_PKEY_set1_EC_KEY 3 |
diff --git a/src/lib/libcrypto/man/EC_POINT_add.3 b/src/lib/libcrypto/man/EC_POINT_add.3 index cc35499c0e..28f3143a8d 100644 --- a/src/lib/libcrypto/man/EC_POINT_add.3 +++ b/src/lib/libcrypto/man/EC_POINT_add.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EC_POINT_add.3,v 1.15 2025/03/08 16:48:22 tb Exp $ | 1 | .\" $OpenBSD: EC_POINT_add.3,v 1.17 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Matt Caswell <matt@openssl.org>. | 4 | .\" This file was written by Matt Caswell <matt@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 8 2025 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt EC_POINT_ADD 3 | 52 | .Dt EC_POINT_ADD 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -62,6 +62,7 @@ | |||
| 62 | .Nm EC_POINT_mul | 62 | .Nm EC_POINT_mul |
| 63 | .Nd perform mathematical operations and tests on EC_POINT objects | 63 | .Nd perform mathematical operations and tests on EC_POINT objects |
| 64 | .Sh SYNOPSIS | 64 | .Sh SYNOPSIS |
| 65 | .Lb libcrypto | ||
| 65 | .In openssl/ec.h | 66 | .In openssl/ec.h |
| 66 | .In openssl/bn.h | 67 | .In openssl/bn.h |
| 67 | .Ft int | 68 | .Ft int |
| @@ -177,7 +178,7 @@ in which case the result is just | |||
| 177 | .Dl q * m. | 178 | .Dl q * m. |
| 178 | .Pp | 179 | .Pp |
| 179 | See | 180 | See |
| 180 | .Xr EC_GROUP_copy 3 | 181 | .Xr EC_GROUP_new_curve_GFp 3 |
| 181 | for information about the generator. | 182 | for information about the generator. |
| 182 | .Sh RETURN VALUES | 183 | .Sh RETURN VALUES |
| 183 | The following functions return 1 on success or 0 on error: | 184 | The following functions return 1 on success or 0 on error: |
| @@ -197,11 +198,17 @@ returns 1 if the point is on the curve, 0 if not, or -1 on error. | |||
| 197 | .Fn EC_POINT_cmp | 198 | .Fn EC_POINT_cmp |
| 198 | returns 1 if the points are not equal, 0 if they are, or -1 on error. | 199 | returns 1 if the points are not equal, 0 if they are, or -1 on error. |
| 199 | .Sh SEE ALSO | 200 | .Sh SEE ALSO |
| 201 | .Xr crypto 3 , | ||
| 200 | .Xr d2i_ECPKParameters 3 , | 202 | .Xr d2i_ECPKParameters 3 , |
| 201 | .Xr EC_GROUP_copy 3 , | 203 | .Xr EC_GROUP_check 3 , |
| 202 | .Xr EC_GROUP_new 3 , | 204 | .Xr EC_GROUP_get_curve_name 3 , |
| 205 | .Xr EC_GROUP_new_by_curve_name 3 , | ||
| 206 | .Xr EC_GROUP_new_curve_GFp 3 , | ||
| 207 | .Xr EC_KEY_METHOD_new 3 , | ||
| 203 | .Xr EC_KEY_new 3 , | 208 | .Xr EC_KEY_new 3 , |
| 204 | .Xr EC_POINT_new 3 | 209 | .Xr EC_POINT_get_affine_coordinates 3 , |
| 210 | .Xr EC_POINT_new 3 , | ||
| 211 | .Xr EC_POINT_point2oct 3 | ||
| 205 | .Sh HISTORY | 212 | .Sh HISTORY |
| 206 | .Fn EC_POINT_add , | 213 | .Fn EC_POINT_add , |
| 207 | .Fn EC_POINT_dbl , | 214 | .Fn EC_POINT_dbl , |
diff --git a/src/lib/libcrypto/man/EC_POINT_get_affine_coordinates.3 b/src/lib/libcrypto/man/EC_POINT_get_affine_coordinates.3 new file mode 100644 index 0000000000..76ef516307 --- /dev/null +++ b/src/lib/libcrypto/man/EC_POINT_get_affine_coordinates.3 | |||
| @@ -0,0 +1,216 @@ | |||
| 1 | .\" $OpenBSD: EC_POINT_get_affine_coordinates.3,v 1.2 2025/06/08 22:40:29 schwarze Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2025 Theo Buehler <tb@openbsd.org> | ||
| 4 | .\" | ||
| 5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 7 | .\" copyright notice and this permission notice appear in all copies. | ||
| 8 | .\" | ||
| 9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | .\" | ||
| 17 | .Dd $Mdocdate: June 8 2025 $ | ||
| 18 | .Dt EC_POINT_GET_AFFINE_COORDINATES 3 | ||
| 19 | .Os | ||
| 20 | .Sh NAME | ||
| 21 | .Nm EC_POINT_get_affine_coordinates , | ||
| 22 | .Nm EC_POINT_set_affine_coordinates , | ||
| 23 | .Nm EC_POINT_set_compressed_coordinates , | ||
| 24 | .Nm EC_POINT_set_to_infinity , | ||
| 25 | .Nm EC_POINT_get_affine_coordinates_GFp , | ||
| 26 | .Nm EC_POINT_set_affine_coordinates_GFp , | ||
| 27 | .Nm EC_POINT_set_compressed_coordinates_GFp | ||
| 28 | .Nd get and set coordinates of elliptic curve points | ||
| 29 | .Sh SYNOPSIS | ||
| 30 | .Lb libcrypto | ||
| 31 | .In openssl/bn.h | ||
| 32 | .In openssl/ec.h | ||
| 33 | .Pp | ||
| 34 | .Ft int | ||
| 35 | .Fo EC_POINT_get_affine_coordinates | ||
| 36 | .Fa "const EC_GROUP *group" | ||
| 37 | .Fa "const EC_POINT *point" | ||
| 38 | .Fa "BIGNUM *x" | ||
| 39 | .Fa "BIGNUM *y" | ||
| 40 | .Fa "BN_CTX *ctx" | ||
| 41 | .Fc | ||
| 42 | .Ft int | ||
| 43 | .Fo EC_POINT_set_affine_coordinates | ||
| 44 | .Fa "const EC_GROUP *group" | ||
| 45 | .Fa "EC_POINT *point" | ||
| 46 | .Fa "const BIGNUM *x" | ||
| 47 | .Fa "const BIGNUM *y" | ||
| 48 | .Fa "BN_CTX *ctx" | ||
| 49 | .Fc | ||
| 50 | .Ft int | ||
| 51 | .Fo EC_POINT_set_compressed_coordinates | ||
| 52 | .Fa "const EC_GROUP *group" | ||
| 53 | .Fa "EC_POINT *point" | ||
| 54 | .Fa "const BIGNUM *x" | ||
| 55 | .Fa "int y_bit" | ||
| 56 | .Fa "BN_CTX *ctx" | ||
| 57 | .Fc | ||
| 58 | .Ft int | ||
| 59 | .Fo EC_POINT_set_to_infinity | ||
| 60 | .Fa "const EC_GROUP *group" | ||
| 61 | .Fa "EC_POINT *point" | ||
| 62 | .Fc | ||
| 63 | .Pp | ||
| 64 | Deprecated: | ||
| 65 | .Pp | ||
| 66 | .Ft int | ||
| 67 | .Fo EC_POINT_get_affine_coordinates_GFp | ||
| 68 | .Fa "const EC_GROUP *group" | ||
| 69 | .Fa "const EC_POINT *point" | ||
| 70 | .Fa "BIGNUM *x" | ||
| 71 | .Fa "BIGNUM *y" | ||
| 72 | .Fa "BN_CTX *ctx" | ||
| 73 | .Fc | ||
| 74 | .Ft int | ||
| 75 | .Fo EC_POINT_set_affine_coordinates_GFp | ||
| 76 | .Fa "const EC_GROUP *group" | ||
| 77 | .Fa "EC_POINT *point" | ||
| 78 | .Fa "const BIGNUM *x" | ||
| 79 | .Fa "const BIGNUM *y" | ||
| 80 | .Fa "BN_CTX *ctx" | ||
| 81 | .Fc | ||
| 82 | .Ft int | ||
| 83 | .Fo EC_POINT_set_compressed_coordinates_GFp | ||
| 84 | .Fa "const EC_GROUP *group" | ||
| 85 | .Fa "EC_POINT *point" | ||
| 86 | .Fa "const BIGNUM *x" | ||
| 87 | .Fa "int y_bit" | ||
| 88 | .Fa "BN_CTX *ctx" | ||
| 89 | .Fc | ||
| 90 | .Sh DESCRIPTION | ||
| 91 | .Fn EC_POINT_get_affine_coordinates | ||
| 92 | assumes that | ||
| 93 | .Fa point | ||
| 94 | is a point on | ||
| 95 | .Fa group , | ||
| 96 | calculates its affine coordinates from its internal representation | ||
| 97 | using the optional | ||
| 98 | .Fa ctx , | ||
| 99 | and copies them into the optional user-provided | ||
| 100 | .Fa x | ||
| 101 | and | ||
| 102 | .Fa y . | ||
| 103 | .Pp | ||
| 104 | .Fn EC_POINT_set_affine_coordinates | ||
| 105 | assumes that | ||
| 106 | .Fa x | ||
| 107 | and | ||
| 108 | .Fa y | ||
| 109 | are the affine coordinates of a point on | ||
| 110 | .Fa group , | ||
| 111 | converts them into internal representation and sets them on | ||
| 112 | .Fa point | ||
| 113 | using the optional | ||
| 114 | .Fa ctx . | ||
| 115 | The user-provided | ||
| 116 | .Fa point | ||
| 117 | should be the result of | ||
| 118 | .Fn EC_POINT_new 3 | ||
| 119 | with an argument of | ||
| 120 | .Fa group . | ||
| 121 | It then verifies using | ||
| 122 | .Xr EC_POINT_is_on_curve 3 | ||
| 123 | that | ||
| 124 | .Fa x | ||
| 125 | and | ||
| 126 | .Fa y | ||
| 127 | are indeed the affine coordinates of a point on | ||
| 128 | .Fa group . | ||
| 129 | .Pp | ||
| 130 | .Fn EC_POINT_set_compressed_coordinates | ||
| 131 | assumes that | ||
| 132 | .Fa x | ||
| 133 | is the x-coordinate and | ||
| 134 | .Fa y_bit | ||
| 135 | is the parity bit of a point on | ||
| 136 | .Fa group | ||
| 137 | and sets | ||
| 138 | .Fa point | ||
| 139 | to the corresponding point on | ||
| 140 | .Fa group . | ||
| 141 | It does this by solving the quadratic equation y^2 = x^3 + ax + b using | ||
| 142 | .Xr BN_mod_sqrt 3 | ||
| 143 | and the optional | ||
| 144 | .Fa ctx , | ||
| 145 | chooses the solution | ||
| 146 | .Fa y | ||
| 147 | with parity matching | ||
| 148 | .Fa y_bit , | ||
| 149 | and passes | ||
| 150 | .Fa x | ||
| 151 | and | ||
| 152 | .Fa y | ||
| 153 | to | ||
| 154 | .Fn EC_POINT_set_affine_coordinates . | ||
| 155 | The user-provided | ||
| 156 | .Fa point | ||
| 157 | should be the result of | ||
| 158 | .Fn EC_POINT_new | ||
| 159 | with argument | ||
| 160 | .Fa group . | ||
| 161 | .Pp | ||
| 162 | .Fn EC_POINT_set_to_infinity | ||
| 163 | sets | ||
| 164 | .Fa point | ||
| 165 | to the internal representation of the point at infinity on | ||
| 166 | .Fa group . | ||
| 167 | .Pp | ||
| 168 | .Fn EC_POINT_get_affine_coordinates_GFp | ||
| 169 | is a deprecated alias for | ||
| 170 | .Fn EC_POINT_get_affine_coordinates . | ||
| 171 | Similarly for | ||
| 172 | .Fn EC_POINT_set_affine_coordinates_GFp | ||
| 173 | and | ||
| 174 | .Fn EC_POINT_set_compressed_coordinates_GFp . | ||
| 175 | .Sh RETURN VALUES | ||
| 176 | All these functions return 1 on success and 0 on error. | ||
| 177 | Error conditions include memory allocation failure, | ||
| 178 | that | ||
| 179 | .Fa point | ||
| 180 | is incompatible with | ||
| 181 | .Fa group , | ||
| 182 | and, for the coordinate setters, that the provided coordinates | ||
| 183 | do not represent a point on | ||
| 184 | .Fa group . | ||
| 185 | .Sh SEE ALSO | ||
| 186 | .Xr BN_CTX_new 3 , | ||
| 187 | .Xr BN_is_zero 3 , | ||
| 188 | .Xr BN_mod_sqrt 3 , | ||
| 189 | .Xr crypto 3 , | ||
| 190 | .Xr d2i_ECPKParameters 3 , | ||
| 191 | .Xr EC_GROUP_check 3 , | ||
| 192 | .Xr EC_GROUP_get_curve_name 3 , | ||
| 193 | .Xr EC_GROUP_new_by_curve_name 3 , | ||
| 194 | .Xr EC_GROUP_new_curve_GFp 3 , | ||
| 195 | .Xr EC_KEY_METHOD_new 3 , | ||
| 196 | .Xr EC_KEY_new 3 , | ||
| 197 | .Xr EC_POINT_add 3 , | ||
| 198 | .Xr EC_POINT_new 3 , | ||
| 199 | .Xr EC_POINT_point2oct 3 , | ||
| 200 | .Xr ECDH_compute_key 3 , | ||
| 201 | .Xr ECDSA_SIG_new 3 | ||
| 202 | .Sh HISTORY | ||
| 203 | .Fn EC_POINT_get_affine_coordinates_GFp , | ||
| 204 | .Fn EC_POINT_set_affine_coordinates_GFp , | ||
| 205 | .Fn EC_POINT_set_compressed_coordinates_GFp , | ||
| 206 | and | ||
| 207 | .Fn EC_POINT_set_to_infinity | ||
| 208 | first appeared in OpenSSL 0.9.7 and have been available since | ||
| 209 | .Ox 3.2 . | ||
| 210 | .Pp | ||
| 211 | .Fn EC_POINT_get_affine_coordinates , | ||
| 212 | .Fn EC_POINT_set_affine_coordinates , | ||
| 213 | and | ||
| 214 | .Fn EC_POINT_set_compressed_coordinates | ||
| 215 | first appeared in OpenSSL 1.1.1 and have been available since | ||
| 216 | .Ox 7.0 . | ||
diff --git a/src/lib/libcrypto/man/EC_POINT_new.3 b/src/lib/libcrypto/man/EC_POINT_new.3 index db6280fce7..0a797f8bc9 100644 --- a/src/lib/libcrypto/man/EC_POINT_new.3 +++ b/src/lib/libcrypto/man/EC_POINT_new.3 | |||
| @@ -1,54 +1,20 @@ | |||
| 1 | .\" $OpenBSD: EC_POINT_new.3,v 1.17 2025/03/08 17:04:07 tb Exp $ | 1 | .\" $OpenBSD: EC_POINT_new.3,v 1.21 2025/06/13 18:34:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 50db8163 Jul 30 16:56:41 2018 +0100 | ||
| 3 | .\" | 2 | .\" |
| 4 | .\" This file was written by Matt Caswell <matt@openssl.org>. | 3 | .\" Copyright (c) 2025 Theo Buehler <tb@openbsd.org> |
| 5 | .\" Copyright (c) 2013, 2016 The OpenSSL Project. All rights reserved. | ||
| 6 | .\" | 4 | .\" |
| 7 | .\" Redistribution and use in source and binary forms, with or without | 5 | .\" Permission to use, copy, modify, and distribute this software for any |
| 8 | .\" modification, are permitted provided that the following conditions | 6 | .\" purpose with or without fee is hereby granted, provided that the above |
| 9 | .\" are met: | 7 | .\" copyright notice and this permission notice appear in all copies. |
| 10 | .\" | 8 | .\" |
| 11 | .\" 1. Redistributions of source code must retain the above copyright | 9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 12 | .\" notice, this list of conditions and the following disclaimer. | 10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 13 | .\" | 16 | .\" |
| 14 | .\" 2. Redistributions in binary form must reproduce the above copyright | 17 | .Dd $Mdocdate: June 13 2025 $ |
| 15 | .\" notice, this list of conditions and the following disclaimer in | ||
| 16 | .\" the documentation and/or other materials provided with the | ||
| 17 | .\" distribution. | ||
| 18 | .\" | ||
| 19 | .\" 3. All advertising materials mentioning features or use of this | ||
| 20 | .\" software must display the following acknowledgment: | ||
| 21 | .\" "This product includes software developed by the OpenSSL Project | ||
| 22 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 23 | .\" | ||
| 24 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 25 | .\" endorse or promote products derived from this software without | ||
| 26 | .\" prior written permission. For written permission, please contact | ||
| 27 | .\" openssl-core@openssl.org. | ||
| 28 | .\" | ||
| 29 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
| 30 | .\" nor may "OpenSSL" appear in their names without prior written | ||
| 31 | .\" permission of the OpenSSL Project. | ||
| 32 | .\" | ||
| 33 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
| 34 | .\" acknowledgment: | ||
| 35 | .\" "This product includes software developed by the OpenSSL Project | ||
| 36 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 37 | .\" | ||
| 38 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 39 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 40 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 41 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 42 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 43 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 44 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 45 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 46 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 47 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 50 | .\" | ||
| 51 | .Dd $Mdocdate: March 8 2025 $ | ||
| 52 | .Dt EC_POINT_NEW 3 | 18 | .Dt EC_POINT_NEW 3 |
| 53 | .Os | 19 | .Os |
| 54 | .Sh NAME | 20 | .Sh NAME |
| @@ -56,24 +22,12 @@ | |||
| 56 | .Nm EC_POINT_free , | 22 | .Nm EC_POINT_free , |
| 57 | .Nm EC_POINT_clear_free , | 23 | .Nm EC_POINT_clear_free , |
| 58 | .Nm EC_POINT_copy , | 24 | .Nm EC_POINT_copy , |
| 59 | .Nm EC_POINT_dup , | 25 | .Nm EC_POINT_dup |
| 60 | .Nm EC_POINT_set_to_infinity , | 26 | .Nd allocate, free and copy elliptic curve points |
| 61 | .Nm EC_POINT_set_affine_coordinates , | ||
| 62 | .Nm EC_POINT_set_affine_coordinates_GFp , | ||
| 63 | .Nm EC_POINT_get_affine_coordinates , | ||
| 64 | .Nm EC_POINT_get_affine_coordinates_GFp , | ||
| 65 | .Nm EC_POINT_set_compressed_coordinates , | ||
| 66 | .Nm EC_POINT_set_compressed_coordinates_GFp , | ||
| 67 | .Nm EC_POINT_point2oct , | ||
| 68 | .Nm EC_POINT_oct2point , | ||
| 69 | .Nm EC_POINT_point2bn , | ||
| 70 | .Nm EC_POINT_bn2point , | ||
| 71 | .Nm EC_POINT_point2hex , | ||
| 72 | .Nm EC_POINT_hex2point | ||
| 73 | .Nd create, destroy, and manipulate EC_POINT objects | ||
| 74 | .Sh SYNOPSIS | 27 | .Sh SYNOPSIS |
| 28 | .Lb libcrypto | ||
| 75 | .In openssl/ec.h | 29 | .In openssl/ec.h |
| 76 | .In openssl/bn.h | 30 | .Pp |
| 77 | .Ft EC_POINT * | 31 | .Ft EC_POINT * |
| 78 | .Fo EC_POINT_new | 32 | .Fo EC_POINT_new |
| 79 | .Fa "const EC_GROUP *group" | 33 | .Fa "const EC_GROUP *group" |
| @@ -93,126 +47,32 @@ | |||
| 93 | .Fc | 47 | .Fc |
| 94 | .Ft EC_POINT * | 48 | .Ft EC_POINT * |
| 95 | .Fo EC_POINT_dup | 49 | .Fo EC_POINT_dup |
| 96 | .Fa "const EC_POINT *src" | 50 | .Fa "const EC_POINT *point" |
| 97 | .Fa "const EC_GROUP *group" | ||
| 98 | .Fc | ||
| 99 | .Ft int | ||
| 100 | .Fo EC_POINT_set_to_infinity | ||
| 101 | .Fa "const EC_GROUP *group" | ||
| 102 | .Fa "EC_POINT *point" | ||
| 103 | .Fc | ||
| 104 | .Ft int | ||
| 105 | .Fo EC_POINT_set_affine_coordinates | ||
| 106 | .Fa "const EC_GROUP *group" | ||
| 107 | .Fa "EC_POINT *p" | ||
| 108 | .Fa "const BIGNUM *x" | ||
| 109 | .Fa "const BIGNUM *y" | ||
| 110 | .Fa "BN_CTX *ctx" | ||
| 111 | .Fc | ||
| 112 | .Ft int | ||
| 113 | .Fo EC_POINT_set_affine_coordinates_GFp | ||
| 114 | .Fa "const EC_GROUP *group" | ||
| 115 | .Fa "EC_POINT *p" | ||
| 116 | .Fa "const BIGNUM *x" | ||
| 117 | .Fa "const BIGNUM *y" | ||
| 118 | .Fa "BN_CTX *ctx" | ||
| 119 | .Fc | ||
| 120 | .Ft int | ||
| 121 | .Fo EC_POINT_get_affine_coordinates | ||
| 122 | .Fa "const EC_GROUP *group" | 51 | .Fa "const EC_GROUP *group" |
| 123 | .Fa "const EC_POINT *p" | ||
| 124 | .Fa "BIGNUM *x" | ||
| 125 | .Fa "BIGNUM *y" | ||
| 126 | .Fa "BN_CTX *ctx" | ||
| 127 | .Fc | ||
| 128 | .Ft int | ||
| 129 | .Fo EC_POINT_get_affine_coordinates_GFp | ||
| 130 | .Fa "const EC_GROUP *group" | ||
| 131 | .Fa "const EC_POINT *p" | ||
| 132 | .Fa "BIGNUM *x" | ||
| 133 | .Fa "BIGNUM *y" | ||
| 134 | .Fa "BN_CTX *ctx" | ||
| 135 | .Fc | ||
| 136 | .Ft int | ||
| 137 | .Fo EC_POINT_set_compressed_coordinates | ||
| 138 | .Fa "const EC_GROUP *group" | ||
| 139 | .Fa "EC_POINT *p" | ||
| 140 | .Fa "const BIGNUM *x" | ||
| 141 | .Fa "int y_bit" | ||
| 142 | .Fa "BN_CTX *ctx" | ||
| 143 | .Fc | ||
| 144 | .Ft int | ||
| 145 | .Fo EC_POINT_set_compressed_coordinates_GFp | ||
| 146 | .Fa "const EC_GROUP *group" | ||
| 147 | .Fa "EC_POINT *p" | ||
| 148 | .Fa "const BIGNUM *x" | ||
| 149 | .Fa "int y_bit" | ||
| 150 | .Fa "BN_CTX *ctx" | ||
| 151 | .Fc | ||
| 152 | .Ft size_t | ||
| 153 | .Fo EC_POINT_point2oct | ||
| 154 | .Fa "const EC_GROUP *group" | ||
| 155 | .Fa "const EC_POINT *p" | ||
| 156 | .Fa "point_conversion_form_t form" | ||
| 157 | .Fa "unsigned char *buf" | ||
| 158 | .Fa "size_t len" | ||
| 159 | .Fa "BN_CTX *ctx" | ||
| 160 | .Fc | ||
| 161 | .Ft int | ||
| 162 | .Fo EC_POINT_oct2point | ||
| 163 | .Fa "const EC_GROUP *group" | ||
| 164 | .Fa "EC_POINT *p" | ||
| 165 | .Fa "const unsigned char *buf" | ||
| 166 | .Fa "size_t len" | ||
| 167 | .Fa "BN_CTX *ctx" | ||
| 168 | .Fc | ||
| 169 | .Ft BIGNUM * | ||
| 170 | .Fo EC_POINT_point2bn | ||
| 171 | .Fa "const EC_GROUP *" | ||
| 172 | .Fa "const EC_POINT *" | ||
| 173 | .Fa "point_conversion_form_t form" | ||
| 174 | .Fa "BIGNUM *" | ||
| 175 | .Fa "BN_CTX *" | ||
| 176 | .Fc | ||
| 177 | .Ft EC_POINT * | ||
| 178 | .Fo EC_POINT_bn2point | ||
| 179 | .Fa "const EC_GROUP *" | ||
| 180 | .Fa "const BIGNUM *" | ||
| 181 | .Fa "EC_POINT *" | ||
| 182 | .Fa "BN_CTX *" | ||
| 183 | .Fc | ||
| 184 | .Ft char * | ||
| 185 | .Fo EC_POINT_point2hex | ||
| 186 | .Fa "const EC_GROUP *" | ||
| 187 | .Fa "const EC_POINT *" | ||
| 188 | .Fa "point_conversion_form_t form" | ||
| 189 | .Fa "BN_CTX *" | ||
| 190 | .Fc | ||
| 191 | .Ft EC_POINT * | ||
| 192 | .Fo EC_POINT_hex2point | ||
| 193 | .Fa "const EC_GROUP *" | ||
| 194 | .Fa "const char *" | ||
| 195 | .Fa "EC_POINT *" | ||
| 196 | .Fa "BN_CTX *" | ||
| 197 | .Fc | 52 | .Fc |
| 198 | .Sh DESCRIPTION | 53 | .Sh DESCRIPTION |
| 199 | An | 54 | An |
| 200 | .Vt EC_POINT | 55 | .Vt EC_POINT |
| 201 | represents a point on a curve. | 56 | object holds a point on the elliptic curve represented by an |
| 202 | A curve is represented by an | 57 | .Vt EC_GROUP . |
| 203 | .Vt EC_GROUP | 58 | The details of the internal representation depend on the group |
| 204 | object created by the functions described in | 59 | and should never be an application's concern since the EC library |
| 205 | .Xr EC_GROUP_new 3 . | 60 | has API to set a point's coordinates, |
| 61 | .Xr EC_POINT_set_affine_coordinates 3 . | ||
| 206 | .Pp | 62 | .Pp |
| 207 | A new point is constructed by calling the function | ||
| 208 | .Fn EC_POINT_new | 63 | .Fn EC_POINT_new |
| 209 | and providing the | 64 | allocates and initializes an |
| 210 | .Fa group | 65 | .Vt EC_POINT |
| 211 | object that the point relates to. | 66 | object to be used with the |
| 67 | .Fa group . | ||
| 68 | Before explicitly setting its coordinates, the returned | ||
| 69 | .Vt EC_POINT | ||
| 70 | is invalid. | ||
| 212 | .Pp | 71 | .Pp |
| 213 | .Fn EC_POINT_free | 72 | .Fn EC_POINT_free |
| 214 | frees the memory associated with the | 73 | frees |
| 215 | .Vt EC_POINT . | 74 | .Fa point |
| 75 | and all memory associated with it. | ||
| 216 | If | 76 | If |
| 217 | .Fa point | 77 | .Fa point |
| 218 | is a | 78 | is a |
| @@ -220,236 +80,129 @@ is a | |||
| 220 | pointer, no action occurs. | 80 | pointer, no action occurs. |
| 221 | .Pp | 81 | .Pp |
| 222 | .Fn EC_POINT_clear_free | 82 | .Fn EC_POINT_clear_free |
| 223 | destroys any sensitive data held within the | 83 | is intended to destroy sensitive data held in |
| 224 | .Vt EC_POINT | ||
| 225 | and then frees its memory. | ||
| 226 | If | ||
| 227 | .Fa point | 84 | .Fa point |
| 228 | is a | 85 | in addition to freeing all memory associated with it. |
| 229 | .Dv NULL | 86 | Since elliptic curve points usually hold public data, this |
| 230 | pointer, no action occurs. | 87 | is rarely needed. |
| 88 | In LibreSSL, | ||
| 89 | .Fn EC_POINT_free | ||
| 90 | and | ||
| 91 | .Fn EC_POINT_clear_free | ||
| 92 | behave identically. | ||
| 231 | .Pp | 93 | .Pp |
| 232 | .Fn EC_POINT_copy | 94 | .Fn EC_POINT_copy |
| 233 | copies the point | 95 | copies the internal representation of |
| 234 | .Fa src | 96 | .Fa src |
| 235 | into | 97 | into |
| 236 | .Fa dst . | 98 | .Fa dst . |
| 237 | Both | 99 | If |
| 238 | .Fa src | 100 | .Fa src |
| 239 | and | 101 | and |
| 240 | .Fa dst | 102 | .Fa dst |
| 241 | must use the same | 103 | are identical, no action occurs. |
| 242 | .Vt EC_METHOD . | 104 | Both |
| 243 | .Pp | ||
| 244 | .Fn EC_POINT_dup | ||
| 245 | creates a new | ||
| 246 | .Vt EC_POINT | ||
| 247 | object and copies the content from | ||
| 248 | .Fa src | 105 | .Fa src |
| 249 | to the newly created | ||
| 250 | .Vt EC_POINT | ||
| 251 | object. | ||
| 252 | .Pp | ||
| 253 | A valid point on a curve is the special point at infinity. | ||
| 254 | A point is set to be at infinity by calling | ||
| 255 | .Fn EC_POINT_set_to_infinity . | ||
| 256 | .Pp | ||
| 257 | The affine coordinates for a point describe a point in terms of its | ||
| 258 | .Fa x | ||
| 259 | and | 106 | and |
| 260 | .Fa y | 107 | .Fa dst |
| 261 | position. | 108 | should be the result of |
| 262 | The function | 109 | .Fn EC_POINT_new |
| 263 | .Fn EC_POINT_set_affine_coordinates | 110 | with the same |
| 264 | sets the | 111 | .Fa group |
| 265 | .Fa x | 112 | argument, although |
| 266 | and | 113 | .Fn EC_POINT_copy |
| 267 | .Fa y | 114 | cannot check that. |
| 268 | coordinates for the point | ||
| 269 | .Fa p | ||
| 270 | defined over the curve given in | ||
| 271 | .Fa group . | ||
| 272 | The function | ||
| 273 | .Fn EC_POINT_get_affine_coordinates | ||
| 274 | sets | ||
| 275 | .Fa x | ||
| 276 | and | ||
| 277 | .Fa y , | ||
| 278 | either of which may be | ||
| 279 | .Dv NULL , | ||
| 280 | to the corresponding coordinates of | ||
| 281 | .Fa p . | ||
| 282 | .Pp | ||
| 283 | The functions | ||
| 284 | .Fn EC_POINT_set_affine_coordinates_GFp | ||
| 285 | is a deprecated synonym for | ||
| 286 | .Fn EC_POINT_set_affine_coordinates | ||
| 287 | and the function | ||
| 288 | .Fn EC_POINT_get_affine_coordinates_GFp | ||
| 289 | is a deprecated synonym for | ||
| 290 | .Fn EC_POINT_get_affine_coordinates . | ||
| 291 | .Pp | ||
| 292 | Points can also be described in terms of their compressed coordinates. | ||
| 293 | For a point | ||
| 294 | .Pq Fa x , y , | ||
| 295 | for any given value for | ||
| 296 | .Fa x | ||
| 297 | such that the point is on the curve, there will only ever be two | ||
| 298 | possible values for | ||
| 299 | .Fa y . | ||
| 300 | Therefore, a point can be set using the | ||
| 301 | .Fn EC_POINT_set_compressed_coordinates | ||
| 302 | function where | ||
| 303 | .Fa x | ||
| 304 | is the x coordinate and | ||
| 305 | .Fa y_bit | ||
| 306 | is a value 0 or 1 to identify which of the two possible values for y | ||
| 307 | should be used. | ||
| 308 | .Pp | ||
| 309 | The functions | ||
| 310 | .Fn EC_POINT_set_compressed_coordinates_GFp | ||
| 311 | is a deprecated synonym for | ||
| 312 | .Fn EC_POINT_set_compressed_coordinates . | ||
| 313 | .Pp | ||
| 314 | In addition | ||
| 315 | .Vt EC_POINT Ns s | ||
| 316 | can be converted to and from various external representations. | ||
| 317 | Supported representations are octet strings, | ||
| 318 | .Vt BIGNUM Ns s , | ||
| 319 | and hexadecimal. | ||
| 320 | The format of the external representation is described by the | ||
| 321 | point_conversion_form. | ||
| 322 | See | ||
| 323 | .Xr EC_GROUP_copy 3 | ||
| 324 | for a description of point_conversion_form. | ||
| 325 | Octet strings are stored in a buffer along with an associated buffer | ||
| 326 | length. | ||
| 327 | A point held in a | ||
| 328 | .Vt BIGNUM | ||
| 329 | is calculated by converting the point to an octet string and then | ||
| 330 | converting that octet string into a | ||
| 331 | .Vt BIGNUM | ||
| 332 | integer. | ||
| 333 | Points in hexadecimal format are stored in a NUL terminated character | ||
| 334 | string where each character is one of the printable values 0-9 or A-F | ||
| 335 | (or a-f). | ||
| 336 | .Pp | ||
| 337 | The functions | ||
| 338 | .Fn EC_POINT_point2oct , | ||
| 339 | .Fn EC_POINT_oct2point , | ||
| 340 | .Fn EC_POINT_point2bn , | ||
| 341 | .Fn EC_POINT_bn2point , | ||
| 342 | .Fn EC_POINT_point2hex , | ||
| 343 | and | ||
| 344 | .Fn EC_POINT_hex2point | ||
| 345 | convert from and to | ||
| 346 | .Vt EC_POINT Ns s | ||
| 347 | for the formats octet string, | ||
| 348 | .Vt BIGNUM , | ||
| 349 | and hexadecimal, respectively. | ||
| 350 | .Pp | ||
| 351 | The function | ||
| 352 | .Fn EC_POINT_point2oct | ||
| 353 | must be supplied with a | ||
| 354 | .Fa buf | ||
| 355 | long enough to store the octet string. | ||
| 356 | The return value provides the number of octets stored. | ||
| 357 | Calling the function with a | ||
| 358 | .Dv NULL | ||
| 359 | .Fa buf | ||
| 360 | will not perform the conversion but will still return the required | ||
| 361 | buffer length. | ||
| 362 | .Pp | 115 | .Pp |
| 363 | The function | 116 | .Fn EC_POINT_dup |
| 364 | .Fn EC_POINT_point2hex | 117 | creates a deep copy of |
| 365 | will allocate sufficient memory to store the hexadecimal string. | 118 | .Fa point |
| 366 | It is the caller's responsibility to free this memory with a subsequent | 119 | by combining |
| 367 | call to | 120 | .Fn EC_POINT_new |
| 368 | .Xr free 3 . | 121 | with |
| 122 | .Fn EC_GROUP_copy . | ||
| 369 | .Sh RETURN VALUES | 123 | .Sh RETURN VALUES |
| 370 | .Fn EC_POINT_new | 124 | .Fn EC_POINT_new |
| 371 | and | 125 | returns a newly allocated |
| 372 | .Fn EC_POINT_dup | ||
| 373 | return the newly allocated | ||
| 374 | .Vt EC_POINT | 126 | .Vt EC_POINT |
| 375 | or | 127 | or |
| 376 | .Dv NULL | 128 | .Dv NULL |
| 377 | on error. | 129 | on memory allocation failure. |
| 378 | .Pp | ||
| 379 | The following functions return 1 on success or 0 on error: | ||
| 380 | .Fn EC_POINT_copy , | ||
| 381 | .Fn EC_POINT_set_to_infinity , | ||
| 382 | .Fn EC_POINT_set_affine_coordinates , | ||
| 383 | .Fn EC_POINT_set_affine_coordinates_GFp , | ||
| 384 | .Fn EC_POINT_get_affine_coordinates , | ||
| 385 | .Fn EC_POINT_get_affine_coordinates_GFp , | ||
| 386 | .Fn EC_POINT_set_compressed_coordinates , | ||
| 387 | .Fn EC_POINT_set_compressed_coordinates_GFp , | ||
| 388 | and | ||
| 389 | .Fn EC_POINT_oct2point . | ||
| 390 | .Pp | ||
| 391 | .Fn EC_POINT_point2oct | ||
| 392 | returns the length of the required buffer, or 0 on error. | ||
| 393 | .Pp | ||
| 394 | .Fn EC_POINT_point2bn | ||
| 395 | returns the pointer to the | ||
| 396 | .Vt BIGNUM | ||
| 397 | supplied or | ||
| 398 | .Dv NULL | ||
| 399 | on error. | ||
| 400 | .Pp | 130 | .Pp |
| 401 | .Fn EC_POINT_bn2point | 131 | .Fn EC_POINT_copy |
| 402 | returns the pointer to the | 132 | returns 1 on success or 0 on error. |
| 403 | .Vt EC_POINT | 133 | Error conditions include memory allocation failure and that |
| 404 | supplied or | 134 | .Fa dst |
| 405 | .Dv NULL | 135 | is incompatible with the group on which |
| 406 | on error. | 136 | .Fa src |
| 407 | .Pp | 137 | is defined. |
| 408 | .Fn EC_POINT_point2hex | ||
| 409 | returns a pointer to the hex string or | ||
| 410 | .Dv NULL | ||
| 411 | on error. | ||
| 412 | .Pp | 138 | .Pp |
| 413 | .Fn EC_POINT_hex2point | 139 | .Fn EC_POINT_dup |
| 414 | returns the pointer to the | 140 | returns a newly allocated |
| 415 | .Vt EC_POINT | 141 | .Vt EC_POINT |
| 416 | supplied or | 142 | or |
| 417 | .Dv NULL | 143 | .Dv NULL |
| 418 | on error. | 144 | on failure. |
| 145 | Error conditions include memory allocation failure or that | ||
| 146 | .Fa group | ||
| 147 | is incompatible with | ||
| 148 | .Fa src . | ||
| 419 | .Sh SEE ALSO | 149 | .Sh SEE ALSO |
| 150 | .Xr BN_CTX_new 3 , | ||
| 151 | .Xr BN_is_zero 3 , | ||
| 152 | .Xr crypto 3 , | ||
| 420 | .Xr d2i_ECPKParameters 3 , | 153 | .Xr d2i_ECPKParameters 3 , |
| 421 | .Xr EC_GROUP_copy 3 , | 154 | .Xr EC_GROUP_check 3 , |
| 422 | .Xr EC_GROUP_new 3 , | 155 | .Xr EC_GROUP_get_curve_name 3 , |
| 156 | .Xr EC_GROUP_new_by_curve_name 3 , | ||
| 157 | .Xr EC_GROUP_new_curve_GFp 3 , | ||
| 158 | .Xr EC_KEY_METHOD_new 3 , | ||
| 423 | .Xr EC_KEY_new 3 , | 159 | .Xr EC_KEY_new 3 , |
| 424 | .Xr EC_POINT_add 3 , | 160 | .Xr EC_POINT_add 3 , |
| 425 | .Xr ECDH_compute_key 3 | 161 | .Xr EC_POINT_get_affine_coordinates 3 , |
| 162 | .Xr EC_POINT_point2oct 3 , | ||
| 163 | .Xr ECDH_compute_key 3 , | ||
| 164 | .Xr ECDSA_SIG_new 3 | ||
| 426 | .Sh HISTORY | 165 | .Sh HISTORY |
| 427 | .Fn EC_POINT_new , | 166 | .Fn EC_POINT_new , |
| 428 | .Fn EC_POINT_free , | 167 | .Fn EC_POINT_free , |
| 429 | .Fn EC_POINT_clear_free , | 168 | .Fn EC_POINT_clear_free , |
| 430 | .Fn EC_POINT_copy , | ||
| 431 | .Fn EC_POINT_set_to_infinity , | ||
| 432 | .Fn EC_POINT_set_affine_coordinates_GFp , | ||
| 433 | .Fn EC_POINT_get_affine_coordinates_GFp , | ||
| 434 | .Fn EC_POINT_set_compressed_coordinates_GFp , | ||
| 435 | .Fn EC_POINT_point2oct , | ||
| 436 | and | 169 | and |
| 437 | .Fn EC_POINT_oct2point | 170 | .Fn EC_POINT_copy |
| 438 | first appeared in OpenSSL 0.9.7 and have been available since | 171 | first appeared in OpenSSL 0.9.7 and have been available since |
| 439 | .Ox 3.2 . | 172 | .Ox 3.2 . |
| 440 | .Pp | 173 | .Pp |
| 441 | .Fn EC_POINT_dup , | 174 | .Fn EC_POINT_dup |
| 442 | .Fn EC_POINT_point2bn , | 175 | first appeared in OpenSSL 0.9.8 and has been available since |
| 443 | .Fn EC_POINT_bn2point , | ||
| 444 | .Fn EC_POINT_point2hex , | ||
| 445 | and | ||
| 446 | .Fn EC_POINT_hex2point | ||
| 447 | first appeared in OpenSSL 0.9.8 and have been available since | ||
| 448 | .Ox 4.5 . | 176 | .Ox 4.5 . |
| 449 | .Pp | 177 | .Sh BUGS |
| 450 | .Fn EC_POINT_set_affine_coordinates , | 178 | A fundamental flaw in the OpenSSL API toolkit is that |
| 451 | .Fn EC_POINT_get_affine_coordinates , | 179 | .Fn *_new |
| 180 | functions usually create invalid objects that are tricky to | ||
| 181 | turn into valid objects. | ||
| 182 | One specific flaw in the EC library internals is that | ||
| 183 | .Vt EC_POINT | ||
| 184 | objects do not hold a reference to the group they live on | ||
| 185 | despite the fact that | ||
| 186 | .Fn EC_POINT_new | ||
| 187 | has a | ||
| 188 | .Fa group | ||
| 189 | argument. | ||
| 190 | This is difficult to fix because | ||
| 191 | .Vt EC_GROUP | ||
| 192 | objects are not reference counted and | ||
| 193 | because of const qualifiers in the API. | ||
| 194 | This is the root cause for various contortions in the EC library | ||
| 195 | and API and | ||
| 196 | there are security implications because not | ||
| 197 | only does the library not know whether an | ||
| 198 | .Fa EC_POINT | ||
| 199 | object represents a valid point, | ||
| 200 | even if it did know that it would still not know on what curve. | ||
| 201 | .Pp | ||
| 202 | The signature of | ||
| 203 | .Fn EC_GROUP_dup | ||
| 204 | is bizarre and the order of | ||
| 205 | .Fa point | ||
| 452 | and | 206 | and |
| 453 | .Fn EC_POINT_set_compressed_coordinates | 207 | .Fa group |
| 454 | first appeared in OpenSSL 1.1.1 and have been available since | 208 | is inconsistent with the rest of the EC API. |
| 455 | .Ox 7.0 . | ||
diff --git a/src/lib/libcrypto/man/EC_POINT_point2oct.3 b/src/lib/libcrypto/man/EC_POINT_point2oct.3 new file mode 100644 index 0000000000..ac89c9b1d4 --- /dev/null +++ b/src/lib/libcrypto/man/EC_POINT_point2oct.3 | |||
| @@ -0,0 +1,434 @@ | |||
| 1 | .\" $OpenBSD: EC_POINT_point2oct.3,v 1.6 2025/06/13 18:34:00 schwarze Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2025 Theo Buehler <tb@openbsd.org> | ||
| 4 | .\" | ||
| 5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 7 | .\" copyright notice and this permission notice appear in all copies. | ||
| 8 | .\" | ||
| 9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | .\" | ||
| 17 | .Dd $Mdocdate: June 13 2025 $ | ||
| 18 | .Dt EC_POINT_POINT2OCT 3 | ||
| 19 | .Os | ||
| 20 | .Sh NAME | ||
| 21 | .Nm EC_POINT_point2oct , | ||
| 22 | .Nm EC_POINT_oct2point , | ||
| 23 | .Nm EC_POINT_point2bn , | ||
| 24 | .Nm EC_POINT_bn2point , | ||
| 25 | .Nm EC_POINT_point2hex , | ||
| 26 | .Nm EC_POINT_hex2point | ||
| 27 | .Nd encode and decode elliptic curve points | ||
| 28 | .Sh SYNOPSIS | ||
| 29 | .Lb libcrypto | ||
| 30 | .In openssl/bn.h | ||
| 31 | .In openssl/ec.h | ||
| 32 | .Bd -literal | ||
| 33 | typedef enum { | ||
| 34 | POINT_CONVERSION_COMPRESSED = 2, | ||
| 35 | POINT_CONVERSION_UNCOMPRESSED = 4, | ||
| 36 | POINT_CONVERSION_HYBRID = 6 | ||
| 37 | } point_conversion_form_t; | ||
| 38 | |||
| 39 | .Ed | ||
| 40 | .Ft size_t | ||
| 41 | .Fo EC_POINT_point2oct | ||
| 42 | .Fa "const EC_GROUP *group" | ||
| 43 | .Fa "const EC_POINT *point" | ||
| 44 | .Fa "point_conversion_form_t form" | ||
| 45 | .Fa "unsigned char *buf" | ||
| 46 | .Fa "size_t len" | ||
| 47 | .Fa "BN_CTX *ctx" | ||
| 48 | .Fc | ||
| 49 | .Ft int | ||
| 50 | .Fo EC_POINT_oct2point | ||
| 51 | .Fa "const EC_GROUP *group" | ||
| 52 | .Fa "EC_POINT *point" | ||
| 53 | .Fa "const unsigned char *buf" | ||
| 54 | .Fa "size_t len" | ||
| 55 | .Fa "BN_CTX *ctx" | ||
| 56 | .Fc | ||
| 57 | .Ft BIGNUM * | ||
| 58 | .Fo EC_POINT_point2bn | ||
| 59 | .Fa "const EC_GROUP *group" | ||
| 60 | .Fa "const EC_POINT *point" | ||
| 61 | .Fa "point_conversion_form_t form" | ||
| 62 | .Fa "BIGNUM *bn" | ||
| 63 | .Fa "BN_CTX *ctx" | ||
| 64 | .Fc | ||
| 65 | .Ft EC_POINT * | ||
| 66 | .Fo EC_POINT_bn2point | ||
| 67 | .Fa "const EC_GROUP *group" | ||
| 68 | .Fa "const BIGNUM *bn" | ||
| 69 | .Fa "EC_POINT *point" | ||
| 70 | .Fa "BN_CTX *ctx" | ||
| 71 | .Fc | ||
| 72 | .Ft char * | ||
| 73 | .Fo EC_POINT_point2hex | ||
| 74 | .Fa "const EC_GROUP *group" | ||
| 75 | .Fa "const EC_POINT *point" | ||
| 76 | .Fa "point_conversion_form_t form" | ||
| 77 | .Fa "BN_CTX *ctx" | ||
| 78 | .Fc | ||
| 79 | .Ft EC_POINT * | ||
| 80 | .Fo EC_POINT_hex2point | ||
| 81 | .Fa "const EC_GROUP *group" | ||
| 82 | .Fa "const char *hex" | ||
| 83 | .Fa "EC_POINT *point" | ||
| 84 | .Fa "BN_CTX *ctx" | ||
| 85 | .Fc | ||
| 86 | .Sh DESCRIPTION | ||
| 87 | The | ||
| 88 | .Fa ctx | ||
| 89 | argument of all functions in this manual is optional. | ||
| 90 | .Pp | ||
| 91 | An | ||
| 92 | .Vt EC_POINT | ||
| 93 | object represents a point on the elliptic curve given by an | ||
| 94 | .Vt EC_GROUP | ||
| 95 | object. | ||
| 96 | It is either the point at infinity or it has a representation | ||
| 97 | (x, y) in standard affine coordinates, | ||
| 98 | in which case it satisfies the curve's Weierstrass equation | ||
| 99 | .Pp | ||
| 100 | .Dl y^2 = x^3 + ax + b | ||
| 101 | .Pp | ||
| 102 | in the prime field of size p. | ||
| 103 | Thus, y is a square root of x^3 + ax + b. | ||
| 104 | Since p > 3 is odd, p - y is another square root | ||
| 105 | with different parity, unless y is zero. | ||
| 106 | Point compression uses that x and the parity of y are enough | ||
| 107 | to compute y using | ||
| 108 | .Xr BN_mod_sqrt 3 . | ||
| 109 | .Pp | ||
| 110 | Field elements are represented as non-negative integers < p | ||
| 111 | in big-endian 2-complement form, zero-padded on the left to the byte | ||
| 112 | length l of p. | ||
| 113 | If X and Y are the representations of x and y, respectively, and P is | ||
| 114 | the parity bit of y, the three encodings of the point (x, y) are | ||
| 115 | the byte strings: | ||
| 116 | .Bl -column "EncodingX" "CompressedX" "UncompressedX" "Hybrid" -offset indent -compact | ||
| 117 | .It Ta Em Compressed Ta Em Uncompressed Ta Em Hybrid | ||
| 118 | .It Encoding Ta 2+P || X Ta 4 || X || Y Ta 6+P || X || Y | ||
| 119 | .It Length Ta 1 + l Ta 1 + 2l Ta 1 + 2l | ||
| 120 | .El | ||
| 121 | where the first octet is the point conversion form | ||
| 122 | combined with the parity bit in the compressed and hybrid encodings. | ||
| 123 | The point at infinity is encoded as a single zero byte. | ||
| 124 | .Pp | ||
| 125 | .Fn EC_POINT_point2oct | ||
| 126 | converts | ||
| 127 | .Fa point | ||
| 128 | into the octet string encoding of type | ||
| 129 | .Fa form . | ||
| 130 | It assumes without checking that | ||
| 131 | .Fa point | ||
| 132 | is a point on the elliptic curve represented by | ||
| 133 | .Fa group | ||
| 134 | and operates in two modes depending on the | ||
| 135 | .Fa buf | ||
| 136 | argument. | ||
| 137 | If | ||
| 138 | .Fa buf | ||
| 139 | is | ||
| 140 | .Dv NULL , | ||
| 141 | .Fn EC_POINT_point2oct | ||
| 142 | returns the length of | ||
| 143 | .Fa point Ns 's | ||
| 144 | encoding of type | ||
| 145 | .Fa form | ||
| 146 | and ignores the | ||
| 147 | .Fa len | ||
| 148 | and | ||
| 149 | .Fa ctx | ||
| 150 | arguments. | ||
| 151 | If | ||
| 152 | .Fa buf | ||
| 153 | is not | ||
| 154 | .Dv NULL | ||
| 155 | and its length | ||
| 156 | .Fa len | ||
| 157 | is sufficiently big, | ||
| 158 | .Fn EC_POINT_point2oct | ||
| 159 | writes the | ||
| 160 | .Fa point Ns 's | ||
| 161 | encoding of type | ||
| 162 | .Fa form | ||
| 163 | to | ||
| 164 | .Fa buf | ||
| 165 | and returns the number of bytes written. | ||
| 166 | Unless | ||
| 167 | .Fa point | ||
| 168 | is the point at infinity, the coordinates to be encoded are calculated using | ||
| 169 | .Xr EC_POINT_get_affine_coordinates 3 . | ||
| 170 | .Pp | ||
| 171 | .Fn EC_POINT_oct2point | ||
| 172 | decodes the octet string representation of a point on | ||
| 173 | .Fa group | ||
| 174 | in | ||
| 175 | .Fa buf | ||
| 176 | of size | ||
| 177 | .Fa len | ||
| 178 | and, if it represents a point on | ||
| 179 | .Fa group , | ||
| 180 | sets it on the caller-provided | ||
| 181 | .Fa point | ||
| 182 | using | ||
| 183 | .Xr EC_POINT_set_to_infinity 3 | ||
| 184 | .Xr EC_POINT_set_compressed_coordinates 3 , | ||
| 185 | or | ||
| 186 | .Xr EC_POINT_set_affine_coordinates 3 . | ||
| 187 | For hybrid encoding the consistency of | ||
| 188 | the parity bit in the leading octet is verified. | ||
| 189 | .Pp | ||
| 190 | .Fn EC_POINT_point2bn | ||
| 191 | returns a | ||
| 192 | .Vt BIGNUM | ||
| 193 | containing the encoding of type | ||
| 194 | .Fa form | ||
| 195 | of the | ||
| 196 | .Fa point | ||
| 197 | on | ||
| 198 | .Fa group . | ||
| 199 | If | ||
| 200 | .Fa bn | ||
| 201 | is | ||
| 202 | .Dv NULL , | ||
| 203 | this | ||
| 204 | .Vt BIGNUM | ||
| 205 | is newly allocated, otherwise the result is copied into | ||
| 206 | .Fa bn | ||
| 207 | and returned. | ||
| 208 | .Fn EC_POINT_point2bn | ||
| 209 | is equivalent to | ||
| 210 | .Fn EC_POINT_point2oct | ||
| 211 | followed by | ||
| 212 | .Xr BN_bin2bn 3 . | ||
| 213 | .Pp | ||
| 214 | .Fn EC_POINT_bn2point | ||
| 215 | assumes that | ||
| 216 | .Fa bn | ||
| 217 | contains the encoding of a point on | ||
| 218 | .Fa group . | ||
| 219 | If | ||
| 220 | .Fa point | ||
| 221 | is | ||
| 222 | .Dv NULL , | ||
| 223 | the result is placed in a newly allocated | ||
| 224 | .Vt EC_POINT , | ||
| 225 | otherwise the result is placed in | ||
| 226 | .Fa point | ||
| 227 | which is then returned. | ||
| 228 | .Fn EC_POINT_bn2point | ||
| 229 | is equivalent to | ||
| 230 | .Xr BN_bn2bin 3 | ||
| 231 | followed by | ||
| 232 | .Fn EC_POINT_oct2point . | ||
| 233 | .Pp | ||
| 234 | .Fn EC_POINT_point2hex | ||
| 235 | returns a printable string containing the hexadecimal encoding of | ||
| 236 | the point encoding of type | ||
| 237 | .Fa form | ||
| 238 | of the | ||
| 239 | .Fa point | ||
| 240 | on | ||
| 241 | .Fa group . | ||
| 242 | The string must be freed by the caller using | ||
| 243 | .Xr free 3 . | ||
| 244 | .Fn EC_POINT_point2hex | ||
| 245 | is equivalent to | ||
| 246 | .Fn EC_POINT_point2bn | ||
| 247 | followed by | ||
| 248 | .Xr BN_bn2hex 3 . | ||
| 249 | .Pp | ||
| 250 | .Fn EC_POINT_hex2point | ||
| 251 | interprets | ||
| 252 | .Fa hex | ||
| 253 | as a hexadecimal encoding of the point encoding of a point on | ||
| 254 | .Fa group . | ||
| 255 | If | ||
| 256 | .Fa point | ||
| 257 | is | ||
| 258 | .Dv NULL , | ||
| 259 | the result is returned in a newly allocated | ||
| 260 | .Vt EC_POINT , | ||
| 261 | otherwise the result is copied into | ||
| 262 | .Fa point , | ||
| 263 | which is then returned. | ||
| 264 | .Fn EC_POINT_hex2point | ||
| 265 | is equivalent to | ||
| 266 | .Xr BN_hex2bn 3 | ||
| 267 | followed by | ||
| 268 | .Fn EC_POINT_bn2point . | ||
| 269 | .Sh RETURN VALUES | ||
| 270 | If | ||
| 271 | .Fa buf | ||
| 272 | is | ||
| 273 | .Dv NULL , | ||
| 274 | .Fn EC_POINT_point2oct | ||
| 275 | returns the length needed to encode the | ||
| 276 | .Fa point | ||
| 277 | on | ||
| 278 | .Fa group , | ||
| 279 | or 0 on error. | ||
| 280 | If | ||
| 281 | .Fa buf | ||
| 282 | is not | ||
| 283 | .Dv NULL , | ||
| 284 | .Fn EC_POINT_point2oct | ||
| 285 | returns the number of bytes written to | ||
| 286 | .Fa buf | ||
| 287 | or 0 on error. | ||
| 288 | Error conditions include that | ||
| 289 | .Fa form | ||
| 290 | is invalid, | ||
| 291 | .Fa len | ||
| 292 | is too small, and memory allocation failure. | ||
| 293 | .Pp | ||
| 294 | .Fn EC_POINT_oct2point | ||
| 295 | returns 1 on success and 0 on error. | ||
| 296 | Error conditions include invalid encoding, | ||
| 297 | .Fa buf | ||
| 298 | does not represent a point on | ||
| 299 | .Fa group , | ||
| 300 | or memory allocation failure. | ||
| 301 | .Pp | ||
| 302 | .Fn EC_POINT_point2bn | ||
| 303 | returns a | ||
| 304 | .Vt BIGNUM | ||
| 305 | containing the encoding of | ||
| 306 | .Fa point | ||
| 307 | or | ||
| 308 | .Dv NULL | ||
| 309 | on error. | ||
| 310 | The returned | ||
| 311 | .Vt BIGNUM | ||
| 312 | is either | ||
| 313 | .Fa bn | ||
| 314 | or a newly allocated one which must be freed by the caller. | ||
| 315 | Error conditions include those of | ||
| 316 | .Fn EC_POINT_point2oct , | ||
| 317 | .Xr BN_bn2bin 3 , | ||
| 318 | or memory allocation failure. | ||
| 319 | .Pp | ||
| 320 | .Fn EC_POINT_bn2point | ||
| 321 | returns an | ||
| 322 | .Vt EC_POINT | ||
| 323 | corresponding to the encoding in | ||
| 324 | .Fa bn | ||
| 325 | or | ||
| 326 | .Dv NULL | ||
| 327 | on error. | ||
| 328 | The returned | ||
| 329 | .Vt EC_POINT | ||
| 330 | is either | ||
| 331 | .Fa point | ||
| 332 | or a newly allocated one which must be freed by the caller. | ||
| 333 | Error conditions include those of | ||
| 334 | .Xr BN_bn2bin 3 , | ||
| 335 | .Fn EC_POINT_oct2point , | ||
| 336 | or memory allocation failure. | ||
| 337 | .Pp | ||
| 338 | .Fn EC_POINT_point2hex | ||
| 339 | returns a newly allocated string or | ||
| 340 | .Dv NULL | ||
| 341 | on error. | ||
| 342 | Error conditions include those of | ||
| 343 | .Fn EC_POINT_point2bn | ||
| 344 | or | ||
| 345 | .Xr BN_bn2hex 3 . | ||
| 346 | .Pp | ||
| 347 | .Fn EC_POINT_hex2point | ||
| 348 | returns an | ||
| 349 | .Vt EC_POINT | ||
| 350 | containing the decoded point on | ||
| 351 | .Fa group | ||
| 352 | or | ||
| 353 | .Dv NULL | ||
| 354 | on error. | ||
| 355 | The returned | ||
| 356 | .Vt EC_POINT | ||
| 357 | is either | ||
| 358 | .Fa point | ||
| 359 | or a newly allocated one which must be freed by the caller. | ||
| 360 | Error conditions are those of | ||
| 361 | .Xr BN_hex2bn 3 , | ||
| 362 | or | ||
| 363 | .Fn EC_POINT_bn2point . | ||
| 364 | .Sh SEE ALSO | ||
| 365 | .Xr BN_mod_sqrt 3 , | ||
| 366 | .Xr BN_new 3 , | ||
| 367 | .Xr BN_num_bits 3 , | ||
| 368 | .Xr crypto 3 , | ||
| 369 | .Xr d2i_ECPKParameters 3 , | ||
| 370 | .Xr EC_GROUP_check 3 , | ||
| 371 | .Xr EC_GROUP_get_curve_name 3 , | ||
| 372 | .Xr EC_GROUP_new_by_curve_name 3 , | ||
| 373 | .Xr EC_GROUP_new_curve_GFp 3 , | ||
| 374 | .Xr EC_KEY_METHOD_new 3 , | ||
| 375 | .Xr EC_KEY_new 3 , | ||
| 376 | .Xr EC_POINT_add 3 , | ||
| 377 | .Xr EC_POINT_get_affine_coordinates 3 , | ||
| 378 | .Xr EC_POINT_new 3 , | ||
| 379 | .Xr ECDH_compute_key 3 , | ||
| 380 | .Xr ECDSA_SIG_new 3 | ||
| 381 | .Sh STANDARDS | ||
| 382 | .Rs | ||
| 383 | .%T SEC 1: Elliptic Curve Cryptography, Version 2.0 | ||
| 384 | .%U https://www.secg.org/sec1-v2.pdf | ||
| 385 | .%D May 21, 2009 | ||
| 386 | .Re | ||
| 387 | .Sh HISTORY | ||
| 388 | .Fn EC_POINT_point2oct | ||
| 389 | and | ||
| 390 | .Fn EC_POINT_oct2point | ||
| 391 | first appeared in OpenSSL 0.9.7 and have been available since | ||
| 392 | .Ox 3.2 . | ||
| 393 | .Pp | ||
| 394 | .Fn EC_POINT_point2bn , | ||
| 395 | .Fn EC_POINT_bn2point , | ||
| 396 | .Fn EC_POINT_point2hex , | ||
| 397 | and | ||
| 398 | .Fn EC_POINT_hex2point | ||
| 399 | first appeared in OpenSSL 0.9.8 and have been available since | ||
| 400 | .Ox 4.5 . | ||
| 401 | .Sh BUGS | ||
| 402 | The | ||
| 403 | .Vt point_conversion_form_t | ||
| 404 | is not properly exposed in the API. | ||
| 405 | There is no representation for the point at infinity nor is there | ||
| 406 | an API interface for the parity bit, | ||
| 407 | forcing applications to invent their own and do bit twiddling in buffers. | ||
| 408 | .Pp | ||
| 409 | The poorly chosen signatures of the functions in this manual result | ||
| 410 | in an unergonomic API, particularly so for | ||
| 411 | .Fn EC_POINT_point2oct | ||
| 412 | and | ||
| 413 | .Fn EC_POINT_oct2point . | ||
| 414 | Due to fundamental misdesign in the EC library, | ||
| 415 | points are not directly linked to the curve they live on. | ||
| 416 | Adding checks that | ||
| 417 | .Fa point | ||
| 418 | lives on | ||
| 419 | .Fa group | ||
| 420 | is too expensive and intrusive, so it is and will continue to be easy | ||
| 421 | to make the EC_POINT_point2* API output nonsense. | ||
| 422 | .Pp | ||
| 423 | .Fn EC_POINT_point2bn | ||
| 424 | and | ||
| 425 | .Fn EC_POINT_bn2point | ||
| 426 | make no sense. | ||
| 427 | They abuse | ||
| 428 | .Vt BIGNUM | ||
| 429 | as a vector type, which is in poor taste. | ||
| 430 | .Pp | ||
| 431 | .Fn EC_POINT_point2hex | ||
| 432 | and | ||
| 433 | .Fn EC_POINT_hex2point | ||
| 434 | use a non-standard encoding format. | ||
diff --git a/src/lib/libcrypto/man/ENGINE_new.3 b/src/lib/libcrypto/man/ENGINE_new.3 index 55ed963563..f70adecc17 100644 --- a/src/lib/libcrypto/man/ENGINE_new.3 +++ b/src/lib/libcrypto/man/ENGINE_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ENGINE_new.3,v 1.10 2023/11/19 21:13:47 tb Exp $ | 1 | .\" $OpenBSD: ENGINE_new.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> | 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> |
| 4 | .\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org> | 4 | .\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org> |
| @@ -15,7 +15,7 @@ | |||
| 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 | .\" | 17 | .\" |
| 18 | .Dd $Mdocdate: November 19 2023 $ | 18 | .Dd $Mdocdate: June 8 2025 $ |
| 19 | .Dt ENGINE_NEW 3 | 19 | .Dt ENGINE_NEW 3 |
| 20 | .Os | 20 | .Os |
| 21 | .Sh NAME | 21 | .Sh NAME |
| @@ -40,6 +40,7 @@ | |||
| 40 | .Nm ENGINE_cleanup | 40 | .Nm ENGINE_cleanup |
| 41 | .Nd ENGINE stub functions | 41 | .Nd ENGINE stub functions |
| 42 | .Sh SYNOPSIS | 42 | .Sh SYNOPSIS |
| 43 | .Lb libcrypto | ||
| 43 | .In openssl/engine.h | 44 | .In openssl/engine.h |
| 44 | .Ft ENGINE * | 45 | .Ft ENGINE * |
| 45 | .Fn ENGINE_new void | 46 | .Fn ENGINE_new void |
diff --git a/src/lib/libcrypto/man/ERR.3 b/src/lib/libcrypto/man/ERR.3 index 8f17e7a329..7d67c4f556 100644 --- a/src/lib/libcrypto/man/ERR.3 +++ b/src/lib/libcrypto/man/ERR.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ERR.3,v 1.11 2023/07/26 20:15:51 tb Exp $ | 1 | .\" $OpenBSD: ERR.3,v 1.12 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL 186bb907 Apr 13 11:05:13 2015 -0700 | 2 | .\" OpenSSL 186bb907 Apr 13 11:05:13 2015 -0700 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> and | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> and |
| @@ -49,13 +49,14 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: July 26 2023 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt ERR 3 | 53 | .Dt ERR 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| 56 | .Nm ERR | 56 | .Nm ERR |
| 57 | .Nd OpenSSL error codes | 57 | .Nd OpenSSL error codes |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 59 | .In openssl/err.h | 60 | .In openssl/err.h |
| 60 | .Sh DESCRIPTION | 61 | .Sh DESCRIPTION |
| 61 | When a call to the OpenSSL library fails, this is usually signaled by | 62 | When a call to the OpenSSL library fails, this is usually signaled by |
diff --git a/src/lib/libcrypto/man/ERR_GET_LIB.3 b/src/lib/libcrypto/man/ERR_GET_LIB.3 index bc14f0e2ac..754f7fafe3 100644 --- a/src/lib/libcrypto/man/ERR_GET_LIB.3 +++ b/src/lib/libcrypto/man/ERR_GET_LIB.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ERR_GET_LIB.3,v 1.7 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: ERR_GET_LIB.3,v 1.8 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL doc/man3/ERR_GET_LIB.pod 3dfda1a6 Dec 12 11:14:40 2016 -0500 | 2 | .\" OpenSSL doc/man3/ERR_GET_LIB.pod 3dfda1a6 Dec 12 11:14:40 2016 -0500 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt ERR_GET_LIB 3 | 52 | .Dt ERR_GET_LIB 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm ERR_FATAL_ERROR | 58 | .Nm ERR_FATAL_ERROR |
| 59 | .Nd get library, function and reason codes for OpenSSL errors | 59 | .Nd get library, function and reason codes for OpenSSL errors |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libcrypto | ||
| 61 | .In openssl/err.h | 62 | .In openssl/err.h |
| 62 | .Ft int | 63 | .Ft int |
| 63 | .Fo ERR_GET_LIB | 64 | .Fo ERR_GET_LIB |
diff --git a/src/lib/libcrypto/man/ERR_asprintf_error_data.3 b/src/lib/libcrypto/man/ERR_asprintf_error_data.3 index 4291dea23e..edd8655d6d 100644 --- a/src/lib/libcrypto/man/ERR_asprintf_error_data.3 +++ b/src/lib/libcrypto/man/ERR_asprintf_error_data.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ERR_asprintf_error_data.3,v 1.3 2024/08/29 20:23:21 tb Exp $ | 1 | .\" $OpenBSD: ERR_asprintf_error_data.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2017 Bob Beck <beck@openbsd.org> | 3 | .\" Copyright (c) 2017 Bob Beck <beck@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -13,13 +13,14 @@ | |||
| 13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .Dd $Mdocdate: August 29 2024 $ | 16 | .Dd $Mdocdate: June 8 2025 $ |
| 17 | .Dt ERR_ASPRINTF_ERROR_DATA 3 | 17 | .Dt ERR_ASPRINTF_ERROR_DATA 3 |
| 18 | .Os | 18 | .Os |
| 19 | .Sh NAME | 19 | .Sh NAME |
| 20 | .Nm ERR_asprintf_error_data | 20 | .Nm ERR_asprintf_error_data |
| 21 | .Nd record a LibreSSL error using a formatted string | 21 | .Nd record a LibreSSL error using a formatted string |
| 22 | .Sh SYNOPSIS | 22 | .Sh SYNOPSIS |
| 23 | .Lb libcrypto | ||
| 23 | .In openssl/err.h | 24 | .In openssl/err.h |
| 24 | .Ft void | 25 | .Ft void |
| 25 | .Fo ERR_asprintf_error_data | 26 | .Fo ERR_asprintf_error_data |
diff --git a/src/lib/libcrypto/man/ERR_clear_error.3 b/src/lib/libcrypto/man/ERR_clear_error.3 index 54f563e166..d39ac11956 100644 --- a/src/lib/libcrypto/man/ERR_clear_error.3 +++ b/src/lib/libcrypto/man/ERR_clear_error.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ERR_clear_error.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: ERR_clear_error.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt ERR_CLEAR_ERROR 3 | 52 | .Dt ERR_CLEAR_ERROR 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm ERR_clear_error | 55 | .Nm ERR_clear_error |
| 56 | .Nd clear the OpenSSL error queue | 56 | .Nd clear the OpenSSL error queue |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/err.h | 59 | .In openssl/err.h |
| 59 | .Ft void | 60 | .Ft void |
| 60 | .Fn ERR_clear_error void | 61 | .Fn ERR_clear_error void |
diff --git a/src/lib/libcrypto/man/ERR_error_string.3 b/src/lib/libcrypto/man/ERR_error_string.3 index 60f9132859..a1df20fe70 100644 --- a/src/lib/libcrypto/man/ERR_error_string.3 +++ b/src/lib/libcrypto/man/ERR_error_string.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ERR_error_string.3,v 1.7 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: ERR_error_string.3,v 1.8 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt ERR_ERROR_STRING 3 | 52 | .Dt ERR_ERROR_STRING 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -59,6 +59,7 @@ | |||
| 59 | .Nm ERR_reason_error_string | 59 | .Nm ERR_reason_error_string |
| 60 | .Nd obtain human-readable OpenSSL error messages | 60 | .Nd obtain human-readable OpenSSL error messages |
| 61 | .Sh SYNOPSIS | 61 | .Sh SYNOPSIS |
| 62 | .Lb libcrypto | ||
| 62 | .In openssl/err.h | 63 | .In openssl/err.h |
| 63 | .Ft char * | 64 | .Ft char * |
| 64 | .Fo ERR_error_string | 65 | .Fo ERR_error_string |
diff --git a/src/lib/libcrypto/man/ERR_get_error.3 b/src/lib/libcrypto/man/ERR_get_error.3 index f3bcc09cbc..c592c34528 100644 --- a/src/lib/libcrypto/man/ERR_get_error.3 +++ b/src/lib/libcrypto/man/ERR_get_error.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ERR_get_error.3,v 1.8 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: ERR_get_error.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt ERR_GET_ERROR 3 | 52 | .Dt ERR_GET_ERROR 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -63,6 +63,7 @@ | |||
| 63 | .Nm ERR_peek_last_error_line_data | 63 | .Nm ERR_peek_last_error_line_data |
| 64 | .Nd obtain OpenSSL error code and data | 64 | .Nd obtain OpenSSL error code and data |
| 65 | .Sh SYNOPSIS | 65 | .Sh SYNOPSIS |
| 66 | .Lb libcrypto | ||
| 66 | .In openssl/err.h | 67 | .In openssl/err.h |
| 67 | .Ft unsigned long | 68 | .Ft unsigned long |
| 68 | .Fn ERR_get_error void | 69 | .Fn ERR_get_error void |
diff --git a/src/lib/libcrypto/man/ERR_load_crypto_strings.3 b/src/lib/libcrypto/man/ERR_load_crypto_strings.3 index 2bca8af60f..13da93e22d 100644 --- a/src/lib/libcrypto/man/ERR_load_crypto_strings.3 +++ b/src/lib/libcrypto/man/ERR_load_crypto_strings.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ERR_load_crypto_strings.3,v 1.12 2024/03/05 19:21:31 tb Exp $ | 1 | .\" $OpenBSD: ERR_load_crypto_strings.3,v 1.14 2025/06/08 22:58:09 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL f672aee4 Feb 9 11:52:40 2016 -0500 | 2 | .\" full merge up to: OpenSSL f672aee4 Feb 9 11:52:40 2016 -0500 |
| 3 | .\" selective merge up to: OpenSSL b3696a55 Sep 2 09:35:50 2017 -0400 | 3 | .\" selective merge up to: OpenSSL b3696a55 Sep 2 09:35:50 2017 -0400 |
| 4 | .\" | 4 | .\" |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: March 5 2024 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt ERR_LOAD_CRYPTO_STRINGS 3 | 70 | .Dt ERR_LOAD_CRYPTO_STRINGS 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -101,11 +101,14 @@ | |||
| 101 | .\" ERR_load_X509_strings() | 101 | .\" ERR_load_X509_strings() |
| 102 | .\" ERR_load_X509V3_strings() | 102 | .\" ERR_load_X509V3_strings() |
| 103 | .Sh SYNOPSIS | 103 | .Sh SYNOPSIS |
| 104 | .Lb libcrypto | ||
| 104 | .In openssl/err.h | 105 | .In openssl/err.h |
| 105 | .Ft void | 106 | .Ft void |
| 106 | .Fn ERR_load_crypto_strings void | 107 | .Fn ERR_load_crypto_strings void |
| 107 | .Ft void | 108 | .Ft void |
| 108 | .Fn ERR_free_strings void | 109 | .Fn ERR_free_strings void |
| 110 | .Pp | ||
| 111 | .Lb libssl libcrypto | ||
| 109 | .In openssl/ssl.h | 112 | .In openssl/ssl.h |
| 110 | .Ft void | 113 | .Ft void |
| 111 | .Fn SSL_load_error_strings void | 114 | .Fn SSL_load_error_strings void |
diff --git a/src/lib/libcrypto/man/ERR_load_strings.3 b/src/lib/libcrypto/man/ERR_load_strings.3 index 1020743954..9697742404 100644 --- a/src/lib/libcrypto/man/ERR_load_strings.3 +++ b/src/lib/libcrypto/man/ERR_load_strings.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ERR_load_strings.3,v 1.8 2024/07/26 03:40:43 tb Exp $ | 1 | .\" $OpenBSD: ERR_load_strings.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL 05ea606a May 20 20:52:46 2016 -0400 | 2 | .\" OpenSSL 05ea606a May 20 20:52:46 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: July 26 2024 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt ERR_LOAD_STRINGS 3 | 52 | .Dt ERR_LOAD_STRINGS 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm ERR_get_next_error_library | 57 | .Nm ERR_get_next_error_library |
| 58 | .Nd load arbitrary OpenSSL error strings | 58 | .Nd load arbitrary OpenSSL error strings |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/err.h | 61 | .In openssl/err.h |
| 61 | .Ft void | 62 | .Ft void |
| 62 | .Fo ERR_load_strings | 63 | .Fo ERR_load_strings |
diff --git a/src/lib/libcrypto/man/ERR_print_errors.3 b/src/lib/libcrypto/man/ERR_print_errors.3 index a5c7c03287..4d6f8d3717 100644 --- a/src/lib/libcrypto/man/ERR_print_errors.3 +++ b/src/lib/libcrypto/man/ERR_print_errors.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ERR_print_errors.3,v 1.8 2020/03/28 22:40:58 schwarze Exp $ | 1 | .\" $OpenBSD: ERR_print_errors.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>, | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>, |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: March 28 2020 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt ERR_PRINT_ERRORS 3 | 53 | .Dt ERR_PRINT_ERRORS 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm ERR_print_errors_cb | 58 | .Nm ERR_print_errors_cb |
| 59 | .Nd print OpenSSL error messages | 59 | .Nd print OpenSSL error messages |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libcrypto | ||
| 61 | .In openssl/err.h | 62 | .In openssl/err.h |
| 62 | .Ft void | 63 | .Ft void |
| 63 | .Fo ERR_print_errors | 64 | .Fo ERR_print_errors |
diff --git a/src/lib/libcrypto/man/ERR_put_error.3 b/src/lib/libcrypto/man/ERR_put_error.3 index 37e1b4d1ab..1af0e37826 100644 --- a/src/lib/libcrypto/man/ERR_put_error.3 +++ b/src/lib/libcrypto/man/ERR_put_error.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ERR_put_error.3,v 1.11 2024/08/29 20:23:21 tb Exp $ | 1 | .\" $OpenBSD: ERR_put_error.3,v 1.12 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: August 29 2024 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt ERR_PUT_ERROR 3 | 52 | .Dt ERR_PUT_ERROR 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm ERR_put_error | 55 | .Nm ERR_put_error |
| 56 | .Nd record an OpenSSL error | 56 | .Nd record an OpenSSL error |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/err.h | 59 | .In openssl/err.h |
| 59 | .Ft void | 60 | .Ft void |
| 60 | .Fo ERR_put_error | 61 | .Fo ERR_put_error |
diff --git a/src/lib/libcrypto/man/ERR_remove_state.3 b/src/lib/libcrypto/man/ERR_remove_state.3 index bc28f15dea..c05810d778 100644 --- a/src/lib/libcrypto/man/ERR_remove_state.3 +++ b/src/lib/libcrypto/man/ERR_remove_state.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ERR_remove_state.3,v 1.7 2020/03/28 22:40:58 schwarze Exp $ | 1 | .\" $OpenBSD: ERR_remove_state.3,v 1.8 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 | 2 | .\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> and | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> and |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: March 28 2020 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt ERR_REMOVE_STATE 3 | 53 | .Dt ERR_REMOVE_STATE 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm ERR_remove_state | 57 | .Nm ERR_remove_state |
| 58 | .Nd free a thread's OpenSSL error queue | 58 | .Nd free a thread's OpenSSL error queue |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/err.h | 61 | .In openssl/err.h |
| 61 | .Ft void | 62 | .Ft void |
| 62 | .Fo ERR_remove_thread_state | 63 | .Fo ERR_remove_thread_state |
diff --git a/src/lib/libcrypto/man/ERR_set_mark.3 b/src/lib/libcrypto/man/ERR_set_mark.3 index 2f3486d8c0..88b1be88b5 100644 --- a/src/lib/libcrypto/man/ERR_set_mark.3 +++ b/src/lib/libcrypto/man/ERR_set_mark.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ERR_set_mark.3,v 1.4 2018/03/23 00:09:11 schwarze Exp $ | 1 | .\" $OpenBSD: ERR_set_mark.3,v 1.5 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Richard Levitte <levitte@openssl.org>. | 4 | .\" This file was written by Richard Levitte <levitte@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 23 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt ERR_SET_MARK 3 | 52 | .Dt ERR_SET_MARK 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm ERR_pop_to_mark | 56 | .Nm ERR_pop_to_mark |
| 57 | .Nd set marks and pop OpenSSL errors until mark | 57 | .Nd set marks and pop OpenSSL errors until mark |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 59 | .In openssl/err.h | 60 | .In openssl/err.h |
| 60 | .Ft int | 61 | .Ft int |
| 61 | .Fn ERR_set_mark void | 62 | .Fn ERR_set_mark void |
diff --git a/src/lib/libcrypto/man/ESS_SIGNING_CERT_new.3 b/src/lib/libcrypto/man/ESS_SIGNING_CERT_new.3 index 4baabbcd99..7014d008af 100644 --- a/src/lib/libcrypto/man/ESS_SIGNING_CERT_new.3 +++ b/src/lib/libcrypto/man/ESS_SIGNING_CERT_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ESS_SIGNING_CERT_new.3,v 1.5 2019/06/06 01:06:58 schwarze Exp $ | 1 | .\" $OpenBSD: ESS_SIGNING_CERT_new.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: June 6 2019 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt ESS_SIGNING_CERT_NEW 3 | 18 | .Dt ESS_SIGNING_CERT_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -26,6 +26,7 @@ | |||
| 26 | .Nm ESS_ISSUER_SERIAL_free | 26 | .Nm ESS_ISSUER_SERIAL_free |
| 27 | .Nd signing certificates for S/MIME | 27 | .Nd signing certificates for S/MIME |
| 28 | .Sh SYNOPSIS | 28 | .Sh SYNOPSIS |
| 29 | .Lb libcrypto | ||
| 29 | .In openssl/ts.h | 30 | .In openssl/ts.h |
| 30 | .Ft ESS_SIGNING_CERT * | 31 | .Ft ESS_SIGNING_CERT * |
| 31 | .Fn ESS_SIGNING_CERT_new void | 32 | .Fn ESS_SIGNING_CERT_new void |
diff --git a/src/lib/libcrypto/man/EVP_AEAD_CTX_init.3 b/src/lib/libcrypto/man/EVP_AEAD_CTX_init.3 index 8b3b8adb0f..41a829c675 100644 --- a/src/lib/libcrypto/man/EVP_AEAD_CTX_init.3 +++ b/src/lib/libcrypto/man/EVP_AEAD_CTX_init.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_AEAD_CTX_init.3,v 1.16 2024/07/21 08:36:43 tb Exp $ | 1 | .\" $OpenBSD: EVP_AEAD_CTX_init.3,v 1.17 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2014, Google Inc. | 3 | .\" Copyright (c) 2014, Google Inc. |
| 4 | .\" Parts of the text were written by Adam Langley and David Benjamin. | 4 | .\" Parts of the text were written by Adam Langley and David Benjamin. |
| @@ -17,7 +17,7 @@ | |||
| 17 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 17 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 18 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 18 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 19 | .\" | 19 | .\" |
| 20 | .Dd $Mdocdate: July 21 2024 $ | 20 | .Dd $Mdocdate: June 8 2025 $ |
| 21 | .Dt EVP_AEAD_CTX_INIT 3 | 21 | .Dt EVP_AEAD_CTX_INIT 3 |
| 22 | .Os | 22 | .Os |
| 23 | .Sh NAME | 23 | .Sh NAME |
| @@ -37,6 +37,7 @@ | |||
| 37 | .Nm EVP_aead_xchacha20_poly1305 | 37 | .Nm EVP_aead_xchacha20_poly1305 |
| 38 | .Nd authenticated encryption with additional data | 38 | .Nd authenticated encryption with additional data |
| 39 | .Sh SYNOPSIS | 39 | .Sh SYNOPSIS |
| 40 | .Lb libcrypto | ||
| 40 | .In openssl/evp.h | 41 | .In openssl/evp.h |
| 41 | .Ft EVP_AEAD_CTX * | 42 | .Ft EVP_AEAD_CTX * |
| 42 | .Fn EVP_AEAD_CTX_new void | 43 | .Fn EVP_AEAD_CTX_new void |
diff --git a/src/lib/libcrypto/man/EVP_BytesToKey.3 b/src/lib/libcrypto/man/EVP_BytesToKey.3 index 1f78b4de06..060335744e 100644 --- a/src/lib/libcrypto/man/EVP_BytesToKey.3 +++ b/src/lib/libcrypto/man/EVP_BytesToKey.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_BytesToKey.3,v 1.9 2024/12/05 15:12:37 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_BytesToKey.3,v 1.10 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -49,13 +49,14 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: December 5 2024 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt EVP_BYTESTOKEY 3 | 53 | .Dt EVP_BYTESTOKEY 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| 56 | .Nm EVP_BytesToKey | 56 | .Nm EVP_BytesToKey |
| 57 | .Nd password based encryption routine | 57 | .Nd password based encryption routine |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 59 | .In openssl/evp.h | 60 | .In openssl/evp.h |
| 60 | .Ft int | 61 | .Ft int |
| 61 | .Fo EVP_BytesToKey | 62 | .Fo EVP_BytesToKey |
diff --git a/src/lib/libcrypto/man/EVP_CIPHER_CTX_ctrl.3 b/src/lib/libcrypto/man/EVP_CIPHER_CTX_ctrl.3 index d7ab36e711..8aaf2cc385 100644 --- a/src/lib/libcrypto/man/EVP_CIPHER_CTX_ctrl.3 +++ b/src/lib/libcrypto/man/EVP_CIPHER_CTX_ctrl.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_CIPHER_CTX_ctrl.3,v 1.4 2025/03/25 11:54:34 tb Exp $ | 1 | .\" $OpenBSD: EVP_CIPHER_CTX_ctrl.3,v 1.5 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 5211e094 Nov 11 14:39:11 2014 -0800 | 2 | .\" full merge up to: OpenSSL 5211e094 Nov 11 14:39:11 2014 -0800 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -67,7 +67,7 @@ | |||
| 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 69 | .\" | 69 | .\" |
| 70 | .Dd $Mdocdate: March 25 2025 $ | 70 | .Dd $Mdocdate: June 8 2025 $ |
| 71 | .Dt EVP_CIPHER_CTX_CTRL 3 | 71 | .Dt EVP_CIPHER_CTX_CTRL 3 |
| 72 | .Os | 72 | .Os |
| 73 | .Sh NAME | 73 | .Sh NAME |
| @@ -82,6 +82,7 @@ | |||
| 82 | .Nm EVP_CIPHER_CTX_get_iv | 82 | .Nm EVP_CIPHER_CTX_get_iv |
| 83 | .Nd configure EVP cipher contexts | 83 | .Nd configure EVP cipher contexts |
| 84 | .Sh SYNOPSIS | 84 | .Sh SYNOPSIS |
| 85 | .Lb libcrypto | ||
| 85 | .In openssl/evp.h | 86 | .In openssl/evp.h |
| 86 | .Ft int | 87 | .Ft int |
| 87 | .Fo EVP_CIPHER_CTX_ctrl | 88 | .Fo EVP_CIPHER_CTX_ctrl |
diff --git a/src/lib/libcrypto/man/EVP_CIPHER_CTX_get_cipher_data.3 b/src/lib/libcrypto/man/EVP_CIPHER_CTX_get_cipher_data.3 index 4f75c8b008..a549ea25f6 100644 --- a/src/lib/libcrypto/man/EVP_CIPHER_CTX_get_cipher_data.3 +++ b/src/lib/libcrypto/man/EVP_CIPHER_CTX_get_cipher_data.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_CIPHER_CTX_get_cipher_data.3,v 1.3 2023/08/26 15:12:04 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_CIPHER_CTX_get_cipher_data.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: August 26 2023 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt EVP_CIPHER_CTX_GET_CIPHER_DATA 3 | 69 | .Dt EVP_CIPHER_CTX_GET_CIPHER_DATA 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -74,6 +74,7 @@ | |||
| 74 | .Nm EVP_CIPHER_CTX_buf_noconst | 74 | .Nm EVP_CIPHER_CTX_buf_noconst |
| 75 | .Nd inspect and modify EVP_CIPHER_CTX objects | 75 | .Nd inspect and modify EVP_CIPHER_CTX objects |
| 76 | .Sh SYNOPSIS | 76 | .Sh SYNOPSIS |
| 77 | .Lb libcrypto | ||
| 77 | .In openssl/evp.h | 78 | .In openssl/evp.h |
| 78 | .Ft void * | 79 | .Ft void * |
| 79 | .Fo EVP_CIPHER_CTX_get_cipher_data | 80 | .Fo EVP_CIPHER_CTX_get_cipher_data |
diff --git a/src/lib/libcrypto/man/EVP_CIPHER_CTX_init.3 b/src/lib/libcrypto/man/EVP_CIPHER_CTX_init.3 index 79a8e540af..7b1d81bafa 100644 --- a/src/lib/libcrypto/man/EVP_CIPHER_CTX_init.3 +++ b/src/lib/libcrypto/man/EVP_CIPHER_CTX_init.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_CIPHER_CTX_init.3,v 1.4 2024/12/06 15:01:01 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_CIPHER_CTX_init.3,v 1.5 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: | 2 | .\" full merge up to: |
| 3 | .\" OpenSSL EVP_EncryptInit.pod 0874d7f2 Oct 11 13:13:47 2022 +0100 | 3 | .\" OpenSSL EVP_EncryptInit.pod 0874d7f2 Oct 11 13:13:47 2022 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -68,7 +68,7 @@ | |||
| 68 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 68 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 69 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 69 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 70 | .\" | 70 | .\" |
| 71 | .Dd $Mdocdate: December 6 2024 $ | 71 | .Dd $Mdocdate: June 8 2025 $ |
| 72 | .Dt EVP_CIPHER_CTX_INIT 3 | 72 | .Dt EVP_CIPHER_CTX_INIT 3 |
| 73 | .Os | 73 | .Os |
| 74 | .Sh NAME | 74 | .Sh NAME |
| @@ -77,6 +77,7 @@ | |||
| 77 | .Nm EVP_Cipher | 77 | .Nm EVP_Cipher |
| 78 | .Nd obsolete EVP cipher functions | 78 | .Nd obsolete EVP cipher functions |
| 79 | .Sh SYNOPSIS | 79 | .Sh SYNOPSIS |
| 80 | .Lb libcrypto | ||
| 80 | .In openssl/evp.h | 81 | .In openssl/evp.h |
| 81 | .Ft int | 82 | .Ft int |
| 82 | .Fo EVP_CIPHER_CTX_init | 83 | .Fo EVP_CIPHER_CTX_init |
diff --git a/src/lib/libcrypto/man/EVP_CIPHER_CTX_set_flags.3 b/src/lib/libcrypto/man/EVP_CIPHER_CTX_set_flags.3 index 67ef8679bc..0d86050ae6 100644 --- a/src/lib/libcrypto/man/EVP_CIPHER_CTX_set_flags.3 +++ b/src/lib/libcrypto/man/EVP_CIPHER_CTX_set_flags.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_CIPHER_CTX_set_flags.3,v 1.2 2023/09/06 16:26:49 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_CIPHER_CTX_set_flags.3,v 1.3 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 5211e094 Nov 11 14:39:11 2014 -0800 | 2 | .\" full merge up to: OpenSSL 5211e094 Nov 11 14:39:11 2014 -0800 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -67,7 +67,7 @@ | |||
| 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 69 | .\" | 69 | .\" |
| 70 | .Dd $Mdocdate: September 6 2023 $ | 70 | .Dd $Mdocdate: June 8 2025 $ |
| 71 | .Dt EVP_CIPHER_CTX_SET_FLAGS 3 | 71 | .Dt EVP_CIPHER_CTX_SET_FLAGS 3 |
| 72 | .Os | 72 | .Os |
| 73 | .Sh NAME | 73 | .Sh NAME |
| @@ -86,6 +86,7 @@ | |||
| 86 | .Nm EVP_CIPHER_CTX_set_app_data | 86 | .Nm EVP_CIPHER_CTX_set_app_data |
| 87 | .Nd unusual EVP cipher context configuration | 87 | .Nd unusual EVP cipher context configuration |
| 88 | .Sh SYNOPSIS | 88 | .Sh SYNOPSIS |
| 89 | .Lb libcrypto | ||
| 89 | .In openssl/evp.h | 90 | .In openssl/evp.h |
| 90 | .Ft void | 91 | .Ft void |
| 91 | .Fo EVP_CIPHER_CTX_set_flags | 92 | .Fo EVP_CIPHER_CTX_set_flags |
diff --git a/src/lib/libcrypto/man/EVP_CIPHER_do_all.3 b/src/lib/libcrypto/man/EVP_CIPHER_do_all.3 index e912044978..342cf372df 100644 --- a/src/lib/libcrypto/man/EVP_CIPHER_do_all.3 +++ b/src/lib/libcrypto/man/EVP_CIPHER_do_all.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_CIPHER_do_all.3,v 1.3 2024/03/14 23:54:55 tb Exp $ | 1 | .\" $OpenBSD: EVP_CIPHER_do_all.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2023,2024 Theo Buehler <tb@openbsd.org> | 3 | .\" Copyright (c) 2023,2024 Theo Buehler <tb@openbsd.org> |
| 4 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 4 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| @@ -15,7 +15,7 @@ | |||
| 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 | .\" | 17 | .\" |
| 18 | .Dd $Mdocdate: March 14 2024 $ | 18 | .Dd $Mdocdate: June 8 2025 $ |
| 19 | .Dt EVP_CIPHER_DO_ALL 3 | 19 | .Dt EVP_CIPHER_DO_ALL 3 |
| 20 | .Os | 20 | .Os |
| 21 | .Sh NAME | 21 | .Sh NAME |
| @@ -27,6 +27,7 @@ | |||
| 27 | .Nm OBJ_NAME_do_all_sorted | 27 | .Nm OBJ_NAME_do_all_sorted |
| 28 | .Nd iterate over lookup tables for ciphers and digests | 28 | .Nd iterate over lookup tables for ciphers and digests |
| 29 | .Sh SYNOPSIS | 29 | .Sh SYNOPSIS |
| 30 | .Lb libcrypto | ||
| 30 | .In openssl/evp.h | 31 | .In openssl/evp.h |
| 31 | .Ft void | 32 | .Ft void |
| 32 | .Fo EVP_CIPHER_do_all | 33 | .Fo EVP_CIPHER_do_all |
diff --git a/src/lib/libcrypto/man/EVP_CIPHER_meth_new.3 b/src/lib/libcrypto/man/EVP_CIPHER_meth_new.3 index 187dab6d8a..f831b20c3d 100644 --- a/src/lib/libcrypto/man/EVP_CIPHER_meth_new.3 +++ b/src/lib/libcrypto/man/EVP_CIPHER_meth_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_CIPHER_meth_new.3,v 1.6 2024/03/04 09:49:07 tb Exp $ | 1 | .\" $OpenBSD: EVP_CIPHER_meth_new.3,v 1.7 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" selective merge up to: OpenSSL b0edda11 Mar 20 13:00:17 2018 +0000 | 2 | .\" selective merge up to: OpenSSL b0edda11 Mar 20 13:00:17 2018 +0000 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: March 4 2024 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt EVP_CIPHER_METH_NEW 3 | 70 | .Dt EVP_CIPHER_METH_NEW 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -84,6 +84,7 @@ | |||
| 84 | .Nm EVP_CIPHER_meth_set_ctrl | 84 | .Nm EVP_CIPHER_meth_set_ctrl |
| 85 | .Nd Routines to build up EVP_CIPHER methods | 85 | .Nd Routines to build up EVP_CIPHER methods |
| 86 | .Sh SYNOPSIS | 86 | .Sh SYNOPSIS |
| 87 | .Lb libcrypto | ||
| 87 | .In openssl/evp.h | 88 | .In openssl/evp.h |
| 88 | .Ft EVP_CIPHER * | 89 | .Ft EVP_CIPHER * |
| 89 | .Fo EVP_CIPHER_meth_new | 90 | .Fo EVP_CIPHER_meth_new |
diff --git a/src/lib/libcrypto/man/EVP_CIPHER_nid.3 b/src/lib/libcrypto/man/EVP_CIPHER_nid.3 index 1feff4f34e..6152c389c8 100644 --- a/src/lib/libcrypto/man/EVP_CIPHER_nid.3 +++ b/src/lib/libcrypto/man/EVP_CIPHER_nid.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_CIPHER_nid.3,v 1.3 2023/09/05 14:54:21 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_CIPHER_nid.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL man3/EVP_EncryptInit.pod | 2 | .\" full merge up to: OpenSSL man3/EVP_EncryptInit.pod |
| 3 | .\" 0874d7f2 Oct 11 13:13:47 2022 +0100 | 3 | .\" 0874d7f2 Oct 11 13:13:47 2022 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: September 5 2023 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt EVP_CIPHER_NID 3 | 70 | .Dt EVP_CIPHER_NID 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -83,6 +83,7 @@ | |||
| 83 | .Nm EVP_CIPHER_CTX_mode | 83 | .Nm EVP_CIPHER_CTX_mode |
| 84 | .Nd inspect EVP_CIPHER objects | 84 | .Nd inspect EVP_CIPHER objects |
| 85 | .Sh SYNOPSIS | 85 | .Sh SYNOPSIS |
| 86 | .Lb libcrypto | ||
| 86 | .In openssl/evp.h | 87 | .In openssl/evp.h |
| 87 | .Ft int | 88 | .Ft int |
| 88 | .Fo EVP_CIPHER_nid | 89 | .Fo EVP_CIPHER_nid |
diff --git a/src/lib/libcrypto/man/EVP_DigestInit.3 b/src/lib/libcrypto/man/EVP_DigestInit.3 index 668c189bc1..1457d65e40 100644 --- a/src/lib/libcrypto/man/EVP_DigestInit.3 +++ b/src/lib/libcrypto/man/EVP_DigestInit.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_DigestInit.3,v 1.37 2024/12/06 15:01:01 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_DigestInit.3,v 1.39 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 7f572e95 Dec 2 13:57:04 2015 +0000 | 2 | .\" full merge up to: OpenSSL 7f572e95 Dec 2 13:57:04 2015 +0000 |
| 3 | .\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 | 3 | .\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -70,7 +70,7 @@ | |||
| 70 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 70 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 71 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 71 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 72 | .\" | 72 | .\" |
| 73 | .Dd $Mdocdate: December 6 2024 $ | 73 | .Dd $Mdocdate: June 8 2025 $ |
| 74 | .Dt EVP_DIGESTINIT 3 | 74 | .Dt EVP_DIGESTINIT 3 |
| 75 | .Os | 75 | .Os |
| 76 | .Sh NAME | 76 | .Sh NAME |
| @@ -103,6 +103,7 @@ | |||
| 103 | .Nm EVP_get_digestbyobj | 103 | .Nm EVP_get_digestbyobj |
| 104 | .Nd EVP digest routines | 104 | .Nd EVP digest routines |
| 105 | .Sh SYNOPSIS | 105 | .Sh SYNOPSIS |
| 106 | .Lb libcrypto | ||
| 106 | .In openssl/evp.h | 107 | .In openssl/evp.h |
| 107 | .Ft EVP_MD_CTX * | 108 | .Ft EVP_MD_CTX * |
| 108 | .Fn EVP_MD_CTX_new void | 109 | .Fn EVP_MD_CTX_new void |
| @@ -361,15 +362,16 @@ and | |||
| 361 | .Fn EVP_ripemd160 | 362 | .Fn EVP_ripemd160 |
| 362 | return | 363 | return |
| 363 | .Vt EVP_MD | 364 | .Vt EVP_MD |
| 364 | structures for the SHA224, SHA256, SHA384, SHA512 and | 365 | structures for the SHA-224, SHA-256, SHA-384, SHA-512 and |
| 365 | RIPEMD160 digest algorithms respectively. | 366 | RIPEMD-160 digest algorithms respectively. |
| 366 | .Pp | 367 | .Pp |
| 367 | .Fn EVP_sha512_224 | 368 | .Fn EVP_sha512_224 |
| 368 | and | 369 | and |
| 369 | .Fn EVP_sha512_256 | 370 | .Fn EVP_sha512_256 |
| 370 | return an | 371 | return an |
| 371 | .Vt EVP_MD | 372 | .Vt EVP_MD |
| 372 | structure that provides the truncated SHA512 variants SHA512/224 and SHA512/256, | 373 | structure that provides the truncated SHA-512 variants |
| 374 | SHA-512/224 and SHA-512/256, | ||
| 373 | respectively. | 375 | respectively. |
| 374 | .Pp | 376 | .Pp |
| 375 | .Fn EVP_md_null | 377 | .Fn EVP_md_null |
diff --git a/src/lib/libcrypto/man/EVP_DigestSignInit.3 b/src/lib/libcrypto/man/EVP_DigestSignInit.3 index caf519e28c..46b8acbd3c 100644 --- a/src/lib/libcrypto/man/EVP_DigestSignInit.3 +++ b/src/lib/libcrypto/man/EVP_DigestSignInit.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_DigestSignInit.3,v 1.15 2024/12/06 14:27:49 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_DigestSignInit.3,v 1.16 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 28428130 Apr 17 15:18:40 2018 +0200 | 2 | .\" full merge up to: OpenSSL 28428130 Apr 17 15:18:40 2018 +0200 |
| 3 | .\" selective merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 | 3 | .\" selective merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 |
| 4 | .\" | 4 | .\" |
| @@ -50,7 +50,7 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: December 6 2024 $ | 53 | .Dd $Mdocdate: June 8 2025 $ |
| 54 | .Dt EVP_DIGESTSIGNINIT 3 | 54 | .Dt EVP_DIGESTSIGNINIT 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| @@ -60,6 +60,7 @@ | |||
| 60 | .Nm EVP_DigestSign | 60 | .Nm EVP_DigestSign |
| 61 | .Nd EVP signing functions | 61 | .Nd EVP signing functions |
| 62 | .Sh SYNOPSIS | 62 | .Sh SYNOPSIS |
| 63 | .Lb libcrypto | ||
| 63 | .In openssl/evp.h | 64 | .In openssl/evp.h |
| 64 | .Ft int | 65 | .Ft int |
| 65 | .Fo EVP_DigestSignInit | 66 | .Fo EVP_DigestSignInit |
diff --git a/src/lib/libcrypto/man/EVP_DigestVerifyInit.3 b/src/lib/libcrypto/man/EVP_DigestVerifyInit.3 index fa62f5a0a5..3d40f8e916 100644 --- a/src/lib/libcrypto/man/EVP_DigestVerifyInit.3 +++ b/src/lib/libcrypto/man/EVP_DigestVerifyInit.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_DigestVerifyInit.3,v 1.17 2024/12/06 14:27:49 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_DigestVerifyInit.3,v 1.18 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to OpenSSL f097e875 Aug 23 11:37:22 2018 +0100 | 2 | .\" full merge up to OpenSSL f097e875 Aug 23 11:37:22 2018 +0100 |
| 3 | .\" selective merge up to 24a535ea Sep 22 13:14:20 2020 +0100 | 3 | .\" selective merge up to 24a535ea Sep 22 13:14:20 2020 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -50,7 +50,7 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: December 6 2024 $ | 53 | .Dd $Mdocdate: June 8 2025 $ |
| 54 | .Dt EVP_DIGESTVERIFYINIT 3 | 54 | .Dt EVP_DIGESTVERIFYINIT 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| @@ -60,6 +60,7 @@ | |||
| 60 | .Nm EVP_DigestVerify | 60 | .Nm EVP_DigestVerify |
| 61 | .Nd EVP signature verification functions | 61 | .Nd EVP signature verification functions |
| 62 | .Sh SYNOPSIS | 62 | .Sh SYNOPSIS |
| 63 | .Lb libcrypto | ||
| 63 | .In openssl/evp.h | 64 | .In openssl/evp.h |
| 64 | .Ft int | 65 | .Ft int |
| 65 | .Fo EVP_DigestVerifyInit | 66 | .Fo EVP_DigestVerifyInit |
diff --git a/src/lib/libcrypto/man/EVP_EncodeInit.3 b/src/lib/libcrypto/man/EVP_EncodeInit.3 index da79af84cf..82f5687c8b 100644 --- a/src/lib/libcrypto/man/EVP_EncodeInit.3 +++ b/src/lib/libcrypto/man/EVP_EncodeInit.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_EncodeInit.3,v 1.7 2019/06/06 01:06:58 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_EncodeInit.3,v 1.8 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL f430ba31 Jun 19 19:39:01 2016 +0200 | 2 | .\" full merge up to: OpenSSL f430ba31 Jun 19 19:39:01 2016 +0200 |
| 3 | .\" selective merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 | 3 | .\" selective merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: June 6 2019 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt EVP_ENCODEINIT 3 | 53 | .Dt EVP_ENCODEINIT 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -65,6 +65,7 @@ | |||
| 65 | .Nm EVP_DecodeBlock | 65 | .Nm EVP_DecodeBlock |
| 66 | .Nd EVP base64 encode/decode routines | 66 | .Nd EVP base64 encode/decode routines |
| 67 | .Sh SYNOPSIS | 67 | .Sh SYNOPSIS |
| 68 | .Lb libcrypto | ||
| 68 | .In openssl/evp.h | 69 | .In openssl/evp.h |
| 69 | .Ft EVP_ENCODE_CTX * | 70 | .Ft EVP_ENCODE_CTX * |
| 70 | .Fn EVP_ENCODE_CTX_new void | 71 | .Fn EVP_ENCODE_CTX_new void |
diff --git a/src/lib/libcrypto/man/EVP_EncryptInit.3 b/src/lib/libcrypto/man/EVP_EncryptInit.3 index 7765be2ca6..382c0e2b06 100644 --- a/src/lib/libcrypto/man/EVP_EncryptInit.3 +++ b/src/lib/libcrypto/man/EVP_EncryptInit.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_EncryptInit.3,v 1.56 2024/12/20 01:54:03 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_EncryptInit.3,v 1.57 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 5211e094 Nov 11 14:39:11 2014 -0800 | 2 | .\" full merge up to: OpenSSL 5211e094 Nov 11 14:39:11 2014 -0800 |
| 3 | .\" EVP_bf_cbc.pod EVP_cast5_cbc.pod EVP_idea_cbc.pod EVP_rc2_cbc.pod | 3 | .\" EVP_bf_cbc.pod EVP_cast5_cbc.pod EVP_idea_cbc.pod EVP_rc2_cbc.pod |
| 4 | .\" 7c6d372a Nov 20 13:20:01 2018 +0000 | 4 | .\" 7c6d372a Nov 20 13:20:01 2018 +0000 |
| @@ -69,7 +69,7 @@ | |||
| 69 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 69 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 70 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 70 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 71 | .\" | 71 | .\" |
| 72 | .Dd $Mdocdate: December 20 2024 $ | 72 | .Dd $Mdocdate: June 8 2025 $ |
| 73 | .Dt EVP_ENCRYPTINIT 3 | 73 | .Dt EVP_ENCRYPTINIT 3 |
| 74 | .Os | 74 | .Os |
| 75 | .Sh NAME | 75 | .Sh NAME |
| @@ -115,6 +115,7 @@ | |||
| 115 | .Nm EVP_cast5_ofb | 115 | .Nm EVP_cast5_ofb |
| 116 | .Nd EVP cipher routines | 116 | .Nd EVP cipher routines |
| 117 | .Sh SYNOPSIS | 117 | .Sh SYNOPSIS |
| 118 | .Lb libcrypto | ||
| 118 | .In openssl/evp.h | 119 | .In openssl/evp.h |
| 119 | .Ft EVP_CIPHER_CTX * | 120 | .Ft EVP_CIPHER_CTX * |
| 120 | .Fn EVP_CIPHER_CTX_new void | 121 | .Fn EVP_CIPHER_CTX_new void |
diff --git a/src/lib/libcrypto/man/EVP_MD_CTX_ctrl.3 b/src/lib/libcrypto/man/EVP_MD_CTX_ctrl.3 index c8c148faf0..a16bba9bf8 100644 --- a/src/lib/libcrypto/man/EVP_MD_CTX_ctrl.3 +++ b/src/lib/libcrypto/man/EVP_MD_CTX_ctrl.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_MD_CTX_ctrl.3,v 1.3 2024/03/05 17:21:40 tb Exp $ | 1 | .\" $OpenBSD: EVP_MD_CTX_ctrl.3,v 1.5 2025/06/11 13:48:54 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL man3/EVP_DigestInit.pod | 2 | .\" full merge up to: OpenSSL man3/EVP_DigestInit.pod |
| 3 | .\" 24a535ea Sep 22 13:14:20 2020 +0100 | 3 | .\" 24a535ea Sep 22 13:14:20 2020 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -69,7 +69,7 @@ | |||
| 69 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 69 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 70 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 70 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 71 | .\" | 71 | .\" |
| 72 | .Dd $Mdocdate: March 5 2024 $ | 72 | .Dd $Mdocdate: June 11 2025 $ |
| 73 | .Dt EVP_MD_CTX_CTRL 3 | 73 | .Dt EVP_MD_CTX_CTRL 3 |
| 74 | .Os | 74 | .Os |
| 75 | .Sh NAME | 75 | .Sh NAME |
| @@ -82,6 +82,7 @@ | |||
| 82 | .Nm EVP_MD_CTX_md_data | 82 | .Nm EVP_MD_CTX_md_data |
| 83 | .Nd configure EVP message digest contexts | 83 | .Nd configure EVP message digest contexts |
| 84 | .Sh SYNOPSIS | 84 | .Sh SYNOPSIS |
| 85 | .Lb libcrypto | ||
| 85 | .In openssl/evp.h | 86 | .In openssl/evp.h |
| 86 | .Ft int | 87 | .Ft int |
| 87 | .Fo EVP_MD_CTX_ctrl | 88 | .Fo EVP_MD_CTX_ctrl |
| @@ -154,7 +155,9 @@ when it is no longer needed. | |||
| 154 | This | 155 | This |
| 155 | .Fa command | 156 | .Fa command |
| 156 | is used by | 157 | is used by |
| 157 | .Xr SMIME_write_ASN1 3 | 158 | .Xr SMIME_write_CMS 3 |
| 159 | and | ||
| 160 | .Xr SMIME_write_PKCS7 3 | ||
| 158 | when creating S/MIME multipart/signed messages as specified in RFC 3851. | 161 | when creating S/MIME multipart/signed messages as specified in RFC 3851. |
| 159 | .Pp | 162 | .Pp |
| 160 | .Fn EVP_MD_CTX_set_flags | 163 | .Fn EVP_MD_CTX_set_flags |
diff --git a/src/lib/libcrypto/man/EVP_MD_nid.3 b/src/lib/libcrypto/man/EVP_MD_nid.3 index 15806091de..384c043149 100644 --- a/src/lib/libcrypto/man/EVP_MD_nid.3 +++ b/src/lib/libcrypto/man/EVP_MD_nid.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_MD_nid.3,v 1.4 2024/03/05 17:21:40 tb Exp $ | 1 | .\" $OpenBSD: EVP_MD_nid.3,v 1.5 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL man3/EVP_DigestInit.pod | 2 | .\" full merge up to: OpenSSL man3/EVP_DigestInit.pod |
| 3 | .\" 24a535ea Sep 22 13:14:20 2020 +0100 | 3 | .\" 24a535ea Sep 22 13:14:20 2020 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -68,7 +68,7 @@ | |||
| 68 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 68 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 69 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 69 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 70 | .\" | 70 | .\" |
| 71 | .Dd $Mdocdate: March 5 2024 $ | 71 | .Dd $Mdocdate: June 8 2025 $ |
| 72 | .Dt EVP_MD_NID 3 | 72 | .Dt EVP_MD_NID 3 |
| 73 | .Os | 73 | .Os |
| 74 | .Sh NAME | 74 | .Sh NAME |
| @@ -84,6 +84,7 @@ | |||
| 84 | .Nm EVP_MD_pkey_type | 84 | .Nm EVP_MD_pkey_type |
| 85 | .Nd inspect EVP_MD objects | 85 | .Nd inspect EVP_MD objects |
| 86 | .Sh SYNOPSIS | 86 | .Sh SYNOPSIS |
| 87 | .Lb libcrypto | ||
| 87 | .In openssl/evp.h | 88 | .In openssl/evp.h |
| 88 | .Ft int | 89 | .Ft int |
| 89 | .Fo EVP_MD_nid | 90 | .Fo EVP_MD_nid |
diff --git a/src/lib/libcrypto/man/EVP_OpenInit.3 b/src/lib/libcrypto/man/EVP_OpenInit.3 index fbd0e75571..8cdcbda0e9 100644 --- a/src/lib/libcrypto/man/EVP_OpenInit.3 +++ b/src/lib/libcrypto/man/EVP_OpenInit.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_OpenInit.3,v 1.9 2023/11/16 20:27:43 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_OpenInit.3,v 1.10 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: November 16 2023 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt EVP_OPENINIT 3 | 52 | .Dt EVP_OPENINIT 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm EVP_OpenFinal | 57 | .Nm EVP_OpenFinal |
| 58 | .Nd EVP envelope decryption | 58 | .Nd EVP envelope decryption |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/evp.h | 61 | .In openssl/evp.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fo EVP_OpenInit | 63 | .Fo EVP_OpenInit |
diff --git a/src/lib/libcrypto/man/EVP_PKCS82PKEY.3 b/src/lib/libcrypto/man/EVP_PKCS82PKEY.3 index 30a43b8dca..a8b7d86808 100644 --- a/src/lib/libcrypto/man/EVP_PKCS82PKEY.3 +++ b/src/lib/libcrypto/man/EVP_PKCS82PKEY.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_PKCS82PKEY.3,v 1.3 2024/03/05 19:21:31 tb Exp $ | 1 | .\" $OpenBSD: EVP_PKCS82PKEY.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 5 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt EVP_PKCS82PKEY 3 | 18 | .Dt EVP_PKCS82PKEY 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm EVP_PKEY2PKCS8 | 22 | .Nm EVP_PKEY2PKCS8 |
| 23 | .Nd convert between EVP_PKEY and PKCS#8 PrivateKeyInfo | 23 | .Nd convert between EVP_PKEY and PKCS#8 PrivateKeyInfo |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/x509.h | 26 | .In openssl/x509.h |
| 26 | .Ft EVP_PKEY * | 27 | .Ft EVP_PKEY * |
| 27 | .Fn EVP_PKCS82PKEY "const PKCS8_PRIV_KEY_INFO *keyinfo" | 28 | .Fn EVP_PKCS82PKEY "const PKCS8_PRIV_KEY_INFO *keyinfo" |
diff --git a/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 b/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 index 137e576c46..db65f132bb 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_PKEY_CTX_ctrl.3,v 1.28 2024/12/10 14:54:20 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_CTX_ctrl.3,v 1.30 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 | 3 | .\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 |
| 4 | .\" Parts were split out into RSA_pkey_ctx_ctrl(3). | 4 | .\" Parts were split out into RSA_pkey_ctx_ctrl(3). |
| @@ -69,7 +69,7 @@ | |||
| 69 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 69 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 70 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 70 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 71 | .\" | 71 | .\" |
| 72 | .Dd $Mdocdate: December 10 2024 $ | 72 | .Dd $Mdocdate: June 8 2025 $ |
| 73 | .Dt EVP_PKEY_CTX_CTRL 3 | 73 | .Dt EVP_PKEY_CTX_CTRL 3 |
| 74 | .Os | 74 | .Os |
| 75 | .Sh NAME | 75 | .Sh NAME |
| @@ -97,6 +97,7 @@ | |||
| 97 | .Nm EVP_PKEY_CTX_get1_id_len | 97 | .Nm EVP_PKEY_CTX_get1_id_len |
| 98 | .Nd algorithm specific control operations | 98 | .Nd algorithm specific control operations |
| 99 | .Sh SYNOPSIS | 99 | .Sh SYNOPSIS |
| 100 | .Lb libcrypto | ||
| 100 | .In openssl/evp.h | 101 | .In openssl/evp.h |
| 101 | .Ft int | 102 | .Ft int |
| 102 | .Fo EVP_PKEY_CTX_ctrl | 103 | .Fo EVP_PKEY_CTX_ctrl |
| @@ -371,7 +372,7 @@ The | |||
| 371 | macro sets the key derivation function message digest to | 372 | macro sets the key derivation function message digest to |
| 372 | .Fa md | 373 | .Fa md |
| 373 | for ECDH key derivation. | 374 | for ECDH key derivation. |
| 374 | Note that X9.63 specifies that this digest should be SHA1, | 375 | Note that X9.63 specifies that this digest should be SHA-1, |
| 375 | but OpenSSL tolerates other digests. | 376 | but OpenSSL tolerates other digests. |
| 376 | .Pp | 377 | .Pp |
| 377 | The | 378 | The |
diff --git a/src/lib/libcrypto/man/EVP_PKEY_CTX_get_operation.3 b/src/lib/libcrypto/man/EVP_PKEY_CTX_get_operation.3 index 2482c746d4..ce234337bb 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_CTX_get_operation.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_CTX_get_operation.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_PKEY_CTX_get_operation.3,v 1.3 2023/09/12 16:15:23 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_CTX_get_operation.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: September 12 2023 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt EVP_PKEY_CTX_GET_OPERATION 3 | 18 | .Dt EVP_PKEY_CTX_GET_OPERATION 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm EVP_PKEY_CTX_get0_pkey | 22 | .Nm EVP_PKEY_CTX_get0_pkey |
| 23 | .Nd inspect EVP_PKEY_CTX objects | 23 | .Nd inspect EVP_PKEY_CTX objects |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/evp.h | 26 | .In openssl/evp.h |
| 26 | .Ft int | 27 | .Ft int |
| 27 | .Fo EVP_PKEY_CTX_get_operation | 28 | .Fo EVP_PKEY_CTX_get_operation |
diff --git a/src/lib/libcrypto/man/EVP_PKEY_CTX_new.3 b/src/lib/libcrypto/man/EVP_PKEY_CTX_new.3 index e74bce9dfb..d0f514d5ea 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_CTX_new.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_CTX_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_PKEY_CTX_new.3,v 1.16 2024/12/06 14:27:49 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_CTX_new.3,v 1.17 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 | 2 | .\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: December 6 2024 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt EVP_PKEY_CTX_NEW 3 | 69 | .Dt EVP_PKEY_CTX_NEW 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -75,6 +75,7 @@ | |||
| 75 | .Nm EVP_PKEY_CTX_free | 75 | .Nm EVP_PKEY_CTX_free |
| 76 | .Nd public key algorithm context functions | 76 | .Nd public key algorithm context functions |
| 77 | .Sh SYNOPSIS | 77 | .Sh SYNOPSIS |
| 78 | .Lb libcrypto | ||
| 78 | .In openssl/evp.h | 79 | .In openssl/evp.h |
| 79 | .Ft EVP_PKEY_CTX * | 80 | .Ft EVP_PKEY_CTX * |
| 80 | .Fo EVP_PKEY_CTX_new | 81 | .Fo EVP_PKEY_CTX_new |
diff --git a/src/lib/libcrypto/man/EVP_PKEY_CTX_set_hkdf_md.3 b/src/lib/libcrypto/man/EVP_PKEY_CTX_set_hkdf_md.3 index 973ae95974..a63744097a 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_CTX_set_hkdf_md.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_CTX_set_hkdf_md.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_PKEY_CTX_set_hkdf_md.3,v 1.4 2024/07/10 07:57:37 tb Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_CTX_set_hkdf_md.3,v 1.5 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 1cb7eff4 Sep 10 13:56:40 2019 +0100 | 2 | .\" full merge up to: OpenSSL 1cb7eff4 Sep 10 13:56:40 2019 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Alessandro Ghedini <alessandro@ghedini.me>, | 4 | .\" This file was written by Alessandro Ghedini <alessandro@ghedini.me>, |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: July 10 2024 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt EVP_PKEY_CTX_SET_HKDF_MD 3 | 53 | .Dt EVP_PKEY_CTX_SET_HKDF_MD 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -60,6 +60,7 @@ | |||
| 60 | .Nm EVP_PKEY_CTX_hkdf_mode | 60 | .Nm EVP_PKEY_CTX_hkdf_mode |
| 61 | .Nd HMAC-based Extract-and-Expand key derivation algorithm | 61 | .Nd HMAC-based Extract-and-Expand key derivation algorithm |
| 62 | .Sh SYNOPSIS | 62 | .Sh SYNOPSIS |
| 63 | .Lb libcrypto | ||
| 63 | .In openssl/evp.h | 64 | .In openssl/evp.h |
| 64 | .In openssl/kdf.h | 65 | .In openssl/kdf.h |
| 65 | .Ft int | 66 | .Ft int |
diff --git a/src/lib/libcrypto/man/EVP_PKEY_CTX_set_tls1_prf_md.3 b/src/lib/libcrypto/man/EVP_PKEY_CTX_set_tls1_prf_md.3 index 1b95bbaa98..57a85a78d9 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_CTX_set_tls1_prf_md.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_CTX_set_tls1_prf_md.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_PKEY_CTX_set_tls1_prf_md.3,v 1.2 2024/07/10 10:22:03 tb Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_CTX_set_tls1_prf_md.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 1cb7eff4 Sep 10 13:56:40 2019 +0100 | 2 | .\" full merge up to: OpenSSL 1cb7eff4 Sep 10 13:56:40 2019 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr Stephen Henson <steve@openssl.org>, | 4 | .\" This file was written by Dr Stephen Henson <steve@openssl.org>, |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: July 10 2024 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt EVP_PKEY_CTX_SET_TLS1_PRF_MD 3 | 52 | .Dt EVP_PKEY_CTX_SET_TLS1_PRF_MD 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm EVP_PKEY_CTX_add1_tls1_prf_seed | 57 | .Nm EVP_PKEY_CTX_add1_tls1_prf_seed |
| 58 | .Nd TLS PRF key derivation algorithm | 58 | .Nd TLS PRF key derivation algorithm |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/evp.h | 61 | .In openssl/evp.h |
| 61 | .In openssl/kdf.h | 62 | .In openssl/kdf.h |
| 62 | .Ft int | 63 | .Ft int |
| @@ -87,7 +88,7 @@ It has no associated private key and only implements key derivation using | |||
| 87 | sets the message digest associated with the TLS PRF. | 88 | sets the message digest associated with the TLS PRF. |
| 88 | .Xr EVP_md5_sha1 3 | 89 | .Xr EVP_md5_sha1 3 |
| 89 | is treated as a special case which uses the PRF algorithm using both | 90 | is treated as a special case which uses the PRF algorithm using both |
| 90 | MD5 and SHA1 as used in TLS 1.0 and 1.1. | 91 | MD5 and SHA-1 as used in TLS 1.0 and 1.1. |
| 91 | .Pp | 92 | .Pp |
| 92 | .Fn EVP_PKEY_CTX_set_tls1_prf_secret | 93 | .Fn EVP_PKEY_CTX_set_tls1_prf_secret |
| 93 | sets the secret value of the TLS PRF to | 94 | sets the secret value of the TLS PRF to |
diff --git a/src/lib/libcrypto/man/EVP_PKEY_asn1_get_count.3 b/src/lib/libcrypto/man/EVP_PKEY_asn1_get_count.3 index f7810789b6..098a5565b2 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_asn1_get_count.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_asn1_get_count.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_PKEY_asn1_get_count.3,v 1.10 2024/12/06 12:51:13 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_asn1_get_count.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 72a7a702 Feb 26 14:05:09 2019 +0000 | 2 | .\" full merge up to: OpenSSL 72a7a702 Feb 26 14:05:09 2019 +0000 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: December 6 2024 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt EVP_PKEY_ASN1_GET_COUNT 3 | 69 | .Dt EVP_PKEY_ASN1_GET_COUNT 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -77,6 +77,7 @@ | |||
| 77 | .Nm EVP_PKEY_asn1_get0_info | 77 | .Nm EVP_PKEY_asn1_get0_info |
| 78 | .Nd enumerate public key ASN.1 methods | 78 | .Nd enumerate public key ASN.1 methods |
| 79 | .Sh SYNOPSIS | 79 | .Sh SYNOPSIS |
| 80 | .Lb libcrypto | ||
| 80 | .In openssl/evp.h | 81 | .In openssl/evp.h |
| 81 | .Ft int | 82 | .Ft int |
| 82 | .Fn EVP_PKEY_asn1_get_count void | 83 | .Fn EVP_PKEY_asn1_get_count void |
diff --git a/src/lib/libcrypto/man/EVP_PKEY_cmp.3 b/src/lib/libcrypto/man/EVP_PKEY_cmp.3 index c12843854d..bcd0152dc8 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_cmp.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_cmp.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_PKEY_cmp.3,v 1.15 2024/12/06 12:51:13 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_cmp.3,v 1.16 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 05ea606a May 20 20:52:46 2016 -0400 | 2 | .\" full merge up to: OpenSSL 05ea606a May 20 20:52:46 2016 -0400 |
| 3 | .\" selective merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 3 | .\" selective merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 4 | .\" | 4 | .\" |
| @@ -67,7 +67,7 @@ | |||
| 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 69 | .\" | 69 | .\" |
| 70 | .Dd $Mdocdate: December 6 2024 $ | 70 | .Dd $Mdocdate: June 8 2025 $ |
| 71 | .Dt EVP_PKEY_CMP 3 | 71 | .Dt EVP_PKEY_CMP 3 |
| 72 | .Os | 72 | .Os |
| 73 | .Sh NAME | 73 | .Sh NAME |
| @@ -81,6 +81,7 @@ | |||
| 81 | .\" resulting in incomplete output without the public key parameters. | 81 | .\" resulting in incomplete output without the public key parameters. |
| 82 | .Nd public key parameter and comparison functions | 82 | .Nd public key parameter and comparison functions |
| 83 | .Sh SYNOPSIS | 83 | .Sh SYNOPSIS |
| 84 | .Lb libcrypto | ||
| 84 | .In openssl/evp.h | 85 | .In openssl/evp.h |
| 85 | .Ft int | 86 | .Ft int |
| 86 | .Fo EVP_PKEY_missing_parameters | 87 | .Fo EVP_PKEY_missing_parameters |
diff --git a/src/lib/libcrypto/man/EVP_PKEY_decrypt.3 b/src/lib/libcrypto/man/EVP_PKEY_decrypt.3 index c063847b10..abac0e6a2e 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_decrypt.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_decrypt.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_PKEY_decrypt.3,v 1.10 2024/12/06 14:27:49 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_decrypt.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 48e5119a Jan 19 10:49:22 2018 +0100 | 2 | .\" full merge up to: OpenSSL 48e5119a Jan 19 10:49:22 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: December 6 2024 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt EVP_PKEY_DECRYPT 3 | 53 | .Dt EVP_PKEY_DECRYPT 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm EVP_PKEY_decrypt | 57 | .Nm EVP_PKEY_decrypt |
| 58 | .Nd decrypt using a public key algorithm | 58 | .Nd decrypt using a public key algorithm |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/evp.h | 61 | .In openssl/evp.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fo EVP_PKEY_decrypt_init | 63 | .Fo EVP_PKEY_decrypt_init |
diff --git a/src/lib/libcrypto/man/EVP_PKEY_derive.3 b/src/lib/libcrypto/man/EVP_PKEY_derive.3 index 47f467fea1..d02ef0e9e4 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_derive.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_derive.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_PKEY_derive.3,v 1.12 2024/12/06 14:27:49 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_derive.3,v 1.13 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 48e5119a Jan 19 10:49:22 2018 +0100 | 2 | .\" full merge up to: OpenSSL 48e5119a Jan 19 10:49:22 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: December 6 2024 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt EVP_PKEY_DERIVE 3 | 70 | .Dt EVP_PKEY_DERIVE 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -76,6 +76,7 @@ | |||
| 76 | .Nm EVP_PKEY_derive | 76 | .Nm EVP_PKEY_derive |
| 77 | .Nd derive public key algorithm shared secret | 77 | .Nd derive public key algorithm shared secret |
| 78 | .Sh SYNOPSIS | 78 | .Sh SYNOPSIS |
| 79 | .Lb libcrypto | ||
| 79 | .In openssl/evp.h | 80 | .In openssl/evp.h |
| 80 | .Ft int | 81 | .Ft int |
| 81 | .Fo EVP_PKEY_derive_init | 82 | .Fo EVP_PKEY_derive_init |
diff --git a/src/lib/libcrypto/man/EVP_PKEY_encrypt.3 b/src/lib/libcrypto/man/EVP_PKEY_encrypt.3 index c2e70cb31f..f32d411283 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_encrypt.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_encrypt.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_PKEY_encrypt.3,v 1.10 2024/12/06 14:27:49 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_encrypt.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: December 6 2024 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt EVP_PKEY_ENCRYPT 3 | 53 | .Dt EVP_PKEY_ENCRYPT 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm EVP_PKEY_encrypt | 57 | .Nm EVP_PKEY_encrypt |
| 58 | .Nd encrypt using a public key algorithm | 58 | .Nd encrypt using a public key algorithm |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/evp.h | 61 | .In openssl/evp.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fo EVP_PKEY_encrypt_init | 63 | .Fo EVP_PKEY_encrypt_init |
diff --git a/src/lib/libcrypto/man/EVP_PKEY_get_default_digest_nid.3 b/src/lib/libcrypto/man/EVP_PKEY_get_default_digest_nid.3 index e9ff7c4609..5c5b07bd3c 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_get_default_digest_nid.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_get_default_digest_nid.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_PKEY_get_default_digest_nid.3,v 1.10 2024/12/06 12:51:13 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_get_default_digest_nid.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 | 2 | .\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -66,13 +66,14 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: December 6 2024 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt EVP_PKEY_GET_DEFAULT_DIGEST_NID 3 | 70 | .Dt EVP_PKEY_GET_DEFAULT_DIGEST_NID 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| 73 | .Nm EVP_PKEY_get_default_digest_nid | 73 | .Nm EVP_PKEY_get_default_digest_nid |
| 74 | .Nd get default signature digest | 74 | .Nd get default signature digest |
| 75 | .Sh SYNOPSIS | 75 | .Sh SYNOPSIS |
| 76 | .Lb libcrypto | ||
| 76 | .In openssl/evp.h | 77 | .In openssl/evp.h |
| 77 | .Ft int | 78 | .Ft int |
| 78 | .Fo EVP_PKEY_get_default_digest_nid | 79 | .Fo EVP_PKEY_get_default_digest_nid |
diff --git a/src/lib/libcrypto/man/EVP_PKEY_keygen.3 b/src/lib/libcrypto/man/EVP_PKEY_keygen.3 index e75859b486..3c000f8cd2 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_keygen.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_keygen.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_PKEY_keygen.3,v 1.15 2024/12/06 14:27:49 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_keygen.3,v 1.16 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 | 2 | .\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: December 6 2024 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt EVP_PKEY_KEYGEN 3 | 70 | .Dt EVP_PKEY_KEYGEN 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -85,6 +85,7 @@ | |||
| 85 | .Nm EVP_PKEY_CTX_get_data | 85 | .Nm EVP_PKEY_CTX_get_data |
| 86 | .Nd key and parameter generation functions | 86 | .Nd key and parameter generation functions |
| 87 | .Sh SYNOPSIS | 87 | .Sh SYNOPSIS |
| 88 | .Lb libcrypto | ||
| 88 | .In openssl/evp.h | 89 | .In openssl/evp.h |
| 89 | .Ft int | 90 | .Ft int |
| 90 | .Fo EVP_PKEY_keygen_init | 91 | .Fo EVP_PKEY_keygen_init |
diff --git a/src/lib/libcrypto/man/EVP_PKEY_new.3 b/src/lib/libcrypto/man/EVP_PKEY_new.3 index 3b1ef029c3..7c13f625bc 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_new.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_PKEY_new.3,v 1.26 2024/12/10 15:10:26 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_new.3,v 1.27 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 4dcfdfce May 27 11:50:05 2020 +0100 | 2 | .\" full merge up to: OpenSSL 4dcfdfce May 27 11:50:05 2020 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: December 10 2024 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt EVP_PKEY_NEW 3 | 70 | .Dt EVP_PKEY_NEW 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -80,6 +80,7 @@ | |||
| 80 | .Nm EVP_PKEY_get_raw_public_key | 80 | .Nm EVP_PKEY_get_raw_public_key |
| 81 | .Nd public and private key allocation and raw key handling functions | 81 | .Nd public and private key allocation and raw key handling functions |
| 82 | .Sh SYNOPSIS | 82 | .Sh SYNOPSIS |
| 83 | .Lb libcrypto | ||
| 83 | .In openssl/evp.h | 84 | .In openssl/evp.h |
| 84 | .Ft EVP_PKEY * | 85 | .Ft EVP_PKEY * |
| 85 | .Fn EVP_PKEY_new void | 86 | .Fn EVP_PKEY_new void |
diff --git a/src/lib/libcrypto/man/EVP_PKEY_new_CMAC_key.3 b/src/lib/libcrypto/man/EVP_PKEY_new_CMAC_key.3 index d09af3a012..e4202fab67 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_new_CMAC_key.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_new_CMAC_key.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_PKEY_new_CMAC_key.3,v 1.1 2024/11/12 20:00:36 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_new_CMAC_key.3,v 1.2 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: November 12 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt EVP_PKEY_NEW_CMAC_KEY 3 | 18 | .Dt EVP_PKEY_NEW_CMAC_KEY 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm EVP_PKEY_new_CMAC_key | 21 | .Nm EVP_PKEY_new_CMAC_key |
| 22 | .Nd CMAC in the EVP framework | 22 | .Nd CMAC in the EVP framework |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/evp.h | 25 | .In openssl/evp.h |
| 25 | .Ft EVP_PKEY * | 26 | .Ft EVP_PKEY * |
| 26 | .Fo EVP_PKEY_new_CMAC_key | 27 | .Fo EVP_PKEY_new_CMAC_key |
diff --git a/src/lib/libcrypto/man/EVP_PKEY_print_private.3 b/src/lib/libcrypto/man/EVP_PKEY_print_private.3 index a4b51a4bbb..877385d15b 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_print_private.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_print_private.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_PKEY_print_private.3,v 1.8 2024/12/06 12:51:13 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_print_private.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: December 6 2024 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt EVP_PKEY_PRINT_PRIVATE 3 | 52 | .Dt EVP_PKEY_PRINT_PRIVATE 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm EVP_PKEY_print_params | 57 | .Nm EVP_PKEY_print_params |
| 58 | .Nd public key algorithm printing routines | 58 | .Nd public key algorithm printing routines |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/evp.h | 61 | .In openssl/evp.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fo EVP_PKEY_print_public | 63 | .Fo EVP_PKEY_print_public |
diff --git a/src/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 b/src/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 index 39404f5286..5e17894bea 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_PKEY_set1_RSA.3,v 1.24 2024/12/09 11:25:25 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_set1_RSA.3,v 1.27 2025/07/02 06:40:28 tb Exp $ |
| 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: December 9 2024 $ | 68 | .Dd $Mdocdate: July 2 2025 $ |
| 69 | .Dt EVP_PKEY_SET1_RSA 3 | 69 | .Dt EVP_PKEY_SET1_RSA 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -103,6 +103,7 @@ | |||
| 103 | .\" EVP_PKT_ENC EVP_PKT_EXCH EVP_PKT_EXP EVP_PKT_SIGN | 103 | .\" EVP_PKT_ENC EVP_PKT_EXCH EVP_PKT_EXP EVP_PKT_SIGN |
| 104 | .Nd EVP_PKEY assignment functions | 104 | .Nd EVP_PKEY assignment functions |
| 105 | .Sh SYNOPSIS | 105 | .Sh SYNOPSIS |
| 106 | .Lb libcrypto | ||
| 106 | .In openssl/evp.h | 107 | .In openssl/evp.h |
| 107 | .Ft int | 108 | .Ft int |
| 108 | .Fo EVP_PKEY_set1_RSA | 109 | .Fo EVP_PKEY_set1_RSA |
| @@ -126,35 +127,35 @@ | |||
| 126 | .Fc | 127 | .Fc |
| 127 | .Ft RSA * | 128 | .Ft RSA * |
| 128 | .Fo EVP_PKEY_get1_RSA | 129 | .Fo EVP_PKEY_get1_RSA |
| 129 | .Fa "EVP_PKEY *pkey" | 130 | .Fa "const EVP_PKEY *pkey" |
| 130 | .Fc | 131 | .Fc |
| 131 | .Ft DSA * | 132 | .Ft DSA * |
| 132 | .Fo EVP_PKEY_get1_DSA | 133 | .Fo EVP_PKEY_get1_DSA |
| 133 | .Fa "EVP_PKEY *pkey" | 134 | .Fa "const EVP_PKEY *pkey" |
| 134 | .Fc | 135 | .Fc |
| 135 | .Ft DH * | 136 | .Ft DH * |
| 136 | .Fo EVP_PKEY_get1_DH | 137 | .Fo EVP_PKEY_get1_DH |
| 137 | .Fa "EVP_PKEY *pkey" | 138 | .Fa "const EVP_PKEY *pkey" |
| 138 | .Fc | 139 | .Fc |
| 139 | .Ft EC_KEY * | 140 | .Ft EC_KEY * |
| 140 | .Fo EVP_PKEY_get1_EC_KEY | 141 | .Fo EVP_PKEY_get1_EC_KEY |
| 141 | .Fa "EVP_PKEY *pkey" | 142 | .Fa "const EVP_PKEY *pkey" |
| 142 | .Fc | 143 | .Fc |
| 143 | .Ft RSA * | 144 | .Ft RSA * |
| 144 | .Fo EVP_PKEY_get0_RSA | 145 | .Fo EVP_PKEY_get0_RSA |
| 145 | .Fa "EVP_PKEY *pkey" | 146 | .Fa "const EVP_PKEY *pkey" |
| 146 | .Fc | 147 | .Fc |
| 147 | .Ft DSA * | 148 | .Ft DSA * |
| 148 | .Fo EVP_PKEY_get0_DSA | 149 | .Fo EVP_PKEY_get0_DSA |
| 149 | .Fa "EVP_PKEY *pkey" | 150 | .Fa "const EVP_PKEY *pkey" |
| 150 | .Fc | 151 | .Fc |
| 151 | .Ft DH * | 152 | .Ft DH * |
| 152 | .Fo EVP_PKEY_get0_DH | 153 | .Fo EVP_PKEY_get0_DH |
| 153 | .Fa "EVP_PKEY *pkey" | 154 | .Fa "const EVP_PKEY *pkey" |
| 154 | .Fc | 155 | .Fc |
| 155 | .Ft EC_KEY * | 156 | .Ft EC_KEY * |
| 156 | .Fo EVP_PKEY_get0_EC_KEY | 157 | .Fo EVP_PKEY_get0_EC_KEY |
| 157 | .Fa "EVP_PKEY *pkey" | 158 | .Fa "const EVP_PKEY *pkey" |
| 158 | .Fc | 159 | .Fc |
| 159 | .Ft const unsigned char * | 160 | .Ft const unsigned char * |
| 160 | .Fo EVP_PKEY_get0_hmac | 161 | .Fo EVP_PKEY_get0_hmac |
| @@ -193,11 +194,11 @@ | |||
| 193 | .Fc | 194 | .Fc |
| 194 | .Ft int | 195 | .Ft int |
| 195 | .Fo EVP_PKEY_base_id | 196 | .Fo EVP_PKEY_base_id |
| 196 | .Fa "EVP_PKEY *pkey" | 197 | .Fa "const EVP_PKEY *pkey" |
| 197 | .Fc | 198 | .Fc |
| 198 | .Ft int | 199 | .Ft int |
| 199 | .Fo EVP_PKEY_id | 200 | .Fo EVP_PKEY_id |
| 200 | .Fa "EVP_PKEY *pkey" | 201 | .Fa "const EVP_PKEY *pkey" |
| 201 | .Fc | 202 | .Fc |
| 202 | .Ft int | 203 | .Ft int |
| 203 | .Fo EVP_PKEY_type | 204 | .Fo EVP_PKEY_type |
diff --git a/src/lib/libcrypto/man/EVP_PKEY_sign.3 b/src/lib/libcrypto/man/EVP_PKEY_sign.3 index d73b0abb7b..58d7e34cb6 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_sign.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_sign.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_PKEY_sign.3,v 1.9 2024/12/06 14:27:49 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_sign.3,v 1.11 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: December 6 2024 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt EVP_PKEY_SIGN 3 | 53 | .Dt EVP_PKEY_SIGN 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm EVP_PKEY_sign | 57 | .Nm EVP_PKEY_sign |
| 58 | .Nd sign using a public key algorithm | 58 | .Nd sign using a public key algorithm |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/evp.h | 61 | .In openssl/evp.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fo EVP_PKEY_sign_init | 63 | .Fo EVP_PKEY_sign_init |
| @@ -134,7 +135,7 @@ return 1 for success and 0 or a negative value for failure. | |||
| 134 | In particular, a return value of -2 indicates the operation is not | 135 | In particular, a return value of -2 indicates the operation is not |
| 135 | supported by the public key algorithm. | 136 | supported by the public key algorithm. |
| 136 | .Sh EXAMPLES | 137 | .Sh EXAMPLES |
| 137 | Sign data using RSA with PKCS#1 padding and SHA256 digest: | 138 | Sign data using RSA with PKCS#1 padding and SHA-256 digest: |
| 138 | .Bd -literal -offset indent | 139 | .Bd -literal -offset indent |
| 139 | #include <openssl/evp.h> | 140 | #include <openssl/evp.h> |
| 140 | #include <openssl/rsa.h> | 141 | #include <openssl/rsa.h> |
diff --git a/src/lib/libcrypto/man/EVP_PKEY_size.3 b/src/lib/libcrypto/man/EVP_PKEY_size.3 index cd25eec9c2..dc53de1268 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_size.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_size.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_PKEY_size.3,v 1.4 2024/12/06 12:51:13 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_size.3,v 1.5 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL eed9d03b Jan 8 11:04:15 2020 +0100 | 2 | .\" full merge up to: OpenSSL eed9d03b Jan 8 11:04:15 2020 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: December 6 2024 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt EVP_PKEY_SIZE 3 | 69 | .Dt EVP_PKEY_SIZE 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -74,6 +74,7 @@ | |||
| 74 | .Nm EVP_PKEY_security_bits | 74 | .Nm EVP_PKEY_security_bits |
| 75 | .Nd EVP_PKEY information functions | 75 | .Nd EVP_PKEY information functions |
| 76 | .Sh SYNOPSIS | 76 | .Sh SYNOPSIS |
| 77 | .Lb libcrypto | ||
| 77 | .In openssl/evp.h | 78 | .In openssl/evp.h |
| 78 | .Ft int | 79 | .Ft int |
| 79 | .Fo EVP_PKEY_size | 80 | .Fo EVP_PKEY_size |
diff --git a/src/lib/libcrypto/man/EVP_PKEY_verify.3 b/src/lib/libcrypto/man/EVP_PKEY_verify.3 index d096a3a7be..1a1d19a552 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_verify.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_verify.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_PKEY_verify.3,v 1.8 2024/12/06 14:27:49 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_verify.3,v 1.10 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 48e5119a Jan 19 10:49:22 2018 +0100 | 2 | .\" full merge up to: OpenSSL 48e5119a Jan 19 10:49:22 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: December 6 2024 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt EVP_PKEY_VERIFY 3 | 53 | .Dt EVP_PKEY_VERIFY 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm EVP_PKEY_verify | 57 | .Nm EVP_PKEY_verify |
| 58 | .Nd signature verification using a public key algorithm | 58 | .Nd signature verification using a public key algorithm |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/evp.h | 61 | .In openssl/evp.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fo EVP_PKEY_verify_init | 63 | .Fo EVP_PKEY_verify_init |
| @@ -120,7 +121,7 @@ failure. | |||
| 120 | In particular, a return value of -2 indicates the operation is not | 121 | In particular, a return value of -2 indicates the operation is not |
| 121 | supported by the public key algorithm. | 122 | supported by the public key algorithm. |
| 122 | .Sh EXAMPLES | 123 | .Sh EXAMPLES |
| 123 | Verify signature using PKCS#1 and SHA256 digest: | 124 | Verify signature using PKCS#1 and SHA-256 digest: |
| 124 | .Bd -literal -offset 3n | 125 | .Bd -literal -offset 3n |
| 125 | #include <openssl/evp.h> | 126 | #include <openssl/evp.h> |
| 126 | #include <openssl/rsa.h> | 127 | #include <openssl/rsa.h> |
diff --git a/src/lib/libcrypto/man/EVP_PKEY_verify_recover.3 b/src/lib/libcrypto/man/EVP_PKEY_verify_recover.3 index 30c034cdb5..840307b41e 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_verify_recover.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_verify_recover.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_PKEY_verify_recover.3,v 1.10 2024/12/06 14:27:49 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_verify_recover.3,v 1.12 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 48e5119a Jan 19 10:49:22 2018 +0100 | 2 | .\" full merge up to: OpenSSL 48e5119a Jan 19 10:49:22 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: December 6 2024 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt EVP_PKEY_VERIFY_RECOVER 3 | 53 | .Dt EVP_PKEY_VERIFY_RECOVER 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm EVP_PKEY_verify_recover | 57 | .Nm EVP_PKEY_verify_recover |
| 58 | .Nd recover signature using a public key algorithm | 58 | .Nd recover signature using a public key algorithm |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/evp.h | 61 | .In openssl/evp.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fo EVP_PKEY_verify_recover_init | 63 | .Fo EVP_PKEY_verify_recover_init |
| @@ -135,7 +136,7 @@ return 1 for success and 0 or a negative value for failure. | |||
| 135 | In particular, a return value of -2 indicates the operation is not | 136 | In particular, a return value of -2 indicates the operation is not |
| 136 | supported by the public key algorithm. | 137 | supported by the public key algorithm. |
| 137 | .Sh EXAMPLES | 138 | .Sh EXAMPLES |
| 138 | Recover digest originally signed using PKCS#1 and SHA256 digest: | 139 | Recover digest originally signed using PKCS#1 and SHA-256 digest: |
| 139 | .Bd -literal -offset indent | 140 | .Bd -literal -offset indent |
| 140 | #include <openssl/evp.h> | 141 | #include <openssl/evp.h> |
| 141 | #include <openssl/rsa.h> | 142 | #include <openssl/rsa.h> |
diff --git a/src/lib/libcrypto/man/EVP_SealInit.3 b/src/lib/libcrypto/man/EVP_SealInit.3 index da53535274..f211702ba6 100644 --- a/src/lib/libcrypto/man/EVP_SealInit.3 +++ b/src/lib/libcrypto/man/EVP_SealInit.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_SealInit.3,v 1.9 2023/11/16 20:27:43 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_SealInit.3,v 1.10 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: November 16 2023 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt EVP_SEALINIT 3 | 53 | .Dt EVP_SEALINIT 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm EVP_SealFinal | 58 | .Nm EVP_SealFinal |
| 59 | .Nd EVP envelope encryption | 59 | .Nd EVP envelope encryption |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libcrypto | ||
| 61 | .In openssl/evp.h | 62 | .In openssl/evp.h |
| 62 | .Ft int | 63 | .Ft int |
| 63 | .Fo EVP_SealInit | 64 | .Fo EVP_SealInit |
diff --git a/src/lib/libcrypto/man/EVP_SignInit.3 b/src/lib/libcrypto/man/EVP_SignInit.3 index 8158b21dbf..d3964abd41 100644 --- a/src/lib/libcrypto/man/EVP_SignInit.3 +++ b/src/lib/libcrypto/man/EVP_SignInit.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_SignInit.3,v 1.21 2024/12/06 12:51:13 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_SignInit.3,v 1.22 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 | 2 | .\" full merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: December 6 2024 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt EVP_SIGNINIT 3 | 53 | .Dt EVP_SIGNINIT 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -59,6 +59,7 @@ | |||
| 59 | .Nm EVP_SignInit | 59 | .Nm EVP_SignInit |
| 60 | .Nd EVP signing functions | 60 | .Nd EVP signing functions |
| 61 | .Sh SYNOPSIS | 61 | .Sh SYNOPSIS |
| 62 | .Lb libcrypto | ||
| 62 | .In openssl/evp.h | 63 | .In openssl/evp.h |
| 63 | .Ft int | 64 | .Ft int |
| 64 | .Fo EVP_SignInit_ex | 65 | .Fo EVP_SignInit_ex |
diff --git a/src/lib/libcrypto/man/EVP_VerifyInit.3 b/src/lib/libcrypto/man/EVP_VerifyInit.3 index 0baadfb9fb..9bf1f1e163 100644 --- a/src/lib/libcrypto/man/EVP_VerifyInit.3 +++ b/src/lib/libcrypto/man/EVP_VerifyInit.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_VerifyInit.3,v 1.13 2024/11/08 22:23:35 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_VerifyInit.3,v 1.14 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 | 2 | .\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: November 8 2024 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt EVP_VERIFYINIT 3 | 53 | .Dt EVP_VERIFYINIT 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -59,6 +59,7 @@ | |||
| 59 | .Nm EVP_VerifyInit | 59 | .Nm EVP_VerifyInit |
| 60 | .Nd EVP signature verification functions | 60 | .Nd EVP signature verification functions |
| 61 | .Sh SYNOPSIS | 61 | .Sh SYNOPSIS |
| 62 | .Lb libcrypto | ||
| 62 | .In openssl/evp.h | 63 | .In openssl/evp.h |
| 63 | .Ft int | 64 | .Ft int |
| 64 | .Fo EVP_VerifyInit_ex | 65 | .Fo EVP_VerifyInit_ex |
diff --git a/src/lib/libcrypto/man/EVP_aes_128_cbc.3 b/src/lib/libcrypto/man/EVP_aes_128_cbc.3 index 46e3ef0bdc..72f654b73d 100644 --- a/src/lib/libcrypto/man/EVP_aes_128_cbc.3 +++ b/src/lib/libcrypto/man/EVP_aes_128_cbc.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_aes_128_cbc.3,v 1.8 2024/12/20 01:54:03 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_aes_128_cbc.3,v 1.9 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" selective merge up to: OpenSSL 7c6d372a Nov 20 13:20:01 2018 +0000 | 2 | .\" selective merge up to: OpenSSL 7c6d372a Nov 20 13:20:01 2018 +0000 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ronald Tse <ronald.tse@ribose.com> | 4 | .\" This file was written by Ronald Tse <ronald.tse@ribose.com> |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: December 20 2024 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt EVP_AES_128_CBC 3 | 52 | .Dt EVP_AES_128_CBC 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -85,6 +85,7 @@ | |||
| 85 | .Nm EVP_aes_256_xts | 85 | .Nm EVP_aes_256_xts |
| 86 | .Nd EVP AES cipher | 86 | .Nd EVP AES cipher |
| 87 | .Sh SYNOPSIS | 87 | .Sh SYNOPSIS |
| 88 | .Lb libcrypto | ||
| 88 | .In openssl/evp.h | 89 | .In openssl/evp.h |
| 89 | .Ft const EVP_CIPHER * | 90 | .Ft const EVP_CIPHER * |
| 90 | .Fn EVP_aes_128_cbc void | 91 | .Fn EVP_aes_128_cbc void |
diff --git a/src/lib/libcrypto/man/EVP_aes_128_ccm.3 b/src/lib/libcrypto/man/EVP_aes_128_ccm.3 index e9023a5b67..eaba95c936 100644 --- a/src/lib/libcrypto/man/EVP_aes_128_ccm.3 +++ b/src/lib/libcrypto/man/EVP_aes_128_ccm.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_aes_128_ccm.3,v 1.5 2024/12/29 12:27:28 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_aes_128_ccm.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: | 2 | .\" full merge up to: |
| 3 | .\" OpenSSL EVP_EncryptInit.pod 0874d7f2 Oct 11 13:13:47 2022 +0100 | 3 | .\" OpenSSL EVP_EncryptInit.pod 0874d7f2 Oct 11 13:13:47 2022 +0100 |
| 4 | .\" OpenSSL EVP_aes.pod a1ec85c1 Apr 21 10:49:12 2020 +0100 | 4 | .\" OpenSSL EVP_aes.pod a1ec85c1 Apr 21 10:49:12 2020 +0100 |
| @@ -67,7 +67,7 @@ | |||
| 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 69 | .\" | 69 | .\" |
| 70 | .Dd $Mdocdate: December 29 2024 $ | 70 | .Dd $Mdocdate: June 8 2025 $ |
| 71 | .Dt EVP_AES_128_CCM 3 | 71 | .Dt EVP_AES_128_CCM 3 |
| 72 | .Os | 72 | .Os |
| 73 | .Sh NAME | 73 | .Sh NAME |
| @@ -76,6 +76,7 @@ | |||
| 76 | .Nm EVP_aes_256_ccm | 76 | .Nm EVP_aes_256_ccm |
| 77 | .Nd EVP AES cipher in Counter with CBC-MAC mode | 77 | .Nd EVP AES cipher in Counter with CBC-MAC mode |
| 78 | .Sh SYNOPSIS | 78 | .Sh SYNOPSIS |
| 79 | .Lb libcrypto | ||
| 79 | .In openssl/evp.h | 80 | .In openssl/evp.h |
| 80 | .Ft const EVP_CIPHER * | 81 | .Ft const EVP_CIPHER * |
| 81 | .Fn EVP_aes_128_ccm void | 82 | .Fn EVP_aes_128_ccm void |
diff --git a/src/lib/libcrypto/man/EVP_aes_128_gcm.3 b/src/lib/libcrypto/man/EVP_aes_128_gcm.3 index 53c41ea162..fa4a88619a 100644 --- a/src/lib/libcrypto/man/EVP_aes_128_gcm.3 +++ b/src/lib/libcrypto/man/EVP_aes_128_gcm.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_aes_128_gcm.3,v 1.2 2024/12/29 12:27:28 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_aes_128_gcm.3,v 1.3 2025/06/08 22:40:29 schwarze Exp $ |
| 2 | .\" full merge up to: | 2 | .\" full merge up to: |
| 3 | .\" OpenSSL EVP_EncryptInit.pod 0874d7f2 Oct 11 13:13:47 2022 +0100 | 3 | .\" OpenSSL EVP_EncryptInit.pod 0874d7f2 Oct 11 13:13:47 2022 +0100 |
| 4 | .\" OpenSSL EVP_aes.pod a1ec85c1 Apr 21 10:49:12 2020 +0100 | 4 | .\" OpenSSL EVP_aes.pod a1ec85c1 Apr 21 10:49:12 2020 +0100 |
| @@ -67,7 +67,7 @@ | |||
| 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 69 | .\" | 69 | .\" |
| 70 | .Dd $Mdocdate: December 29 2024 $ | 70 | .Dd $Mdocdate: June 8 2025 $ |
| 71 | .Dt EVP_AES_128_GCM 3 | 71 | .Dt EVP_AES_128_GCM 3 |
| 72 | .Os | 72 | .Os |
| 73 | .Sh NAME | 73 | .Sh NAME |
| @@ -76,6 +76,7 @@ | |||
| 76 | .Nm EVP_aes_256_gcm | 76 | .Nm EVP_aes_256_gcm |
| 77 | .Nd EVP AES cipher in Galois Counter Mode | 77 | .Nd EVP AES cipher in Galois Counter Mode |
| 78 | .Sh SYNOPSIS | 78 | .Sh SYNOPSIS |
| 79 | .Lb libcrypto | ||
| 79 | .In openssl/evp.h | 80 | .In openssl/evp.h |
| 80 | .Ft const EVP_CIPHER * | 81 | .Ft const EVP_CIPHER * |
| 81 | .Fn EVP_aes_128_gcm void | 82 | .Fn EVP_aes_128_gcm void |
diff --git a/src/lib/libcrypto/man/EVP_camellia_128_cbc.3 b/src/lib/libcrypto/man/EVP_camellia_128_cbc.3 index 6f15a85f7f..3ff5d5a0e0 100644 --- a/src/lib/libcrypto/man/EVP_camellia_128_cbc.3 +++ b/src/lib/libcrypto/man/EVP_camellia_128_cbc.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_camellia_128_cbc.3,v 1.3 2024/11/09 22:03:49 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_camellia_128_cbc.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" selective merge up to: OpenSSL 7c6d372a Nov 20 13:20:01 2018 +0000 | 2 | .\" selective merge up to: OpenSSL 7c6d372a Nov 20 13:20:01 2018 +0000 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ronald Tse <ronald.tse@ribose.com> | 4 | .\" This file was written by Ronald Tse <ronald.tse@ribose.com> |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: November 9 2024 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt EVP_CAMELLIA_128_CBC 3 | 52 | .Dt EVP_CAMELLIA_128_CBC 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -75,6 +75,7 @@ | |||
| 75 | .Nm EVP_camellia_256_ofb | 75 | .Nm EVP_camellia_256_ofb |
| 76 | .Nd EVP Camellia cipher | 76 | .Nd EVP Camellia cipher |
| 77 | .Sh SYNOPSIS | 77 | .Sh SYNOPSIS |
| 78 | .Lb libcrypto | ||
| 78 | .In openssl/evp.h | 79 | .In openssl/evp.h |
| 79 | .Ft const EVP_CIPHER * | 80 | .Ft const EVP_CIPHER * |
| 80 | .Fn EVP_camellia_128_cbc void | 81 | .Fn EVP_camellia_128_cbc void |
diff --git a/src/lib/libcrypto/man/EVP_chacha20.3 b/src/lib/libcrypto/man/EVP_chacha20.3 index 8fc79dbf2b..45584f3e86 100644 --- a/src/lib/libcrypto/man/EVP_chacha20.3 +++ b/src/lib/libcrypto/man/EVP_chacha20.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_chacha20.3,v 1.8 2024/12/09 11:55:52 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_chacha20.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 35fd9953 May 28 14:49:38 2019 +0200 | 2 | .\" full merge up to: OpenSSL 35fd9953 May 28 14:49:38 2019 +0200 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: December 9 2024 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt EVP_CHACHA20 3 | 69 | .Dt EVP_CHACHA20 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -73,6 +73,7 @@ | |||
| 73 | .Nm EVP_chacha20_poly1305 | 73 | .Nm EVP_chacha20_poly1305 |
| 74 | .Nd ChaCha20 stream cipher for EVP | 74 | .Nd ChaCha20 stream cipher for EVP |
| 75 | .Sh SYNOPSIS | 75 | .Sh SYNOPSIS |
| 76 | .Lb libcrypto | ||
| 76 | .In openssl/evp.h | 77 | .In openssl/evp.h |
| 77 | .Ft const EVP_CIPHER * | 78 | .Ft const EVP_CIPHER * |
| 78 | .Fn EVP_chacha20 void | 79 | .Fn EVP_chacha20 void |
diff --git a/src/lib/libcrypto/man/EVP_des_cbc.3 b/src/lib/libcrypto/man/EVP_des_cbc.3 index 7c8a08c7db..84ee9aaa61 100644 --- a/src/lib/libcrypto/man/EVP_des_cbc.3 +++ b/src/lib/libcrypto/man/EVP_des_cbc.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_des_cbc.3,v 1.2 2024/11/09 22:03:49 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_des_cbc.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: | 2 | .\" full merge up to: |
| 3 | .\" OpenSSL EVP_desx_cbc.pod 8fa4d95e Oct 21 11:59:09 2017 +0900 | 3 | .\" OpenSSL EVP_desx_cbc.pod 8fa4d95e Oct 21 11:59:09 2017 +0900 |
| 4 | .\" selective merge up to: | 4 | .\" selective merge up to: |
| @@ -51,7 +51,7 @@ | |||
| 51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 53 | .\" | 53 | .\" |
| 54 | .Dd $Mdocdate: November 9 2024 $ | 54 | .Dd $Mdocdate: June 8 2025 $ |
| 55 | .Dt EVP_DES_CBC 3 | 55 | .Dt EVP_DES_CBC 3 |
| 56 | .Os | 56 | .Os |
| 57 | .Sh NAME | 57 | .Sh NAME |
| @@ -79,6 +79,7 @@ | |||
| 79 | .Nm EVP_desx_cbc | 79 | .Nm EVP_desx_cbc |
| 80 | .Nd EVP DES cipher | 80 | .Nd EVP DES cipher |
| 81 | .Sh SYNOPSIS | 81 | .Sh SYNOPSIS |
| 82 | .Lb libcrypto | ||
| 82 | .In openssl/evp.h | 83 | .In openssl/evp.h |
| 83 | .Ft const EVP_CIPHER * | 84 | .Ft const EVP_CIPHER * |
| 84 | .Fn EVP_des_cbc void | 85 | .Fn EVP_des_cbc void |
diff --git a/src/lib/libcrypto/man/EVP_rc2_cbc.3 b/src/lib/libcrypto/man/EVP_rc2_cbc.3 index 38c8184260..9a3bc29304 100644 --- a/src/lib/libcrypto/man/EVP_rc2_cbc.3 +++ b/src/lib/libcrypto/man/EVP_rc2_cbc.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_rc2_cbc.3,v 1.1 2024/12/08 17:41:23 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_rc2_cbc.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 8 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt EVP_RC2_CBC 3 | 18 | .Dt EVP_RC2_CBC 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -27,6 +27,7 @@ | |||
| 27 | .Nm EVP_rc2_64_cbc | 27 | .Nm EVP_rc2_64_cbc |
| 28 | .Nd Rivest Cipher 2 in the EVP framework | 28 | .Nd Rivest Cipher 2 in the EVP framework |
| 29 | .Sh SYNOPSIS | 29 | .Sh SYNOPSIS |
| 30 | .Lb libcrypto | ||
| 30 | .In openssl/evp.h | 31 | .In openssl/evp.h |
| 31 | .Ft const EVP_CIPHER * | 32 | .Ft const EVP_CIPHER * |
| 32 | .Fn EVP_rc2_cbc void | 33 | .Fn EVP_rc2_cbc void |
diff --git a/src/lib/libcrypto/man/EVP_rc4.3 b/src/lib/libcrypto/man/EVP_rc4.3 index fda041113c..40dd27e49f 100644 --- a/src/lib/libcrypto/man/EVP_rc4.3 +++ b/src/lib/libcrypto/man/EVP_rc4.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_rc4.3,v 1.1 2019/03/21 13:37:25 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_rc4.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 8fa4d95e Oct 21 11:59:09 2017 +0900 | 2 | .\" full merge up to: OpenSSL 8fa4d95e Oct 21 11:59:09 2017 +0900 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ronald Tse <ronald.tse@ribose.com> | 4 | .\" This file was written by Ronald Tse <ronald.tse@ribose.com> |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 21 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt EVP_RC4 3 | 52 | .Dt EVP_RC4 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm EVP_rc4_hmac_md5 | 57 | .Nm EVP_rc4_hmac_md5 |
| 58 | .Nd EVP RC4 stream cipher | 58 | .Nd EVP RC4 stream cipher |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/evp.h | 61 | .In openssl/evp.h |
| 61 | .Ft const EVP_CIPHER * | 62 | .Ft const EVP_CIPHER * |
| 62 | .Fn EVP_rc4 void | 63 | .Fn EVP_rc4 void |
diff --git a/src/lib/libcrypto/man/EVP_sha1.3 b/src/lib/libcrypto/man/EVP_sha1.3 index b28c9f54c3..d1e336cc42 100644 --- a/src/lib/libcrypto/man/EVP_sha1.3 +++ b/src/lib/libcrypto/man/EVP_sha1.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_sha1.3,v 1.2 2024/03/05 17:21:40 tb Exp $ | 1 | .\" $OpenBSD: EVP_sha1.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 5 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt EVP_SHA1 3 | 18 | .Dt EVP_SHA1 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -24,6 +24,7 @@ | |||
| 24 | .Nm EVP_md4 | 24 | .Nm EVP_md4 |
| 25 | .Nd legacy message digest algorithms | 25 | .Nd legacy message digest algorithms |
| 26 | .Sh SYNOPSIS | 26 | .Sh SYNOPSIS |
| 27 | .Lb libcrypto | ||
| 27 | .In openssl/evp.h | 28 | .In openssl/evp.h |
| 28 | .Ft const EVP_MD * | 29 | .Ft const EVP_MD * |
| 29 | .Fn EVP_sha1 void | 30 | .Fn EVP_sha1 void |
diff --git a/src/lib/libcrypto/man/EVP_sha3_224.3 b/src/lib/libcrypto/man/EVP_sha3_224.3 index 3c21ae1a09..19a9114885 100644 --- a/src/lib/libcrypto/man/EVP_sha3_224.3 +++ b/src/lib/libcrypto/man/EVP_sha3_224.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_sha3_224.3,v 1.3 2024/03/05 17:21:40 tb Exp $ | 1 | .\" $OpenBSD: EVP_sha3_224.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" selective merge up to: OpenSSL bbda8ce9 Oct 31 15:43:01 2017 +0800 | 2 | .\" selective merge up to: OpenSSL bbda8ce9 Oct 31 15:43:01 2017 +0800 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ronald Tse <ronald.tse@ribose.com>. | 4 | .\" This file was written by Ronald Tse <ronald.tse@ribose.com>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 5 2024 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt EVP_SHA3_224 3 | 52 | .Dt EVP_SHA3_224 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm EVP_sha3_512 | 58 | .Nm EVP_sha3_512 |
| 59 | .Nd Secure Hash Algorithm 3 for EVP | 59 | .Nd Secure Hash Algorithm 3 for EVP |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libcrypto | ||
| 61 | .In openssl/evp.h | 62 | .In openssl/evp.h |
| 62 | .Ft const EVP_MD * | 63 | .Ft const EVP_MD * |
| 63 | .Fn EVP_sha3_224 void | 64 | .Fn EVP_sha3_224 void |
diff --git a/src/lib/libcrypto/man/EVP_sm3.3 b/src/lib/libcrypto/man/EVP_sm3.3 index aa6789f249..33621bef81 100644 --- a/src/lib/libcrypto/man/EVP_sm3.3 +++ b/src/lib/libcrypto/man/EVP_sm3.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_sm3.3,v 1.1 2019/08/25 17:08:20 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_sm3.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 21ebd2fc Aug 24 20:38:04 2018 +0800 | 2 | .\" full merge up to: OpenSSL 21ebd2fc Aug 24 20:38:04 2018 +0800 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Jack Lloyd <jack.lloyd@ribose.com> | 4 | .\" This file was written by Jack Lloyd <jack.lloyd@ribose.com> |
| @@ -50,13 +50,14 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: August 25 2019 $ | 53 | .Dd $Mdocdate: June 8 2025 $ |
| 54 | .Dt EVP_SM3 3 | 54 | .Dt EVP_SM3 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| 57 | .Nm EVP_sm3 | 57 | .Nm EVP_sm3 |
| 58 | .Nd SM3 hash function for EVP | 58 | .Nd SM3 hash function for EVP |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/evp.h | 61 | .In openssl/evp.h |
| 61 | .Ft const EVP_MD * | 62 | .Ft const EVP_MD * |
| 62 | .Fn EVP_sm3 void | 63 | .Fn EVP_sm3 void |
diff --git a/src/lib/libcrypto/man/EVP_sm4_cbc.3 b/src/lib/libcrypto/man/EVP_sm4_cbc.3 index 0605a52faa..eba31afff3 100644 --- a/src/lib/libcrypto/man/EVP_sm4_cbc.3 +++ b/src/lib/libcrypto/man/EVP_sm4_cbc.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EVP_sm4_cbc.3,v 1.2 2023/11/16 20:27:43 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_sm4_cbc.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 87103969 Oct 1 14:11:57 2018 -0700 | 2 | .\" full merge up to: OpenSSL 87103969 Oct 1 14:11:57 2018 -0700 |
| 3 | .\" | 3 | .\" |
| 4 | .\" Copyright (c) 2017 Ribose Inc | 4 | .\" Copyright (c) 2017 Ribose Inc |
| @@ -18,7 +18,7 @@ | |||
| 18 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 18 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 19 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 19 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 20 | .\" | 20 | .\" |
| 21 | .Dd $Mdocdate: November 16 2023 $ | 21 | .Dd $Mdocdate: June 8 2025 $ |
| 22 | .Dt EVP_SM4_CBC 3 | 22 | .Dt EVP_SM4_CBC 3 |
| 23 | .Os | 23 | .Os |
| 24 | .Sh NAME | 24 | .Sh NAME |
| @@ -30,6 +30,7 @@ | |||
| 30 | .Nm EVP_sm4_ctr | 30 | .Nm EVP_sm4_ctr |
| 31 | .Nd EVP SM4 cipher | 31 | .Nd EVP SM4 cipher |
| 32 | .Sh SYNOPSIS | 32 | .Sh SYNOPSIS |
| 33 | .Lb libcrypto | ||
| 33 | .In openssl/evp.h | 34 | .In openssl/evp.h |
| 34 | .Ft const EVP_CIPHER * | 35 | .Ft const EVP_CIPHER * |
| 35 | .Fn EVP_sm4_cbc void | 36 | .Fn EVP_sm4_cbc void |
diff --git a/src/lib/libcrypto/man/EXTENDED_KEY_USAGE_new.3 b/src/lib/libcrypto/man/EXTENDED_KEY_USAGE_new.3 index 3d1ed17ff3..3258c9793d 100644 --- a/src/lib/libcrypto/man/EXTENDED_KEY_USAGE_new.3 +++ b/src/lib/libcrypto/man/EXTENDED_KEY_USAGE_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: EXTENDED_KEY_USAGE_new.3,v 1.6 2021/10/27 11:24:47 schwarze Exp $ | 1 | .\" $OpenBSD: EXTENDED_KEY_USAGE_new.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: October 27 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt EXTENDED_KEY_USAGE_NEW 3 | 18 | .Dt EXTENDED_KEY_USAGE_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm EXTENDED_KEY_USAGE_free | 22 | .Nm EXTENDED_KEY_USAGE_free |
| 23 | .Nd X.509 key usage restrictions | 23 | .Nd X.509 key usage restrictions |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/x509v3.h | 26 | .In openssl/x509v3.h |
| 26 | .Ft EXTENDED_KEY_USAGE | 27 | .Ft EXTENDED_KEY_USAGE |
| 27 | .Fn EXTENDED_KEY_USAGE_new void | 28 | .Fn EXTENDED_KEY_USAGE_new void |
diff --git a/src/lib/libcrypto/man/GENERAL_NAME_new.3 b/src/lib/libcrypto/man/GENERAL_NAME_new.3 index a6b7ee56da..84ad2edb3b 100644 --- a/src/lib/libcrypto/man/GENERAL_NAME_new.3 +++ b/src/lib/libcrypto/man/GENERAL_NAME_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: GENERAL_NAME_new.3,v 1.6 2019/06/06 01:06:58 schwarze Exp $ | 1 | .\" $OpenBSD: GENERAL_NAME_new.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: June 6 2019 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt GENERAL_NAME_NEW 3 | 18 | .Dt GENERAL_NAME_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -28,6 +28,7 @@ | |||
| 28 | .Nm OTHERNAME_free | 28 | .Nm OTHERNAME_free |
| 29 | .Nd names for use in X.509 extensions | 29 | .Nd names for use in X.509 extensions |
| 30 | .Sh SYNOPSIS | 30 | .Sh SYNOPSIS |
| 31 | .Lb libcrypto | ||
| 31 | .In openssl/x509v3.h | 32 | .In openssl/x509v3.h |
| 32 | .Ft GENERAL_NAME * | 33 | .Ft GENERAL_NAME * |
| 33 | .Fn GENERAL_NAME_new void | 34 | .Fn GENERAL_NAME_new void |
diff --git a/src/lib/libcrypto/man/HMAC.3 b/src/lib/libcrypto/man/HMAC.3 index a515014fca..0b9e24a7bd 100644 --- a/src/lib/libcrypto/man/HMAC.3 +++ b/src/lib/libcrypto/man/HMAC.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: HMAC.3,v 1.23 2024/08/29 20:21:53 tb Exp $ | 1 | .\" $OpenBSD: HMAC.3,v 1.24 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL crypto/hmac a528d4f0 Oct 27 13:40:11 2015 -0400 | 2 | .\" full merge up to: OpenSSL crypto/hmac a528d4f0 Oct 27 13:40:11 2015 -0400 |
| 3 | .\" selective merge up to: OpenSSL man3/HMAC b3696a55 Sep 2 09:35:50 2017 -0400 | 3 | .\" selective merge up to: OpenSSL man3/HMAC b3696a55 Sep 2 09:35:50 2017 -0400 |
| 4 | .\" | 4 | .\" |
| @@ -52,7 +52,7 @@ | |||
| 52 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 52 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 53 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 53 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 54 | .\" | 54 | .\" |
| 55 | .Dd $Mdocdate: August 29 2024 $ | 55 | .Dd $Mdocdate: June 8 2025 $ |
| 56 | .Dt HMAC 3 | 56 | .Dt HMAC 3 |
| 57 | .Os | 57 | .Os |
| 58 | .Sh NAME | 58 | .Sh NAME |
| @@ -69,6 +69,7 @@ | |||
| 69 | .Nm HMAC_size | 69 | .Nm HMAC_size |
| 70 | .Nd HMAC message authentication code | 70 | .Nd HMAC message authentication code |
| 71 | .Sh SYNOPSIS | 71 | .Sh SYNOPSIS |
| 72 | .Lb libcrypto | ||
| 72 | .In openssl/hmac.h | 73 | .In openssl/hmac.h |
| 73 | .Ft unsigned char * | 74 | .Ft unsigned char * |
| 74 | .Fo HMAC | 75 | .Fo HMAC |
diff --git a/src/lib/libcrypto/man/IPAddressRange_new.3 b/src/lib/libcrypto/man/IPAddressRange_new.3 index a812107cdf..79e3751b4e 100644 --- a/src/lib/libcrypto/man/IPAddressRange_new.3 +++ b/src/lib/libcrypto/man/IPAddressRange_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: IPAddressRange_new.3,v 1.9 2023/10/03 09:58:06 tb Exp $ | 1 | .\" $OpenBSD: IPAddressRange_new.3,v 1.11 2025/06/13 18:34:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> | 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: October 3 2023 $ | 17 | .Dd $Mdocdate: June 13 2025 $ |
| 18 | .Dt IPADDRESSRANGE_NEW 3 | 18 | .Dt IPADDRESSRANGE_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -36,8 +36,9 @@ | |||
| 36 | .Nm i2d_IPAddressFamily | 36 | .Nm i2d_IPAddressFamily |
| 37 | .Nd RFC 3779 IP address prefixes and ranges | 37 | .Nd RFC 3779 IP address prefixes and ranges |
| 38 | .Sh SYNOPSIS | 38 | .Sh SYNOPSIS |
| 39 | .Lb libcrypto | ||
| 39 | .In openssl/x509v3.h | 40 | .In openssl/x509v3.h |
| 40 | .Ft "IPAddressRange *" | 41 | .Ft IPAddressRange * |
| 41 | .Fn IPAddressRange_new void | 42 | .Fn IPAddressRange_new void |
| 42 | .Ft void | 43 | .Ft void |
| 43 | .Fn IPAddressRange_free "IPAddressRange *range" | 44 | .Fn IPAddressRange_free "IPAddressRange *range" |
| @@ -52,7 +53,7 @@ | |||
| 52 | .Fa "IPAddressRange *range" | 53 | .Fa "IPAddressRange *range" |
| 53 | .Fa "unsigned char **der_out" | 54 | .Fa "unsigned char **der_out" |
| 54 | .Fc | 55 | .Fc |
| 55 | .Ft "IPAddressOrRange *" | 56 | .Ft IPAddressOrRange * |
| 56 | .Fn IPAddressOrRange_new void | 57 | .Fn IPAddressOrRange_new void |
| 57 | .Ft void | 58 | .Ft void |
| 58 | .Fn IPAddressOrRange_free "IPAddressOrRange *aor" | 59 | .Fn IPAddressOrRange_free "IPAddressOrRange *aor" |
| @@ -67,7 +68,7 @@ | |||
| 67 | .Fa "IPAddressOrRange *aor" | 68 | .Fa "IPAddressOrRange *aor" |
| 68 | .Fa "unsigned char **der_out" | 69 | .Fa "unsigned char **der_out" |
| 69 | .Fc | 70 | .Fc |
| 70 | .Ft "IPAddressChoice *" | 71 | .Ft IPAddressChoice * |
| 71 | .Fn IPAddressChoice_new void | 72 | .Fn IPAddressChoice_new void |
| 72 | .Ft void | 73 | .Ft void |
| 73 | .Fn IPAddressChoice_free "IPAddressChoice *ac" | 74 | .Fn IPAddressChoice_free "IPAddressChoice *ac" |
| @@ -82,7 +83,7 @@ | |||
| 82 | .Fa "IPAddressChoice *ac" | 83 | .Fa "IPAddressChoice *ac" |
| 83 | .Fa "unsigned char **der_out" | 84 | .Fa "unsigned char **der_out" |
| 84 | .Fc | 85 | .Fc |
| 85 | .Ft "IPAddressFamily *" | 86 | .Ft IPAddressFamily * |
| 86 | .Fn IPAddressFamily_new void | 87 | .Fn IPAddressFamily_new void |
| 87 | .Ft void | 88 | .Ft void |
| 88 | .Fn IPAddressFamily_free "IPAddressFamily *af" | 89 | .Fn IPAddressFamily_free "IPAddressFamily *af" |
diff --git a/src/lib/libcrypto/man/MD5.3 b/src/lib/libcrypto/man/MD5.3 index 01e715f406..c9c89c33af 100644 --- a/src/lib/libcrypto/man/MD5.3 +++ b/src/lib/libcrypto/man/MD5.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: MD5.3,v 1.9 2024/05/26 09:54:16 tb Exp $ | 1 | .\" $OpenBSD: MD5.3,v 1.10 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> and | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> and |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: May 26 2024 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt MD5 3 | 53 | .Dt MD5 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -63,6 +63,7 @@ | |||
| 63 | .Nm MD5_Final | 63 | .Nm MD5_Final |
| 64 | .Nd MD4 and MD5 hash functions | 64 | .Nd MD4 and MD5 hash functions |
| 65 | .Sh SYNOPSIS | 65 | .Sh SYNOPSIS |
| 66 | .Lb libcrypto | ||
| 66 | .In openssl/md4.h | 67 | .In openssl/md4.h |
| 67 | .Ft unsigned char * | 68 | .Ft unsigned char * |
| 68 | .Fo MD4 | 69 | .Fo MD4 |
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index 9f3d448432..aea939dc2b 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.307 2025/03/08 17:12:55 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.312 2025/07/17 10:31:50 schwarze Exp $ |
| 2 | 2 | ||
| 3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> |
| 4 | 4 | ||
| @@ -133,12 +133,16 @@ MAN= \ | |||
| 133 | DSA_size.3 \ | 133 | DSA_size.3 \ |
| 134 | ECDH_compute_key.3 \ | 134 | ECDH_compute_key.3 \ |
| 135 | ECDSA_SIG_new.3 \ | 135 | ECDSA_SIG_new.3 \ |
| 136 | EC_GROUP_copy.3 \ | 136 | EC_GROUP_check.3 \ |
| 137 | EC_GROUP_new.3 \ | 137 | EC_GROUP_get_curve_name.3 \ |
| 138 | EC_GROUP_new_by_curve_name.3 \ | ||
| 139 | EC_GROUP_new_curve_GFp.3 \ | ||
| 138 | EC_KEY_METHOD_new.3 \ | 140 | EC_KEY_METHOD_new.3 \ |
| 139 | EC_KEY_new.3 \ | 141 | EC_KEY_new.3 \ |
| 140 | EC_POINT_add.3 \ | 142 | EC_POINT_add.3 \ |
| 143 | EC_POINT_get_affine_coordinates.3 \ | ||
| 141 | EC_POINT_new.3 \ | 144 | EC_POINT_new.3 \ |
| 145 | EC_POINT_point2oct.3 \ | ||
| 142 | ENGINE_new.3 \ | 146 | ENGINE_new.3 \ |
| 143 | ERR.3 \ | 147 | ERR.3 \ |
| 144 | ERR_GET_LIB.3 \ | 148 | ERR_GET_LIB.3 \ |
| @@ -212,7 +216,6 @@ MAN= \ | |||
| 212 | IPAddressRange_new.3 \ | 216 | IPAddressRange_new.3 \ |
| 213 | MD5.3 \ | 217 | MD5.3 \ |
| 214 | NAME_CONSTRAINTS_new.3 \ | 218 | NAME_CONSTRAINTS_new.3 \ |
| 215 | OBJ_NAME_add.3 \ | ||
| 216 | OBJ_create.3 \ | 219 | OBJ_create.3 \ |
| 217 | OBJ_find_sigid_algs.3 \ | 220 | OBJ_find_sigid_algs.3 \ |
| 218 | OBJ_nid2obj.3 \ | 221 | OBJ_nid2obj.3 \ |
| @@ -228,12 +231,11 @@ MAN= \ | |||
| 228 | OPENSSL_cleanse.3 \ | 231 | OPENSSL_cleanse.3 \ |
| 229 | OPENSSL_config.3 \ | 232 | OPENSSL_config.3 \ |
| 230 | OPENSSL_init_crypto.3 \ | 233 | OPENSSL_init_crypto.3 \ |
| 231 | OPENSSL_load_builtin_modules.3 \ | ||
| 232 | OPENSSL_malloc.3 \ | 234 | OPENSSL_malloc.3 \ |
| 233 | OPENSSL_sk_new.3 \ | 235 | OPENSSL_sk_new.3 \ |
| 234 | OpenSSL_add_all_algorithms.3 \ | 236 | OpenSSL_add_all_algorithms.3 \ |
| 235 | PEM_ASN1_read.3 \ | 237 | PEM_ASN1_read.3 \ |
| 236 | PEM_X509_INFO_read.3 \ | 238 | PEM_X509_INFO_read_bio.3 \ |
| 237 | PEM_bytes_read_bio.3 \ | 239 | PEM_bytes_read_bio.3 \ |
| 238 | PEM_read.3 \ | 240 | PEM_read.3 \ |
| 239 | PEM_read_bio_PrivateKey.3 \ | 241 | PEM_read_bio_PrivateKey.3 \ |
| @@ -289,11 +291,9 @@ MAN= \ | |||
| 289 | RSA_size.3 \ | 291 | RSA_size.3 \ |
| 290 | SHA1.3 \ | 292 | SHA1.3 \ |
| 291 | SMIME_crlf_copy.3 \ | 293 | SMIME_crlf_copy.3 \ |
| 292 | SMIME_read_ASN1.3 \ | ||
| 293 | SMIME_read_CMS.3 \ | 294 | SMIME_read_CMS.3 \ |
| 294 | SMIME_read_PKCS7.3 \ | 295 | SMIME_read_PKCS7.3 \ |
| 295 | SMIME_text.3 \ | 296 | SMIME_text.3 \ |
| 296 | SMIME_write_ASN1.3 \ | ||
| 297 | SMIME_write_CMS.3 \ | 297 | SMIME_write_CMS.3 \ |
| 298 | SMIME_write_PKCS7.3 \ | 298 | SMIME_write_PKCS7.3 \ |
| 299 | STACK_OF.3 \ | 299 | STACK_OF.3 \ |
| @@ -326,7 +326,6 @@ MAN= \ | |||
| 326 | X509_NAME_new.3 \ | 326 | X509_NAME_new.3 \ |
| 327 | X509_NAME_print_ex.3 \ | 327 | X509_NAME_print_ex.3 \ |
| 328 | X509_OBJECT_get0_X509.3 \ | 328 | X509_OBJECT_get0_X509.3 \ |
| 329 | X509_PKEY_new.3 \ | ||
| 330 | X509_PUBKEY_new.3 \ | 329 | X509_PUBKEY_new.3 \ |
| 331 | X509_PURPOSE_set.3 \ | 330 | X509_PURPOSE_set.3 \ |
| 332 | X509_REQ_add1_attr.3 \ | 331 | X509_REQ_add1_attr.3 \ |
diff --git a/src/lib/libcrypto/man/NAME_CONSTRAINTS_new.3 b/src/lib/libcrypto/man/NAME_CONSTRAINTS_new.3 index fec3aba7f7..7d39754858 100644 --- a/src/lib/libcrypto/man/NAME_CONSTRAINTS_new.3 +++ b/src/lib/libcrypto/man/NAME_CONSTRAINTS_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: NAME_CONSTRAINTS_new.3,v 1.4 2020/09/17 08:50:05 schwarze Exp $ | 1 | .\" $OpenBSD: NAME_CONSTRAINTS_new.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: September 17 2020 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt NAME_CONSTRAINTS_NEW 3 | 18 | .Dt NAME_CONSTRAINTS_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -27,6 +27,7 @@ | |||
| 27 | .\" We probably need to deprecate it thoughtfully. | 27 | .\" We probably need to deprecate it thoughtfully. |
| 28 | .Nd X.509 CA name constraints extension | 28 | .Nd X.509 CA name constraints extension |
| 29 | .Sh SYNOPSIS | 29 | .Sh SYNOPSIS |
| 30 | .Lb libcrypto | ||
| 30 | .In openssl/x509v3.h | 31 | .In openssl/x509v3.h |
| 31 | .Ft NAME_CONSTRAINTS * | 32 | .Ft NAME_CONSTRAINTS * |
| 32 | .Fn NAME_CONSTRAINTS_new void | 33 | .Fn NAME_CONSTRAINTS_new void |
diff --git a/src/lib/libcrypto/man/OBJ_NAME_add.3 b/src/lib/libcrypto/man/OBJ_NAME_add.3 deleted file mode 100644 index 0b46010c49..0000000000 --- a/src/lib/libcrypto/man/OBJ_NAME_add.3 +++ /dev/null | |||
| @@ -1,307 +0,0 @@ | |||
| 1 | .\" $OpenBSD: OBJ_NAME_add.3,v 1.6 2024/01/31 08:02:53 tb Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | ||
| 4 | .\" | ||
| 5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 7 | .\" copyright notice and this permission notice appear in all copies. | ||
| 8 | .\" | ||
| 9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | .\" | ||
| 17 | .Dd $Mdocdate: January 31 2024 $ | ||
| 18 | .Dt OBJ_NAME_ADD 3 | ||
| 19 | .Os | ||
| 20 | .Sh NAME | ||
| 21 | .Nm OBJ_NAME_add , | ||
| 22 | .Nm OBJ_NAME_remove , | ||
| 23 | .Nm OBJ_NAME_get , | ||
| 24 | .Nm OBJ_NAME_new_index , | ||
| 25 | .Nm OBJ_NAME_init , | ||
| 26 | .Nm OBJ_NAME_cleanup | ||
| 27 | .Nd global associative array | ||
| 28 | .Sh SYNOPSIS | ||
| 29 | .In openssl/objects.h | ||
| 30 | .Ft int | ||
| 31 | .Fo OBJ_NAME_add | ||
| 32 | .Fa "const char *name" | ||
| 33 | .Fa "int type" | ||
| 34 | .Fa "const char *value" | ||
| 35 | .Fc | ||
| 36 | .Ft int | ||
| 37 | .Fo OBJ_NAME_remove | ||
| 38 | .Fa "const char *name" | ||
| 39 | .Fa "int type" | ||
| 40 | .Fc | ||
| 41 | .Ft const char * | ||
| 42 | .Fo OBJ_NAME_get | ||
| 43 | .Fa "const char *name" | ||
| 44 | .Fa "int type" | ||
| 45 | .Fc | ||
| 46 | .Ft int | ||
| 47 | .Fo OBJ_NAME_new_index | ||
| 48 | .Fa "unsigned long (*hash_func)(const char *name)" | ||
| 49 | .Fa "int (*cmp_func)(const char *name1, const char *name2)" | ||
| 50 | .Fa "void (*free_func)(const char *name, int type, const char *value)" | ||
| 51 | .Fc | ||
| 52 | .Ft int | ||
| 53 | .Fn OBJ_NAME_init void | ||
| 54 | .Ft void | ||
| 55 | .Fn OBJ_NAME_cleanup "int type" | ||
| 56 | .Bd -literal | ||
| 57 | typedef struct { | ||
| 58 | int type; | ||
| 59 | int alias; | ||
| 60 | const char *name; | ||
| 61 | const char *data; | ||
| 62 | } OBJ_NAME; | ||
| 63 | .Ed | ||
| 64 | .Sh DESCRIPTION | ||
| 65 | These functions implement a single, static associative array | ||
| 66 | with the following properties: | ||
| 67 | .Bl -bullet | ||
| 68 | .It | ||
| 69 | The keys are ordered pairs consisting of a NUL-terminated string | ||
| 70 | .Pq called the Fa name | ||
| 71 | and an | ||
| 72 | .Vt int | ||
| 73 | number | ||
| 74 | .Pq called the Fa type . | ||
| 75 | Two types are predefined and used internally by the library: | ||
| 76 | .Dv OBJ_NAME_TYPE_MD_METH | ||
| 77 | and | ||
| 78 | .Dv OBJ_NAME_TYPE_CIPHER_METH . | ||
| 79 | Two additional types are predefined but not used internally: | ||
| 80 | .Dv OBJ_NAME_TYPE_PKEY_METH | ||
| 81 | and | ||
| 82 | .Dv OBJ_NAME_TYPE_COMP_METH . | ||
| 83 | All predefined types are greater than | ||
| 84 | .Dv OBJ_NAME_TYPE_UNDEF | ||
| 85 | and smaller than | ||
| 86 | .Dv OBJ_NAME_TYPE_NUM . | ||
| 87 | .It | ||
| 88 | The values are pointers. | ||
| 89 | Formally, they are of the type | ||
| 90 | .Vt const char * , | ||
| 91 | but in practice, pointers of other types, for example | ||
| 92 | .Vt EVP_CIPHER * | ||
| 93 | or | ||
| 94 | .Vt EVP_MD * , | ||
| 95 | are often stored as values | ||
| 96 | and cast back to the correct type on retrieval. | ||
| 97 | .It | ||
| 98 | The array supports type-specific aliases for names. | ||
| 99 | .El | ||
| 100 | .Pp | ||
| 101 | .Fn OBJ_NAME_add | ||
| 102 | removes the key-value pair or alias with the key | ||
| 103 | .Pq Fa name , type | ||
| 104 | in the same way as | ||
| 105 | .Fn OBJ_NAME_remove | ||
| 106 | and inserts a key-value pair with the specified | ||
| 107 | .Fa name , | ||
| 108 | .Fa type , | ||
| 109 | and | ||
| 110 | .Fa value . | ||
| 111 | If the bit | ||
| 112 | .Dv OBJ_NAME_ALIAS | ||
| 113 | is set in the | ||
| 114 | .Fa type | ||
| 115 | argument, that bit is cleared before using the | ||
| 116 | .Fa type | ||
| 117 | and the key | ||
| 118 | .Pq Fa name , type | ||
| 119 | becomes an alias for the key | ||
| 120 | .Pq Fa value , type | ||
| 121 | instead of setting a value. | ||
| 122 | It is not checked whether the key | ||
| 123 | .Pq Fa value , type | ||
| 124 | already exists. | ||
| 125 | Consequently, it is possible to define an alias | ||
| 126 | before setting the associated value. | ||
| 127 | .Pp | ||
| 128 | .Fn OBJ_NAME_remove | ||
| 129 | removes the key-value pair or alias with the key | ||
| 130 | .Pq Fa name , type | ||
| 131 | from the array, if it exists. | ||
| 132 | Otherwise, it has no effect. | ||
| 133 | If the bit | ||
| 134 | .Dv OBJ_NAME_ALIAS | ||
| 135 | is set in the | ||
| 136 | .Fa type | ||
| 137 | argument, it is ignored and cleared before using the | ||
| 138 | .Fa type . | ||
| 139 | If the | ||
| 140 | .Fa type | ||
| 141 | is an application-defined type added with | ||
| 142 | .Fn OBJ_NAME_new_index | ||
| 143 | and the | ||
| 144 | .Fa free_func | ||
| 145 | associated with the | ||
| 146 | .Fa type | ||
| 147 | is not a | ||
| 148 | .Dv NULL | ||
| 149 | pointer, it is called with the | ||
| 150 | .Fa name , | ||
| 151 | .Fa type , | ||
| 152 | and | ||
| 153 | .Fa value | ||
| 154 | of the key-value pair being removed or with the | ||
| 155 | .Fa name , | ||
| 156 | .Fa type , | ||
| 157 | and alias target name of the alias being removed. | ||
| 158 | In typical usage, this function might free the | ||
| 159 | .Fa name , | ||
| 160 | and it might free the | ||
| 161 | .Fa value | ||
| 162 | in a type-specific way. | ||
| 163 | .Pp | ||
| 164 | .Fn OBJ_NAME_get | ||
| 165 | looks up the key | ||
| 166 | .Pq Fa name , type , | ||
| 167 | recursively resolving up to ten aliases if needed. | ||
| 168 | If the bit | ||
| 169 | .Dv OBJ_NAME_ALIAS | ||
| 170 | is set in the | ||
| 171 | .Fa type | ||
| 172 | argument, it is cleared before using the | ||
| 173 | .Fa type , | ||
| 174 | processing of aliases is disabled, and if | ||
| 175 | .Pq Fa name , type | ||
| 176 | is an alias, the target name of the alias is returned instead of a value. | ||
| 177 | .Pp | ||
| 178 | .Fn OBJ_NAME_new_index | ||
| 179 | assigns the smallest unassigned positive integer number | ||
| 180 | to represent a new, application-defined | ||
| 181 | .Fa type . | ||
| 182 | The three function pointers will be used, respectively, | ||
| 183 | to hash a name for this type, to compare two names for this type, | ||
| 184 | and to free the contents of a key-value pair holding the given | ||
| 185 | .Fa name , | ||
| 186 | .Fa type , | ||
| 187 | and | ||
| 188 | .Fa value . | ||
| 189 | If the | ||
| 190 | .Fa hash_func | ||
| 191 | argument is a | ||
| 192 | .Dv NULL | ||
| 193 | pointer, | ||
| 194 | .Xr lh_strhash 3 | ||
| 195 | is used instead. | ||
| 196 | If the | ||
| 197 | .Fa cmp_func | ||
| 198 | argument is a | ||
| 199 | .Dv NULL | ||
| 200 | pointer, | ||
| 201 | .Xr strcmp 3 | ||
| 202 | is used instead. | ||
| 203 | If the | ||
| 204 | .Fa free_func | ||
| 205 | argument is a | ||
| 206 | .Dv NULL | ||
| 207 | pointer, the | ||
| 208 | .Fa name | ||
| 209 | and | ||
| 210 | .Fa value | ||
| 211 | pointers contained in the key-value pair are not freed, | ||
| 212 | only the structure representing the pair itself is. | ||
| 213 | This default behaviour is also used for the built-in types. | ||
| 214 | .Pp | ||
| 215 | .Fn OBJ_NAME_init | ||
| 216 | initializes the array. | ||
| 217 | After initialization, the array is empty. | ||
| 218 | Calling | ||
| 219 | .Fn OBJ_NAME_init | ||
| 220 | when the array is already initialized has no effect. | ||
| 221 | Application programs do not need to call this function because | ||
| 222 | .Fn OBJ_NAME_add | ||
| 223 | and | ||
| 224 | .Fn OBJ_NAME_get | ||
| 225 | automatically call it whenever needed. | ||
| 226 | .Pp | ||
| 227 | .Fn OBJ_NAME_cleanup | ||
| 228 | removes all key-value pairs and aliases of the given | ||
| 229 | .Fa type | ||
| 230 | from the array by calling | ||
| 231 | .Fn OBJ_NAME_remove | ||
| 232 | on every such pair and alias. | ||
| 233 | If the | ||
| 234 | .Fa type | ||
| 235 | argument is negative, it removes all key-value pairs and aliases | ||
| 236 | of any type and also reverses all effects of | ||
| 237 | .Fn OBJ_NAME_new_index | ||
| 238 | and | ||
| 239 | .Fn OBJ_NAME_init , | ||
| 240 | in particular resetting the list of types to the predefined types | ||
| 241 | and releasing all memory reserved by these functions. | ||
| 242 | .Pp | ||
| 243 | The | ||
| 244 | .Vt OBJ_NAME | ||
| 245 | structure represents one key-value pair or one alias with the key | ||
| 246 | .Pq Fa name , type . | ||
| 247 | If the | ||
| 248 | .Fa alias | ||
| 249 | field is 0, the | ||
| 250 | .Fa data | ||
| 251 | field contains the value; otherwise, it contains the alias target name. | ||
| 252 | .Sh RETURN VALUES | ||
| 253 | .Fn OBJ_NAME_add | ||
| 254 | and | ||
| 255 | .Fn OBJ_NAME_init | ||
| 256 | return 1 on success or 0 if memory allocation fails. | ||
| 257 | .Pp | ||
| 258 | .Fn OBJ_NAME_remove | ||
| 259 | returns 1 if one key-value pair or alias was removed or 0 otherwise. | ||
| 260 | .Pp | ||
| 261 | .Fn OBJ_NAME_get | ||
| 262 | returns the | ||
| 263 | .Fa value | ||
| 264 | associated with the key | ||
| 265 | .Pq Fa name , type | ||
| 266 | or | ||
| 267 | .Dv NULL | ||
| 268 | if | ||
| 269 | .Fa name | ||
| 270 | is | ||
| 271 | .Dv NULL , | ||
| 272 | if the array does not contain a value for this key, | ||
| 273 | or if more than ten aliases are encountered before finding a value. | ||
| 274 | .Pp | ||
| 275 | .Fn OBJ_NAME_new_index | ||
| 276 | returns a positive integer greater than or equal to | ||
| 277 | .Dv OBJ_NAME_TYPE_NUM | ||
| 278 | representing the new type or 0 if memory allocation fails. | ||
| 279 | .Sh SEE ALSO | ||
| 280 | .Xr EVP_cleanup 3 , | ||
| 281 | .Xr EVP_get_cipherbyname 3 , | ||
| 282 | .Xr EVP_get_digestbyname 3 , | ||
| 283 | .Xr lh_new 3 , | ||
| 284 | .Xr OBJ_create 3 , | ||
| 285 | .Xr OBJ_nid2obj 3 | ||
| 286 | .Sh BUGS | ||
| 287 | Calling | ||
| 288 | .Fn OBJ_NAME_get | ||
| 289 | with the bit | ||
| 290 | .Dv OBJ_NAME_ALIAS | ||
| 291 | is not very useful because there is no way to tell | ||
| 292 | whether the returned pointer points to a value or to a name, | ||
| 293 | short of calling the function again without setting the bit | ||
| 294 | and comparing the two returned pointers. | ||
| 295 | .Pp | ||
| 296 | The | ||
| 297 | .Fa free_func | ||
| 298 | has no way to tell whether its | ||
| 299 | .Fa value | ||
| 300 | argument is indeed of the given | ||
| 301 | .Fa type | ||
| 302 | or whether it is merely the target name of an alias. | ||
| 303 | Consequently, to use values of a type | ||
| 304 | that requires more cleanup than merely calling | ||
| 305 | .Xr free 3 | ||
| 306 | on it, instances of the type need to begin with a magic number or string | ||
| 307 | that cannot occur at the beginning of a name. | ||
diff --git a/src/lib/libcrypto/man/OBJ_create.3 b/src/lib/libcrypto/man/OBJ_create.3 index fa5bde3dd3..75d51f4bb8 100644 --- a/src/lib/libcrypto/man/OBJ_create.3 +++ b/src/lib/libcrypto/man/OBJ_create.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: OBJ_create.3,v 1.10 2024/01/31 08:02:53 tb Exp $ | 1 | .\" $OpenBSD: OBJ_create.3,v 1.11 2025/06/08 22:37:23 schwarze Exp $ |
| 2 | .\" full merge up to: | 2 | .\" full merge up to: |
| 3 | .\" OpenSSL OBJ_nid2obj.pod 9b86974e Aug 17 15:21:33 2015 -0400 | 3 | .\" OpenSSL OBJ_nid2obj.pod 9b86974e Aug 17 15:21:33 2015 -0400 |
| 4 | .\" selective merge up to: | 4 | .\" selective merge up to: |
| @@ -69,18 +69,18 @@ | |||
| 69 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 69 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 70 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 70 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 71 | .\" | 71 | .\" |
| 72 | .Dd $Mdocdate: January 31 2024 $ | 72 | .Dd $Mdocdate: June 8 2025 $ |
| 73 | .Dt OBJ_CREATE 3 | 73 | .Dt OBJ_CREATE 3 |
| 74 | .Os | 74 | .Os |
| 75 | .Sh NAME | 75 | .Sh NAME |
| 76 | .Nm OBJ_new_nid , | 76 | .Nm OBJ_new_nid , |
| 77 | .Nm OBJ_add_object , | 77 | .Nm OBJ_add_object , |
| 78 | .Nm OBJ_create , | 78 | .Nm OBJ_create , |
| 79 | .\" OBJ_create_and_add_object is a deprecated, unused alias for OBJ_create(3). | ||
| 80 | .Nm OBJ_create_objects , | 79 | .Nm OBJ_create_objects , |
| 81 | .Nm OBJ_cleanup | 80 | .Nm OBJ_cleanup |
| 82 | .Nd modify the table of ASN.1 object identifiers | 81 | .Nd modify the table of ASN.1 object identifiers |
| 83 | .Sh SYNOPSIS | 82 | .Sh SYNOPSIS |
| 83 | .Lb libcrypto | ||
| 84 | .In openssl/objects.h | 84 | .In openssl/objects.h |
| 85 | .Ft int | 85 | .Ft int |
| 86 | .Fn OBJ_new_nid "int increment" | 86 | .Fn OBJ_new_nid "int increment" |
diff --git a/src/lib/libcrypto/man/OBJ_find_sigid_algs.3 b/src/lib/libcrypto/man/OBJ_find_sigid_algs.3 index 1d7a2b649b..4c071c6c76 100644 --- a/src/lib/libcrypto/man/OBJ_find_sigid_algs.3 +++ b/src/lib/libcrypto/man/OBJ_find_sigid_algs.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: OBJ_find_sigid_algs.3,v 1.2 2024/01/31 08:02:53 tb Exp $ | 1 | .\" $OpenBSD: OBJ_find_sigid_algs.3,v 1.4 2025/06/09 12:42:46 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: January 31 2024 $ | 17 | .Dd $Mdocdate: June 9 2025 $ |
| 18 | .Dt OBJ_FIND_SIGID_ALGS 3 | 18 | .Dt OBJ_FIND_SIGID_ALGS 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm OBJ_find_sigid_by_algs | 22 | .Nm OBJ_find_sigid_by_algs |
| 23 | .Nd signature algorithm mappings | 23 | .Nd signature algorithm mappings |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/objects.h | 26 | .In openssl/objects.h |
| 26 | .Ft int | 27 | .Ft int |
| 27 | .Fo OBJ_find_sigid_algs | 28 | .Fo OBJ_find_sigid_algs |
| @@ -80,7 +81,6 @@ and | |||
| 80 | algorithms is defined or 0 if the definition of such an algorithm | 81 | algorithms is defined or 0 if the definition of such an algorithm |
| 81 | is not built into the library. | 82 | is not built into the library. |
| 82 | .Sh SEE ALSO | 83 | .Sh SEE ALSO |
| 83 | .Xr EVP_cleanup 3 , | ||
| 84 | .Xr OBJ_create 3 , | 84 | .Xr OBJ_create 3 , |
| 85 | .Xr OBJ_nid2obj 3 | 85 | .Xr OBJ_nid2obj 3 |
| 86 | .Sh HISTORY | 86 | .Sh HISTORY |
diff --git a/src/lib/libcrypto/man/OBJ_nid2obj.3 b/src/lib/libcrypto/man/OBJ_nid2obj.3 index ccab1ed30c..9261ac9a7d 100644 --- a/src/lib/libcrypto/man/OBJ_nid2obj.3 +++ b/src/lib/libcrypto/man/OBJ_nid2obj.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: OBJ_nid2obj.3,v 1.22 2024/01/31 08:02:53 tb Exp $ | 1 | .\" $OpenBSD: OBJ_nid2obj.3,v 1.23 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL c264592d May 14 11:28:00 2006 +0000 | 2 | .\" full merge up to: OpenSSL c264592d May 14 11:28:00 2006 +0000 |
| 3 | .\" selective merge up to: OpenSSL 35fd9953 May 28 14:49:38 2019 +0200 | 3 | .\" selective merge up to: OpenSSL 35fd9953 May 28 14:49:38 2019 +0200 |
| 4 | .\" | 4 | .\" |
| @@ -67,7 +67,7 @@ | |||
| 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 69 | .\" | 69 | .\" |
| 70 | .Dd $Mdocdate: January 31 2024 $ | 70 | .Dd $Mdocdate: June 8 2025 $ |
| 71 | .Dt OBJ_NID2OBJ 3 | 71 | .Dt OBJ_NID2OBJ 3 |
| 72 | .Os | 72 | .Os |
| 73 | .Sh NAME | 73 | .Sh NAME |
| @@ -86,6 +86,7 @@ | |||
| 86 | .Nm i2a_ASN1_OBJECT | 86 | .Nm i2a_ASN1_OBJECT |
| 87 | .Nd inspect and create ASN.1 object identifiers | 87 | .Nd inspect and create ASN.1 object identifiers |
| 88 | .Sh SYNOPSIS | 88 | .Sh SYNOPSIS |
| 89 | .Lb libcrypto | ||
| 89 | .In openssl/objects.h | 90 | .In openssl/objects.h |
| 90 | .Ft ASN1_OBJECT * | 91 | .Ft ASN1_OBJECT * |
| 91 | .Fo OBJ_nid2obj | 92 | .Fo OBJ_nid2obj |
diff --git a/src/lib/libcrypto/man/OCSP_CRLID_new.3 b/src/lib/libcrypto/man/OCSP_CRLID_new.3 index 6feb608654..9b0126fe91 100644 --- a/src/lib/libcrypto/man/OCSP_CRLID_new.3 +++ b/src/lib/libcrypto/man/OCSP_CRLID_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: OCSP_CRLID_new.3,v 1.8 2022/01/15 23:38:50 jsg Exp $ | 1 | .\" $OpenBSD: OCSP_CRLID_new.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: January 15 2022 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt OCSP_CRLID_NEW 3 | 18 | .Dt OCSP_CRLID_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -23,6 +23,7 @@ | |||
| 23 | .Nm OCSP_crlID_new | 23 | .Nm OCSP_crlID_new |
| 24 | .Nd OCSP CRL extension | 24 | .Nd OCSP CRL extension |
| 25 | .Sh SYNOPSIS | 25 | .Sh SYNOPSIS |
| 26 | .Lb libcrypto | ||
| 26 | .In openssl/ocsp.h | 27 | .In openssl/ocsp.h |
| 27 | .Ft OCSP_CRLID * | 28 | .Ft OCSP_CRLID * |
| 28 | .Fn OCSP_CRLID_new void | 29 | .Fn OCSP_CRLID_new void |
diff --git a/src/lib/libcrypto/man/OCSP_REQUEST_new.3 b/src/lib/libcrypto/man/OCSP_REQUEST_new.3 index a304f60160..0e4e0ffb38 100644 --- a/src/lib/libcrypto/man/OCSP_REQUEST_new.3 +++ b/src/lib/libcrypto/man/OCSP_REQUEST_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: OCSP_REQUEST_new.3,v 1.12 2022/02/19 13:09:36 jsg Exp $ | 1 | .\" $OpenBSD: OCSP_REQUEST_new.3,v 1.13 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: February 19 2022 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt OCSP_REQUEST_NEW 3 | 69 | .Dt OCSP_REQUEST_NEW 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -84,6 +84,7 @@ | |||
| 84 | .Nm OCSP_request_onereq_get0 | 84 | .Nm OCSP_request_onereq_get0 |
| 85 | .Nd OCSP request functions | 85 | .Nd OCSP request functions |
| 86 | .Sh SYNOPSIS | 86 | .Sh SYNOPSIS |
| 87 | .Lb libcrypto | ||
| 87 | .In openssl/ocsp.h | 88 | .In openssl/ocsp.h |
| 88 | .Ft OCSP_REQUEST * | 89 | .Ft OCSP_REQUEST * |
| 89 | .Fn OCSP_REQUEST_new void | 90 | .Fn OCSP_REQUEST_new void |
diff --git a/src/lib/libcrypto/man/OCSP_SERVICELOC_new.3 b/src/lib/libcrypto/man/OCSP_SERVICELOC_new.3 index 62eb8c320f..42288321a3 100644 --- a/src/lib/libcrypto/man/OCSP_SERVICELOC_new.3 +++ b/src/lib/libcrypto/man/OCSP_SERVICELOC_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: OCSP_SERVICELOC_new.3,v 1.8 2019/08/23 12:23:39 schwarze Exp $ | 1 | .\" $OpenBSD: OCSP_SERVICELOC_new.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: August 23 2019 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt OCSP_SERVICELOC_NEW 3 | 18 | .Dt OCSP_SERVICELOC_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -23,6 +23,7 @@ | |||
| 23 | .Nm OCSP_url_svcloc_new | 23 | .Nm OCSP_url_svcloc_new |
| 24 | .Nd OCSP service locator extension | 24 | .Nd OCSP service locator extension |
| 25 | .Sh SYNOPSIS | 25 | .Sh SYNOPSIS |
| 26 | .Lb libcrypto | ||
| 26 | .In openssl/ocsp.h | 27 | .In openssl/ocsp.h |
| 27 | .Ft OCSP_SERVICELOC * | 28 | .Ft OCSP_SERVICELOC * |
| 28 | .Fn OCSP_SERVICELOC_new void | 29 | .Fn OCSP_SERVICELOC_new void |
diff --git a/src/lib/libcrypto/man/OCSP_cert_to_id.3 b/src/lib/libcrypto/man/OCSP_cert_to_id.3 index e014a1d262..d0c04fcbb1 100644 --- a/src/lib/libcrypto/man/OCSP_cert_to_id.3 +++ b/src/lib/libcrypto/man/OCSP_cert_to_id.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: OCSP_cert_to_id.3,v 1.13 2024/08/24 19:31:09 tb Exp $ | 1 | .\" $OpenBSD: OCSP_cert_to_id.3,v 1.15 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: August 24 2024 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt OCSP_CERT_TO_ID 3 | 69 | .Dt OCSP_CERT_TO_ID 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -78,6 +78,7 @@ | |||
| 78 | .Nm OCSP_id_get0_info | 78 | .Nm OCSP_id_get0_info |
| 79 | .Nd OCSP certificate ID utility functions | 79 | .Nd OCSP certificate ID utility functions |
| 80 | .Sh SYNOPSIS | 80 | .Sh SYNOPSIS |
| 81 | .Lb libcrypto | ||
| 81 | .In openssl/ocsp.h | 82 | .In openssl/ocsp.h |
| 82 | .Ft OCSP_CERTID * | 83 | .Ft OCSP_CERTID * |
| 83 | .Fn OCSP_CERTID_new void | 84 | .Fn OCSP_CERTID_new void |
| @@ -148,7 +149,7 @@ If | |||
| 148 | .Fa dgst | 149 | .Fa dgst |
| 149 | is | 150 | is |
| 150 | .Dv NULL | 151 | .Dv NULL |
| 151 | then SHA1 is used. | 152 | then SHA-1 is used. |
| 152 | .Pp | 153 | .Pp |
| 153 | .Fn OCSP_cert_id_new | 154 | .Fn OCSP_cert_id_new |
| 154 | creates and returns a new | 155 | creates and returns a new |
diff --git a/src/lib/libcrypto/man/OCSP_request_add1_nonce.3 b/src/lib/libcrypto/man/OCSP_request_add1_nonce.3 index 036c937c61..304d686ba7 100644 --- a/src/lib/libcrypto/man/OCSP_request_add1_nonce.3 +++ b/src/lib/libcrypto/man/OCSP_request_add1_nonce.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: OCSP_request_add1_nonce.3,v 1.4 2018/03/22 21:08:22 schwarze Exp $ | 1 | .\" $OpenBSD: OCSP_request_add1_nonce.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 22 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt OCSP_REQUEST_ADD1_NONCE 3 | 52 | .Dt OCSP_REQUEST_ADD1_NONCE 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm OCSP_copy_nonce | 58 | .Nm OCSP_copy_nonce |
| 59 | .Nd OCSP nonce functions | 59 | .Nd OCSP nonce functions |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libcrypto | ||
| 61 | .In openssl/ocsp.h | 62 | .In openssl/ocsp.h |
| 62 | .Ft int | 63 | .Ft int |
| 63 | .Fo OCSP_request_add1_nonce | 64 | .Fo OCSP_request_add1_nonce |
diff --git a/src/lib/libcrypto/man/OCSP_resp_find_status.3 b/src/lib/libcrypto/man/OCSP_resp_find_status.3 index 06d0354bd6..5e9ce02fd5 100644 --- a/src/lib/libcrypto/man/OCSP_resp_find_status.3 +++ b/src/lib/libcrypto/man/OCSP_resp_find_status.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: OCSP_resp_find_status.3,v 1.11 2022/03/31 17:27:17 naddy Exp $ | 1 | .\" $OpenBSD: OCSP_resp_find_status.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL c952780c Jun 21 07:03:34 2016 -0400 | 2 | .\" full merge up to: OpenSSL c952780c Jun 21 07:03:34 2016 -0400 |
| 3 | .\" selective merge up to: OpenSSL 1212818e Sep 11 13:22:14 2018 +0100 | 3 | .\" selective merge up to: OpenSSL 1212818e Sep 11 13:22:14 2018 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -67,7 +67,7 @@ | |||
| 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 69 | .\" | 69 | .\" |
| 70 | .Dd $Mdocdate: March 31 2022 $ | 70 | .Dd $Mdocdate: June 8 2025 $ |
| 71 | .Dt OCSP_RESP_FIND_STATUS 3 | 71 | .Dt OCSP_RESP_FIND_STATUS 3 |
| 72 | .Os | 72 | .Os |
| 73 | .Sh NAME | 73 | .Sh NAME |
| @@ -88,6 +88,7 @@ | |||
| 88 | .Nm OCSP_basic_verify | 88 | .Nm OCSP_basic_verify |
| 89 | .Nd OCSP response utility functions | 89 | .Nd OCSP response utility functions |
| 90 | .Sh SYNOPSIS | 90 | .Sh SYNOPSIS |
| 91 | .Lb libcrypto | ||
| 91 | .In openssl/ocsp.h | 92 | .In openssl/ocsp.h |
| 92 | .Ft OCSP_SINGLERESP * | 93 | .Ft OCSP_SINGLERESP * |
| 93 | .Fn OCSP_SINGLERESP_new void | 94 | .Fn OCSP_SINGLERESP_new void |
diff --git a/src/lib/libcrypto/man/OCSP_response_status.3 b/src/lib/libcrypto/man/OCSP_response_status.3 index 4e85384fb0..7fd8267d9f 100644 --- a/src/lib/libcrypto/man/OCSP_response_status.3 +++ b/src/lib/libcrypto/man/OCSP_response_status.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: OCSP_response_status.3,v 1.8 2019/08/27 09:40:29 schwarze Exp $ | 1 | .\" $OpenBSD: OCSP_response_status.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400 | 2 | .\" full merge up to: OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400 |
| 3 | .\" selective merge up to: OpenSSL 6738bf14 Feb 13 12:51:29 2018 +0000 | 3 | .\" selective merge up to: OpenSSL 6738bf14 Feb 13 12:51:29 2018 +0000 |
| 4 | .\" | 4 | .\" |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: August 27 2019 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt OCSP_RESPONSE_STATUS 3 | 70 | .Dt OCSP_RESPONSE_STATUS 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -87,6 +87,7 @@ | |||
| 87 | .Nm OCSP_basic_sign | 87 | .Nm OCSP_basic_sign |
| 88 | .Nd OCSP response functions | 88 | .Nd OCSP response functions |
| 89 | .Sh SYNOPSIS | 89 | .Sh SYNOPSIS |
| 90 | .Lb libcrypto | ||
| 90 | .In openssl/ocsp.h | 91 | .In openssl/ocsp.h |
| 91 | .Ft OCSP_RESPONSE * | 92 | .Ft OCSP_RESPONSE * |
| 92 | .Fn OCSP_RESPONSE_new void | 93 | .Fn OCSP_RESPONSE_new void |
diff --git a/src/lib/libcrypto/man/OCSP_sendreq_new.3 b/src/lib/libcrypto/man/OCSP_sendreq_new.3 index 300f719525..c6608ecce7 100644 --- a/src/lib/libcrypto/man/OCSP_sendreq_new.3 +++ b/src/lib/libcrypto/man/OCSP_sendreq_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: OCSP_sendreq_new.3,v 1.10 2022/03/31 17:27:17 naddy Exp $ | 1 | .\" $OpenBSD: OCSP_sendreq_new.3,v 1.11 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: March 31 2022 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt OCSP_SENDREQ_NEW 3 | 69 | .Dt OCSP_SENDREQ_NEW 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -78,6 +78,7 @@ | |||
| 78 | .Nm OCSP_sendreq_bio | 78 | .Nm OCSP_sendreq_bio |
| 79 | .Nd OCSP responder query functions | 79 | .Nd OCSP responder query functions |
| 80 | .Sh SYNOPSIS | 80 | .Sh SYNOPSIS |
| 81 | .Lb libcrypto | ||
| 81 | .In openssl/ocsp.h | 82 | .In openssl/ocsp.h |
| 82 | .Ft OCSP_REQ_CTX * | 83 | .Ft OCSP_REQ_CTX * |
| 83 | .Fo OCSP_sendreq_new | 84 | .Fo OCSP_sendreq_new |
diff --git a/src/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 b/src/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 index 76427a864b..929658c28d 100644 --- a/src/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 +++ b/src/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: OPENSSL_VERSION_NUMBER.3,v 1.13 2023/11/16 20:17:04 schwarze Exp $ | 1 | .\" $OpenBSD: OPENSSL_VERSION_NUMBER.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 1f13ad31 Dec 25 17:50:39 2017 +0800 | 2 | .\" full merge up to: OpenSSL 1f13ad31 Dec 25 17:50:39 2017 +0800 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -68,7 +68,7 @@ | |||
| 68 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 68 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 69 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 69 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 70 | .\" | 70 | .\" |
| 71 | .Dd $Mdocdate: November 16 2023 $ | 71 | .Dd $Mdocdate: June 8 2025 $ |
| 72 | .Dt OPENSSL_VERSION_NUMBER 3 | 72 | .Dt OPENSSL_VERSION_NUMBER 3 |
| 73 | .Os | 73 | .Os |
| 74 | .Sh NAME | 74 | .Sh NAME |
| @@ -82,6 +82,7 @@ | |||
| 82 | .Nm SSLeay_version | 82 | .Nm SSLeay_version |
| 83 | .Nd get OpenSSL version number | 83 | .Nd get OpenSSL version number |
| 84 | .Sh SYNOPSIS | 84 | .Sh SYNOPSIS |
| 85 | .Lb libcrypto | ||
| 85 | .In openssl/opensslv.h | 86 | .In openssl/opensslv.h |
| 86 | .Fd #define OPENSSL_VERSION_NUMBER 0x020000000L | 87 | .Fd #define OPENSSL_VERSION_NUMBER 0x020000000L |
| 87 | .Fd #define LIBRESSL_VERSION_NUMBER 0x02nnnn00fL | 88 | .Fd #define LIBRESSL_VERSION_NUMBER 0x02nnnn00fL |
diff --git a/src/lib/libcrypto/man/OPENSSL_cleanse.3 b/src/lib/libcrypto/man/OPENSSL_cleanse.3 index 95fe6b86fd..cf16405db9 100644 --- a/src/lib/libcrypto/man/OPENSSL_cleanse.3 +++ b/src/lib/libcrypto/man/OPENSSL_cleanse.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: OPENSSL_cleanse.3,v 1.4 2019/06/10 09:49:48 schwarze Exp $ | 1 | .\" $OpenBSD: OPENSSL_cleanse.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: June 10 2019 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt OPENSSL_CLEANSE 3 | 18 | .Dt OPENSSL_CLEANSE 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm OPENSSL_cleanse | 21 | .Nm OPENSSL_cleanse |
| 22 | .Nd OpenSSL memory cleaning operation | 22 | .Nd OpenSSL memory cleaning operation |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/crypto.h | 25 | .In openssl/crypto.h |
| 25 | .Ft void | 26 | .Ft void |
| 26 | .Fo OPENSSL_cleanse | 27 | .Fo OPENSSL_cleanse |
diff --git a/src/lib/libcrypto/man/OPENSSL_config.3 b/src/lib/libcrypto/man/OPENSSL_config.3 index f5f31571a1..e21b9817de 100644 --- a/src/lib/libcrypto/man/OPENSSL_config.3 +++ b/src/lib/libcrypto/man/OPENSSL_config.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: OPENSSL_config.3,v 1.16 2023/11/19 21:01:27 tb Exp $ | 1 | .\" $OpenBSD: OPENSSL_config.3,v 1.18 2025/06/09 12:43:53 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: November 19 2023 $ | 68 | .Dd $Mdocdate: June 9 2025 $ |
| 69 | .Dt OPENSSL_CONFIG 3 | 69 | .Dt OPENSSL_CONFIG 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -73,6 +73,7 @@ | |||
| 73 | .Nm OPENSSL_no_config | 73 | .Nm OPENSSL_no_config |
| 74 | .Nd simple crypto and ssl library configuration | 74 | .Nd simple crypto and ssl library configuration |
| 75 | .Sh SYNOPSIS | 75 | .Sh SYNOPSIS |
| 76 | .Lb libcrypto | ||
| 76 | .In openssl/conf.h | 77 | .In openssl/conf.h |
| 77 | .Ft void | 78 | .Ft void |
| 78 | .Fo OPENSSL_config | 79 | .Fo OPENSSL_config |
| @@ -117,13 +118,11 @@ To use a non-standard configuration file, refer to | |||
| 117 | Internally, | 118 | Internally, |
| 118 | .Fn OPENSSL_config | 119 | .Fn OPENSSL_config |
| 119 | calls | 120 | calls |
| 120 | .Xr OPENSSL_init_crypto 3 | 121 | .Xr OPENSSL_init_crypto 3 . |
| 121 | and | ||
| 122 | .Xr OPENSSL_load_builtin_modules 3 . | ||
| 123 | .Pp | 122 | .Pp |
| 124 | If an application is compiled with the preprocessor symbol | 123 | If an application is compiled with the preprocessor symbol |
| 125 | .Dv OPENSSL_LOAD_CONF | 124 | .Dv OPENSSL_LOAD_CONF |
| 126 | #define'd, | 125 | defined, |
| 127 | .Xr OpenSSL_add_all_algorithms 3 | 126 | .Xr OpenSSL_add_all_algorithms 3 |
| 128 | automatically calls | 127 | automatically calls |
| 129 | .Fn OPENSSL_config . | 128 | .Fn OPENSSL_config . |
| @@ -140,7 +139,6 @@ standard configuration file | |||
| 140 | .Xr CONF_modules_free 3 , | 139 | .Xr CONF_modules_free 3 , |
| 141 | .Xr CONF_modules_load_file 3 , | 140 | .Xr CONF_modules_load_file 3 , |
| 142 | .Xr crypto 3 , | 141 | .Xr crypto 3 , |
| 143 | .Xr OPENSSL_load_builtin_modules 3 , | ||
| 144 | .Xr OPENSSL_VERSION_NUMBER 3 , | 142 | .Xr OPENSSL_VERSION_NUMBER 3 , |
| 145 | .Xr openssl.cnf 5 , | 143 | .Xr openssl.cnf 5 , |
| 146 | .Xr x509v3.cnf 5 | 144 | .Xr x509v3.cnf 5 |
diff --git a/src/lib/libcrypto/man/OPENSSL_init_crypto.3 b/src/lib/libcrypto/man/OPENSSL_init_crypto.3 index 6f38c7bda2..5c29d55aa9 100644 --- a/src/lib/libcrypto/man/OPENSSL_init_crypto.3 +++ b/src/lib/libcrypto/man/OPENSSL_init_crypto.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: OPENSSL_init_crypto.3,v 1.5 2020/05/24 12:21:31 schwarze Exp $ | 1 | .\" $OpenBSD: OPENSSL_init_crypto.3,v 1.7 2025/06/09 12:43:53 schwarze Exp $ |
| 2 | .\" Copyright (c) 2018, 2020 Ingo Schwarze <schwarze@openbsd.org> | 2 | .\" Copyright (c) 2018, 2020 Ingo Schwarze <schwarze@openbsd.org> |
| 3 | .\" | 3 | .\" |
| 4 | .\" Permission to use, copy, modify, and distribute this software for any | 4 | .\" Permission to use, copy, modify, and distribute this software for any |
| @@ -13,7 +13,7 @@ | |||
| 13 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 13 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 14 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | .\" | 15 | .\" |
| 16 | .Dd $Mdocdate: May 24 2020 $ | 16 | .Dd $Mdocdate: June 9 2025 $ |
| 17 | .Dt OPENSSL_INIT_CRYPTO 3 | 17 | .Dt OPENSSL_INIT_CRYPTO 3 |
| 18 | .Os | 18 | .Os |
| 19 | .Sh NAME | 19 | .Sh NAME |
| @@ -21,6 +21,7 @@ | |||
| 21 | .Nm OPENSSL_init | 21 | .Nm OPENSSL_init |
| 22 | .Nd initialise the crypto library | 22 | .Nd initialise the crypto library |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/crypto.h | 25 | .In openssl/crypto.h |
| 25 | .Ft int | 26 | .Ft int |
| 26 | .Fo OPENSSL_init_crypto | 27 | .Fo OPENSSL_init_crypto |
| @@ -54,10 +55,7 @@ If | |||
| 54 | is called before any other crypto or ssl functions, the crypto | 55 | is called before any other crypto or ssl functions, the crypto |
| 55 | library is initialised by allocating various internal resources, | 56 | library is initialised by allocating various internal resources, |
| 56 | in particular calling | 57 | in particular calling |
| 57 | .Xr ERR_load_crypto_strings 3 , | 58 | .Xr ERR_load_crypto_strings 3 . |
| 58 | .Xr OpenSSL_add_all_ciphers 3 , | ||
| 59 | and | ||
| 60 | .Xr OpenSSL_add_all_digests 3 . | ||
| 61 | .Pp | 59 | .Pp |
| 62 | The following | 60 | The following |
| 63 | .Fa options | 61 | .Fa options |
| @@ -92,7 +90,6 @@ is intended to return 1 on success or 0 on error. | |||
| 92 | .Sh SEE ALSO | 90 | .Sh SEE ALSO |
| 93 | .Xr CONF_modules_load_file 3 , | 91 | .Xr CONF_modules_load_file 3 , |
| 94 | .Xr OPENSSL_config 3 , | 92 | .Xr OPENSSL_config 3 , |
| 95 | .Xr OPENSSL_load_builtin_modules 3 , | ||
| 96 | .Xr openssl.cnf 5 | 93 | .Xr openssl.cnf 5 |
| 97 | .Sh HISTORY | 94 | .Sh HISTORY |
| 98 | .Fn OPENSSL_init | 95 | .Fn OPENSSL_init |
diff --git a/src/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 b/src/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 deleted file mode 100644 index 2b20efaf0e..0000000000 --- a/src/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 +++ /dev/null | |||
| @@ -1,101 +0,0 @@ | |||
| 1 | .\" $OpenBSD: OPENSSL_load_builtin_modules.3,v 1.8 2023/12/05 02:41:13 jsg Exp $ | ||
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | ||
| 3 | .\" | ||
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | ||
| 5 | .\" Copyright (c) 2004, 2013 The OpenSSL Project. All rights reserved. | ||
| 6 | .\" | ||
| 7 | .\" Redistribution and use in source and binary forms, with or without | ||
| 8 | .\" modification, are permitted provided that the following conditions | ||
| 9 | .\" are met: | ||
| 10 | .\" | ||
| 11 | .\" 1. Redistributions of source code must retain the above copyright | ||
| 12 | .\" notice, this list of conditions and the following disclaimer. | ||
| 13 | .\" | ||
| 14 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
| 15 | .\" notice, this list of conditions and the following disclaimer in | ||
| 16 | .\" the documentation and/or other materials provided with the | ||
| 17 | .\" distribution. | ||
| 18 | .\" | ||
| 19 | .\" 3. All advertising materials mentioning features or use of this | ||
| 20 | .\" software must display the following acknowledgment: | ||
| 21 | .\" "This product includes software developed by the OpenSSL Project | ||
| 22 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 23 | .\" | ||
| 24 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 25 | .\" endorse or promote products derived from this software without | ||
| 26 | .\" prior written permission. For written permission, please contact | ||
| 27 | .\" openssl-core@openssl.org. | ||
| 28 | .\" | ||
| 29 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
| 30 | .\" nor may "OpenSSL" appear in their names without prior written | ||
| 31 | .\" permission of the OpenSSL Project. | ||
| 32 | .\" | ||
| 33 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
| 34 | .\" acknowledgment: | ||
| 35 | .\" "This product includes software developed by the OpenSSL Project | ||
| 36 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 37 | .\" | ||
| 38 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 39 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 40 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 41 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 42 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 43 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 44 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 45 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 46 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 47 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 50 | .\" | ||
| 51 | .Dd $Mdocdate: December 5 2023 $ | ||
| 52 | .Dt OPENSSL_LOAD_BUILTIN_MODULES 3 | ||
| 53 | .Os | ||
| 54 | .Sh NAME | ||
| 55 | .Nm OPENSSL_load_builtin_modules , | ||
| 56 | .Nm ASN1_add_oid_module | ||
| 57 | .Nd add standard configuration modules | ||
| 58 | .Sh SYNOPSIS | ||
| 59 | .In openssl/conf.h | ||
| 60 | .Ft void | ||
| 61 | .Fn OPENSSL_load_builtin_modules void | ||
| 62 | .Ft void | ||
| 63 | .Fn ASN1_add_oid_module void | ||
| 64 | .Sh DESCRIPTION | ||
| 65 | The function | ||
| 66 | .Fn OPENSSL_load_builtin_modules | ||
| 67 | adds all the standard OpenSSL configuration modules to the internal | ||
| 68 | list. | ||
| 69 | They can then be used by the OpenSSL configuration code. | ||
| 70 | .Pp | ||
| 71 | .Fn ASN1_add_oid_module | ||
| 72 | adds just the ASN.1 OBJECT module. | ||
| 73 | .Pp | ||
| 74 | If the simple configuration function | ||
| 75 | .Xr OPENSSL_config 3 | ||
| 76 | is called then | ||
| 77 | .Fn OPENSSL_load_builtin_modules | ||
| 78 | is called automatically. | ||
| 79 | .Pp | ||
| 80 | Applications which use configuration functions like | ||
| 81 | .Xr CONF_modules_load_file 3 | ||
| 82 | directly need to call | ||
| 83 | .Fn OPENSSL_load_builtin_modules | ||
| 84 | themselves | ||
| 85 | .Em before | ||
| 86 | any other configuration code. | ||
| 87 | .Pp | ||
| 88 | Applications should call | ||
| 89 | .Xr OPENSSL_config 3 | ||
| 90 | or | ||
| 91 | .Fn OPENSSL_load_builtin_modules | ||
| 92 | to load all configuration modules instead of adding modules selectively: | ||
| 93 | otherwise functionality may be missing from the application when | ||
| 94 | new modules are added. | ||
| 95 | .Sh SEE ALSO | ||
| 96 | .Xr CONF_modules_load_file 3 , | ||
| 97 | .Xr OPENSSL_config 3 | ||
| 98 | .Sh HISTORY | ||
| 99 | These functions first appeared in OpenSSL 0.9.7 | ||
| 100 | and have been available since | ||
| 101 | .Ox 3.2 . | ||
diff --git a/src/lib/libcrypto/man/OPENSSL_malloc.3 b/src/lib/libcrypto/man/OPENSSL_malloc.3 index a43dc56923..6e87d030d8 100644 --- a/src/lib/libcrypto/man/OPENSSL_malloc.3 +++ b/src/lib/libcrypto/man/OPENSSL_malloc.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: OPENSSL_malloc.3,v 1.13 2024/04/04 09:30:43 tb Exp $ | 1 | .\" $OpenBSD: OPENSSL_malloc.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: April 4 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt OPENSSL_MALLOC 3 | 18 | .Dt OPENSSL_MALLOC 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -26,6 +26,7 @@ | |||
| 26 | .Nm CRYPTO_strdup | 26 | .Nm CRYPTO_strdup |
| 27 | .Nd legacy OpenSSL memory allocation wrappers | 27 | .Nd legacy OpenSSL memory allocation wrappers |
| 28 | .Sh SYNOPSIS | 28 | .Sh SYNOPSIS |
| 29 | .Lb libcrypto | ||
| 29 | .In openssl/crypto.h | 30 | .In openssl/crypto.h |
| 30 | .Ft void * | 31 | .Ft void * |
| 31 | .Fo OPENSSL_malloc | 32 | .Fo OPENSSL_malloc |
diff --git a/src/lib/libcrypto/man/OPENSSL_sk_new.3 b/src/lib/libcrypto/man/OPENSSL_sk_new.3 index 8f06bb4212..632bc9d39f 100644 --- a/src/lib/libcrypto/man/OPENSSL_sk_new.3 +++ b/src/lib/libcrypto/man/OPENSSL_sk_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: OPENSSL_sk_new.3,v 1.13 2024/03/04 09:47:34 tb Exp $ | 1 | .\" $OpenBSD: OPENSSL_sk_new.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 4 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt OPENSSL_SK_NEW 3 | 18 | .Dt OPENSSL_SK_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -40,6 +40,7 @@ | |||
| 40 | .Nm sk_zero | 40 | .Nm sk_zero |
| 41 | .Nd variable-sized arrays of void pointers, called OpenSSL stacks | 41 | .Nd variable-sized arrays of void pointers, called OpenSSL stacks |
| 42 | .Sh SYNOPSIS | 42 | .Sh SYNOPSIS |
| 43 | .Lb libcrypto | ||
| 43 | .In openssl/stack.h | 44 | .In openssl/stack.h |
| 44 | .Ft _STACK * | 45 | .Ft _STACK * |
| 45 | .Fn sk_new_null void | 46 | .Fn sk_new_null void |
diff --git a/src/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 b/src/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 index 88ecef9768..68d8799bd4 100644 --- a/src/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 +++ b/src/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 | |||
| @@ -1,7 +1,24 @@ | |||
| 1 | .\" $OpenBSD: OpenSSL_add_all_algorithms.3,v 1.16 2024/03/04 19:04:47 tb Exp $ | 1 | .\" $OpenBSD: OpenSSL_add_all_algorithms.3,v 1.19 2025/06/12 15:59:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL b3696a55 Sep 2 09:35:50 2017 -0400 | 2 | .\" full merge up to: OpenSSL b3696a55 Sep 2 09:35:50 2017 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file is a derived work. |
| 5 | .\" The changes are covered by the following Copyright and license: | ||
| 6 | .\" | ||
| 7 | .\" Copyright (c) 2018, 2019, 2023, 2025 Ingo Schwarze <schwarze@openbsd.org> | ||
| 8 | .\" | ||
| 9 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 10 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 11 | .\" copyright notice and this permission notice appear in all copies. | ||
| 12 | .\" | ||
| 13 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 14 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 15 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 16 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 17 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 18 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 19 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 20 | .\" | ||
| 21 | .\" The original file was written by Dr. Stephen Henson <steve@openssl.org>. | ||
| 5 | .\" Copyright (c) 2000, 2003, 2013 The OpenSSL Project. All rights reserved. | 22 | .\" Copyright (c) 2000, 2003, 2013 The OpenSSL Project. All rights reserved. |
| 6 | .\" | 23 | .\" |
| 7 | .\" Redistribution and use in source and binary forms, with or without | 24 | .\" Redistribution and use in source and binary forms, with or without |
| @@ -48,7 +65,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 67 | .\" |
| 51 | .Dd $Mdocdate: March 4 2024 $ | 68 | .Dd $Mdocdate: June 12 2025 $ |
| 52 | .Dt OPENSSL_ADD_ALL_ALGORITHMS 3 | 69 | .Dt OPENSSL_ADD_ALL_ALGORITHMS 3 |
| 53 | .Os | 70 | .Os |
| 54 | .Sh NAME | 71 | .Sh NAME |
| @@ -64,6 +81,7 @@ | |||
| 64 | .\" because they are unused aliases. | 81 | .\" because they are unused aliases. |
| 65 | .Nd add algorithms to internal table | 82 | .Nd add algorithms to internal table |
| 66 | .Sh SYNOPSIS | 83 | .Sh SYNOPSIS |
| 84 | .Lb libcrypto | ||
| 67 | .In openssl/evp.h | 85 | .In openssl/evp.h |
| 68 | .Ft void | 86 | .Ft void |
| 69 | .Fn OpenSSL_add_all_algorithms void | 87 | .Fn OpenSSL_add_all_algorithms void |
| @@ -79,40 +97,43 @@ | |||
| 79 | These functions are deprecated. | 97 | These functions are deprecated. |
| 80 | It is never useful for any application program | 98 | It is never useful for any application program |
| 81 | to call any of them explicitly. | 99 | to call any of them explicitly. |
| 82 | The library automatically calls them internally whenever needed. | 100 | Most of them have no effect except that they may or may not call |
| 101 | .Xr OPENSSL_init_crypto 3 . | ||
| 83 | .Pp | 102 | .Pp |
| 84 | OpenSSL keeps an internal table of digest algorithms and ciphers. | 103 | The library contains internal tables of digest algorithms and ciphers. |
| 85 | It uses this table to look up ciphers via functions such as | 104 | It uses these tables to look up digests and ciphers via |
| 86 | .Xr EVP_get_cipherbyname 3 . | 105 | .Xr EVP_get_digestbyname 3 |
| 106 | and | ||
| 107 | .Xr EVP_get_cipherbyname 3 , | ||
| 108 | respectively. | ||
| 109 | In LibreSSL, these tables are static constants and do not require | ||
| 110 | initialization. | ||
| 87 | .Pp | 111 | .Pp |
| 88 | .Fn OpenSSL_add_all_algorithms | 112 | .Fn OpenSSL_add_all_algorithms |
| 89 | adds all algorithms to the table (digests and ciphers). | 113 | used to add all digests and ciphers to the tables. |
| 90 | If an application is compiled with the preprocessor symbol | 114 | If an application is compiled with the preprocessor symbol |
| 91 | .Dv OPENSSL_LOAD_CONF | 115 | .Dv OPENSSL_LOAD_CONF |
| 92 | #define'd, it also calls | 116 | defined, it also calls |
| 93 | .Xr OPENSSL_config 3 | 117 | .Xr OPENSSL_config 3 |
| 94 | with a | 118 | with a |
| 95 | .Dv NULL | 119 | .Dv NULL |
| 96 | argument, loading the default configuration file. | 120 | argument, loading the default configuration file. |
| 121 | Relying on this behaviour is not recommended. | ||
| 122 | If loading a configuration file is desired, call | ||
| 123 | .Xr OPENSSL_config 3 | ||
| 124 | or | ||
| 125 | .Xr CONF_modules_load_file 3 | ||
| 126 | directly. | ||
| 97 | .Pp | 127 | .Pp |
| 98 | .Fn OpenSSL_add_all_digests | 128 | .Fn OpenSSL_add_all_digests |
| 99 | adds all digest algorithms to the table. | 129 | used to add all digest algorithms to the table. |
| 100 | .Pp | 130 | .Pp |
| 101 | .Fn OpenSSL_add_all_ciphers | 131 | .Fn OpenSSL_add_all_ciphers |
| 102 | adds all encryption algorithms to the table including password based | 132 | used to add all encryption algorithms to the table. |
| 103 | encryption algorithms. | ||
| 104 | .Pp | ||
| 105 | If any of the above functions is called more than once, | ||
| 106 | only the first call has an effect. | ||
| 107 | .Pp | 133 | .Pp |
| 108 | .Fn EVP_cleanup | 134 | .Fn EVP_cleanup |
| 109 | removes all ciphers and digests from the table and also calls | 135 | has no effect; it used to remove various kinds of application-supplied |
| 110 | .Xr OBJ_NAME_cleanup 3 | 136 | data that is no longer supported in the first place. |
| 111 | with an argument of \-1 , | ||
| 112 | thus resetting the global associative array of names | ||
| 113 | and all signature algorithm definitions to their default states, | ||
| 114 | removing all application-defined types, key-value pairs, and aliases, | ||
| 115 | including any that are unrelated to the EVP library. | ||
| 116 | .Pp | 137 | .Pp |
| 117 | .Fn SSLeay_add_all_algorithms | 138 | .Fn SSLeay_add_all_algorithms |
| 118 | is a deprecated alias for | 139 | is a deprecated alias for |
| @@ -126,8 +147,6 @@ are implemented as macros. | |||
| 126 | .Xr evp 3 , | 147 | .Xr evp 3 , |
| 127 | .Xr EVP_DigestInit 3 , | 148 | .Xr EVP_DigestInit 3 , |
| 128 | .Xr EVP_EncryptInit 3 , | 149 | .Xr EVP_EncryptInit 3 , |
| 129 | .Xr OBJ_cleanup 3 , | ||
| 130 | .Xr OBJ_NAME_add 3 , | ||
| 131 | .Xr OPENSSL_config 3 | 150 | .Xr OPENSSL_config 3 |
| 132 | .Sh HISTORY | 151 | .Sh HISTORY |
| 133 | .Fn EVP_cleanup , | 152 | .Fn EVP_cleanup , |
| @@ -148,5 +167,3 @@ first appeared in OpenSSL 0.9.5 and have been available since | |||
| 148 | .Sh BUGS | 167 | .Sh BUGS |
| 149 | Although the functions do not return error codes, it is possible for them | 168 | Although the functions do not return error codes, it is possible for them |
| 150 | to fail. | 169 | to fail. |
| 151 | This will only happen as a result of a memory allocation failure so this | ||
| 152 | is not too much of a problem in practice. | ||
diff --git a/src/lib/libcrypto/man/PEM_ASN1_read.3 b/src/lib/libcrypto/man/PEM_ASN1_read.3 index 53ebe5ada4..016007d405 100644 --- a/src/lib/libcrypto/man/PEM_ASN1_read.3 +++ b/src/lib/libcrypto/man/PEM_ASN1_read.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PEM_ASN1_read.3,v 1.2 2020/07/23 17:34:53 schwarze Exp $ | 1 | .\" $OpenBSD: PEM_ASN1_read.3,v 1.4 2025/07/16 17:59:10 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: July 23 2020 $ | 17 | .Dd $Mdocdate: July 16 2025 $ |
| 18 | .Dt PEM_ASN1_READ 3 | 18 | .Dt PEM_ASN1_READ 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -23,6 +23,7 @@ | |||
| 23 | .Nm PEM_ASN1_read_bio | 23 | .Nm PEM_ASN1_read_bio |
| 24 | .Nd PEM and DER decode an arbitrary ASN.1 value | 24 | .Nd PEM and DER decode an arbitrary ASN.1 value |
| 25 | .Sh SYNOPSIS | 25 | .Sh SYNOPSIS |
| 26 | .Lb libcrypto | ||
| 26 | .In openssl/pem.h | 27 | .In openssl/pem.h |
| 27 | .Ft typedef void * | 28 | .Ft typedef void * |
| 28 | .Fo d2i_of_void | 29 | .Fo d2i_of_void |
| @@ -165,7 +166,7 @@ Additional types of errors can result from | |||
| 165 | .Xr PEM_read 3 , | 166 | .Xr PEM_read 3 , |
| 166 | .Xr PEM_read_bio_PrivateKey 3 , | 167 | .Xr PEM_read_bio_PrivateKey 3 , |
| 167 | .Xr PEM_read_SSL_SESSION 3 , | 168 | .Xr PEM_read_SSL_SESSION 3 , |
| 168 | .Xr PEM_X509_INFO_read 3 | 169 | .Xr PEM_X509_INFO_read_bio 3 |
| 169 | .Sh HISTORY | 170 | .Sh HISTORY |
| 170 | These functions first appeared in SSLeay 0.5.1 | 171 | These functions first appeared in SSLeay 0.5.1 |
| 171 | and have been available since | 172 | and have been available since |
diff --git a/src/lib/libcrypto/man/PEM_X509_INFO_read.3 b/src/lib/libcrypto/man/PEM_X509_INFO_read_bio.3 index b3216a89b6..7d34951df0 100644 --- a/src/lib/libcrypto/man/PEM_X509_INFO_read.3 +++ b/src/lib/libcrypto/man/PEM_X509_INFO_read_bio.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PEM_X509_INFO_read.3,v 1.4 2021/10/19 10:39:33 schwarze Exp $ | 1 | .\" $OpenBSD: PEM_X509_INFO_read_bio.3,v 1.1 2025/07/17 10:31:50 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,23 +14,16 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: October 19 2021 $ | 17 | .Dd $Mdocdate: July 17 2025 $ |
| 18 | .Dt PEM_X509_INFO_READ 3 | 18 | .Dt PEM_X509_INFO_READ_BIO 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm PEM_X509_INFO_read , | ||
| 22 | .Nm PEM_X509_INFO_read_bio | 21 | .Nm PEM_X509_INFO_read_bio |
| 23 | .Nd PEM and DER decode X.509 certificates, private keys, and revocation lists | 22 | .Nd PEM and DER decode X.509 certificates, private keys, and revocation lists |
| 24 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 25 | .In openssl/pem.h | 25 | .In openssl/pem.h |
| 26 | .Ft STACK_OF(X509_INFO) * | 26 | .Ft STACK_OF(X509_INFO) * |
| 27 | .Fo PEM_X509_INFO_read | ||
| 28 | .Fa "FILE *in_fp" | ||
| 29 | .Fa "STACK_OF(X509_INFO) *sk" | ||
| 30 | .Fa "pem_password_cb *cb" | ||
| 31 | .Fa "void *u" | ||
| 32 | .Fc | ||
| 33 | .Ft STACK_OF(X509_INFO) * | ||
| 34 | .Fo PEM_X509_INFO_read_bio | 27 | .Fo PEM_X509_INFO_read_bio |
| 35 | .Fa "BIO *in_bp" | 28 | .Fa "BIO *in_bp" |
| 36 | .Fa "STACK_OF(X509_INFO) *sk" | 29 | .Fa "STACK_OF(X509_INFO) *sk" |
| @@ -38,13 +31,11 @@ | |||
| 38 | .Fa "void *u" | 31 | .Fa "void *u" |
| 39 | .Fc | 32 | .Fc |
| 40 | .Sh DESCRIPTION | 33 | .Sh DESCRIPTION |
| 41 | These functions read zero or more objects | 34 | This function reads zero or more objects |
| 42 | related to X.509 certificates from | 35 | related to X.509 certificates from |
| 43 | .Fa in_fp | ||
| 44 | or | ||
| 45 | .Fa in_bp , | 36 | .Fa in_bp , |
| 46 | perform both PEM and DER decoding, | 37 | performs both PEM and DER decoding, |
| 47 | and wrap the resulting objects in newly allocated | 38 | and wraps the resulting objects in newly allocated |
| 48 | .Vt X509_INFO | 39 | .Vt X509_INFO |
| 49 | containers. | 40 | containers. |
| 50 | .Pp | 41 | .Pp |
| @@ -109,11 +100,11 @@ during the same call are deleted again and | |||
| 109 | .Fa sk | 100 | .Fa sk |
| 110 | is left unchanged. | 101 | is left unchanged. |
| 111 | .Sh RETURN VALUES | 102 | .Sh RETURN VALUES |
| 112 | These functions return a pointer to the stack | 103 | This function returns a pointer to the stack |
| 113 | the objects read were pushed onto or | 104 | the objects read were pushed onto or |
| 114 | .Dv NULL | 105 | .Dv NULL |
| 115 | if an error occurs. | 106 | if an error occurs. |
| 116 | They fail if | 107 | It fails if |
| 117 | .Xr PEM_read_bio 3 , | 108 | .Xr PEM_read_bio 3 , |
| 118 | .Xr PEM_get_EVP_CIPHER_INFO 3 , | 109 | .Xr PEM_get_EVP_CIPHER_INFO 3 , |
| 119 | .Xr PEM_do_header 3 , | 110 | .Xr PEM_do_header 3 , |
| @@ -128,9 +119,6 @@ include: | |||
| 128 | .Bl -tag -width Ds | 119 | .Bl -tag -width Ds |
| 129 | .It Dv ERR_R_ASN1_LIB Qq "ASN1 lib" | 120 | .It Dv ERR_R_ASN1_LIB Qq "ASN1 lib" |
| 130 | DER decoding of a PEM object failed. | 121 | DER decoding of a PEM object failed. |
| 131 | .It Dv ERR_R_BUF_LIB Qq BUF lib | ||
| 132 | .Fn PEM_X509_INFO_read | ||
| 133 | failed to set up a temporary BIO, for example because memory was exhausted. | ||
| 134 | .It Dv ERR_R_MALLOC_FAILURE Qq "malloc failure" | 122 | .It Dv ERR_R_MALLOC_FAILURE Qq "malloc failure" |
| 135 | .Fn PEM_X509_INFO_read_bio | 123 | .Fn PEM_X509_INFO_read_bio |
| 136 | failed to allocate a new | 124 | failed to allocate a new |
| @@ -147,7 +135,7 @@ Additional types of errors can result from | |||
| 147 | and | 135 | and |
| 148 | .Xr PEM_do_header 3 . | 136 | .Xr PEM_do_header 3 . |
| 149 | .Pp | 137 | .Pp |
| 150 | After these functions failed due to memory exhaustion, | 138 | After this function failed due to memory exhaustion, |
| 151 | .Xr ERR_get_error 3 | 139 | .Xr ERR_get_error 3 |
| 152 | may sometimes return 0 anyway. | 140 | may sometimes return 0 anyway. |
| 153 | .Sh SEE ALSO | 141 | .Sh SEE ALSO |
| @@ -162,14 +150,10 @@ may sometimes return 0 anyway. | |||
| 162 | .Xr X509_CRL_new 3 , | 150 | .Xr X509_CRL_new 3 , |
| 163 | .Xr X509_INFO_new 3 , | 151 | .Xr X509_INFO_new 3 , |
| 164 | .Xr X509_LOOKUP_new 3 , | 152 | .Xr X509_LOOKUP_new 3 , |
| 165 | .Xr X509_new 3 , | 153 | .Xr X509_new 3 |
| 166 | .Xr X509_PKEY_new 3 | ||
| 167 | .Sh HISTORY | 154 | .Sh HISTORY |
| 168 | .Fn PEM_X509_INFO_read | ||
| 169 | first appeared in SSLeay 0.5.1 and | ||
| 170 | .Fn PEM_X509_INFO_read_bio | 155 | .Fn PEM_X509_INFO_read_bio |
| 171 | in SSLeay 0.6.0. | 156 | first appeared in SSLeay 0.6.0 and has been available since |
| 172 | Both functions have been available since | ||
| 173 | .Ox 2.4 . | 157 | .Ox 2.4 . |
| 174 | .Sh CAVEATS | 158 | .Sh CAVEATS |
| 175 | It is not an error | 159 | It is not an error |
| @@ -184,6 +168,6 @@ a newly allocated, empty stack is returned. | |||
| 184 | The only way to detect this situation is by comparing | 168 | The only way to detect this situation is by comparing |
| 185 | the number of objects on the stack before and after the call. | 169 | the number of objects on the stack before and after the call. |
| 186 | .Sh BUGS | 170 | .Sh BUGS |
| 187 | When reaching the end of the input, these functions call | 171 | When reaching the end of the input, this function calls |
| 188 | .Xr ERR_clear_error 3 , | 172 | .Xr ERR_clear_error 3 , |
| 189 | which may hide errors that occurred before calling these functions. | 173 | which may hide errors that occurred before calling it. |
diff --git a/src/lib/libcrypto/man/PEM_bytes_read_bio.3 b/src/lib/libcrypto/man/PEM_bytes_read_bio.3 index 20ad6b8a4d..69cb26ce8d 100644 --- a/src/lib/libcrypto/man/PEM_bytes_read_bio.3 +++ b/src/lib/libcrypto/man/PEM_bytes_read_bio.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PEM_bytes_read_bio.3,v 1.6 2020/07/23 17:34:53 schwarze Exp $ | 1 | .\" $OpenBSD: PEM_bytes_read_bio.3,v 1.8 2025/07/16 17:59:10 schwarze Exp $ |
| 2 | .\" selective merge up to: | 2 | .\" selective merge up to: |
| 3 | .\" OpenSSL PEM_bytes_read_bio.pod 7671342e Feb 29 15:47:12 2016 -0600 | 3 | .\" OpenSSL PEM_bytes_read_bio.pod 7671342e Feb 29 15:47:12 2016 -0600 |
| 4 | .\" | 4 | .\" |
| @@ -65,13 +65,14 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: July 23 2020 $ | 68 | .Dd $Mdocdate: July 16 2025 $ |
| 69 | .Dt PEM_BYTES_READ_BIO 3 | 69 | .Dt PEM_BYTES_READ_BIO 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| 72 | .Nm PEM_bytes_read_bio | 72 | .Nm PEM_bytes_read_bio |
| 73 | .Nd read a PEM-encoded data structure from a BIO | 73 | .Nd read a PEM-encoded data structure from a BIO |
| 74 | .Sh SYNOPSIS | 74 | .Sh SYNOPSIS |
| 75 | .Lb libcrypto | ||
| 75 | .In openssl/pem.h | 76 | .In openssl/pem.h |
| 76 | .Ft int | 77 | .Ft int |
| 77 | .Fo PEM_bytes_read_bio | 78 | .Fo PEM_bytes_read_bio |
| @@ -175,7 +176,7 @@ Additional types of errors can result from | |||
| 175 | .Xr PEM_ASN1_read 3 , | 176 | .Xr PEM_ASN1_read 3 , |
| 176 | .Xr PEM_read 3 , | 177 | .Xr PEM_read 3 , |
| 177 | .Xr PEM_read_bio_PrivateKey 3 , | 178 | .Xr PEM_read_bio_PrivateKey 3 , |
| 178 | .Xr PEM_X509_INFO_read 3 | 179 | .Xr PEM_X509_INFO_read_bio 3 |
| 179 | .Sh STANDARDS | 180 | .Sh STANDARDS |
| 180 | RFC 1421: Privacy Enhancement for Internet Electronic Mail (PEM), Part I | 181 | RFC 1421: Privacy Enhancement for Internet Electronic Mail (PEM), Part I |
| 181 | .Sh HISTORY | 182 | .Sh HISTORY |
diff --git a/src/lib/libcrypto/man/PEM_read.3 b/src/lib/libcrypto/man/PEM_read.3 index 1493d54fc4..de93b3e903 100644 --- a/src/lib/libcrypto/man/PEM_read.3 +++ b/src/lib/libcrypto/man/PEM_read.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PEM_read.3,v 1.15 2023/09/18 15:26:46 schwarze Exp $ | 1 | .\" $OpenBSD: PEM_read.3,v 1.17 2025/07/16 17:59:10 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 | 2 | .\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: September 18 2023 $ | 69 | .Dd $Mdocdate: July 16 2025 $ |
| 70 | .Dt PEM_READ 3 | 70 | .Dt PEM_READ 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -80,6 +80,7 @@ | |||
| 80 | .Nm pem_password_cb | 80 | .Nm pem_password_cb |
| 81 | .Nd PEM encoding routines | 81 | .Nd PEM encoding routines |
| 82 | .Sh SYNOPSIS | 82 | .Sh SYNOPSIS |
| 83 | .Lb libcrypto | ||
| 83 | .In openssl/pem.h | 84 | .In openssl/pem.h |
| 84 | .Ft int | 85 | .Ft int |
| 85 | .Fo PEM_write | 86 | .Fo PEM_write |
| @@ -395,7 +396,7 @@ to fail may differ. | |||
| 395 | .Xr PEM_read_SSL_SESSION 3 , | 396 | .Xr PEM_read_SSL_SESSION 3 , |
| 396 | .Xr PEM_write_bio_CMS_stream 3 , | 397 | .Xr PEM_write_bio_CMS_stream 3 , |
| 397 | .Xr PEM_write_bio_PKCS7_stream 3 , | 398 | .Xr PEM_write_bio_PKCS7_stream 3 , |
| 398 | .Xr PEM_X509_INFO_read 3 | 399 | .Xr PEM_X509_INFO_read_bio 3 |
| 399 | .Sh HISTORY | 400 | .Sh HISTORY |
| 400 | .Fn PEM_write , | 401 | .Fn PEM_write , |
| 401 | .Fn PEM_read , | 402 | .Fn PEM_read , |
diff --git a/src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3 b/src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3 index 9f45261725..9ef136de7e 100644 --- a/src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3 +++ b/src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PEM_read_bio_PrivateKey.3,v 1.23 2024/09/02 08:04:32 tb Exp $ | 1 | .\" $OpenBSD: PEM_read_bio_PrivateKey.3,v 1.25 2025/07/16 17:59:10 schwarze Exp $ |
| 2 | .\" full merge up to: | 2 | .\" full merge up to: |
| 3 | .\" OpenSSL man3/PEM_read_bio_PrivateKey.pod 18bad535 Apr 9 15:13:55 2019 +0100 | 3 | .\" OpenSSL man3/PEM_read_bio_PrivateKey.pod 18bad535 Apr 9 15:13:55 2019 +0100 |
| 4 | .\" OpenSSL man3/PEM_read_CMS.pod 83cf7abf May 29 13:07:08 2018 +0100 | 4 | .\" OpenSSL man3/PEM_read_CMS.pod 83cf7abf May 29 13:07:08 2018 +0100 |
| @@ -51,7 +51,7 @@ | |||
| 51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 53 | .\" | 53 | .\" |
| 54 | .Dd $Mdocdate: September 2 2024 $ | 54 | .Dd $Mdocdate: July 16 2025 $ |
| 55 | .Dt PEM_READ_BIO_PRIVATEKEY 3 | 55 | .Dt PEM_READ_BIO_PRIVATEKEY 3 |
| 56 | .Os | 56 | .Os |
| 57 | .Sh NAME | 57 | .Sh NAME |
| @@ -143,6 +143,7 @@ | |||
| 143 | .Nm PEM_write_bio_CMS | 143 | .Nm PEM_write_bio_CMS |
| 144 | .Nd PEM routines | 144 | .Nd PEM routines |
| 145 | .Sh SYNOPSIS | 145 | .Sh SYNOPSIS |
| 146 | .Lb libcrypto | ||
| 146 | .In openssl/pem.h | 147 | .In openssl/pem.h |
| 147 | .Ft EVP_PKEY * | 148 | .Ft EVP_PKEY * |
| 148 | .Fo PEM_read_bio_PrivateKey | 149 | .Fo PEM_read_bio_PrivateKey |
| @@ -1183,7 +1184,7 @@ pass_cb(char *buf, int size, int rwflag, void *u) | |||
| 1183 | .Xr PEM_read_SSL_SESSION 3 , | 1184 | .Xr PEM_read_SSL_SESSION 3 , |
| 1184 | .Xr PEM_write_bio_CMS_stream 3 , | 1185 | .Xr PEM_write_bio_CMS_stream 3 , |
| 1185 | .Xr PEM_write_bio_PKCS7_stream 3 , | 1186 | .Xr PEM_write_bio_PKCS7_stream 3 , |
| 1186 | .Xr PEM_X509_INFO_read 3 , | 1187 | .Xr PEM_X509_INFO_read_bio 3 , |
| 1187 | .Xr RSA_new 3 , | 1188 | .Xr RSA_new 3 , |
| 1188 | .Xr X509_CRL_new 3 , | 1189 | .Xr X509_CRL_new 3 , |
| 1189 | .Xr X509_REQ_new 3 , | 1190 | .Xr X509_REQ_new 3 , |
diff --git a/src/lib/libcrypto/man/PEM_write_bio_CMS_stream.3 b/src/lib/libcrypto/man/PEM_write_bio_CMS_stream.3 index 88adbba74f..a858874bab 100644 --- a/src/lib/libcrypto/man/PEM_write_bio_CMS_stream.3 +++ b/src/lib/libcrypto/man/PEM_write_bio_CMS_stream.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PEM_write_bio_CMS_stream.3,v 1.6 2023/05/01 07:28:11 tb Exp $ | 1 | .\" $OpenBSD: PEM_write_bio_CMS_stream.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 | 2 | .\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: May 1 2023 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt PEM_WRITE_BIO_CMS_STREAM 3 | 52 | .Dt PEM_WRITE_BIO_CMS_STREAM 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm PEM_write_bio_CMS_stream | 55 | .Nm PEM_write_bio_CMS_stream |
| 56 | .Nd output CMS_ContentInfo structure in PEM format | 56 | .Nd output CMS_ContentInfo structure in PEM format |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/cms.h | 59 | .In openssl/cms.h |
| 59 | .Ft int | 60 | .Ft int |
| 60 | .Fo PEM_write_bio_CMS_stream | 61 | .Fo PEM_write_bio_CMS_stream |
diff --git a/src/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3 b/src/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3 index 9050b8562f..a731767049 100644 --- a/src/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3 +++ b/src/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PEM_write_bio_PKCS7_stream.3,v 1.12 2023/05/01 07:28:11 tb Exp $ | 1 | .\" $OpenBSD: PEM_write_bio_PKCS7_stream.3,v 1.13 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 | 2 | .\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: May 1 2023 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt PEM_WRITE_BIO_PKCS7_STREAM 3 | 52 | .Dt PEM_WRITE_BIO_PKCS7_STREAM 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm PEM_write_bio_PKCS7_stream | 55 | .Nm PEM_write_bio_PKCS7_stream |
| 56 | .Nd output PKCS7 structure in PEM format | 56 | .Nd output PKCS7 structure in PEM format |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/pkcs7.h | 59 | .In openssl/pkcs7.h |
| 59 | .Ft int | 60 | .Ft int |
| 60 | .Fo PEM_write_bio_PKCS7_stream | 61 | .Fo PEM_write_bio_PKCS7_stream |
diff --git a/src/lib/libcrypto/man/PKCS12_SAFEBAG_new.3 b/src/lib/libcrypto/man/PKCS12_SAFEBAG_new.3 index e7d20ea7f6..45bdc20bc9 100644 --- a/src/lib/libcrypto/man/PKCS12_SAFEBAG_new.3 +++ b/src/lib/libcrypto/man/PKCS12_SAFEBAG_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS12_SAFEBAG_new.3,v 1.4 2019/06/06 01:06:58 schwarze Exp $ | 1 | .\" $OpenBSD: PKCS12_SAFEBAG_new.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: June 6 2019 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt PKCS12_SAFEBAG_NEW 3 | 18 | .Dt PKCS12_SAFEBAG_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -24,6 +24,7 @@ | |||
| 24 | .Nm PKCS12_BAGS_free | 24 | .Nm PKCS12_BAGS_free |
| 25 | .Nd PKCS#12 container for one piece of information | 25 | .Nd PKCS#12 container for one piece of information |
| 26 | .Sh SYNOPSIS | 26 | .Sh SYNOPSIS |
| 27 | .Lb libcrypto | ||
| 27 | .In openssl/pkcs12.h | 28 | .In openssl/pkcs12.h |
| 28 | .Ft PKCS12_SAFEBAG * | 29 | .Ft PKCS12_SAFEBAG * |
| 29 | .Fn PKCS12_SAFEBAG_new void | 30 | .Fn PKCS12_SAFEBAG_new void |
diff --git a/src/lib/libcrypto/man/PKCS12_create.3 b/src/lib/libcrypto/man/PKCS12_create.3 index 904166da73..80471ca88a 100644 --- a/src/lib/libcrypto/man/PKCS12_create.3 +++ b/src/lib/libcrypto/man/PKCS12_create.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS12_create.3,v 1.13 2024/08/22 12:26:01 tb Exp $ | 1 | .\" $OpenBSD: PKCS12_create.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 05ea606a May 20 20:52:46 2016 -0400 | 2 | .\" full merge up to: OpenSSL 05ea606a May 20 20:52:46 2016 -0400 |
| 3 | .\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 | 3 | .\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 |
| 4 | .\" | 4 | .\" |
| @@ -49,13 +49,14 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: August 22 2024 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt PKCS12_CREATE 3 | 53 | .Dt PKCS12_CREATE 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| 56 | .Nm PKCS12_create | 56 | .Nm PKCS12_create |
| 57 | .Nd create a PKCS#12 structure | 57 | .Nd create a PKCS#12 structure |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 59 | .In openssl/pkcs12.h | 60 | .In openssl/pkcs12.h |
| 60 | .Ft PKCS12 * | 61 | .Ft PKCS12 * |
| 61 | .Fo PKCS12_create | 62 | .Fo PKCS12_create |
diff --git a/src/lib/libcrypto/man/PKCS12_new.3 b/src/lib/libcrypto/man/PKCS12_new.3 index c7ccdb4911..1506eaade3 100644 --- a/src/lib/libcrypto/man/PKCS12_new.3 +++ b/src/lib/libcrypto/man/PKCS12_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS12_new.3,v 1.4 2019/06/06 01:06:58 schwarze Exp $ | 1 | .\" $OpenBSD: PKCS12_new.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: June 6 2019 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt PKCS12_NEW 3 | 18 | .Dt PKCS12_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -24,6 +24,7 @@ | |||
| 24 | .Nm PKCS12_MAC_DATA_free | 24 | .Nm PKCS12_MAC_DATA_free |
| 25 | .Nd PKCS#12 personal information exchange (PFX) | 25 | .Nd PKCS#12 personal information exchange (PFX) |
| 26 | .Sh SYNOPSIS | 26 | .Sh SYNOPSIS |
| 27 | .Lb libcrypto | ||
| 27 | .In openssl/pkcs12.h | 28 | .In openssl/pkcs12.h |
| 28 | .Ft PKCS12 * | 29 | .Ft PKCS12 * |
| 29 | .Fn PKCS12_new void | 30 | .Fn PKCS12_new void |
diff --git a/src/lib/libcrypto/man/PKCS12_newpass.3 b/src/lib/libcrypto/man/PKCS12_newpass.3 index b5642c96ea..b4d088e0e8 100644 --- a/src/lib/libcrypto/man/PKCS12_newpass.3 +++ b/src/lib/libcrypto/man/PKCS12_newpass.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS12_newpass.3,v 1.4 2019/06/14 13:59:32 schwarze Exp $ | 1 | .\" $OpenBSD: PKCS12_newpass.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL c95a8b4e May 5 14:26:26 2016 +0100 | 2 | .\" OpenSSL c95a8b4e May 5 14:26:26 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Jeffrey Walton <noloader@gmail.com>. | 4 | .\" This file was written by Jeffrey Walton <noloader@gmail.com>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 14 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt PKCS12_NEWPASS 3 | 52 | .Dt PKCS12_NEWPASS 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm PKCS12_newpass | 55 | .Nm PKCS12_newpass |
| 56 | .Nd change the password of a PKCS#12 structure | 56 | .Nd change the password of a PKCS#12 structure |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/pkcs12.h | 59 | .In openssl/pkcs12.h |
| 59 | .Ft int | 60 | .Ft int |
| 60 | .Fo PKCS12_newpass | 61 | .Fo PKCS12_newpass |
diff --git a/src/lib/libcrypto/man/PKCS12_parse.3 b/src/lib/libcrypto/man/PKCS12_parse.3 index 4e92d303c7..333d86b672 100644 --- a/src/lib/libcrypto/man/PKCS12_parse.3 +++ b/src/lib/libcrypto/man/PKCS12_parse.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS12_parse.3,v 1.7 2021/07/09 12:07:27 schwarze Exp $ | 1 | .\" $OpenBSD: PKCS12_parse.3,v 1.8 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: July 9 2021 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt PKCS12_PARSE 3 | 52 | .Dt PKCS12_PARSE 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm PKCS12_parse | 55 | .Nm PKCS12_parse |
| 56 | .Nd parse a PKCS#12 structure | 56 | .Nd parse a PKCS#12 structure |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/pkcs12.h | 59 | .In openssl/pkcs12.h |
| 59 | .Ft int | 60 | .Ft int |
| 60 | .Fo PKCS12_parse | 61 | .Fo PKCS12_parse |
diff --git a/src/lib/libcrypto/man/PKCS5_PBKDF2_HMAC.3 b/src/lib/libcrypto/man/PKCS5_PBKDF2_HMAC.3 index 3a448b92a7..7c113029ee 100644 --- a/src/lib/libcrypto/man/PKCS5_PBKDF2_HMAC.3 +++ b/src/lib/libcrypto/man/PKCS5_PBKDF2_HMAC.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS5_PBKDF2_HMAC.3,v 1.9 2019/06/07 20:46:25 schwarze Exp $ | 1 | .\" $OpenBSD: PKCS5_PBKDF2_HMAC.3,v 1.10 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Jeffrey Walton <noloader@gmail.com>. | 4 | .\" This file was written by Jeffrey Walton <noloader@gmail.com>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 7 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt PKCS5_PBKDF2_HMAC 3 | 52 | .Dt PKCS5_PBKDF2_HMAC 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm PKCS5_PBKDF2_HMAC_SHA1 | 56 | .Nm PKCS5_PBKDF2_HMAC_SHA1 |
| 57 | .Nd password based derivation routines with salt and iteration count | 57 | .Nd password based derivation routines with salt and iteration count |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 59 | .In openssl/evp.h | 60 | .In openssl/evp.h |
| 60 | .Ft int | 61 | .Ft int |
| 61 | .Fo PKCS5_PBKDF2_HMAC | 62 | .Fo PKCS5_PBKDF2_HMAC |
diff --git a/src/lib/libcrypto/man/PKCS7_add_attribute.3 b/src/lib/libcrypto/man/PKCS7_add_attribute.3 index 4a1c350f98..e7c8c734c4 100644 --- a/src/lib/libcrypto/man/PKCS7_add_attribute.3 +++ b/src/lib/libcrypto/man/PKCS7_add_attribute.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS7_add_attribute.3,v 1.3 2020/06/10 11:39:12 schwarze Exp $ | 1 | .\" $OpenBSD: PKCS7_add_attribute.3,v 1.6 2025/07/27 19:31:20 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: June 10 2020 $ | 17 | .Dd $Mdocdate: July 27 2025 $ |
| 18 | .Dt PKCS7_ADD_ATTRIBUTE 3 | 18 | .Dt PKCS7_ADD_ATTRIBUTE 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -30,6 +30,7 @@ | |||
| 30 | .Nm PKCS7_add_attrib_smimecap | 30 | .Nm PKCS7_add_attrib_smimecap |
| 31 | .Nd attributes of SignerInfo objects | 31 | .Nd attributes of SignerInfo objects |
| 32 | .Sh SYNOPSIS | 32 | .Sh SYNOPSIS |
| 33 | .Lb libcrypto | ||
| 33 | .In openssl/pkcs7.h | 34 | .In openssl/pkcs7.h |
| 34 | .Ft int | 35 | .Ft int |
| 35 | .Fo PKCS7_add_attribute | 36 | .Fo PKCS7_add_attribute |
| @@ -306,6 +307,10 @@ RFC 2985: PKCS #9: Selected Object Classes and Attribute Types Version 2.0, | |||
| 306 | section 5.3: Attribute types for use in PKCS #7 data | 307 | section 5.3: Attribute types for use in PKCS #7 data |
| 307 | and section 5.6: Attributes defined in S/MIME | 308 | and section 5.6: Attributes defined in S/MIME |
| 308 | .Pp | 309 | .Pp |
| 310 | RFC 5652: Cryptographic Message Syntax (CMS), | ||
| 311 | section 5.3: SignerInfo Type | ||
| 312 | and section 11: Useful Attributes | ||
| 313 | .Pp | ||
| 309 | RFC 8551: Secure/Multipurpose Internet Mail Extensions (S/MIME) | 314 | RFC 8551: Secure/Multipurpose Internet Mail Extensions (S/MIME) |
| 310 | Version 4.0 Message Specification, | 315 | Version 4.0 Message Specification, |
| 311 | section 2.5.2: SMIMECapabilities Attribute | 316 | section 2.5.2: SMIMECapabilities Attribute |
| @@ -345,7 +350,7 @@ in a state that violates the standard. | |||
| 345 | .Fn PKCS7_add0_attrib_signing_time | 350 | .Fn PKCS7_add0_attrib_signing_time |
| 346 | does not validate | 351 | does not validate |
| 347 | .Fa t | 352 | .Fa t |
| 348 | in any way. | 353 | beyond checking that it is well-formed per RFC 5652, section 11.3. |
| 349 | In particular, it may set the signing time to the future | 354 | In particular, it may set the signing time to the future |
| 350 | or to the remote past. | 355 | or to the remote past. |
| 351 | .Sh BUGS | 356 | .Sh BUGS |
diff --git a/src/lib/libcrypto/man/PKCS7_dataFinal.3 b/src/lib/libcrypto/man/PKCS7_dataFinal.3 index 1a01b2ff61..fdc9da7f9e 100644 --- a/src/lib/libcrypto/man/PKCS7_dataFinal.3 +++ b/src/lib/libcrypto/man/PKCS7_dataFinal.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS7_dataFinal.3,v 1.3 2022/12/26 07:18:52 jmc Exp $ | 1 | .\" $OpenBSD: PKCS7_dataFinal.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 26 2022 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt PKCS7_DATAFINAL 3 | 18 | .Dt PKCS7_DATAFINAL 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm PKCS7_dataFinal | 21 | .Nm PKCS7_dataFinal |
| 22 | .Nd move data from a BIO chain to a ContentInfo object | 22 | .Nd move data from a BIO chain to a ContentInfo object |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/pkcs7.h | 25 | .In openssl/pkcs7.h |
| 25 | .Ft int | 26 | .Ft int |
| 26 | .Fo PKCS7_dataFinal | 27 | .Fo PKCS7_dataFinal |
diff --git a/src/lib/libcrypto/man/PKCS7_dataInit.3 b/src/lib/libcrypto/man/PKCS7_dataInit.3 index cb54d3f95c..320a227454 100644 --- a/src/lib/libcrypto/man/PKCS7_dataInit.3 +++ b/src/lib/libcrypto/man/PKCS7_dataInit.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS7_dataInit.3,v 1.2 2020/06/03 13:41:27 schwarze Exp $ | 1 | .\" $OpenBSD: PKCS7_dataInit.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: June 3 2020 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt PKCS7_DATAINIT 3 | 18 | .Dt PKCS7_DATAINIT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm PKCS7_dataInit | 21 | .Nm PKCS7_dataInit |
| 22 | .Nd construct a BIO chain for adding or retrieving content | 22 | .Nd construct a BIO chain for adding or retrieving content |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/pkcs7.h | 25 | .In openssl/pkcs7.h |
| 25 | .Ft BIO * | 26 | .Ft BIO * |
| 26 | .Fo PKCS7_dataInit | 27 | .Fo PKCS7_dataInit |
diff --git a/src/lib/libcrypto/man/PKCS7_decrypt.3 b/src/lib/libcrypto/man/PKCS7_decrypt.3 index 8d00499b57..857777bcd6 100644 --- a/src/lib/libcrypto/man/PKCS7_decrypt.3 +++ b/src/lib/libcrypto/man/PKCS7_decrypt.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS7_decrypt.3,v 1.10 2019/06/10 14:58:48 schwarze Exp $ | 1 | .\" $OpenBSD: PKCS7_decrypt.3,v 1.11 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 10 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt PKCS7_DECRYPT 3 | 52 | .Dt PKCS7_DECRYPT 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm PKCS7_decrypt | 55 | .Nm PKCS7_decrypt |
| 56 | .Nd decrypt content from a PKCS#7 envelopedData structure | 56 | .Nd decrypt content from a PKCS#7 envelopedData structure |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/pkcs7.h | 59 | .In openssl/pkcs7.h |
| 59 | .Ft int | 60 | .Ft int |
| 60 | .Fo PKCS7_decrypt | 61 | .Fo PKCS7_decrypt |
diff --git a/src/lib/libcrypto/man/PKCS7_encrypt.3 b/src/lib/libcrypto/man/PKCS7_encrypt.3 index 700498a1de..3e7283839d 100644 --- a/src/lib/libcrypto/man/PKCS7_encrypt.3 +++ b/src/lib/libcrypto/man/PKCS7_encrypt.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS7_encrypt.3,v 1.11 2020/06/03 13:41:27 schwarze Exp $ | 1 | .\" $OpenBSD: PKCS7_encrypt.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 | 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -49,13 +49,14 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: June 3 2020 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt PKCS7_ENCRYPT 3 | 53 | .Dt PKCS7_ENCRYPT 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| 56 | .Nm PKCS7_encrypt | 56 | .Nm PKCS7_encrypt |
| 57 | .Nd create a PKCS#7 envelopedData structure | 57 | .Nd create a PKCS#7 envelopedData structure |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 59 | .In openssl/pkcs7.h | 60 | .In openssl/pkcs7.h |
| 60 | .Ft PKCS7 * | 61 | .Ft PKCS7 * |
| 61 | .Fo PKCS7_encrypt | 62 | .Fo PKCS7_encrypt |
diff --git a/src/lib/libcrypto/man/PKCS7_final.3 b/src/lib/libcrypto/man/PKCS7_final.3 index 775b84d984..5c2063b1bd 100644 --- a/src/lib/libcrypto/man/PKCS7_final.3 +++ b/src/lib/libcrypto/man/PKCS7_final.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS7_final.3,v 1.3 2022/12/26 07:18:52 jmc Exp $ | 1 | .\" $OpenBSD: PKCS7_final.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 26 2022 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt PKCS7_FINAL 3 | 18 | .Dt PKCS7_FINAL 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm PKCS7_final | 21 | .Nm PKCS7_final |
| 22 | .Nd read data from a BIO into a ContentInfo object | 22 | .Nd read data from a BIO into a ContentInfo object |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/pkcs7.h | 25 | .In openssl/pkcs7.h |
| 25 | .Ft int | 26 | .Ft int |
| 26 | .Fo PKCS7_final | 27 | .Fo PKCS7_final |
diff --git a/src/lib/libcrypto/man/PKCS7_get_signer_info.3 b/src/lib/libcrypto/man/PKCS7_get_signer_info.3 index 280f373ead..9edf4c63de 100644 --- a/src/lib/libcrypto/man/PKCS7_get_signer_info.3 +++ b/src/lib/libcrypto/man/PKCS7_get_signer_info.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS7_get_signer_info.3,v 1.1 2020/06/10 11:43:08 schwarze Exp $ | 1 | .\" $OpenBSD: PKCS7_get_signer_info.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: June 10 2020 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt PKCS7_GET_SIGNER_INFO 3 | 18 | .Dt PKCS7_GET_SIGNER_INFO 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm PKCS7_get_signer_info | 21 | .Nm PKCS7_get_signer_info |
| 22 | .Nd retrieve signerInfos from a SignedData object | 22 | .Nd retrieve signerInfos from a SignedData object |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/pkcs7.h | 25 | .In openssl/pkcs7.h |
| 25 | .Ft STACK_OF(PKCS7_SIGNER_INFO) * | 26 | .Ft STACK_OF(PKCS7_SIGNER_INFO) * |
| 26 | .Fn PKCS7_get_signer_info "PKCS7 *p7" | 27 | .Fn PKCS7_get_signer_info "PKCS7 *p7" |
diff --git a/src/lib/libcrypto/man/PKCS7_new.3 b/src/lib/libcrypto/man/PKCS7_new.3 index 151261a312..19f6f1ac81 100644 --- a/src/lib/libcrypto/man/PKCS7_new.3 +++ b/src/lib/libcrypto/man/PKCS7_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS7_new.3,v 1.12 2020/06/10 11:43:08 schwarze Exp $ | 1 | .\" $OpenBSD: PKCS7_new.3,v 1.13 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: June 10 2020 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt PKCS7_NEW 3 | 18 | .Dt PKCS7_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -40,6 +40,7 @@ | |||
| 40 | .Nm PKCS7_ISSUER_AND_SERIAL_free | 40 | .Nm PKCS7_ISSUER_AND_SERIAL_free |
| 41 | .Nd PKCS#7 data structures | 41 | .Nd PKCS#7 data structures |
| 42 | .Sh SYNOPSIS | 42 | .Sh SYNOPSIS |
| 43 | .Lb libcrypto | ||
| 43 | .In openssl/pkcs7.h | 44 | .In openssl/pkcs7.h |
| 44 | .Ft PKCS7 * | 45 | .Ft PKCS7 * |
| 45 | .Fn PKCS7_new void | 46 | .Fn PKCS7_new void |
diff --git a/src/lib/libcrypto/man/PKCS7_set_content.3 b/src/lib/libcrypto/man/PKCS7_set_content.3 index fa057341d5..bf0eb76786 100644 --- a/src/lib/libcrypto/man/PKCS7_set_content.3 +++ b/src/lib/libcrypto/man/PKCS7_set_content.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS7_set_content.3,v 1.2 2020/05/24 12:37:30 schwarze Exp $ | 1 | .\" $OpenBSD: PKCS7_set_content.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: May 24 2020 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt PKCS7_SET_CONTENT 3 | 18 | .Dt PKCS7_SET_CONTENT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm PKCS7_content_new | 22 | .Nm PKCS7_content_new |
| 23 | .Nd set the nested contentInfo in a PKCS#7 structure | 23 | .Nd set the nested contentInfo in a PKCS#7 structure |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/pkcs7.h | 26 | .In openssl/pkcs7.h |
| 26 | .Ft int | 27 | .Ft int |
| 27 | .Fo PKCS7_set_content | 28 | .Fo PKCS7_set_content |
diff --git a/src/lib/libcrypto/man/PKCS7_set_type.3 b/src/lib/libcrypto/man/PKCS7_set_type.3 index f414b128a2..23eefff972 100644 --- a/src/lib/libcrypto/man/PKCS7_set_type.3 +++ b/src/lib/libcrypto/man/PKCS7_set_type.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS7_set_type.3,v 1.2 2020/05/20 11:40:26 schwarze Exp $ | 1 | .\" $OpenBSD: PKCS7_set_type.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: May 20 2020 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt PKCS7_SET_TYPE 3 | 18 | .Dt PKCS7_SET_TYPE 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm PKCS7_set0_type_other | 22 | .Nm PKCS7_set0_type_other |
| 23 | .Nd initialize type of PKCS#7 ContentInfo | 23 | .Nd initialize type of PKCS#7 ContentInfo |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/pkcs7.h | 26 | .In openssl/pkcs7.h |
| 26 | .Ft int | 27 | .Ft int |
| 27 | .Fo PKCS7_set_type | 28 | .Fo PKCS7_set_type |
diff --git a/src/lib/libcrypto/man/PKCS7_sign.3 b/src/lib/libcrypto/man/PKCS7_sign.3 index 37257e60fd..174b385196 100644 --- a/src/lib/libcrypto/man/PKCS7_sign.3 +++ b/src/lib/libcrypto/man/PKCS7_sign.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS7_sign.3,v 1.13 2020/06/10 11:43:08 schwarze Exp $ | 1 | .\" $OpenBSD: PKCS7_sign.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 | 2 | .\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -49,13 +49,14 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: June 10 2020 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt PKCS7_SIGN 3 | 53 | .Dt PKCS7_SIGN 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| 56 | .Nm PKCS7_sign | 56 | .Nm PKCS7_sign |
| 57 | .Nd create a PKCS#7 signedData structure | 57 | .Nd create a PKCS#7 signedData structure |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 59 | .In openssl/pkcs7.h | 60 | .In openssl/pkcs7.h |
| 60 | .Ft PKCS7 * | 61 | .Ft PKCS7 * |
| 61 | .Fo PKCS7_sign | 62 | .Fo PKCS7_sign |
diff --git a/src/lib/libcrypto/man/PKCS7_sign_add_signer.3 b/src/lib/libcrypto/man/PKCS7_sign_add_signer.3 index 195d6388c9..4b88ff72bd 100644 --- a/src/lib/libcrypto/man/PKCS7_sign_add_signer.3 +++ b/src/lib/libcrypto/man/PKCS7_sign_add_signer.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS7_sign_add_signer.3,v 1.13 2020/06/10 11:43:08 schwarze Exp $ | 1 | .\" $OpenBSD: PKCS7_sign_add_signer.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 | 2 | .\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -49,13 +49,14 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: June 10 2020 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt PKCS7_SIGN_ADD_SIGNER 3 | 53 | .Dt PKCS7_SIGN_ADD_SIGNER 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| 56 | .Nm PKCS7_sign_add_signer | 56 | .Nm PKCS7_sign_add_signer |
| 57 | .Nd add a signer to a SignedData structure | 57 | .Nd add a signer to a SignedData structure |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 59 | .In openssl/pkcs7.h | 60 | .In openssl/pkcs7.h |
| 60 | .Ft PKCS7_SIGNER_INFO * | 61 | .Ft PKCS7_SIGNER_INFO * |
| 61 | .Fo PKCS7_sign_add_signer | 62 | .Fo PKCS7_sign_add_signer |
diff --git a/src/lib/libcrypto/man/PKCS7_verify.3 b/src/lib/libcrypto/man/PKCS7_verify.3 index d091c03dfd..53b32f738a 100644 --- a/src/lib/libcrypto/man/PKCS7_verify.3 +++ b/src/lib/libcrypto/man/PKCS7_verify.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS7_verify.3,v 1.11 2022/03/31 17:27:17 naddy Exp $ | 1 | .\" $OpenBSD: PKCS7_verify.3,v 1.13 2025/12/20 07:22:43 tb Exp $ |
| 2 | .\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 | 2 | .\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 31 2022 $ | 51 | .Dd $Mdocdate: December 20 2025 $ |
| 52 | .Dt PKCS7_VERIFY 3 | 52 | .Dt PKCS7_VERIFY 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm PKCS7_get0_signers | 56 | .Nm PKCS7_get0_signers |
| 57 | .Nd verify a PKCS#7 signedData structure | 57 | .Nd verify a PKCS#7 signedData structure |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 59 | .In openssl/pkcs7.h | 60 | .In openssl/pkcs7.h |
| 60 | .Ft int | 61 | .Ft int |
| 61 | .Fo PKCS7_verify | 62 | .Fo PKCS7_verify |
| @@ -124,6 +125,15 @@ is detached, | |||
| 124 | .Fa indata | 125 | .Fa indata |
| 125 | cannot be | 126 | cannot be |
| 126 | .Dv NULL . | 127 | .Dv NULL . |
| 128 | If the content is not detached and | ||
| 129 | .Fa indata | ||
| 130 | is not | ||
| 131 | .Fa NULL , | ||
| 132 | then the structure has both embedded and external content. | ||
| 133 | To treat this as an error, use the flag | ||
| 134 | .Dv PKCS7_NO_DUAL_CONTENT . | ||
| 135 | The default behavior allows this, for compatibility with other | ||
| 136 | implementations. | ||
| 127 | .Pp | 137 | .Pp |
| 128 | An attempt is made to locate all the signer's certificates, first | 138 | An attempt is made to locate all the signer's certificates, first |
| 129 | looking in the | 139 | looking in the |
diff --git a/src/lib/libcrypto/man/PKCS8_PRIV_KEY_INFO_new.3 b/src/lib/libcrypto/man/PKCS8_PRIV_KEY_INFO_new.3 index 822968f58d..55eb464a33 100644 --- a/src/lib/libcrypto/man/PKCS8_PRIV_KEY_INFO_new.3 +++ b/src/lib/libcrypto/man/PKCS8_PRIV_KEY_INFO_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS8_PRIV_KEY_INFO_new.3,v 1.7 2024/12/06 12:51:13 schwarze Exp $ | 1 | .\" $OpenBSD: PKCS8_PRIV_KEY_INFO_new.3,v 1.8 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 6 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt PKCS8_PRIV_KEY_INFO_NEW 3 | 18 | .Dt PKCS8_PRIV_KEY_INFO_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm PKCS8_PRIV_KEY_INFO_free | 22 | .Nm PKCS8_PRIV_KEY_INFO_free |
| 23 | .Nd PKCS#8 private key information | 23 | .Nd PKCS#8 private key information |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/x509.h | 26 | .In openssl/x509.h |
| 26 | .Ft PKCS8_PRIV_KEY_INFO * | 27 | .Ft PKCS8_PRIV_KEY_INFO * |
| 27 | .Fn PKCS8_PRIV_KEY_INFO_new void | 28 | .Fn PKCS8_PRIV_KEY_INFO_new void |
diff --git a/src/lib/libcrypto/man/PKCS8_pkey_set0.3 b/src/lib/libcrypto/man/PKCS8_pkey_set0.3 index f3d5a294c3..a8a160d544 100644 --- a/src/lib/libcrypto/man/PKCS8_pkey_set0.3 +++ b/src/lib/libcrypto/man/PKCS8_pkey_set0.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS8_pkey_set0.3,v 1.3 2024/09/02 07:45:09 tb Exp $ | 1 | .\" $OpenBSD: PKCS8_pkey_set0.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: September 2 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt PKCS8_PKEY_SET0 3 | 18 | .Dt PKCS8_PKEY_SET0 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -24,6 +24,7 @@ | |||
| 24 | .Nm PKCS8_pkey_get0_attrs | 24 | .Nm PKCS8_pkey_get0_attrs |
| 25 | .Nd change and inspect PKCS#8 PrivateKeyInfo objects | 25 | .Nd change and inspect PKCS#8 PrivateKeyInfo objects |
| 26 | .Sh SYNOPSIS | 26 | .Sh SYNOPSIS |
| 27 | .Lb libcrypto | ||
| 27 | .In openssl/x509.h | 28 | .In openssl/x509.h |
| 28 | .Ft int | 29 | .Ft int |
| 29 | .Fo PKCS8_pkey_set0 | 30 | .Fo PKCS8_pkey_set0 |
diff --git a/src/lib/libcrypto/man/PKEY_USAGE_PERIOD_new.3 b/src/lib/libcrypto/man/PKEY_USAGE_PERIOD_new.3 index 40735c6f86..2d4f010bce 100644 --- a/src/lib/libcrypto/man/PKEY_USAGE_PERIOD_new.3 +++ b/src/lib/libcrypto/man/PKEY_USAGE_PERIOD_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKEY_USAGE_PERIOD_new.3,v 1.5 2019/06/06 01:06:59 schwarze Exp $ | 1 | .\" $OpenBSD: PKEY_USAGE_PERIOD_new.3,v 1.6 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: June 6 2019 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt PKEY_USAGE_PERIOD_NEW 3 | 18 | .Dt PKEY_USAGE_PERIOD_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm PKEY_USAGE_PERIOD_free | 22 | .Nm PKEY_USAGE_PERIOD_free |
| 23 | .Nd X.509 certificate private key usage period extension | 23 | .Nd X.509 certificate private key usage period extension |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/x509v3.h | 26 | .In openssl/x509v3.h |
| 26 | .Ft PKEY_USAGE_PERIOD * | 27 | .Ft PKEY_USAGE_PERIOD * |
| 27 | .Fn PKEY_USAGE_PERIOD_new void | 28 | .Fn PKEY_USAGE_PERIOD_new void |
diff --git a/src/lib/libcrypto/man/POLICYINFO_new.3 b/src/lib/libcrypto/man/POLICYINFO_new.3 index 52c004414e..aad2ad3ce5 100644 --- a/src/lib/libcrypto/man/POLICYINFO_new.3 +++ b/src/lib/libcrypto/man/POLICYINFO_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: POLICYINFO_new.3,v 1.11 2023/05/14 08:03:57 tb Exp $ | 1 | .\" $OpenBSD: POLICYINFO_new.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: May 14 2023 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt POLICYINFO_NEW 3 | 18 | .Dt POLICYINFO_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -34,6 +34,7 @@ | |||
| 34 | .Nm POLICY_CONSTRAINTS_free | 34 | .Nm POLICY_CONSTRAINTS_free |
| 35 | .Nd X.509 certificate policies | 35 | .Nd X.509 certificate policies |
| 36 | .Sh SYNOPSIS | 36 | .Sh SYNOPSIS |
| 37 | .Lb libcrypto | ||
| 37 | .In openssl/x509v3.h | 38 | .In openssl/x509v3.h |
| 38 | .Ft POLICYINFO * | 39 | .Ft POLICYINFO * |
| 39 | .Fn POLICYINFO_new void | 40 | .Fn POLICYINFO_new void |
diff --git a/src/lib/libcrypto/man/RAND_add.3 b/src/lib/libcrypto/man/RAND_add.3 index 5404f696a3..b56707a313 100644 --- a/src/lib/libcrypto/man/RAND_add.3 +++ b/src/lib/libcrypto/man/RAND_add.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RAND_add.3,v 1.10 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: RAND_add.3,v 1.11 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" content checked up to: OpenSSL c16de9d8 Aug 31 23:16:22 2017 +0200 | 2 | .\" content checked up to: OpenSSL c16de9d8 Aug 31 23:16:22 2017 +0200 |
| 3 | .\" | 3 | .\" |
| 4 | .\" Copyright (c) 2014 Miod Vallat <miod@openbsd.org> | 4 | .\" Copyright (c) 2014 Miod Vallat <miod@openbsd.org> |
| @@ -15,7 +15,7 @@ | |||
| 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 | .\" | 17 | .\" |
| 18 | .Dd $Mdocdate: March 27 2018 $ | 18 | .Dd $Mdocdate: June 8 2025 $ |
| 19 | .Dt RAND_ADD 3 | 19 | .Dt RAND_ADD 3 |
| 20 | .Os | 20 | .Os |
| 21 | .Sh NAME | 21 | .Sh NAME |
| @@ -26,6 +26,7 @@ | |||
| 26 | .Nm RAND_status | 26 | .Nm RAND_status |
| 27 | .Nd manipulate the PRNG state | 27 | .Nd manipulate the PRNG state |
| 28 | .Sh SYNOPSIS | 28 | .Sh SYNOPSIS |
| 29 | .Lb libcrypto | ||
| 29 | .In openssl/rand.h | 30 | .In openssl/rand.h |
| 30 | .Ft void | 31 | .Ft void |
| 31 | .Fo RAND_add | 32 | .Fo RAND_add |
diff --git a/src/lib/libcrypto/man/RAND_bytes.3 b/src/lib/libcrypto/man/RAND_bytes.3 index 19427a82df..ce0773f448 100644 --- a/src/lib/libcrypto/man/RAND_bytes.3 +++ b/src/lib/libcrypto/man/RAND_bytes.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RAND_bytes.3,v 1.6 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: RAND_bytes.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt RAND_BYTES 3 | 52 | .Dt RAND_BYTES 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm RAND_pseudo_bytes | 56 | .Nm RAND_pseudo_bytes |
| 57 | .Nd generate random data | 57 | .Nd generate random data |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 59 | .In openssl/rand.h | 60 | .In openssl/rand.h |
| 60 | .Ft int | 61 | .Ft int |
| 61 | .Fo RAND_bytes | 62 | .Fo RAND_bytes |
diff --git a/src/lib/libcrypto/man/RAND_load_file.3 b/src/lib/libcrypto/man/RAND_load_file.3 index 9227e2721b..1c6f7a27fb 100644 --- a/src/lib/libcrypto/man/RAND_load_file.3 +++ b/src/lib/libcrypto/man/RAND_load_file.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RAND_load_file.3,v 1.6 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: RAND_load_file.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt RAND_LOAD_FILE 3 | 52 | .Dt RAND_LOAD_FILE 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm RAND_write_file | 57 | .Nm RAND_write_file |
| 58 | .Nd PRNG seed file | 58 | .Nd PRNG seed file |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/rand.h | 61 | .In openssl/rand.h |
| 61 | .Ft const char * | 62 | .Ft const char * |
| 62 | .Fo RAND_file_name | 63 | .Fo RAND_file_name |
diff --git a/src/lib/libcrypto/man/RAND_set_rand_method.3 b/src/lib/libcrypto/man/RAND_set_rand_method.3 index d94d794daf..2756099c7b 100644 --- a/src/lib/libcrypto/man/RAND_set_rand_method.3 +++ b/src/lib/libcrypto/man/RAND_set_rand_method.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RAND_set_rand_method.3,v 1.4 2018/03/21 09:03:49 schwarze Exp $ | 1 | .\" $OpenBSD: RAND_set_rand_method.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2014 Miod Vallat <miod@openbsd.org> | 3 | .\" Copyright (c) 2014 Miod Vallat <miod@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 21 2018 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt RAND_SET_RAND_METHOD 3 | 18 | .Dt RAND_SET_RAND_METHOD 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -23,6 +23,7 @@ | |||
| 23 | .Nm RAND_SSLeay | 23 | .Nm RAND_SSLeay |
| 24 | .Nd select RAND method | 24 | .Nd select RAND method |
| 25 | .Sh SYNOPSIS | 25 | .Sh SYNOPSIS |
| 26 | .Lb libcrypto | ||
| 26 | .In openssl/rand.h | 27 | .In openssl/rand.h |
| 27 | .Ft int | 28 | .Ft int |
| 28 | .Fo RAND_set_rand_method | 29 | .Fo RAND_set_rand_method |
diff --git a/src/lib/libcrypto/man/RC2_encrypt.3 b/src/lib/libcrypto/man/RC2_encrypt.3 index a90e0f574b..735c10cbd7 100644 --- a/src/lib/libcrypto/man/RC2_encrypt.3 +++ b/src/lib/libcrypto/man/RC2_encrypt.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RC2_encrypt.3,v 1.2 2024/12/18 04:15:48 jsg Exp $ | 1 | .\" $OpenBSD: RC2_encrypt.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 18 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt RC2_ENCRYPT 3 | 18 | .Dt RC2_ENCRYPT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -27,6 +27,7 @@ | |||
| 27 | .Nm RC2_ofb64_encrypt | 27 | .Nm RC2_ofb64_encrypt |
| 28 | .Nd low-level functions for Rivest Cipher 2 | 28 | .Nd low-level functions for Rivest Cipher 2 |
| 29 | .Sh SYNOPSIS | 29 | .Sh SYNOPSIS |
| 30 | .Lb libcrypto | ||
| 30 | .In openssl/rc2.h | 31 | .In openssl/rc2.h |
| 31 | .Ft void | 32 | .Ft void |
| 32 | .Fo RC2_set_key | 33 | .Fo RC2_set_key |
diff --git a/src/lib/libcrypto/man/RC4.3 b/src/lib/libcrypto/man/RC4.3 index 8b20a434b7..ff92cffc78 100644 --- a/src/lib/libcrypto/man/RC4.3 +++ b/src/lib/libcrypto/man/RC4.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RC4.3,v 1.8 2020/03/29 17:05:02 schwarze Exp $ | 1 | .\" $OpenBSD: RC4.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 29 2020 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt RC4 3 | 52 | .Dt RC4 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm RC4 | 56 | .Nm RC4 |
| 57 | .Nd RC4 encryption | 57 | .Nd RC4 encryption |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 59 | .In openssl/rc4.h | 60 | .In openssl/rc4.h |
| 60 | .Ft void | 61 | .Ft void |
| 61 | .Fo RC4_set_key | 62 | .Fo RC4_set_key |
diff --git a/src/lib/libcrypto/man/RIPEMD160.3 b/src/lib/libcrypto/man/RIPEMD160.3 index 43c6694036..e22f4ed841 100644 --- a/src/lib/libcrypto/man/RIPEMD160.3 +++ b/src/lib/libcrypto/man/RIPEMD160.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RIPEMD160.3,v 1.8 2024/05/26 09:54:16 tb Exp $ | 1 | .\" $OpenBSD: RIPEMD160.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 72a7a702 Feb 26 14:05:09 2019 +0000 | 2 | .\" full merge up to: OpenSSL 72a7a702 Feb 26 14:05:09 2019 +0000 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: May 26 2024 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt RIPEMD160 3 | 52 | .Dt RIPEMD160 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm RIPEMD160_Final | 58 | .Nm RIPEMD160_Final |
| 59 | .Nd RIPEMD-160 hash function | 59 | .Nd RIPEMD-160 hash function |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libcrypto | ||
| 61 | .In openssl/ripemd.h | 62 | .In openssl/ripemd.h |
| 62 | .Ft unsigned char * | 63 | .Ft unsigned char * |
| 63 | .Fo RIPEMD160 | 64 | .Fo RIPEMD160 |
diff --git a/src/lib/libcrypto/man/RSA_PSS_PARAMS_new.3 b/src/lib/libcrypto/man/RSA_PSS_PARAMS_new.3 index f69f33dbe5..6532028a57 100644 --- a/src/lib/libcrypto/man/RSA_PSS_PARAMS_new.3 +++ b/src/lib/libcrypto/man/RSA_PSS_PARAMS_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RSA_PSS_PARAMS_new.3,v 1.4 2019/06/06 01:06:59 schwarze Exp $ | 1 | .\" $OpenBSD: RSA_PSS_PARAMS_new.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: June 6 2019 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt RSA_PSS_PARAMS_NEW 3 | 18 | .Dt RSA_PSS_PARAMS_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm RSA_PSS_PARAMS_free | 22 | .Nm RSA_PSS_PARAMS_free |
| 23 | .Nd probabilistic signature scheme with RSA hashing | 23 | .Nd probabilistic signature scheme with RSA hashing |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/rsa.h | 26 | .In openssl/rsa.h |
| 26 | .Ft RSA_PSS_PARAMS * | 27 | .Ft RSA_PSS_PARAMS * |
| 27 | .Fn RSA_PSS_PARAMS_new void | 28 | .Fn RSA_PSS_PARAMS_new void |
diff --git a/src/lib/libcrypto/man/RSA_blinding_on.3 b/src/lib/libcrypto/man/RSA_blinding_on.3 index bd2a301377..0dfebf3739 100644 --- a/src/lib/libcrypto/man/RSA_blinding_on.3 +++ b/src/lib/libcrypto/man/RSA_blinding_on.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RSA_blinding_on.3,v 1.7 2023/07/26 20:08:59 tb Exp $ | 1 | .\" $OpenBSD: RSA_blinding_on.3,v 1.8 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: July 26 2023 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt RSA_BLINDING_ON 3 | 52 | .Dt RSA_BLINDING_ON 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm RSA_blinding_off | 56 | .Nm RSA_blinding_off |
| 57 | .Nd protect the RSA operation from timing attacks | 57 | .Nd protect the RSA operation from timing attacks |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 59 | .In openssl/rsa.h | 60 | .In openssl/rsa.h |
| 60 | .Ft int | 61 | .Ft int |
| 61 | .Fo RSA_blinding_on | 62 | .Fo RSA_blinding_on |
diff --git a/src/lib/libcrypto/man/RSA_check_key.3 b/src/lib/libcrypto/man/RSA_check_key.3 index 36b613b3a5..b6c9bc20a1 100644 --- a/src/lib/libcrypto/man/RSA_check_key.3 +++ b/src/lib/libcrypto/man/RSA_check_key.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RSA_check_key.3,v 1.10 2023/11/19 21:06:15 tb Exp $ | 1 | .\" $OpenBSD: RSA_check_key.3,v 1.11 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL 6859cf74 Sep 25 13:33:28 2002 +0000 | 2 | .\" OpenSSL 6859cf74 Sep 25 13:33:28 2002 +0000 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> and | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> and |
| @@ -49,13 +49,14 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: November 19 2023 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt RSA_CHECK_KEY 3 | 53 | .Dt RSA_CHECK_KEY 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| 56 | .Nm RSA_check_key | 56 | .Nm RSA_check_key |
| 57 | .Nd validate private RSA keys | 57 | .Nd validate private RSA keys |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 59 | .In openssl/rsa.h | 60 | .In openssl/rsa.h |
| 60 | .Ft int | 61 | .Ft int |
| 61 | .Fo RSA_check_key | 62 | .Fo RSA_check_key |
diff --git a/src/lib/libcrypto/man/RSA_generate_key.3 b/src/lib/libcrypto/man/RSA_generate_key.3 index 83703b1eaa..a72168def9 100644 --- a/src/lib/libcrypto/man/RSA_generate_key.3 +++ b/src/lib/libcrypto/man/RSA_generate_key.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RSA_generate_key.3,v 1.13 2019/06/10 14:58:48 schwarze Exp $ | 1 | .\" $OpenBSD: RSA_generate_key.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL RSA_generate_key.pod bb6c5e7f Feb 5 10:29:22 2017 -0500 | 2 | .\" OpenSSL RSA_generate_key.pod bb6c5e7f Feb 5 10:29:22 2017 -0500 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 10 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt RSA_GENERATE_KEY 3 | 52 | .Dt RSA_GENERATE_KEY 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm RSA_generate_key | 56 | .Nm RSA_generate_key |
| 57 | .Nd generate RSA key pair | 57 | .Nd generate RSA key pair |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 59 | .In openssl/rsa.h | 60 | .In openssl/rsa.h |
| 60 | .Ft int | 61 | .Ft int |
| 61 | .Fo RSA_generate_key_ex | 62 | .Fo RSA_generate_key_ex |
diff --git a/src/lib/libcrypto/man/RSA_get0_key.3 b/src/lib/libcrypto/man/RSA_get0_key.3 index f09fb00d2b..cf82b21ce2 100644 --- a/src/lib/libcrypto/man/RSA_get0_key.3 +++ b/src/lib/libcrypto/man/RSA_get0_key.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RSA_get0_key.3,v 1.8 2025/01/05 15:40:42 tb Exp $ | 1 | .\" $OpenBSD: RSA_get0_key.3,v 1.10 2025/06/13 18:34:00 schwarze Exp $ |
| 2 | .\" selective merge up to: OpenSSL 665d899f Aug 2 02:19:43 2017 +0800 | 2 | .\" selective merge up to: OpenSSL 665d899f Aug 2 02:19:43 2017 +0800 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: January 5 2025 $ | 68 | .Dd $Mdocdate: June 13 2025 $ |
| 69 | .Dt RSA_GET0_KEY 3 | 69 | .Dt RSA_GET0_KEY 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -88,6 +88,7 @@ | |||
| 88 | .Nm RSA_set_flags | 88 | .Nm RSA_set_flags |
| 89 | .Nd get and set data in an RSA object | 89 | .Nd get and set data in an RSA object |
| 90 | .Sh SYNOPSIS | 90 | .Sh SYNOPSIS |
| 91 | .Lb libcrypto | ||
| 91 | .In openssl/rsa.h | 92 | .In openssl/rsa.h |
| 92 | .Ft void | 93 | .Ft void |
| 93 | .Fo RSA_get0_key | 94 | .Fo RSA_get0_key |
| @@ -96,15 +97,15 @@ | |||
| 96 | .Fa "const BIGNUM **e" | 97 | .Fa "const BIGNUM **e" |
| 97 | .Fa "const BIGNUM **d" | 98 | .Fa "const BIGNUM **d" |
| 98 | .Fc | 99 | .Fc |
| 99 | .Ft "const BIGNUM *" | 100 | .Ft const BIGNUM * |
| 100 | .Fo RSA_get0_n | 101 | .Fo RSA_get0_n |
| 101 | .Fa "const RSA *r" | 102 | .Fa "const RSA *r" |
| 102 | .Fc | 103 | .Fc |
| 103 | .Ft "const BIGNUM *" | 104 | .Ft const BIGNUM * |
| 104 | .Fo RSA_get0_e | 105 | .Fo RSA_get0_e |
| 105 | .Fa "const RSA *r" | 106 | .Fa "const RSA *r" |
| 106 | .Fc | 107 | .Fc |
| 107 | .Ft "const BIGNUM *" | 108 | .Ft const BIGNUM * |
| 108 | .Fo RSA_get0_d | 109 | .Fo RSA_get0_d |
| 109 | .Fa "const RSA *r" | 110 | .Fa "const RSA *r" |
| 110 | .Fc | 111 | .Fc |
| @@ -121,11 +122,11 @@ | |||
| 121 | .Fa "const BIGNUM **p" | 122 | .Fa "const BIGNUM **p" |
| 122 | .Fa "const BIGNUM **q" | 123 | .Fa "const BIGNUM **q" |
| 123 | .Fc | 124 | .Fc |
| 124 | .Ft "const BIGNUM *" | 125 | .Ft const BIGNUM * |
| 125 | .Fo RSA_get0_p | 126 | .Fo RSA_get0_p |
| 126 | .Fa "const RSA *r" | 127 | .Fa "const RSA *r" |
| 127 | .Fc | 128 | .Fc |
| 128 | .Ft "const BIGNUM *" | 129 | .Ft const BIGNUM * |
| 129 | .Fo RSA_get0_q | 130 | .Fo RSA_get0_q |
| 130 | .Fa "const RSA *r" | 131 | .Fa "const RSA *r" |
| 131 | .Fc | 132 | .Fc |
| @@ -142,15 +143,15 @@ | |||
| 142 | .Fa "const BIGNUM **dmq1" | 143 | .Fa "const BIGNUM **dmq1" |
| 143 | .Fa "const BIGNUM **iqmp" | 144 | .Fa "const BIGNUM **iqmp" |
| 144 | .Fc | 145 | .Fc |
| 145 | .Ft "const BIGNUM *" | 146 | .Ft const BIGNUM * |
| 146 | .Fo RSA_get0_dmp1 | 147 | .Fo RSA_get0_dmp1 |
| 147 | .Fa "const RSA *r" | 148 | .Fa "const RSA *r" |
| 148 | .Fc | 149 | .Fc |
| 149 | .Ft "const BIGNUM *" | 150 | .Ft const BIGNUM * |
| 150 | .Fo RSA_get0_dmq1 | 151 | .Fo RSA_get0_dmq1 |
| 151 | .Fa "const RSA *r" | 152 | .Fa "const RSA *r" |
| 152 | .Fc | 153 | .Fc |
| 153 | .Ft "const BIGNUM *" | 154 | .Ft const BIGNUM * |
| 154 | .Fo RSA_get0_iqmp | 155 | .Fo RSA_get0_iqmp |
| 155 | .Fa "const RSA *r" | 156 | .Fa "const RSA *r" |
| 156 | .Fc | 157 | .Fc |
diff --git a/src/lib/libcrypto/man/RSA_get_ex_new_index.3 b/src/lib/libcrypto/man/RSA_get_ex_new_index.3 index 5f1fb4335f..1b7096faa1 100644 --- a/src/lib/libcrypto/man/RSA_get_ex_new_index.3 +++ b/src/lib/libcrypto/man/RSA_get_ex_new_index.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RSA_get_ex_new_index.3,v 1.13 2023/11/19 21:08:04 tb Exp $ | 1 | .\" $OpenBSD: RSA_get_ex_new_index.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: November 19 2023 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt RSA_GET_EX_NEW_INDEX 3 | 18 | .Dt RSA_GET_EX_NEW_INDEX 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -23,6 +23,7 @@ | |||
| 23 | .Nm RSA_get_ex_data | 23 | .Nm RSA_get_ex_data |
| 24 | .Nd add application specific data to RSA objects | 24 | .Nd add application specific data to RSA objects |
| 25 | .Sh SYNOPSIS | 25 | .Sh SYNOPSIS |
| 26 | .Lb libcrypto | ||
| 26 | .In openssl/rsa.h | 27 | .In openssl/rsa.h |
| 27 | .Ft int | 28 | .Ft int |
| 28 | .Fo RSA_get_ex_new_index | 29 | .Fo RSA_get_ex_new_index |
diff --git a/src/lib/libcrypto/man/RSA_meth_new.3 b/src/lib/libcrypto/man/RSA_meth_new.3 index a3a5c549e5..9626f1139f 100644 --- a/src/lib/libcrypto/man/RSA_meth_new.3 +++ b/src/lib/libcrypto/man/RSA_meth_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RSA_meth_new.3,v 1.6 2025/01/05 15:40:42 tb Exp $ | 1 | .\" $OpenBSD: RSA_meth_new.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL a970b14f Jul 31 18:58:40 2017 -0400 | 2 | .\" full merge up to: OpenSSL a970b14f Jul 31 18:58:40 2017 -0400 |
| 3 | .\" selective merge up to: OpenSSL 24907560 Sep 17 07:47:42 2018 +1000 | 3 | .\" selective merge up to: OpenSSL 24907560 Sep 17 07:47:42 2018 +1000 |
| 4 | .\" | 4 | .\" |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: January 5 2025 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt RSA_METH_NEW 3 | 70 | .Dt RSA_METH_NEW 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -103,6 +103,7 @@ | |||
| 103 | .Nm RSA_meth_set_keygen | 103 | .Nm RSA_meth_set_keygen |
| 104 | .Nd build up RSA methods | 104 | .Nd build up RSA methods |
| 105 | .Sh SYNOPSIS | 105 | .Sh SYNOPSIS |
| 106 | .Lb libcrypto | ||
| 106 | .In openssl/rsa.h | 107 | .In openssl/rsa.h |
| 107 | .Ft RSA_METHOD * | 108 | .Ft RSA_METHOD * |
| 108 | .Fo RSA_meth_new | 109 | .Fo RSA_meth_new |
diff --git a/src/lib/libcrypto/man/RSA_new.3 b/src/lib/libcrypto/man/RSA_new.3 index f5c7929e77..9c69ce27b1 100644 --- a/src/lib/libcrypto/man/RSA_new.3 +++ b/src/lib/libcrypto/man/RSA_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RSA_new.3,v 1.18 2023/11/19 21:03:22 tb Exp $ | 1 | .\" $OpenBSD: RSA_new.3,v 1.19 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: | 2 | .\" full merge up to: |
| 3 | .\" OpenSSL doc/man3/RSA_new.pod e9b77246 Jan 20 19:58:49 2017 +0100 | 3 | .\" OpenSSL doc/man3/RSA_new.pod e9b77246 Jan 20 19:58:49 2017 +0100 |
| 4 | .\" OpenSSL doc/crypto/rsa.pod 35d2e327 Jun 3 16:19:49 2016 -0400 (final) | 4 | .\" OpenSSL doc/crypto/rsa.pod 35d2e327 Jun 3 16:19:49 2016 -0400 (final) |
| @@ -67,7 +67,7 @@ | |||
| 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 69 | .\" | 69 | .\" |
| 70 | .Dd $Mdocdate: November 19 2023 $ | 70 | .Dd $Mdocdate: June 8 2025 $ |
| 71 | .Dt RSA_NEW 3 | 71 | .Dt RSA_NEW 3 |
| 72 | .Os | 72 | .Os |
| 73 | .Sh NAME | 73 | .Sh NAME |
| @@ -78,6 +78,7 @@ | |||
| 78 | .Nm RSA_free | 78 | .Nm RSA_free |
| 79 | .Nd allocate and free RSA objects | 79 | .Nd allocate and free RSA objects |
| 80 | .Sh SYNOPSIS | 80 | .Sh SYNOPSIS |
| 81 | .Lb libcrypto | ||
| 81 | .In openssl/rsa.h | 82 | .In openssl/rsa.h |
| 82 | .Ft RSA * | 83 | .Ft RSA * |
| 83 | .Fn RSA_new void | 84 | .Fn RSA_new void |
diff --git a/src/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 b/src/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 index e7c3a2a624..d8a142f3f9 100644 --- a/src/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 +++ b/src/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RSA_padding_add_PKCS1_type_1.3,v 1.8 2018/03/21 16:09:51 schwarze Exp $ | 1 | .\" $OpenBSD: RSA_padding_add_PKCS1_type_1.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL 1e3f62a3 Jul 17 16:47:13 2017 +0200 | 2 | .\" OpenSSL 1e3f62a3 Jul 17 16:47:13 2017 +0200 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 21 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt RSA_PADDING_ADD_PKCS1_TYPE_1 3 | 52 | .Dt RSA_PADDING_ADD_PKCS1_TYPE_1 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -62,6 +62,7 @@ | |||
| 62 | .Nm RSA_padding_check_none | 62 | .Nm RSA_padding_check_none |
| 63 | .Nd asymmetric encryption padding | 63 | .Nd asymmetric encryption padding |
| 64 | .Sh SYNOPSIS | 64 | .Sh SYNOPSIS |
| 65 | .Lb libcrypto | ||
| 65 | .In openssl/rsa.h | 66 | .In openssl/rsa.h |
| 66 | .Ft int | 67 | .Ft int |
| 67 | .Fo RSA_padding_add_PKCS1_type_1 | 68 | .Fo RSA_padding_add_PKCS1_type_1 |
diff --git a/src/lib/libcrypto/man/RSA_pkey_ctx_ctrl.3 b/src/lib/libcrypto/man/RSA_pkey_ctx_ctrl.3 index 3d4e79cc47..ca805e5191 100644 --- a/src/lib/libcrypto/man/RSA_pkey_ctx_ctrl.3 +++ b/src/lib/libcrypto/man/RSA_pkey_ctx_ctrl.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RSA_pkey_ctx_ctrl.3,v 1.8 2024/12/06 14:27:49 schwarze Exp $ | 1 | .\" $OpenBSD: RSA_pkey_ctx_ctrl.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: | 2 | .\" full merge up to: |
| 3 | .\" OpenSSL man3/EVP_PKEY_CTX_ctrl.pod 99d63d46 Oct 26 13:56:48 2016 -0400 | 3 | .\" OpenSSL man3/EVP_PKEY_CTX_ctrl.pod 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 4 | .\" OpenSSL man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md.pod | 4 | .\" OpenSSL man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md.pod |
| @@ -55,7 +55,7 @@ | |||
| 55 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 55 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 56 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 56 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 57 | .\" | 57 | .\" |
| 58 | .Dd $Mdocdate: December 6 2024 $ | 58 | .Dd $Mdocdate: June 8 2025 $ |
| 59 | .Dt RSA_PKEY_CTX_CTRL 3 | 59 | .Dt RSA_PKEY_CTX_CTRL 3 |
| 60 | .Os | 60 | .Os |
| 61 | .Sh NAME | 61 | .Sh NAME |
| @@ -77,6 +77,7 @@ | |||
| 77 | .Nm EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen | 77 | .Nm EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen |
| 78 | .Nd RSA private key control operations | 78 | .Nd RSA private key control operations |
| 79 | .Sh SYNOPSIS | 79 | .Sh SYNOPSIS |
| 80 | .Lb libcrypto | ||
| 80 | .In openssl/rsa.h | 81 | .In openssl/rsa.h |
| 81 | .Ft int | 82 | .Ft int |
| 82 | .Fo RSA_pkey_ctx_ctrl | 83 | .Fo RSA_pkey_ctx_ctrl |
diff --git a/src/lib/libcrypto/man/RSA_print.3 b/src/lib/libcrypto/man/RSA_print.3 index 767241ce1c..3f5d927b79 100644 --- a/src/lib/libcrypto/man/RSA_print.3 +++ b/src/lib/libcrypto/man/RSA_print.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RSA_print.3,v 1.9 2019/06/06 01:06:59 schwarze Exp $ | 1 | .\" $OpenBSD: RSA_print.3,v 1.10 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 6 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt RSA_PRINT 3 | 52 | .Dt RSA_PRINT 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -62,6 +62,7 @@ | |||
| 62 | .Nm DHparams_print_fp | 62 | .Nm DHparams_print_fp |
| 63 | .Nd print cryptographic parameters | 63 | .Nd print cryptographic parameters |
| 64 | .Sh SYNOPSIS | 64 | .Sh SYNOPSIS |
| 65 | .Lb libcrypto | ||
| 65 | .In openssl/rsa.h | 66 | .In openssl/rsa.h |
| 66 | .Ft int | 67 | .Ft int |
| 67 | .Fo RSA_print | 68 | .Fo RSA_print |
diff --git a/src/lib/libcrypto/man/RSA_private_encrypt.3 b/src/lib/libcrypto/man/RSA_private_encrypt.3 index 2bf6c57dba..43e94b1fd2 100644 --- a/src/lib/libcrypto/man/RSA_private_encrypt.3 +++ b/src/lib/libcrypto/man/RSA_private_encrypt.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RSA_private_encrypt.3,v 1.10 2019/06/10 14:58:48 schwarze Exp $ | 1 | .\" $OpenBSD: RSA_private_encrypt.3,v 1.11 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL RSA_private_encrypt.pod b41f6b64 Mar 10 15:49:04 2017 +0000 | 2 | .\" OpenSSL RSA_private_encrypt.pod b41f6b64 Mar 10 15:49:04 2017 +0000 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 10 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt RSA_PRIVATE_ENCRYPT 3 | 52 | .Dt RSA_PRIVATE_ENCRYPT 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm RSA_public_decrypt | 56 | .Nm RSA_public_decrypt |
| 57 | .Nd low level signature operations | 57 | .Nd low level signature operations |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 59 | .In openssl/rsa.h | 60 | .In openssl/rsa.h |
| 60 | .Ft int | 61 | .Ft int |
| 61 | .Fo RSA_private_encrypt | 62 | .Fo RSA_private_encrypt |
diff --git a/src/lib/libcrypto/man/RSA_public_encrypt.3 b/src/lib/libcrypto/man/RSA_public_encrypt.3 index be3afdf402..f40118846a 100644 --- a/src/lib/libcrypto/man/RSA_public_encrypt.3 +++ b/src/lib/libcrypto/man/RSA_public_encrypt.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RSA_public_encrypt.3,v 1.13 2023/09/10 16:04:15 schwarze Exp $ | 1 | .\" $OpenBSD: RSA_public_encrypt.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL RSA_public_encrypt.pod 1e3f62a3 Jul 17 16:47:13 2017 +0200 | 2 | .\" OpenSSL RSA_public_encrypt.pod 1e3f62a3 Jul 17 16:47:13 2017 +0200 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: September 10 2023 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt RSA_PUBLIC_ENCRYPT 3 | 69 | .Dt RSA_PUBLIC_ENCRYPT 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -75,6 +75,7 @@ | |||
| 75 | .Nm EVP_PKEY_decrypt_old | 75 | .Nm EVP_PKEY_decrypt_old |
| 76 | .Nd RSA public key cryptography | 76 | .Nd RSA public key cryptography |
| 77 | .Sh SYNOPSIS | 77 | .Sh SYNOPSIS |
| 78 | .Lb libcrypto | ||
| 78 | .In openssl/rsa.h | 79 | .In openssl/rsa.h |
| 79 | .Ft int | 80 | .Ft int |
| 80 | .Fo RSA_public_encrypt | 81 | .Fo RSA_public_encrypt |
diff --git a/src/lib/libcrypto/man/RSA_security_bits.3 b/src/lib/libcrypto/man/RSA_security_bits.3 index f7024a7956..0766ce61b1 100644 --- a/src/lib/libcrypto/man/RSA_security_bits.3 +++ b/src/lib/libcrypto/man/RSA_security_bits.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RSA_security_bits.3,v 1.1 2022/07/13 17:32:16 schwarze Exp $ | 1 | .\" $OpenBSD: RSA_security_bits.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: July 13 2022 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt RSA_SECURITY_BITS 3 | 18 | .Dt RSA_SECURITY_BITS 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -24,6 +24,7 @@ | |||
| 24 | .Nm BN_security_bits | 24 | .Nm BN_security_bits |
| 25 | .Nd get security strength | 25 | .Nd get security strength |
| 26 | .Sh SYNOPSIS | 26 | .Sh SYNOPSIS |
| 27 | .Lb libcrypto | ||
| 27 | .In openssl/rsa.h | 28 | .In openssl/rsa.h |
| 28 | .Ft int | 29 | .Ft int |
| 29 | .Fn RSA_security_bits "const RSA *rsa" | 30 | .Fn RSA_security_bits "const RSA *rsa" |
diff --git a/src/lib/libcrypto/man/RSA_set_method.3 b/src/lib/libcrypto/man/RSA_set_method.3 index ffe22c116f..127dc62c60 100644 --- a/src/lib/libcrypto/man/RSA_set_method.3 +++ b/src/lib/libcrypto/man/RSA_set_method.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RSA_set_method.3,v 1.18 2023/11/19 10:34:26 tb Exp $ | 1 | .\" $OpenBSD: RSA_set_method.3,v 1.19 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> |
| @@ -50,7 +50,7 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: November 19 2023 $ | 53 | .Dd $Mdocdate: June 8 2025 $ |
| 54 | .Dt RSA_SET_METHOD 3 | 54 | .Dt RSA_SET_METHOD 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| @@ -63,6 +63,7 @@ | |||
| 63 | .Nm RSA_new_method | 63 | .Nm RSA_new_method |
| 64 | .Nd select RSA method | 64 | .Nd select RSA method |
| 65 | .Sh SYNOPSIS | 65 | .Sh SYNOPSIS |
| 66 | .Lb libcrypto | ||
| 66 | .In openssl/rsa.h | 67 | .In openssl/rsa.h |
| 67 | .Ft void | 68 | .Ft void |
| 68 | .Fo RSA_set_default_method | 69 | .Fo RSA_set_default_method |
diff --git a/src/lib/libcrypto/man/RSA_sign.3 b/src/lib/libcrypto/man/RSA_sign.3 index 65e9dc99b8..d2a4512302 100644 --- a/src/lib/libcrypto/man/RSA_sign.3 +++ b/src/lib/libcrypto/man/RSA_sign.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RSA_sign.3,v 1.8 2019/06/10 14:58:48 schwarze Exp $ | 1 | .\" $OpenBSD: RSA_sign.3,v 1.10 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL aa90ca11 Aug 20 15:48:56 2016 -0400 | 2 | .\" OpenSSL aa90ca11 Aug 20 15:48:56 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: June 10 2019 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt RSA_SIGN 3 | 53 | .Dt RSA_SIGN 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm RSA_verify | 57 | .Nm RSA_verify |
| 58 | .Nd RSA signatures | 58 | .Nd RSA signatures |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/rsa.h | 61 | .In openssl/rsa.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fo RSA_sign | 63 | .Fo RSA_sign |
| @@ -106,7 +107,7 @@ If | |||
| 106 | .Fa type | 107 | .Fa type |
| 107 | is | 108 | is |
| 108 | .Sy NID_md5_sha1 , | 109 | .Sy NID_md5_sha1 , |
| 109 | an SSL signature (MD5 and SHA1 message digests with PKCS #1 padding and | 110 | an SSL signature (MD5 and SHA-1 message digests with PKCS #1 padding and |
| 110 | no algorithm identifier) is created. | 111 | no algorithm identifier) is created. |
| 111 | .Pp | 112 | .Pp |
| 112 | .Fn RSA_verify | 113 | .Fn RSA_verify |
diff --git a/src/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 b/src/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 index 34aef42c48..bd11a0607a 100644 --- a/src/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 +++ b/src/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RSA_sign_ASN1_OCTET_STRING.3,v 1.7 2019/06/10 14:58:48 schwarze Exp $ | 1 | .\" $OpenBSD: RSA_sign_ASN1_OCTET_STRING.3,v 1.8 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 10 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt RSA_SIGN_ASN1_OCTET_STRING 3 | 52 | .Dt RSA_SIGN_ASN1_OCTET_STRING 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm RSA_verify_ASN1_OCTET_STRING | 56 | .Nm RSA_verify_ASN1_OCTET_STRING |
| 57 | .Nd RSA signatures | 57 | .Nd RSA signatures |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 59 | .In openssl/rsa.h | 60 | .In openssl/rsa.h |
| 60 | .Ft int | 61 | .Ft int |
| 61 | .Fo RSA_sign_ASN1_OCTET_STRING | 62 | .Fo RSA_sign_ASN1_OCTET_STRING |
diff --git a/src/lib/libcrypto/man/RSA_size.3 b/src/lib/libcrypto/man/RSA_size.3 index 8a552b4e67..9988903d55 100644 --- a/src/lib/libcrypto/man/RSA_size.3 +++ b/src/lib/libcrypto/man/RSA_size.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: RSA_size.3,v 1.10 2022/07/13 21:51:35 schwarze Exp $ | 1 | .\" $OpenBSD: RSA_size.3,v 1.11 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> and | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> and |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: July 13 2022 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt RSA_SIZE 3 | 53 | .Dt RSA_SIZE 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm RSA_bits | 57 | .Nm RSA_bits |
| 58 | .Nd get the RSA modulus size | 58 | .Nd get the RSA modulus size |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/rsa.h | 61 | .In openssl/rsa.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fo RSA_size | 63 | .Fo RSA_size |
diff --git a/src/lib/libcrypto/man/SHA1.3 b/src/lib/libcrypto/man/SHA1.3 index 4ccb08157c..74fd388cd8 100644 --- a/src/lib/libcrypto/man/SHA1.3 +++ b/src/lib/libcrypto/man/SHA1.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SHA1.3,v 1.9 2024/06/01 12:35:23 tb Exp $ | 1 | .\" $OpenBSD: SHA1.3,v 1.10 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> and | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> and |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: June 1 2024 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SHA1 3 | 53 | .Dt SHA1 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -75,6 +75,7 @@ | |||
| 75 | .Nm SHA512_Final | 75 | .Nm SHA512_Final |
| 76 | .Nd Secure Hash Algorithm | 76 | .Nd Secure Hash Algorithm |
| 77 | .Sh SYNOPSIS | 77 | .Sh SYNOPSIS |
| 78 | .Lb libcrypto | ||
| 78 | .In openssl/sha.h | 79 | .In openssl/sha.h |
| 79 | .Ft unsigned char * | 80 | .Ft unsigned char * |
| 80 | .Fo SHA1 | 81 | .Fo SHA1 |
diff --git a/src/lib/libcrypto/man/SMIME_crlf_copy.3 b/src/lib/libcrypto/man/SMIME_crlf_copy.3 index 3b46138473..0991d207a1 100644 --- a/src/lib/libcrypto/man/SMIME_crlf_copy.3 +++ b/src/lib/libcrypto/man/SMIME_crlf_copy.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SMIME_crlf_copy.3,v 1.3 2023/05/01 07:28:11 tb Exp $ | 1 | .\" $OpenBSD: SMIME_crlf_copy.3,v 1.5 2025/06/11 13:48:54 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,15 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: May 1 2023 $ | 17 | .Dd $Mdocdate: June 11 2025 $ |
| 18 | .Dt SMIME_CRLF_COPY 3 | 18 | .Dt SMIME_CRLF_COPY 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm SMIME_crlf_copy | 21 | .Nm SMIME_crlf_copy |
| 22 | .Nd buffered copy between BIOs | 22 | .Nd buffered copy between BIOs |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 25 | .In openssl/asn1.h | ||
| 24 | .Ft int | 26 | .Ft int |
| 25 | .Fo SMIME_crlf_copy | 27 | .Fo SMIME_crlf_copy |
| 26 | .Fa "BIO *in_bio" | 28 | .Fa "BIO *in_bio" |
| @@ -79,7 +81,8 @@ is intended to return 1 on success or 0 on failure. | |||
| 79 | .Xr BIO_push 3 , | 81 | .Xr BIO_push 3 , |
| 80 | .Xr BIO_read 3 , | 82 | .Xr BIO_read 3 , |
| 81 | .Xr SMIME_text 3 , | 83 | .Xr SMIME_text 3 , |
| 82 | .Xr SMIME_write_ASN1 3 | 84 | .Xr SMIME_write_CMS 3 , |
| 85 | .Xr SMIME_write_PKCS7 3 | ||
| 83 | .Sh HISTORY | 86 | .Sh HISTORY |
| 84 | .Fn SMIME_crlf_copy | 87 | .Fn SMIME_crlf_copy |
| 85 | first appeared in OpenSSL 1.0.0 and has been available since | 88 | first appeared in OpenSSL 1.0.0 and has been available since |
diff --git a/src/lib/libcrypto/man/SMIME_read_ASN1.3 b/src/lib/libcrypto/man/SMIME_read_ASN1.3 deleted file mode 100644 index 320064567c..0000000000 --- a/src/lib/libcrypto/man/SMIME_read_ASN1.3 +++ /dev/null | |||
| @@ -1,124 +0,0 @@ | |||
| 1 | .\" $OpenBSD: SMIME_read_ASN1.3,v 1.2 2021/12/14 15:22:49 schwarze Exp $ | ||
| 2 | .\" full merge up to: | ||
| 3 | .\" OpenSSL SMIME_read_PKCS7.pod 83cf7abf May 29 13:07:08 2018 +0100 | ||
| 4 | .\" OpenSSL SMIME_read_CMS.pod b97fdb57 Nov 11 09:33:09 2016 +0100 | ||
| 5 | .\" | ||
| 6 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | ||
| 7 | .\" Copyright (c) 2002, 2006, 2008 The OpenSSL Project. All rights reserved. | ||
| 8 | .\" | ||
| 9 | .\" Redistribution and use in source and binary forms, with or without | ||
| 10 | .\" modification, are permitted provided that the following conditions | ||
| 11 | .\" are met: | ||
| 12 | .\" | ||
| 13 | .\" 1. Redistributions of source code must retain the above copyright | ||
| 14 | .\" notice, this list of conditions and the following disclaimer. | ||
| 15 | .\" | ||
| 16 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
| 17 | .\" notice, this list of conditions and the following disclaimer in | ||
| 18 | .\" the documentation and/or other materials provided with the | ||
| 19 | .\" distribution. | ||
| 20 | .\" | ||
| 21 | .\" 3. All advertising materials mentioning features or use of this | ||
| 22 | .\" software must display the following acknowledgment: | ||
| 23 | .\" "This product includes software developed by the OpenSSL Project | ||
| 24 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 25 | .\" | ||
| 26 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 27 | .\" endorse or promote products derived from this software without | ||
| 28 | .\" prior written permission. For written permission, please contact | ||
| 29 | .\" openssl-core@openssl.org. | ||
| 30 | .\" | ||
| 31 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
| 32 | .\" nor may "OpenSSL" appear in their names without prior written | ||
| 33 | .\" permission of the OpenSSL Project. | ||
| 34 | .\" | ||
| 35 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
| 36 | .\" acknowledgment: | ||
| 37 | .\" "This product includes software developed by the OpenSSL Project | ||
| 38 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 39 | .\" | ||
| 40 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 41 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 42 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 43 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 44 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 45 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 46 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 47 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 49 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 52 | .\" | ||
| 53 | .Dd $Mdocdate: December 14 2021 $ | ||
| 54 | .Dt SMIME_READ_ASN1 3 | ||
| 55 | .Os | ||
| 56 | .Sh NAME | ||
| 57 | .Nm SMIME_read_ASN1 | ||
| 58 | .Nd generic S/MIME message parser | ||
| 59 | .Sh SYNOPSIS | ||
| 60 | .In openssl/asn1.h | ||
| 61 | .Ft ASN1_VALUE * | ||
| 62 | .Fo SMIME_read_ASN1 | ||
| 63 | .Fa "BIO *in_bio" | ||
| 64 | .Fa "BIO **out_bio" | ||
| 65 | .Fa "const ASN1_ITEM *it" | ||
| 66 | .Fc | ||
| 67 | .Sh DESCRIPTION | ||
| 68 | .Fn SMIME_read_ASN1 | ||
| 69 | reads a message in S/MIME format from | ||
| 70 | .Fa in_bio . | ||
| 71 | .Pp | ||
| 72 | If the message uses cleartext signing, the content is saved in a memory | ||
| 73 | .Vt BIO | ||
| 74 | which is written to | ||
| 75 | .Pf * Fa out_bio . | ||
| 76 | Otherwise, | ||
| 77 | .Pf * Fa out_bio | ||
| 78 | is set to | ||
| 79 | .Dv NULL . | ||
| 80 | .Pp | ||
| 81 | To support future functionality, if | ||
| 82 | .Fa out_bio | ||
| 83 | is not | ||
| 84 | .Dv NULL , | ||
| 85 | .Pf * Fa out_bio | ||
| 86 | should be initialized to | ||
| 87 | .Dv NULL | ||
| 88 | before calling | ||
| 89 | .Fn SMIME_read_ASN1 . | ||
| 90 | .Sh RETURN VALUES | ||
| 91 | .Fn SMIME_read_ASN1 | ||
| 92 | returns a newly allocated object of type | ||
| 93 | .Fa it | ||
| 94 | or | ||
| 95 | .Dv NULL | ||
| 96 | if an error occurred. | ||
| 97 | The error can be obtained from | ||
| 98 | .Xr ERR_get_error 3 . | ||
| 99 | .Sh SEE ALSO | ||
| 100 | .Xr ASN1_item_d2i_bio 3 , | ||
| 101 | .Xr BIO_f_base64 3 , | ||
| 102 | .Xr BIO_new 3 , | ||
| 103 | .Xr SMIME_read_CMS 3 , | ||
| 104 | .Xr SMIME_read_PKCS7 3 , | ||
| 105 | .Xr SMIME_text 3 | ||
| 106 | .Sh HISTORY | ||
| 107 | .Fn SMIME_read_ASN1 | ||
| 108 | first appeared in OpenSSL 0.9.8h and has been available since | ||
| 109 | .Ox 4.5 . | ||
| 110 | .Sh BUGS | ||
| 111 | The MIME parser used by | ||
| 112 | .Fn SMIME_read_ASN1 | ||
| 113 | is somewhat primitive. | ||
| 114 | While it will handle most S/MIME messages, more complex compound | ||
| 115 | formats may not work. | ||
| 116 | .Pp | ||
| 117 | The parser assumes that the | ||
| 118 | structure is always base64 encoded, and it will not handle the case | ||
| 119 | where it is in binary format or uses quoted printable format. | ||
| 120 | .Pp | ||
| 121 | The use of a memory | ||
| 122 | to hold the signed content limits the size of the message which can | ||
| 123 | be processed due to memory restraints: a streaming single pass | ||
| 124 | option should be available. | ||
diff --git a/src/lib/libcrypto/man/SMIME_read_CMS.3 b/src/lib/libcrypto/man/SMIME_read_CMS.3 index e1b1d07499..d37769e5ea 100644 --- a/src/lib/libcrypto/man/SMIME_read_CMS.3 +++ b/src/lib/libcrypto/man/SMIME_read_CMS.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SMIME_read_CMS.3,v 1.7 2021/12/14 14:30:50 schwarze Exp $ | 1 | .\" $OpenBSD: SMIME_read_CMS.3,v 1.9 2025/06/11 13:41:03 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: December 14 2021 $ | 51 | .Dd $Mdocdate: June 11 2025 $ |
| 52 | .Dt SMIME_READ_CMS 3 | 52 | .Dt SMIME_READ_CMS 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SMIME_read_CMS | 55 | .Nm SMIME_read_CMS |
| 56 | .Nd extract CMS ContentInfo from an S/MIME message | 56 | .Nd extract CMS ContentInfo from an S/MIME message |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/cms.h | 59 | .In openssl/cms.h |
| 59 | .Ft CMS_ContentInfo * | 60 | .Ft CMS_ContentInfo * |
| 60 | .Fo SMIME_read_CMS | 61 | .Fo SMIME_read_CMS |
| @@ -103,12 +104,15 @@ if an error occurred. | |||
| 103 | The error can be obtained from | 104 | The error can be obtained from |
| 104 | .Xr ERR_get_error 3 . | 105 | .Xr ERR_get_error 3 . |
| 105 | .Sh SEE ALSO | 106 | .Sh SEE ALSO |
| 107 | .Xr BIO_f_base64 3 , | ||
| 108 | .Xr BIO_new 3 , | ||
| 106 | .Xr CMS_ContentInfo_new 3 , | 109 | .Xr CMS_ContentInfo_new 3 , |
| 107 | .Xr CMS_decrypt 3 , | 110 | .Xr CMS_decrypt 3 , |
| 108 | .Xr CMS_get0_type 3 , | 111 | .Xr CMS_get0_type 3 , |
| 109 | .Xr CMS_verify 3 , | 112 | .Xr CMS_verify 3 , |
| 110 | .Xr d2i_CMS_ContentInfo 3 , | 113 | .Xr d2i_CMS_ContentInfo 3 , |
| 111 | .Xr SMIME_read_ASN1 3 , | 114 | .Xr SMIME_read_PKCS7 3 , |
| 115 | .Xr SMIME_text 3 , | ||
| 112 | .Xr SMIME_write_CMS 3 | 116 | .Xr SMIME_write_CMS 3 |
| 113 | .Sh HISTORY | 117 | .Sh HISTORY |
| 114 | .Fn SMIME_read_CMS | 118 | .Fn SMIME_read_CMS |
diff --git a/src/lib/libcrypto/man/SMIME_read_PKCS7.3 b/src/lib/libcrypto/man/SMIME_read_PKCS7.3 index dbe2765b8b..095115c0dc 100644 --- a/src/lib/libcrypto/man/SMIME_read_PKCS7.3 +++ b/src/lib/libcrypto/man/SMIME_read_PKCS7.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SMIME_read_PKCS7.3,v 1.8 2021/12/14 14:30:50 schwarze Exp $ | 1 | .\" $OpenBSD: SMIME_read_PKCS7.3,v 1.10 2025/06/11 13:41:03 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 | 2 | .\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: December 14 2021 $ | 51 | .Dd $Mdocdate: June 11 2025 $ |
| 52 | .Dt SMIME_READ_PKCS7 3 | 52 | .Dt SMIME_READ_PKCS7 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SMIME_read_PKCS7 | 55 | .Nm SMIME_read_PKCS7 |
| 56 | .Nd extract a PKCS#7 object from an S/MIME message | 56 | .Nd extract a PKCS#7 object from an S/MIME message |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/pkcs7.h | 59 | .In openssl/pkcs7.h |
| 59 | .Ft PKCS7 * | 60 | .Ft PKCS7 * |
| 60 | .Fo SMIME_read_PKCS7 | 61 | .Fo SMIME_read_PKCS7 |
| @@ -124,8 +125,11 @@ if an error occurred. | |||
| 124 | The error can be obtained from | 125 | The error can be obtained from |
| 125 | .Xr ERR_get_error 3 . | 126 | .Xr ERR_get_error 3 . |
| 126 | .Sh SEE ALSO | 127 | .Sh SEE ALSO |
| 128 | .Xr BIO_f_base64 3 , | ||
| 129 | .Xr BIO_new 3 , | ||
| 127 | .Xr PKCS7_new 3 , | 130 | .Xr PKCS7_new 3 , |
| 128 | .Xr SMIME_read_ASN1 3 , | 131 | .Xr SMIME_read_CMS 3 , |
| 132 | .Xr SMIME_text 3 , | ||
| 129 | .Xr SMIME_write_PKCS7 3 | 133 | .Xr SMIME_write_PKCS7 3 |
| 130 | .Sh HISTORY | 134 | .Sh HISTORY |
| 131 | .Fn SMIME_read_PKCS7 | 135 | .Fn SMIME_read_PKCS7 |
diff --git a/src/lib/libcrypto/man/SMIME_text.3 b/src/lib/libcrypto/man/SMIME_text.3 index a4c9689925..719b3d921f 100644 --- a/src/lib/libcrypto/man/SMIME_text.3 +++ b/src/lib/libcrypto/man/SMIME_text.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SMIME_text.3,v 1.1 2021/12/14 15:22:49 schwarze Exp $ | 1 | .\" $OpenBSD: SMIME_text.3,v 1.3 2025/06/11 13:48:54 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 14 2021 $ | 17 | .Dd $Mdocdate: June 11 2025 $ |
| 18 | .Dt SMIME_TEXT 3 | 18 | .Dt SMIME_TEXT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm SMIME_text | 21 | .Nm SMIME_text |
| 22 | .Nd remove text/plain MIME headers | 22 | .Nd remove text/plain MIME headers |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/asn1.h | 25 | .In openssl/asn1.h |
| 25 | .Ft int | 26 | .Ft int |
| 26 | .Fo SMIME_text | 27 | .Fo SMIME_text |
| @@ -47,7 +48,10 @@ header, or if the content type is not | |||
| 47 | .Dq text/plain . | 48 | .Dq text/plain . |
| 48 | .Sh SEE ALSO | 49 | .Sh SEE ALSO |
| 49 | .Xr SMIME_crlf_copy 3 , | 50 | .Xr SMIME_crlf_copy 3 , |
| 50 | .Xr SMIME_read_ASN1 3 | 51 | .Xr SMIME_read_CMS 3 , |
| 52 | .Xr SMIME_read_PKCS7 3 , | ||
| 53 | .Xr SMIME_write_CMS 3 , | ||
| 54 | .Xr SMIME_write_PKCS7 3 | ||
| 51 | .Sh HISTORY | 55 | .Sh HISTORY |
| 52 | .Fn SMIME_text | 56 | .Fn SMIME_text |
| 53 | first appeared in OpenSSL 1.0.0 and has been available since | 57 | first appeared in OpenSSL 1.0.0 and has been available since |
diff --git a/src/lib/libcrypto/man/SMIME_write_ASN1.3 b/src/lib/libcrypto/man/SMIME_write_ASN1.3 deleted file mode 100644 index a02fa58570..0000000000 --- a/src/lib/libcrypto/man/SMIME_write_ASN1.3 +++ /dev/null | |||
| @@ -1,163 +0,0 @@ | |||
| 1 | .\" $OpenBSD: SMIME_write_ASN1.3,v 1.2 2023/05/01 07:28:11 tb Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | ||
| 4 | .\" | ||
| 5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 7 | .\" copyright notice and this permission notice appear in all copies. | ||
| 8 | .\" | ||
| 9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | .\" | ||
| 17 | .Dd $Mdocdate: May 1 2023 $ | ||
| 18 | .Dt SMIME_WRITE_ASN1 3 | ||
| 19 | .Os | ||
| 20 | .Sh NAME | ||
| 21 | .Nm SMIME_write_ASN1 | ||
| 22 | .Nd generate an S/MIME message | ||
| 23 | .Sh SYNOPSIS | ||
| 24 | .In openssl/asn1.h | ||
| 25 | .Ft int | ||
| 26 | .Fo SMIME_write_ASN1 | ||
| 27 | .Fa "BIO *out_bio" | ||
| 28 | .Fa "ASN1_VALUE *val_in" | ||
| 29 | .Fa "BIO *in_bio" | ||
| 30 | .Fa "int flags" | ||
| 31 | .Fa "int ctype_nid" | ||
| 32 | .Fa "int econt_nid" | ||
| 33 | .Fa "STACK_OF(X509_ALGOR) *micalg" | ||
| 34 | .Fa "const ASN1_ITEM *it" | ||
| 35 | .Fc | ||
| 36 | .Sh DESCRIPTION | ||
| 37 | .Fn SMIME_write_ASN1 | ||
| 38 | generates an S/MIME message on | ||
| 39 | .Fa out_bio | ||
| 40 | by writing MIME 1.0 headers | ||
| 41 | followed by a BER- and base64-encoded serialization of | ||
| 42 | .Fa val_in , | ||
| 43 | which can be of the type | ||
| 44 | .Vt CMS_ContentInfo | ||
| 45 | or | ||
| 46 | .Vt PKCS7 | ||
| 47 | and has to match the | ||
| 48 | .Fa it | ||
| 49 | argument. | ||
| 50 | .Pp | ||
| 51 | The | ||
| 52 | .Fa flags | ||
| 53 | can be the logical OR of zero or more of the following bits: | ||
| 54 | .Bl -tag -width Ds | ||
| 55 | .It Dv PKCS7_REUSE_DIGEST | ||
| 56 | Skip the calls to | ||
| 57 | .Xr PKCS7_dataInit 3 | ||
| 58 | and | ||
| 59 | .Xr PKCS7_dataFinal 3 . | ||
| 60 | This flag has no effect unless | ||
| 61 | .Dv SMIME_DETACHED | ||
| 62 | is also set. | ||
| 63 | It is normally used if | ||
| 64 | .Fa out_bio | ||
| 65 | is already set up to calculate and finalize the digest when written through. | ||
| 66 | .It Dv SMIME_BINARY | ||
| 67 | If specified, this flag is passed through to | ||
| 68 | .Xr SMIME_crlf_copy 3 . | ||
| 69 | .It Dv SMIME_CRLFEOL | ||
| 70 | End MIME header lines with pairs of carriage return and newline characters. | ||
| 71 | By default, no carriage return characters are written | ||
| 72 | and header lines are ended with newline characters only. | ||
| 73 | .It Dv SMIME_DETACHED | ||
| 74 | Use cleartext signing. | ||
| 75 | Generate a | ||
| 76 | .Qq multipart/signed | ||
| 77 | S/MIME message using the | ||
| 78 | .Fa micalg | ||
| 79 | argument and ignoring the | ||
| 80 | .Fa ctype_nid | ||
| 81 | and | ||
| 82 | .Fa econt_nid | ||
| 83 | arguments. | ||
| 84 | The content is read from | ||
| 85 | .Fa in_bio . | ||
| 86 | If | ||
| 87 | .Fa in_bio | ||
| 88 | is a | ||
| 89 | .Dv NULL | ||
| 90 | pointer, this flag is ignored. | ||
| 91 | .Pp | ||
| 92 | If this flag is ignored or not specified, | ||
| 93 | the smime-type is chosen according to | ||
| 94 | .Fa ctype_nid | ||
| 95 | instead: | ||
| 96 | .Bl -tag -width Ds | ||
| 97 | .It Dv NID_pkcs7_enveloped | ||
| 98 | .Qq enveloped-data | ||
| 99 | .It Dv NID_pkcs7_signed | ||
| 100 | .Qq signed-receipt | ||
| 101 | if | ||
| 102 | .Fa econt_nid | ||
| 103 | is | ||
| 104 | .Dv NID_id_smime_ct_receipt | ||
| 105 | .br | ||
| 106 | .Qq signed-data | ||
| 107 | if | ||
| 108 | .Fa micalg | ||
| 109 | is not empty | ||
| 110 | .br | ||
| 111 | .Qq certs-only | ||
| 112 | if | ||
| 113 | .Fa micalg | ||
| 114 | is empty | ||
| 115 | .It Dv NID_id_smime_ct_compressedData | ||
| 116 | .Qq compressed-data | ||
| 117 | .El | ||
| 118 | .It Dv SMIME_OLDMIME | ||
| 119 | In Content-Type headers, use | ||
| 120 | .Qq application/x-pkcs7-mime | ||
| 121 | or | ||
| 122 | .Qq application/x-pkcs7-signature . | ||
| 123 | By default, | ||
| 124 | .Qq application/pkcs7-mime | ||
| 125 | or | ||
| 126 | .Qq application/pkcs7-signature | ||
| 127 | are used instead. | ||
| 128 | .It Dv SMIME_STREAM | ||
| 129 | Perform streaming by reading the content from | ||
| 130 | .Fa in_bio . | ||
| 131 | This only works if | ||
| 132 | .Dv SMIME_DETACHED | ||
| 133 | is not specified. | ||
| 134 | .It SMIME_TEXT | ||
| 135 | Prepend the line | ||
| 136 | .Qq Content-Type: text/plain | ||
| 137 | to the content. | ||
| 138 | This only makes sense if | ||
| 139 | .Dv SMIME_DETACHED | ||
| 140 | is also set. | ||
| 141 | It is ignored if the flag | ||
| 142 | .Dv SMIME_BINARY | ||
| 143 | is also set. | ||
| 144 | .El | ||
| 145 | .Sh RETURN VALUES | ||
| 146 | .Fn SMIME_write_ASN1 | ||
| 147 | is intended to return 1 on success or 0 on failure. | ||
| 148 | .Sh SEE ALSO | ||
| 149 | .Xr ASN1_item_i2d_bio 3 , | ||
| 150 | .Xr BIO_f_base64 3 , | ||
| 151 | .Xr BIO_new 3 , | ||
| 152 | .Xr SMIME_crlf_copy 3 , | ||
| 153 | .Xr SMIME_write_CMS 3 , | ||
| 154 | .Xr SMIME_write_PKCS7 3 , | ||
| 155 | .Xr X509_ALGOR_new 3 | ||
| 156 | .Sh HISTORY | ||
| 157 | .Fn SMIME_write_ASN1 | ||
| 158 | first appeared in OpenSSL 1.0.0 and has been available since | ||
| 159 | .Ox 4.9 . | ||
| 160 | .Sh BUGS | ||
| 161 | .Fn SMIME_write_ASN1 | ||
| 162 | ignores most errors and is likely to return 1 | ||
| 163 | even after producing corrupt or incomplete output. | ||
diff --git a/src/lib/libcrypto/man/SMIME_write_CMS.3 b/src/lib/libcrypto/man/SMIME_write_CMS.3 index c2c6b77e53..5f4c43bb7c 100644 --- a/src/lib/libcrypto/man/SMIME_write_CMS.3 +++ b/src/lib/libcrypto/man/SMIME_write_CMS.3 | |||
| @@ -1,7 +1,24 @@ | |||
| 1 | .\" $OpenBSD: SMIME_write_CMS.3,v 1.6 2021/12/13 17:24:39 schwarze Exp $ | 1 | .\" $OpenBSD: SMIME_write_CMS.3,v 1.9 2025/06/11 23:16:32 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file is a derived work. |
| 5 | .\" The changes are covered by the following Copyright and license: | ||
| 6 | .\" | ||
| 7 | .\" Copyright (c) 2021, 2025 Ingo Schwarze <schwarze@openbsd.org> | ||
| 8 | .\" | ||
| 9 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 10 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 11 | .\" copyright notice and this permission notice appear in all copies. | ||
| 12 | .\" | ||
| 13 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 14 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 15 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 16 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 17 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 18 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 19 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 20 | .\" | ||
| 21 | .\" The original file was written by Dr. Stephen Henson <steve@openssl.org>. | ||
| 5 | .\" Copyright (c) 2008 The OpenSSL Project. All rights reserved. | 22 | .\" Copyright (c) 2008 The OpenSSL Project. All rights reserved. |
| 6 | .\" | 23 | .\" |
| 7 | .\" Redistribution and use in source and binary forms, with or without | 24 | .\" Redistribution and use in source and binary forms, with or without |
| @@ -48,13 +65,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 67 | .\" |
| 51 | .Dd $Mdocdate: December 13 2021 $ | 68 | .Dd $Mdocdate: June 11 2025 $ |
| 52 | .Dt SMIME_WRITE_CMS 3 | 69 | .Dt SMIME_WRITE_CMS 3 |
| 53 | .Os | 70 | .Os |
| 54 | .Sh NAME | 71 | .Sh NAME |
| 55 | .Nm SMIME_write_CMS | 72 | .Nm SMIME_write_CMS |
| 56 | .Nd convert CMS structure to S/MIME format | 73 | .Nd convert CMS structure to S/MIME format |
| 57 | .Sh SYNOPSIS | 74 | .Sh SYNOPSIS |
| 75 | .Lb libcrypto | ||
| 58 | .In openssl/cms.h | 76 | .In openssl/cms.h |
| 59 | .Ft int | 77 | .Ft int |
| 60 | .Fo SMIME_write_CMS | 78 | .Fo SMIME_write_CMS |
| @@ -65,21 +83,35 @@ | |||
| 65 | .Fc | 83 | .Fc |
| 66 | .Sh DESCRIPTION | 84 | .Sh DESCRIPTION |
| 67 | .Fn SMIME_write_CMS | 85 | .Fn SMIME_write_CMS |
| 68 | adds the appropriate MIME headers to the | 86 | generates an S/MIME message on |
| 69 | .Fa cms | 87 | .Fa out |
| 70 | structure to produce an S/MIME message and writes it to | 88 | by writing MIME 1.0 headers |
| 71 | .Fa out . | 89 | followed by a BER- and base64-encoded serialization of |
| 90 | .Fa cms . | ||
| 91 | The BER encoding uses the DER format except as described for | ||
| 92 | .Dv CMS_STREAM | ||
| 93 | below. | ||
| 72 | If streaming is enabled, the content must be supplied in the | 94 | If streaming is enabled, the content must be supplied in the |
| 73 | .Fa data | 95 | .Fa data |
| 74 | argument. | 96 | argument. |
| 75 | .Pp | 97 | .Pp |
| 76 | The following | 98 | The |
| 77 | .Fa flags | 99 | .Fa flags |
| 78 | can be passed: | 100 | can be the logical OR of zero or more of the following bits: |
| 79 | .Bl -tag -width Ds | 101 | .Bl -tag -width Ds |
| 80 | .It Dv CMS_DETACHED | 102 | .It Dv CMS_DETACHED |
| 81 | Use cleartext signing. | 103 | Use cleartext signing and generate a |
| 82 | This option only makes sense if | 104 | .Qq multipart/signed |
| 105 | S/MIME message. | ||
| 106 | The content is read from | ||
| 107 | .Fa data . | ||
| 108 | If | ||
| 109 | .Fa data | ||
| 110 | is a | ||
| 111 | .Dv NULL | ||
| 112 | pointer, this flag is ignored. | ||
| 113 | .Pp | ||
| 114 | This flag is only supported if | ||
| 83 | .Fa cms | 115 | .Fa cms |
| 84 | is of the type | 116 | is of the type |
| 85 | .Vt SignedData | 117 | .Vt SignedData |
| @@ -94,13 +126,46 @@ is not set, the data must be read twice: | |||
| 94 | once to compute the signature in | 126 | once to compute the signature in |
| 95 | .Xr CMS_sign 3 | 127 | .Xr CMS_sign 3 |
| 96 | and once to output the S/MIME message. | 128 | and once to output the S/MIME message. |
| 97 | .It Dv CMS_TEXT | 129 | .Pp |
| 98 | Add MIME headers for type text/plain to the content. | 130 | If |
| 99 | This only makes sense if | 131 | .Dv CMS_DETACHED |
| 132 | is ignored or not specified, the smime-type is chosen according to | ||
| 133 | .Xr CMS_get0_type 3 : | ||
| 134 | .Bl -tag -width Ds | ||
| 135 | .It Dv NID_pkcs7_enveloped | ||
| 136 | .Qq enveloped-data | ||
| 137 | .It Dv NID_pkcs7_signed | ||
| 138 | .Bl -tag -width Msigned-receiptM -compact | ||
| 139 | .It Qq signed-receipt | ||
| 140 | if | ||
| 141 | .Xr CMS_get0_eContentType 3 | ||
| 142 | is | ||
| 143 | .Dv NID_id_smime_ct_receipt | ||
| 144 | .It Qq signed-data | ||
| 145 | if | ||
| 146 | .Fa cms | ||
| 147 | specifies any digest algorithm | ||
| 148 | .It Qq certs-only | ||
| 149 | otherwise | ||
| 150 | .El | ||
| 151 | .It Dv NID_id_smime_ct_compressedData | ||
| 152 | .Qq compressed-data | ||
| 153 | .El | ||
| 154 | .It Dv CMS_REUSE_DIGEST | ||
| 155 | Skip the calls to | ||
| 156 | .Xr CMS_dataInit 3 | ||
| 157 | and | ||
| 158 | .Xr CMS_dataFinal 3 . | ||
| 159 | This flag has no effect unless | ||
| 100 | .Dv CMS_DETACHED | 160 | .Dv CMS_DETACHED |
| 101 | is also set. | 161 | is also set. |
| 102 | .It Dv CMS_STREAM | 162 | .It Dv CMS_STREAM |
| 103 | Perform streaming. | 163 | Perform streaming by reading the content from |
| 164 | .Fa data . | ||
| 165 | This only works if | ||
| 166 | .Dv CMS_DETACHED | ||
| 167 | is not specified. | ||
| 168 | .Pp | ||
| 104 | This flag should only be set if | 169 | This flag should only be set if |
| 105 | .Dv CMS_STREAM | 170 | .Dv CMS_STREAM |
| 106 | was also passed to the function that created | 171 | was also passed to the function that created |
| @@ -111,17 +176,38 @@ constructed encoding except in the case of | |||
| 111 | .Vt SignedData | 176 | .Vt SignedData |
| 112 | with detached content where the content is absent and DER format is | 177 | with detached content where the content is absent and DER format is |
| 113 | used. | 178 | used. |
| 179 | .It Dv CMS_TEXT | ||
| 180 | Prepend the line | ||
| 181 | .Qq Content-Type: text/plain | ||
| 182 | to the content. | ||
| 183 | This only makes sense if | ||
| 184 | .Dv CMS_DETACHED | ||
| 185 | is also set. | ||
| 186 | It is ignored if the flag | ||
| 187 | .Dv SMIME_BINARY | ||
| 188 | is also set. | ||
| 189 | .It Dv SMIME_BINARY | ||
| 190 | If specified, this flag is passed through to | ||
| 191 | .Xr SMIME_crlf_copy 3 . | ||
| 192 | .It Dv SMIME_CRLFEOL | ||
| 193 | End MIME header lines with pairs of carriage return and newline characters. | ||
| 194 | By default, no carriage return characters are written | ||
| 195 | and header lines are ended with newline characters only. | ||
| 114 | .El | 196 | .El |
| 115 | .Sh RETURN VALUES | 197 | .Sh RETURN VALUES |
| 116 | .Fn SMIME_write_CMS | 198 | .Fn SMIME_write_CMS |
| 117 | returns 1 for success or 0 for failure. | 199 | is intended to return 1 on success or 0 on failure. |
| 118 | .Sh SEE ALSO | 200 | .Sh SEE ALSO |
| 201 | .Xr BIO_f_base64 3 , | ||
| 202 | .Xr BIO_new 3 , | ||
| 119 | .Xr CMS_ContentInfo_new 3 , | 203 | .Xr CMS_ContentInfo_new 3 , |
| 120 | .Xr CMS_encrypt 3 , | 204 | .Xr CMS_encrypt 3 , |
| 121 | .Xr CMS_sign 3 , | 205 | .Xr CMS_sign 3 , |
| 122 | .Xr d2i_CMS_ContentInfo 3 , | 206 | .Xr d2i_CMS_ContentInfo 3 , |
| 123 | .Xr ERR_get_error 3 , | 207 | .Xr ERR_get_error 3 , |
| 124 | .Xr SMIME_write_ASN1 3 | 208 | .Xr SMIME_crlf_copy 3 , |
| 209 | .Xr SMIME_read_CMS 3 , | ||
| 210 | .Xr SMIME_write_PKCS7 3 | ||
| 125 | .Sh HISTORY | 211 | .Sh HISTORY |
| 126 | .Fn SMIME_write_CMS | 212 | .Fn SMIME_write_CMS |
| 127 | first appeared in OpenSSL 0.9.8h | 213 | first appeared in OpenSSL 0.9.8h |
| @@ -129,5 +215,9 @@ and has been available since | |||
| 129 | .Ox 6.7 . | 215 | .Ox 6.7 . |
| 130 | .Sh BUGS | 216 | .Sh BUGS |
| 131 | .Fn SMIME_write_CMS | 217 | .Fn SMIME_write_CMS |
| 218 | ignores most errors and is likely to return 1 | ||
| 219 | even after producing corrupt or incomplete output. | ||
| 220 | .Pp | ||
| 221 | .Fn SMIME_write_CMS | ||
| 132 | always base64 encodes CMS structures. | 222 | always base64 encodes CMS structures. |
| 133 | There should be an option to disable this. | 223 | There should be an option to disable this. |
diff --git a/src/lib/libcrypto/man/SMIME_write_PKCS7.3 b/src/lib/libcrypto/man/SMIME_write_PKCS7.3 index c1a9f051d0..5e344d9c63 100644 --- a/src/lib/libcrypto/man/SMIME_write_PKCS7.3 +++ b/src/lib/libcrypto/man/SMIME_write_PKCS7.3 | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | .\" $OpenBSD: SMIME_write_PKCS7.3,v 1.9 2021/12/14 15:46:48 schwarze Exp $ | 1 | .\" $OpenBSD: SMIME_write_PKCS7.3,v 1.12 2025/06/11 23:16:32 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| 5 | .\" The changes are covered by the following Copyright and license: | 5 | .\" The changes are covered by the following Copyright and license: |
| 6 | .\" | 6 | .\" |
| 7 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 7 | .\" Copyright (c) 2021, 2025 Ingo Schwarze <schwarze@openbsd.org> |
| 8 | .\" | 8 | .\" |
| 9 | .\" Permission to use, copy, modify, and distribute this software for any | 9 | .\" Permission to use, copy, modify, and distribute this software for any |
| 10 | .\" purpose with or without fee is hereby granted, provided that the above | 10 | .\" purpose with or without fee is hereby granted, provided that the above |
| @@ -66,13 +66,14 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: December 14 2021 $ | 69 | .Dd $Mdocdate: June 11 2025 $ |
| 70 | .Dt SMIME_WRITE_PKCS7 3 | 70 | .Dt SMIME_WRITE_PKCS7 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| 73 | .Nm SMIME_write_PKCS7 | 73 | .Nm SMIME_write_PKCS7 |
| 74 | .Nd convert PKCS#7 structure to S/MIME format | 74 | .Nd convert PKCS#7 structure to S/MIME format |
| 75 | .Sh SYNOPSIS | 75 | .Sh SYNOPSIS |
| 76 | .Lb libcrypto | ||
| 76 | .In openssl/pkcs7.h | 77 | .In openssl/pkcs7.h |
| 77 | .Ft int | 78 | .Ft int |
| 78 | .Fo SMIME_write_PKCS7 | 79 | .Fo SMIME_write_PKCS7 |
| @@ -83,48 +84,81 @@ | |||
| 83 | .Fc | 84 | .Fc |
| 84 | .Sh DESCRIPTION | 85 | .Sh DESCRIPTION |
| 85 | .Fn SMIME_write_PKCS7 | 86 | .Fn SMIME_write_PKCS7 |
| 86 | adds the appropriate MIME headers to a PKCS#7 structure to produce an | 87 | generates an S/MIME message on |
| 87 | S/MIME message. | ||
| 88 | .Pp | ||
| 89 | .Fa out | 88 | .Fa out |
| 90 | is the | 89 | by writing MIME 1.0 headers |
| 91 | .Vt BIO | 90 | followed by a BER- and base64-encoded serialization of |
| 92 | to write the data to. | 91 | .Fa p7 . |
| 93 | .Fa p7 | 92 | The BER encoding uses the DER format except as described for |
| 94 | is the appropriate | 93 | .Dv PKCS7_STREAM |
| 95 | .Vt PKCS7 | 94 | below. |
| 96 | structure. | ||
| 97 | If streaming is enabled, then the content must be supplied in the | 95 | If streaming is enabled, then the content must be supplied in the |
| 98 | .Fa data | 96 | .Fa data |
| 99 | argument. | 97 | argument. |
| 100 | .Fa flags | ||
| 101 | is an optional set of flags. | ||
| 102 | .Pp | 98 | .Pp |
| 103 | The following flags can be passed in the | 99 | The |
| 104 | .Fa flags | 100 | .Fa flags |
| 105 | parameter. | 101 | can be the logical OR of zero or more of the following bits: |
| 106 | .Pp | 102 | .Bl -tag -width Ds |
| 103 | .It Dv PKCS7_DETACHED | ||
| 104 | Use cleartext signing and generate a | ||
| 105 | .Qq multipart/signed | ||
| 106 | S/MIME message. | ||
| 107 | The content is read from | ||
| 108 | .Fa data . | ||
| 107 | If | 109 | If |
| 108 | .Dv PKCS7_DETACHED | 110 | .Fa data |
| 109 | is set, then cleartext signing will be used. | 111 | is a |
| 110 | This option only makes sense for signedData where | 112 | .Dv NULL |
| 113 | pointer, this flag is ignored. | ||
| 114 | .Pp | ||
| 115 | This flag is only supported for signedData where | ||
| 111 | .Dv PKCS7_DETACHED | 116 | .Dv PKCS7_DETACHED |
| 112 | is also set when | 117 | is also set when |
| 113 | .Xr PKCS7_sign 3 | 118 | .Xr PKCS7_sign 3 |
| 114 | is also called. | 119 | is called. |
| 115 | .Pp | 120 | .Pp |
| 116 | If the | 121 | If |
| 117 | .Dv PKCS7_TEXT | 122 | .Dv PKCS7_STREAM |
| 118 | flag is set, MIME headers for type | 123 | is not set, the data must be read twice: once to compute the |
| 119 | .Sy text/plain | 124 | signature in |
| 120 | are added to the content. | 125 | .Xr PKCS7_sign 3 |
| 121 | This only makes sense if | 126 | and once to output the S/MIME message. |
| 127 | .Pp | ||
| 128 | If | ||
| 129 | .Dv PKCS7_DETACHED | ||
| 130 | is ignored or not specified, the smime-type is chosen according to the type of | ||
| 131 | .Fa p7 : | ||
| 132 | .Bl -tag -width Ds | ||
| 133 | .It Dv NID_pkcs7_enveloped | ||
| 134 | .Qq enveloped-data | ||
| 135 | .It Dv NID_pkcs7_signed | ||
| 136 | .Bl -tag -width Msigned-dataM -compact | ||
| 137 | .It Qq signed-data | ||
| 138 | if | ||
| 139 | .Fa p7 | ||
| 140 | specifies any digest algorithm | ||
| 141 | .It Qq certs-only | ||
| 142 | otherwise | ||
| 143 | .El | ||
| 144 | .It Dv NID_id_smime_ct_compressedData | ||
| 145 | .Qq compressed-data | ||
| 146 | .El | ||
| 147 | .It Dv PKCS7_REUSE_DIGEST | ||
| 148 | Skip the calls to | ||
| 149 | .Xr PKCS7_dataInit 3 | ||
| 150 | and | ||
| 151 | .Xr PKCS7_dataFinal 3 . | ||
| 152 | This flag has no effect unless | ||
| 122 | .Dv PKCS7_DETACHED | 153 | .Dv PKCS7_DETACHED |
| 123 | is also set. | 154 | is also set. |
| 155 | .It Dv PKCS7_STREAM | ||
| 156 | Perform streaming by reading the content from | ||
| 157 | .Fa data . | ||
| 158 | This only works if | ||
| 159 | .Dv PKCS7_DETACHED | ||
| 160 | is not specified. | ||
| 124 | .Pp | 161 | .Pp |
| 125 | If the | ||
| 126 | .Dv PKCS7_STREAM | ||
| 127 | flag is set, streaming is performed. | ||
| 128 | This flag should only be set if | 162 | This flag should only be set if |
| 129 | .Dv PKCS7_STREAM | 163 | .Dv PKCS7_STREAM |
| 130 | was also set in the previous call to | 164 | was also set in the previous call to |
| @@ -132,13 +166,28 @@ was also set in the previous call to | |||
| 132 | or | 166 | or |
| 133 | .Xr PKCS7_encrypt 3 . | 167 | .Xr PKCS7_encrypt 3 . |
| 134 | .Pp | 168 | .Pp |
| 135 | The bit | 169 | The content is output in BER format using indefinite length constructed |
| 136 | .Dv SMIME_OLDMIME | 170 | encoding except in the case of signed data with detached content |
| 137 | is inverted before passing on the | 171 | where the content is absent and DER format is used. |
| 138 | .Fa flags | 172 | .It Dv PKCS7_TEXT |
| 139 | to | 173 | Prepend the line |
| 140 | .Xr SMIME_write_ASN1 3 . | 174 | .Qq Content-Type: text/plain |
| 141 | Consequently, if this bit is set in the | 175 | to the content. |
| 176 | This only makes sense if | ||
| 177 | .Dv PKCS7_DETACHED | ||
| 178 | is also set. | ||
| 179 | It is ignored if the flag | ||
| 180 | .Dv SMIME_BINARY | ||
| 181 | is also set. | ||
| 182 | .It Dv SMIME_BINARY | ||
| 183 | If specified, this flag is passed through to | ||
| 184 | .Xr SMIME_crlf_copy 3 . | ||
| 185 | .It Dv SMIME_CRLFEOL | ||
| 186 | End MIME header lines with pairs of carriage return and newline characters. | ||
| 187 | By default, no carriage return characters are written | ||
| 188 | and header lines are ended with newline characters only. | ||
| 189 | .It Dv SMIME_OLDMIME | ||
| 190 | If this bit is set in the | ||
| 142 | .Fa flags | 191 | .Fa flags |
| 143 | argument, | 192 | argument, |
| 144 | .Qq application/pkcs7-mime | 193 | .Qq application/pkcs7-mime |
| @@ -150,35 +199,30 @@ Otherwise, | |||
| 150 | or | 199 | or |
| 151 | .Qq application/x-pkcs7-signature | 200 | .Qq application/x-pkcs7-signature |
| 152 | is used. | 201 | is used. |
| 153 | .Pp | 202 | .El |
| 154 | If cleartext signing is being used and | ||
| 155 | .Dv PKCS7_STREAM | ||
| 156 | is not set, then the data must be read twice: once to compute the | ||
| 157 | signature in | ||
| 158 | .Xr PKCS7_sign 3 | ||
| 159 | and once to output the S/MIME message. | ||
| 160 | .Pp | ||
| 161 | If streaming is performed, the content is output in BER format using | ||
| 162 | indefinite length constructed encoding except in the case of signed | ||
| 163 | data with detached content where the content is absent and DER | ||
| 164 | format is used. | ||
| 165 | .Sh RETURN VALUES | 203 | .Sh RETURN VALUES |
| 166 | Upon successful completion, 1 is returned; | 204 | .Fn SMIME_write_PKCS7 |
| 167 | otherwise 0 is returned and an error code can be retrieved with | 205 | is intended to return 1 on success or 0 on failure. |
| 168 | .Xr ERR_get_error 3 . | ||
| 169 | .Sh SEE ALSO | 206 | .Sh SEE ALSO |
| 207 | .Xr BIO_f_base64 3 , | ||
| 208 | .Xr BIO_new 3 , | ||
| 170 | .Xr i2d_PKCS7_bio_stream 3 , | 209 | .Xr i2d_PKCS7_bio_stream 3 , |
| 171 | .Xr PEM_write_bio_PKCS7_stream 3 , | 210 | .Xr PEM_write_bio_PKCS7_stream 3 , |
| 172 | .Xr PEM_write_PKCS7 3 , | 211 | .Xr PEM_write_PKCS7 3 , |
| 173 | .Xr PKCS7_final 3 , | 212 | .Xr PKCS7_final 3 , |
| 174 | .Xr PKCS7_new 3 , | 213 | .Xr PKCS7_new 3 , |
| 214 | .Xr SMIME_crlf_copy 3 , | ||
| 175 | .Xr SMIME_read_PKCS7 3 , | 215 | .Xr SMIME_read_PKCS7 3 , |
| 176 | .Xr SMIME_write_ASN1 3 | 216 | .Xr SMIME_write_CMS 3 |
| 177 | .Sh HISTORY | 217 | .Sh HISTORY |
| 178 | .Fn SMIME_write_PKCS7 | 218 | .Fn SMIME_write_PKCS7 |
| 179 | first appeared in OpenSSL 0.9.5 and has been available since | 219 | first appeared in OpenSSL 0.9.5 and has been available since |
| 180 | .Ox 2.7 . | 220 | .Ox 2.7 . |
| 181 | .Sh BUGS | 221 | .Sh BUGS |
| 182 | .Fn SMIME_write_PKCS7 | 222 | .Fn SMIME_write_PKCS7 |
| 223 | ignores most errors and is likely to return 1 | ||
| 224 | even after producing corrupt or incomplete output. | ||
| 225 | .Pp | ||
| 226 | .Fn SMIME_write_PKCS7 | ||
| 183 | always base64 encodes PKCS#7 structures. | 227 | always base64 encodes PKCS#7 structures. |
| 184 | There should be an option to disable this. | 228 | There should be an option to disable this. |
diff --git a/src/lib/libcrypto/man/STACK_OF.3 b/src/lib/libcrypto/man/STACK_OF.3 index 4c627eed9b..38bca99cf6 100644 --- a/src/lib/libcrypto/man/STACK_OF.3 +++ b/src/lib/libcrypto/man/STACK_OF.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: STACK_OF.3,v 1.5 2021/10/24 13:10:46 schwarze Exp $ | 1 | .\" $OpenBSD: STACK_OF.3,v 1.6 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: October 24 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt STACK_OF 3 | 18 | .Dt STACK_OF 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm STACK_OF | 21 | .Nm STACK_OF |
| 22 | .Nd variable-sized arrays of pointers, called OpenSSL stacks | 22 | .Nd variable-sized arrays of pointers, called OpenSSL stacks |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/safestack.h | 25 | .In openssl/safestack.h |
| 25 | .Fn STACK_OF type | 26 | .Fn STACK_OF type |
| 26 | .Sh DESCRIPTION | 27 | .Sh DESCRIPTION |
diff --git a/src/lib/libcrypto/man/TS_REQ_new.3 b/src/lib/libcrypto/man/TS_REQ_new.3 index 8dbd15ea7e..796b58f4f8 100644 --- a/src/lib/libcrypto/man/TS_REQ_new.3 +++ b/src/lib/libcrypto/man/TS_REQ_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: TS_REQ_new.3,v 1.6 2019/06/06 01:06:59 schwarze Exp $ | 1 | .\" $OpenBSD: TS_REQ_new.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: June 6 2019 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt TS_REQ_NEW 3 | 18 | .Dt TS_REQ_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -32,6 +32,7 @@ | |||
| 32 | .Nm TS_MSG_IMPRINT_free | 32 | .Nm TS_MSG_IMPRINT_free |
| 33 | .Nd X.509 time-stamp protocol | 33 | .Nd X.509 time-stamp protocol |
| 34 | .Sh SYNOPSIS | 34 | .Sh SYNOPSIS |
| 35 | .Lb libcrypto | ||
| 35 | .In openssl/ts.h | 36 | .In openssl/ts.h |
| 36 | .Ft TS_REQ * | 37 | .Ft TS_REQ * |
| 37 | .Fn TS_REQ_new void | 38 | .Fn TS_REQ_new void |
diff --git a/src/lib/libcrypto/man/UI_create_method.3 b/src/lib/libcrypto/man/UI_create_method.3 index ffd6b98157..a116baaa79 100644 --- a/src/lib/libcrypto/man/UI_create_method.3 +++ b/src/lib/libcrypto/man/UI_create_method.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: UI_create_method.3,v 1.6 2023/05/22 19:38:04 tb Exp $ | 1 | .\" $OpenBSD: UI_create_method.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL UI_create_method.pod 8e3d46e5 Mar 11 10:51:04 2017 +0100 | 2 | .\" OpenSSL UI_create_method.pod 8e3d46e5 Mar 11 10:51:04 2017 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Richard Levitte <levitte@openssl.org>. | 4 | .\" This file was written by Richard Levitte <levitte@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: May 22 2023 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt UI_CREATE_METHOD 3 | 52 | .Dt UI_CREATE_METHOD 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -68,6 +68,7 @@ | |||
| 68 | .Nm UI_method_get_prompt_constructor | 68 | .Nm UI_method_get_prompt_constructor |
| 69 | .Nd user interface method creation and destruction | 69 | .Nd user interface method creation and destruction |
| 70 | .Sh SYNOPSIS | 70 | .Sh SYNOPSIS |
| 71 | .Lb libcrypto | ||
| 71 | .In openssl/ui.h | 72 | .In openssl/ui.h |
| 72 | .Ft UI_METHOD * | 73 | .Ft UI_METHOD * |
| 73 | .Fo UI_create_method | 74 | .Fo UI_create_method |
diff --git a/src/lib/libcrypto/man/UI_get_string_type.3 b/src/lib/libcrypto/man/UI_get_string_type.3 index bc0449a90e..84c774d94d 100644 --- a/src/lib/libcrypto/man/UI_get_string_type.3 +++ b/src/lib/libcrypto/man/UI_get_string_type.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: UI_get_string_type.3,v 1.4 2018/03/22 21:08:22 schwarze Exp $ | 1 | .\" $OpenBSD: UI_get_string_type.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL UI_STRING.pod e9c9971b Jul 1 18:28:50 2017 +0200 | 2 | .\" OpenSSL UI_STRING.pod e9c9971b Jul 1 18:28:50 2017 +0200 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Richard Levitte <levitte@openssl.org> | 4 | .\" This file was written by Richard Levitte <levitte@openssl.org> |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 22 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt UI_GET_STRING_TYPE 3 | 52 | .Dt UI_GET_STRING_TYPE 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -63,6 +63,7 @@ | |||
| 63 | .Nm UI_set_result | 63 | .Nm UI_set_result |
| 64 | .Nd OpenSSL user interface string parsing | 64 | .Nd OpenSSL user interface string parsing |
| 65 | .Sh SYNOPSIS | 65 | .Sh SYNOPSIS |
| 66 | .Lb libcrypto | ||
| 66 | .In openssl/ui.h | 67 | .In openssl/ui.h |
| 67 | .Bd -literal | 68 | .Bd -literal |
| 68 | enum UI_string_types { | 69 | enum UI_string_types { |
diff --git a/src/lib/libcrypto/man/UI_new.3 b/src/lib/libcrypto/man/UI_new.3 index e55477f31e..853219aac2 100644 --- a/src/lib/libcrypto/man/UI_new.3 +++ b/src/lib/libcrypto/man/UI_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: UI_new.3,v 1.13 2025/03/09 15:25:14 tb Exp $ | 1 | .\" $OpenBSD: UI_new.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 78b19e90 Jan 11 00:12:01 2017 +0100 | 2 | .\" full merge up to: OpenSSL 78b19e90 Jan 11 00:12:01 2017 +0100 |
| 3 | .\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 | 3 | .\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 |
| 4 | .\" | 4 | .\" |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: March 9 2025 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt UI_NEW 3 | 53 | .Dt UI_NEW 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -80,6 +80,7 @@ | |||
| 80 | .Nm UI_null | 80 | .Nm UI_null |
| 81 | .Nd New User Interface | 81 | .Nd New User Interface |
| 82 | .Sh SYNOPSIS | 82 | .Sh SYNOPSIS |
| 83 | .Lb libcrypto | ||
| 83 | .In openssl/ui.h | 84 | .In openssl/ui.h |
| 84 | .Ft UI * | 85 | .Ft UI * |
| 85 | .Fn UI_new void | 86 | .Fn UI_new void |
diff --git a/src/lib/libcrypto/man/X25519.3 b/src/lib/libcrypto/man/X25519.3 index a327f8c7b2..3686df9bfa 100644 --- a/src/lib/libcrypto/man/X25519.3 +++ b/src/lib/libcrypto/man/X25519.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X25519.3,v 1.7 2022/12/15 17:20:48 schwarze Exp $ | 1 | .\" $OpenBSD: X25519.3,v 1.8 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" contains some text from: BoringSSL curve25519.h, curve25519.c | 2 | .\" contains some text from: BoringSSL curve25519.h, curve25519.c |
| 3 | .\" content also checked up to: OpenSSL f929439f Mar 15 12:19:16 2018 +0000 | 3 | .\" content also checked up to: OpenSSL f929439f Mar 15 12:19:16 2018 +0000 |
| 4 | .\" | 4 | .\" |
| @@ -24,7 +24,7 @@ | |||
| 24 | .\" by Daniel J. Bernstein and others that are included in SUPERCOP | 24 | .\" by Daniel J. Bernstein and others that are included in SUPERCOP |
| 25 | .\" and that Adam Langley's BoringSSL implementation is based on. | 25 | .\" and that Adam Langley's BoringSSL implementation is based on. |
| 26 | .\" | 26 | .\" |
| 27 | .Dd $Mdocdate: December 15 2022 $ | 27 | .Dd $Mdocdate: June 8 2025 $ |
| 28 | .Dt X25519 3 | 28 | .Dt X25519 3 |
| 29 | .Os | 29 | .Os |
| 30 | .Sh NAME | 30 | .Sh NAME |
| @@ -35,6 +35,7 @@ | |||
| 35 | .Nm ED25519_verify | 35 | .Nm ED25519_verify |
| 36 | .Nd Elliptic Curve Diffie-Hellman and signature primitives based on Curve25519 | 36 | .Nd Elliptic Curve Diffie-Hellman and signature primitives based on Curve25519 |
| 37 | .Sh SYNOPSIS | 37 | .Sh SYNOPSIS |
| 38 | .Lb libcrypto | ||
| 38 | .In openssl/curve25519.h | 39 | .In openssl/curve25519.h |
| 39 | .Ft int | 40 | .Ft int |
| 40 | .Fo X25519 | 41 | .Fo X25519 |
diff --git a/src/lib/libcrypto/man/X509V3_EXT_get_nid.3 b/src/lib/libcrypto/man/X509V3_EXT_get_nid.3 index ad153c36d0..78975874aa 100644 --- a/src/lib/libcrypto/man/X509V3_EXT_get_nid.3 +++ b/src/lib/libcrypto/man/X509V3_EXT_get_nid.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509V3_EXT_get_nid.3,v 1.8 2024/12/24 09:48:56 schwarze Exp $ | 1 | .\" $OpenBSD: X509V3_EXT_get_nid.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2024 Theo Buehler <tb@openbsd.org> | 3 | .\" Copyright (c) 2024 Theo Buehler <tb@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 24 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509V3_EXT_GET_NID 3 | 18 | .Dt X509V3_EXT_GET_NID 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm X509V3_EXT_get | 22 | .Nm X509V3_EXT_get |
| 23 | .Nd retrieve X.509v3 certificate extension methods | 23 | .Nd retrieve X.509v3 certificate extension methods |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/x509v3.h | 26 | .In openssl/x509v3.h |
| 26 | .Ft const X509V3_EXT_METHOD * | 27 | .Ft const X509V3_EXT_METHOD * |
| 27 | .Fo X509V3_EXT_get_nid | 28 | .Fo X509V3_EXT_get_nid |
diff --git a/src/lib/libcrypto/man/X509V3_EXT_print.3 b/src/lib/libcrypto/man/X509V3_EXT_print.3 index edb97d3a36..8705e4d5ac 100644 --- a/src/lib/libcrypto/man/X509V3_EXT_print.3 +++ b/src/lib/libcrypto/man/X509V3_EXT_print.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509V3_EXT_print.3,v 1.3 2024/12/28 10:19:45 schwarze Exp $ | 1 | .\" $OpenBSD: X509V3_EXT_print.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021, 2024 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021, 2024 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 28 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509V3_EXT_PRINT 3 | 18 | .Dt X509V3_EXT_PRINT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm X509V3_EXT_print_fp | 22 | .Nm X509V3_EXT_print_fp |
| 23 | .Nd pretty-print an X.509 extension | 23 | .Nd pretty-print an X.509 extension |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/x509v3.h | 26 | .In openssl/x509v3.h |
| 26 | .Ft int | 27 | .Ft int |
| 27 | .Fo X509V3_EXT_print | 28 | .Fo X509V3_EXT_print |
diff --git a/src/lib/libcrypto/man/X509V3_extensions_print.3 b/src/lib/libcrypto/man/X509V3_extensions_print.3 index 8c43fe9b01..d95a4da01e 100644 --- a/src/lib/libcrypto/man/X509V3_extensions_print.3 +++ b/src/lib/libcrypto/man/X509V3_extensions_print.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509V3_extensions_print.3,v 1.2 2021/11/26 13:48:21 jsg Exp $ | 1 | .\" $OpenBSD: X509V3_extensions_print.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: November 26 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509V3_EXTENSIONS_PRINT 3 | 18 | .Dt X509V3_EXTENSIONS_PRINT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm X509V3_extensions_print | 21 | .Nm X509V3_extensions_print |
| 22 | .Nd pretty-print an array of X.509 extensions | 22 | .Nd pretty-print an array of X.509 extensions |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/x509v3.h | 25 | .In openssl/x509v3.h |
| 25 | .Ft int | 26 | .Ft int |
| 26 | .Fo X509V3_extensions_print | 27 | .Fo X509V3_extensions_print |
diff --git a/src/lib/libcrypto/man/X509V3_get_d2i.3 b/src/lib/libcrypto/man/X509V3_get_d2i.3 index bf442dc846..7920fca09f 100644 --- a/src/lib/libcrypto/man/X509V3_get_d2i.3 +++ b/src/lib/libcrypto/man/X509V3_get_d2i.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509V3_get_d2i.3,v 1.25 2024/12/31 20:17:00 tb Exp $ | 1 | .\" $OpenBSD: X509V3_get_d2i.3,v 1.26 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL ff7fbfd5 Nov 2 11:52:01 2015 +0000 | 2 | .\" full merge up to: OpenSSL ff7fbfd5 Nov 2 11:52:01 2015 +0000 |
| 3 | .\" selective merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 3 | .\" selective merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 4 | .\" | 4 | .\" |
| @@ -67,7 +67,7 @@ | |||
| 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 69 | .\" | 69 | .\" |
| 70 | .Dd $Mdocdate: December 31 2024 $ | 70 | .Dd $Mdocdate: June 8 2025 $ |
| 71 | .Dt X509V3_GET_D2I 3 | 71 | .Dt X509V3_GET_D2I 3 |
| 72 | .Os | 72 | .Os |
| 73 | .Sh NAME | 73 | .Sh NAME |
| @@ -87,6 +87,7 @@ | |||
| 87 | .Nm X509_get0_uids | 87 | .Nm X509_get0_uids |
| 88 | .Nd X509 extension decode and encode functions | 88 | .Nd X509 extension decode and encode functions |
| 89 | .Sh SYNOPSIS | 89 | .Sh SYNOPSIS |
| 90 | .Lb libcrypto | ||
| 90 | .In openssl/x509v3.h | 91 | .In openssl/x509v3.h |
| 91 | .Ft void * | 92 | .Ft void * |
| 92 | .Fo X509V3_get_d2i | 93 | .Fo X509V3_get_d2i |
diff --git a/src/lib/libcrypto/man/X509V3_parse_list.3 b/src/lib/libcrypto/man/X509V3_parse_list.3 index 447f1a5e94..385f8ad9c8 100644 --- a/src/lib/libcrypto/man/X509V3_parse_list.3 +++ b/src/lib/libcrypto/man/X509V3_parse_list.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509V3_parse_list.3,v 1.2 2024/12/24 09:48:56 schwarze Exp $ | 1 | .\" $OpenBSD: X509V3_parse_list.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 24 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509V3_PARSE_LIST 3 | 18 | .Dt X509V3_PARSE_LIST 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm X509V3_conf_free | 22 | .Nm X509V3_conf_free |
| 23 | .Nd create and destroy CONF_VALUE objects | 23 | .Nd create and destroy CONF_VALUE objects |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/x509v3.h | 26 | .In openssl/x509v3.h |
| 26 | .Ft STACK_OF(CONF_VALUE) * | 27 | .Ft STACK_OF(CONF_VALUE) * |
| 27 | .Fn X509V3_parse_list "const char *string" | 28 | .Fn X509V3_parse_list "const char *string" |
diff --git a/src/lib/libcrypto/man/X509_ALGOR_dup.3 b/src/lib/libcrypto/man/X509_ALGOR_dup.3 index ef7ca75863..bc9ba4b77d 100644 --- a/src/lib/libcrypto/man/X509_ALGOR_dup.3 +++ b/src/lib/libcrypto/man/X509_ALGOR_dup.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_ALGOR_dup.3,v 1.23 2024/03/19 17:34:05 tb Exp $ | 1 | .\" $OpenBSD: X509_ALGOR_dup.3,v 1.24 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL 4692340e Jun 7 15:49:08 2016 -0400 | 2 | .\" OpenSSL 4692340e Jun 7 15:49:08 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: March 19 2024 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt X509_ALGOR_DUP 3 | 70 | .Dt X509_ALGOR_DUP 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -78,6 +78,7 @@ | |||
| 78 | .Nm X509_ALGOR_cmp | 78 | .Nm X509_ALGOR_cmp |
| 79 | .Nd create, change, and inspect algorithm identifiers | 79 | .Nd create, change, and inspect algorithm identifiers |
| 80 | .Sh SYNOPSIS | 80 | .Sh SYNOPSIS |
| 81 | .Lb libcrypto | ||
| 81 | .In openssl/x509.h | 82 | .In openssl/x509.h |
| 82 | .Ft X509_ALGOR * | 83 | .Ft X509_ALGOR * |
| 83 | .Fn X509_ALGOR_new void | 84 | .Fn X509_ALGOR_new void |
diff --git a/src/lib/libcrypto/man/X509_ATTRIBUTE_get0_object.3 b/src/lib/libcrypto/man/X509_ATTRIBUTE_get0_object.3 index 4212e27d7e..b452fcbea2 100644 --- a/src/lib/libcrypto/man/X509_ATTRIBUTE_get0_object.3 +++ b/src/lib/libcrypto/man/X509_ATTRIBUTE_get0_object.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_ATTRIBUTE_get0_object.3,v 1.2 2021/10/21 16:26:34 schwarze Exp $ | 1 | .\" $OpenBSD: X509_ATTRIBUTE_get0_object.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: October 21 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_ATTRIBUTE_GET0_OBJECT 3 | 18 | .Dt X509_ATTRIBUTE_GET0_OBJECT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -27,6 +27,7 @@ | |||
| 27 | .\" The type is called "Attribute" with capital "A", not "attribute". | 27 | .\" The type is called "Attribute" with capital "A", not "attribute". |
| 28 | .Nd X.501 Attribute read accessors | 28 | .Nd X.501 Attribute read accessors |
| 29 | .Sh SYNOPSIS | 29 | .Sh SYNOPSIS |
| 30 | .Lb libcrypto | ||
| 30 | .In openssl/x509.h | 31 | .In openssl/x509.h |
| 31 | .Ft ASN1_OBJECT * | 32 | .Ft ASN1_OBJECT * |
| 32 | .Fo X509_ATTRIBUTE_get0_object | 33 | .Fo X509_ATTRIBUTE_get0_object |
diff --git a/src/lib/libcrypto/man/X509_ATTRIBUTE_new.3 b/src/lib/libcrypto/man/X509_ATTRIBUTE_new.3 index cc2b27d4c0..63a5c58169 100644 --- a/src/lib/libcrypto/man/X509_ATTRIBUTE_new.3 +++ b/src/lib/libcrypto/man/X509_ATTRIBUTE_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_ATTRIBUTE_new.3,v 1.18 2024/09/02 07:57:27 tb Exp $ | 1 | .\" $OpenBSD: X509_ATTRIBUTE_new.3,v 1.19 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016, 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016, 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: September 2 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_ATTRIBUTE_NEW 3 | 18 | .Dt X509_ATTRIBUTE_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -27,6 +27,7 @@ | |||
| 27 | .\" The type is called "Attribute" with capital "A", not "attribute". | 27 | .\" The type is called "Attribute" with capital "A", not "attribute". |
| 28 | .Nd generic X.501 Attribute | 28 | .Nd generic X.501 Attribute |
| 29 | .Sh SYNOPSIS | 29 | .Sh SYNOPSIS |
| 30 | .Lb libcrypto | ||
| 30 | .In openssl/x509.h | 31 | .In openssl/x509.h |
| 31 | .Ft X509_ATTRIBUTE * | 32 | .Ft X509_ATTRIBUTE * |
| 32 | .Fn X509_ATTRIBUTE_new void | 33 | .Fn X509_ATTRIBUTE_new void |
diff --git a/src/lib/libcrypto/man/X509_ATTRIBUTE_set1_object.3 b/src/lib/libcrypto/man/X509_ATTRIBUTE_set1_object.3 index 3555d4b169..d26e7de473 100644 --- a/src/lib/libcrypto/man/X509_ATTRIBUTE_set1_object.3 +++ b/src/lib/libcrypto/man/X509_ATTRIBUTE_set1_object.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_ATTRIBUTE_set1_object.3,v 1.3 2021/11/26 13:48:21 jsg Exp $ | 1 | .\" $OpenBSD: X509_ATTRIBUTE_set1_object.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: November 26 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_ATTRIBUTE_SET1_OBJECT 3 | 18 | .Dt X509_ATTRIBUTE_SET1_OBJECT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -28,6 +28,7 @@ | |||
| 28 | .\" The type is called "Attribute" with capital "A", not "attribute". | 28 | .\" The type is called "Attribute" with capital "A", not "attribute". |
| 29 | .Nd modify an X.501 Attribute | 29 | .Nd modify an X.501 Attribute |
| 30 | .Sh SYNOPSIS | 30 | .Sh SYNOPSIS |
| 31 | .Lb libcrypto | ||
| 31 | .In openssl/x509.h | 32 | .In openssl/x509.h |
| 32 | .Ft int | 33 | .Ft int |
| 33 | .Fo X509_ATTRIBUTE_set1_object | 34 | .Fo X509_ATTRIBUTE_set1_object |
diff --git a/src/lib/libcrypto/man/X509_CINF_new.3 b/src/lib/libcrypto/man/X509_CINF_new.3 index 6c09c58545..62399c07f7 100644 --- a/src/lib/libcrypto/man/X509_CINF_new.3 +++ b/src/lib/libcrypto/man/X509_CINF_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_CINF_new.3,v 1.11 2024/09/02 08:04:32 tb Exp $ | 1 | .\" $OpenBSD: X509_CINF_new.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: September 2 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_CINF_NEW 3 | 18 | .Dt X509_CINF_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -26,6 +26,7 @@ | |||
| 26 | .Nm X509_CERT_AUX_free | 26 | .Nm X509_CERT_AUX_free |
| 27 | .Nd X.509 certificate information objects | 27 | .Nd X.509 certificate information objects |
| 28 | .Sh SYNOPSIS | 28 | .Sh SYNOPSIS |
| 29 | .Lb libcrypto | ||
| 29 | .In openssl/x509.h | 30 | .In openssl/x509.h |
| 30 | .Ft X509_CINF * | 31 | .Ft X509_CINF * |
| 31 | .Fn X509_CINF_new void | 32 | .Fn X509_CINF_new void |
diff --git a/src/lib/libcrypto/man/X509_CRL_get0_by_serial.3 b/src/lib/libcrypto/man/X509_CRL_get0_by_serial.3 index f5edee6085..5a7d57c3f5 100644 --- a/src/lib/libcrypto/man/X509_CRL_get0_by_serial.3 +++ b/src/lib/libcrypto/man/X509_CRL_get0_by_serial.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_CRL_get0_by_serial.3,v 1.13 2024/03/06 02:34:14 tb Exp $ | 1 | .\" $OpenBSD: X509_CRL_get0_by_serial.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL cdd6c8c5 Mar 20 12:29:37 2017 +0100 | 2 | .\" full merge up to: OpenSSL cdd6c8c5 Mar 20 12:29:37 2017 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 6 2024 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt X509_CRL_GET0_BY_SERIAL 3 | 52 | .Dt X509_CRL_GET0_BY_SERIAL 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -59,6 +59,7 @@ | |||
| 59 | .Nm X509_CRL_sort | 59 | .Nm X509_CRL_sort |
| 60 | .Nd add, sort, and retrieve CRL entries | 60 | .Nd add, sort, and retrieve CRL entries |
| 61 | .Sh SYNOPSIS | 61 | .Sh SYNOPSIS |
| 62 | .Lb libcrypto | ||
| 62 | .In openssl/x509.h | 63 | .In openssl/x509.h |
| 63 | .Ft int | 64 | .Ft int |
| 64 | .Fo X509_CRL_get0_by_serial | 65 | .Fo X509_CRL_get0_by_serial |
diff --git a/src/lib/libcrypto/man/X509_CRL_new.3 b/src/lib/libcrypto/man/X509_CRL_new.3 index f9355fcfd3..36a6439269 100644 --- a/src/lib/libcrypto/man/X509_CRL_new.3 +++ b/src/lib/libcrypto/man/X509_CRL_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_CRL_new.3,v 1.14 2024/03/06 02:34:14 tb Exp $ | 1 | .\" $OpenBSD: X509_CRL_new.3,v 1.15 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016, 2018, 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016, 2018, 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 6 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_CRL_NEW 3 | 18 | .Dt X509_CRL_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -26,6 +26,7 @@ | |||
| 26 | .Nm X509_CRL_INFO_free | 26 | .Nm X509_CRL_INFO_free |
| 27 | .Nd X.509 certificate revocation lists | 27 | .Nd X.509 certificate revocation lists |
| 28 | .Sh SYNOPSIS | 28 | .Sh SYNOPSIS |
| 29 | .Lb libcrypto | ||
| 29 | .In openssl/x509.h | 30 | .In openssl/x509.h |
| 30 | .Ft X509_CRL * | 31 | .Ft X509_CRL * |
| 31 | .Fn X509_CRL_new void | 32 | .Fn X509_CRL_new void |
diff --git a/src/lib/libcrypto/man/X509_CRL_print.3 b/src/lib/libcrypto/man/X509_CRL_print.3 index 2f4832f0e7..1f1d278968 100644 --- a/src/lib/libcrypto/man/X509_CRL_print.3 +++ b/src/lib/libcrypto/man/X509_CRL_print.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_CRL_print.3,v 1.1 2021/07/19 13:16:43 schwarze Exp $ | 1 | .\" $OpenBSD: X509_CRL_print.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: July 19 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_CRL_PRINT 3 | 18 | .Dt X509_CRL_PRINT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm X509_CRL_print_fp | 22 | .Nm X509_CRL_print_fp |
| 23 | .Nd pretty-print a certificate revocation list | 23 | .Nd pretty-print a certificate revocation list |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/x509.h | 26 | .In openssl/x509.h |
| 26 | .Ft int | 27 | .Ft int |
| 27 | .Fo X509_CRL_print | 28 | .Fo X509_CRL_print |
diff --git a/src/lib/libcrypto/man/X509_EXTENSION_set_object.3 b/src/lib/libcrypto/man/X509_EXTENSION_set_object.3 index 45cf0dbaa5..f1356c350b 100644 --- a/src/lib/libcrypto/man/X509_EXTENSION_set_object.3 +++ b/src/lib/libcrypto/man/X509_EXTENSION_set_object.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_EXTENSION_set_object.3,v 1.19 2024/12/28 11:04:09 schwarze Exp $ | 1 | .\" $OpenBSD: X509_EXTENSION_set_object.3,v 1.20 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: December 28 2024 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt X509_EXTENSION_SET_OBJECT 3 | 69 | .Dt X509_EXTENSION_SET_OBJECT 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -85,6 +85,7 @@ | |||
| 85 | .\" The ASN.1 structure is called "Extension", not "extension". | 85 | .\" The ASN.1 structure is called "Extension", not "extension". |
| 86 | .Nd create, change, and inspect X.509 Extension objects | 86 | .Nd create, change, and inspect X.509 Extension objects |
| 87 | .Sh SYNOPSIS | 87 | .Sh SYNOPSIS |
| 88 | .Lb libcrypto | ||
| 88 | .In openssl/x509.h | 89 | .In openssl/x509.h |
| 89 | .Ft X509_EXTENSION * | 90 | .Ft X509_EXTENSION * |
| 90 | .Fn X509_EXTENSION_new void | 91 | .Fn X509_EXTENSION_new void |
diff --git a/src/lib/libcrypto/man/X509_INFO_new.3 b/src/lib/libcrypto/man/X509_INFO_new.3 index 1e9bb832f3..38bf6fe55c 100644 --- a/src/lib/libcrypto/man/X509_INFO_new.3 +++ b/src/lib/libcrypto/man/X509_INFO_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_INFO_new.3,v 1.3 2021/10/19 10:39:33 schwarze Exp $ | 1 | .\" $OpenBSD: X509_INFO_new.3,v 1.5 2025/07/16 17:59:10 schwarze Exp $ |
| 2 | .\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> | 2 | .\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> |
| 3 | .\" | 3 | .\" |
| 4 | .\" Permission to use, copy, modify, and distribute this software for any | 4 | .\" Permission to use, copy, modify, and distribute this software for any |
| @@ -13,7 +13,7 @@ | |||
| 13 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 13 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 14 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | .\" | 15 | .\" |
| 16 | .Dd $Mdocdate: October 19 2021 $ | 16 | .Dd $Mdocdate: July 16 2025 $ |
| 17 | .Dt X509_INFO_NEW 3 | 17 | .Dt X509_INFO_NEW 3 |
| 18 | .Os | 18 | .Os |
| 19 | .Sh NAME | 19 | .Sh NAME |
| @@ -21,6 +21,7 @@ | |||
| 21 | .Nm X509_INFO_free | 21 | .Nm X509_INFO_free |
| 22 | .Nd X.509 certificate wrapper object | 22 | .Nd X.509 certificate wrapper object |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/x509.h | 25 | .In openssl/x509.h |
| 25 | .Ft X509_INFO * | 26 | .Ft X509_INFO * |
| 26 | .Fn X509_INFO_new void | 27 | .Fn X509_INFO_new void |
| @@ -60,10 +61,9 @@ object or | |||
| 60 | .Dv NULL | 61 | .Dv NULL |
| 61 | if an error occurs. | 62 | if an error occurs. |
| 62 | .Sh SEE ALSO | 63 | .Sh SEE ALSO |
| 63 | .Xr PEM_X509_INFO_read 3 , | 64 | .Xr PEM_X509_INFO_read_bio 3 , |
| 64 | .Xr X509_CRL_new 3 , | 65 | .Xr X509_CRL_new 3 , |
| 65 | .Xr X509_new 3 , | 66 | .Xr X509_new 3 |
| 66 | .Xr X509_PKEY_new 3 | ||
| 67 | .Sh HISTORY | 67 | .Sh HISTORY |
| 68 | .Fn X509_INFO_new | 68 | .Fn X509_INFO_new |
| 69 | and | 69 | and |
diff --git a/src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3 b/src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3 index 5980f8f80d..74e3aaed3c 100644 --- a/src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3 +++ b/src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_LOOKUP_hash_dir.3,v 1.13 2024/09/02 07:20:21 tb Exp $ | 1 | .\" $OpenBSD: X509_LOOKUP_hash_dir.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 | 2 | .\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 |
| 3 | .\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 | 3 | .\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -67,7 +67,7 @@ | |||
| 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 69 | .\" | 69 | .\" |
| 70 | .Dd $Mdocdate: September 2 2024 $ | 70 | .Dd $Mdocdate: June 8 2025 $ |
| 71 | .Dt X509_LOOKUP_HASH_DIR 3 | 71 | .Dt X509_LOOKUP_HASH_DIR 3 |
| 72 | .Os | 72 | .Os |
| 73 | .Sh NAME | 73 | .Sh NAME |
| @@ -76,6 +76,7 @@ | |||
| 76 | .Nm X509_LOOKUP_mem | 76 | .Nm X509_LOOKUP_mem |
| 77 | .Nd certificate lookup methods | 77 | .Nd certificate lookup methods |
| 78 | .Sh SYNOPSIS | 78 | .Sh SYNOPSIS |
| 79 | .Lb libcrypto | ||
| 79 | .In openssl/x509_vfy.h | 80 | .In openssl/x509_vfy.h |
| 80 | .Ft const X509_LOOKUP_METHOD * | 81 | .Ft const X509_LOOKUP_METHOD * |
| 81 | .Fn X509_LOOKUP_hash_dir void | 82 | .Fn X509_LOOKUP_hash_dir void |
diff --git a/src/lib/libcrypto/man/X509_LOOKUP_new.3 b/src/lib/libcrypto/man/X509_LOOKUP_new.3 index 559dbbb594..5fa9f99d7c 100644 --- a/src/lib/libcrypto/man/X509_LOOKUP_new.3 +++ b/src/lib/libcrypto/man/X509_LOOKUP_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_LOOKUP_new.3,v 1.12 2024/09/06 07:48:20 tb Exp $ | 1 | .\" $OpenBSD: X509_LOOKUP_new.3,v 1.13 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: September 6 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_LOOKUP_NEW 3 | 18 | .Dt X509_LOOKUP_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -32,6 +32,7 @@ | |||
| 32 | .\" and because it doesn't do much in the first place. | 32 | .\" and because it doesn't do much in the first place. |
| 33 | .Nd certificate lookup object | 33 | .Nd certificate lookup object |
| 34 | .Sh SYNOPSIS | 34 | .Sh SYNOPSIS |
| 35 | .Lb libcrypto | ||
| 35 | .In openssl/x509_vfy.h | 36 | .In openssl/x509_vfy.h |
| 36 | .Ft void | 37 | .Ft void |
| 37 | .Fn X509_LOOKUP_free "X509_LOOKUP *lookup" | 38 | .Fn X509_LOOKUP_free "X509_LOOKUP *lookup" |
diff --git a/src/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 b/src/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 index 2eadec7b4d..4cf40c78be 100644 --- a/src/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 +++ b/src/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_NAME_ENTRY_get_object.3,v 1.16 2021/12/10 16:58:20 schwarze Exp $ | 1 | .\" $OpenBSD: X509_NAME_ENTRY_get_object.3,v 1.18 2025/12/21 09:36:35 tb Exp $ |
| 2 | .\" full merge up to: OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400 | 2 | .\" full merge up to: OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400 |
| 3 | .\" selective merge up to: OpenSSL ca34e08d Dec 12 07:38:07 2018 +0100 | 3 | .\" selective merge up to: OpenSSL ca34e08d Dec 12 07:38:07 2018 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -67,7 +67,7 @@ | |||
| 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 69 | .\" | 69 | .\" |
| 70 | .Dd $Mdocdate: December 10 2021 $ | 70 | .Dd $Mdocdate: December 21 2025 $ |
| 71 | .Dt X509_NAME_ENTRY_GET_OBJECT 3 | 71 | .Dt X509_NAME_ENTRY_GET_OBJECT 3 |
| 72 | .Os | 72 | .Os |
| 73 | .Sh NAME | 73 | .Sh NAME |
| @@ -85,6 +85,7 @@ | |||
| 85 | .\" This object defined in X.501, not in X.509. | 85 | .\" This object defined in X.501, not in X.509. |
| 86 | .Nd X.501 relative distinguished name | 86 | .Nd X.501 relative distinguished name |
| 87 | .Sh SYNOPSIS | 87 | .Sh SYNOPSIS |
| 88 | .Lb libcrypto | ||
| 88 | .In openssl/x509.h | 89 | .In openssl/x509.h |
| 89 | .Ft X509_NAME_ENTRY * | 90 | .Ft X509_NAME_ENTRY * |
| 90 | .Fn X509_NAME_ENTRY_new void | 91 | .Fn X509_NAME_ENTRY_new void |
| @@ -252,14 +253,6 @@ argument and using the | |||
| 252 | .Fa nid | 253 | .Fa nid |
| 253 | corresponding to | 254 | corresponding to |
| 254 | .Fa ne . | 255 | .Fa ne . |
| 255 | Otherwise, if the | ||
| 256 | .Fa type | ||
| 257 | argument is | ||
| 258 | .Dv V_ASN1_APP_CHOOSE , | ||
| 259 | the type of | ||
| 260 | .Fa ne | ||
| 261 | is set to the return value of | ||
| 262 | .Xr ASN1_PRINTABLE_type 3 . | ||
| 263 | .Pp | 256 | .Pp |
| 264 | .Fn X509_NAME_ENTRY_create_by_txt , | 257 | .Fn X509_NAME_ENTRY_create_by_txt , |
| 265 | .Fn X509_NAME_ENTRY_create_by_NID , | 258 | .Fn X509_NAME_ENTRY_create_by_NID , |
diff --git a/src/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 b/src/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 index 3c1237d20e..e2b78150b9 100644 --- a/src/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 +++ b/src/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_NAME_add_entry_by_txt.3,v 1.16 2022/03/31 17:27:17 naddy Exp $ | 1 | .\" $OpenBSD: X509_NAME_add_entry_by_txt.3,v 1.18 2025/12/21 09:36:35 tb Exp $ |
| 2 | .\" OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400 | 2 | .\" OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: March 31 2022 $ | 52 | .Dd $Mdocdate: December 21 2025 $ |
| 53 | .Dt X509_NAME_ADD_ENTRY_BY_TXT 3 | 53 | .Dt X509_NAME_ADD_ENTRY_BY_TXT 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -60,6 +60,7 @@ | |||
| 60 | .Nm X509_NAME_delete_entry | 60 | .Nm X509_NAME_delete_entry |
| 61 | .Nd X509_NAME modification functions | 61 | .Nd X509_NAME modification functions |
| 62 | .Sh SYNOPSIS | 62 | .Sh SYNOPSIS |
| 63 | .Lb libcrypto | ||
| 63 | .In openssl/x509.h | 64 | .In openssl/x509.h |
| 64 | .Ft int | 65 | .Ft int |
| 65 | .Fo X509_NAME_add_entry_by_txt | 66 | .Fo X509_NAME_add_entry_by_txt |
| @@ -271,13 +272,3 @@ and | |||
| 271 | .Fn X509_NAME_add_entry_by_NID | 272 | .Fn X509_NAME_add_entry_by_NID |
| 272 | first appeared in OpenSSL 0.9.5 and have been available since | 273 | first appeared in OpenSSL 0.9.5 and have been available since |
| 273 | .Ox 2.7 . | 274 | .Ox 2.7 . |
| 274 | .Sh BUGS | ||
| 275 | .Fa type | ||
| 276 | can still be set to | ||
| 277 | .Dv V_ASN1_APP_CHOOSE | ||
| 278 | to use | ||
| 279 | .Xr ASN1_PRINTABLE_type 3 | ||
| 280 | to determine field types. | ||
| 281 | Since this form does not understand multicharacter types, performs | ||
| 282 | no length checks, and can result in invalid field types, its use | ||
| 283 | is strongly discouraged. | ||
diff --git a/src/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 b/src/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 index a2ceb10eb5..57dd488181 100644 --- a/src/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 +++ b/src/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_NAME_get_index_by_NID.3,v 1.16 2023/05/29 11:54:50 beck Exp $ | 1 | .\" $OpenBSD: X509_NAME_get_index_by_NID.3,v 1.17 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400 | 2 | .\" OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: May 29 2023 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt X509_NAME_GET_INDEX_BY_NID 3 | 53 | .Dt X509_NAME_GET_INDEX_BY_NID 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -61,6 +61,7 @@ | |||
| 61 | .Nm X509_NAME_get_text_by_OBJ | 61 | .Nm X509_NAME_get_text_by_OBJ |
| 62 | .Nd X509_NAME lookup and enumeration functions | 62 | .Nd X509_NAME lookup and enumeration functions |
| 63 | .Sh SYNOPSIS | 63 | .Sh SYNOPSIS |
| 64 | .Lb libcrypto | ||
| 64 | .In openssl/x509.h | 65 | .In openssl/x509.h |
| 65 | .Ft int | 66 | .Ft int |
| 66 | .Fo X509_NAME_get_index_by_NID | 67 | .Fo X509_NAME_get_index_by_NID |
diff --git a/src/lib/libcrypto/man/X509_NAME_hash.3 b/src/lib/libcrypto/man/X509_NAME_hash.3 index 8766109525..2e03f41ed2 100644 --- a/src/lib/libcrypto/man/X509_NAME_hash.3 +++ b/src/lib/libcrypto/man/X509_NAME_hash.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_NAME_hash.3,v 1.3 2021/07/31 14:54:33 schwarze Exp $ | 1 | .\" $OpenBSD: X509_NAME_hash.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2017, 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2017, 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: July 31 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_NAME_HASH 3 | 18 | .Dt X509_NAME_HASH 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -31,6 +31,7 @@ | |||
| 31 | .\" The type is called "Name" with capital "N", not "name". | 31 | .\" The type is called "Name" with capital "N", not "name". |
| 32 | .Nd calculate SHA-1 or MD5 hashes of X.501 Name objects | 32 | .Nd calculate SHA-1 or MD5 hashes of X.501 Name objects |
| 33 | .Sh SYNOPSIS | 33 | .Sh SYNOPSIS |
| 34 | .Lb libcrypto | ||
| 34 | .In openssl/x509.h | 35 | .In openssl/x509.h |
| 35 | .Ft unsigned long | 36 | .Ft unsigned long |
| 36 | .Fn X509_NAME_hash "X509_NAME *name" | 37 | .Fn X509_NAME_hash "X509_NAME *name" |
| @@ -86,7 +87,7 @@ rather than an ASCII rendering in SSLeay 0.9.0 and have all been | |||
| 86 | available since | 87 | available since |
| 87 | .Ox 2.4 . | 88 | .Ox 2.4 . |
| 88 | .Pp | 89 | .Pp |
| 89 | They were switched to using SHA1 instead of MD5 in OpenSSL 1.0.0 and in | 90 | They were switched to using SHA-1 instead of MD5 in OpenSSL 1.0.0 and in |
| 90 | .Ox 4.9 . | 91 | .Ox 4.9 . |
| 91 | .Pp | 92 | .Pp |
| 92 | .Fn X509_NAME_hash_old , | 93 | .Fn X509_NAME_hash_old , |
diff --git a/src/lib/libcrypto/man/X509_NAME_new.3 b/src/lib/libcrypto/man/X509_NAME_new.3 index 3a4786a9ae..279df816fe 100644 --- a/src/lib/libcrypto/man/X509_NAME_new.3 +++ b/src/lib/libcrypto/man/X509_NAME_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_NAME_new.3,v 1.9 2021/07/20 17:31:32 schwarze Exp $ | 1 | .\" $OpenBSD: X509_NAME_new.3,v 1.10 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: July 20 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_NAME_NEW 3 | 18 | .Dt X509_NAME_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -25,6 +25,7 @@ | |||
| 25 | .\" The type in called "Name" with capital "N", not "name". | 25 | .\" The type in called "Name" with capital "N", not "name". |
| 26 | .Nd X.501 Name object | 26 | .Nd X.501 Name object |
| 27 | .Sh SYNOPSIS | 27 | .Sh SYNOPSIS |
| 28 | .Lb libcrypto | ||
| 28 | .In openssl/x509.h | 29 | .In openssl/x509.h |
| 29 | .Ft X509_NAME * | 30 | .Ft X509_NAME * |
| 30 | .Fn X509_NAME_new void | 31 | .Fn X509_NAME_new void |
diff --git a/src/lib/libcrypto/man/X509_NAME_print_ex.3 b/src/lib/libcrypto/man/X509_NAME_print_ex.3 index fc06a717cc..845428b3fb 100644 --- a/src/lib/libcrypto/man/X509_NAME_print_ex.3 +++ b/src/lib/libcrypto/man/X509_NAME_print_ex.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_NAME_print_ex.3,v 1.17 2025/03/09 16:45:31 tb Exp $ | 1 | .\" $OpenBSD: X509_NAME_print_ex.3,v 1.18 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400 | 2 | .\" full merge up to: OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400 |
| 3 | .\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 | 3 | .\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 |
| 4 | .\" | 4 | .\" |
| @@ -50,7 +50,7 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: March 9 2025 $ | 53 | .Dd $Mdocdate: June 8 2025 $ |
| 54 | .Dt X509_NAME_PRINT_EX 3 | 54 | .Dt X509_NAME_PRINT_EX 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| @@ -59,6 +59,7 @@ | |||
| 59 | .Nm X509_NAME_oneline | 59 | .Nm X509_NAME_oneline |
| 60 | .Nd X509_NAME printing routines | 60 | .Nd X509_NAME printing routines |
| 61 | .Sh SYNOPSIS | 61 | .Sh SYNOPSIS |
| 62 | .Lb libcrypto | ||
| 62 | .In openssl/x509.h | 63 | .In openssl/x509.h |
| 63 | .Ft int | 64 | .Ft int |
| 64 | .Fo X509_NAME_print_ex | 65 | .Fo X509_NAME_print_ex |
diff --git a/src/lib/libcrypto/man/X509_OBJECT_get0_X509.3 b/src/lib/libcrypto/man/X509_OBJECT_get0_X509.3 index 56b3926a8b..1b0de39265 100644 --- a/src/lib/libcrypto/man/X509_OBJECT_get0_X509.3 +++ b/src/lib/libcrypto/man/X509_OBJECT_get0_X509.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_OBJECT_get0_X509.3,v 1.16 2025/03/08 17:02:59 tb Exp $ | 1 | .\" $OpenBSD: X509_OBJECT_get0_X509.3,v 1.17 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2018, 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2018, 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 8 2025 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_OBJECT_GET0_X509 3 | 18 | .Dt X509_OBJECT_GET0_X509 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -28,6 +28,7 @@ | |||
| 28 | .Nm X509_OBJECT_retrieve_match | 28 | .Nm X509_OBJECT_retrieve_match |
| 29 | .Nd certificate, CRL, private key, and string wrapper for certificate stores | 29 | .Nd certificate, CRL, private key, and string wrapper for certificate stores |
| 30 | .Sh SYNOPSIS | 30 | .Sh SYNOPSIS |
| 31 | .Lb libcrypto | ||
| 31 | .In openssl/x509_vfy.h | 32 | .In openssl/x509_vfy.h |
| 32 | .Ft X509_LOOKUP_TYPE | 33 | .Ft X509_LOOKUP_TYPE |
| 33 | .Fo X509_OBJECT_get_type | 34 | .Fo X509_OBJECT_get_type |
diff --git a/src/lib/libcrypto/man/X509_PKEY_new.3 b/src/lib/libcrypto/man/X509_PKEY_new.3 deleted file mode 100644 index 253b0f6db5..0000000000 --- a/src/lib/libcrypto/man/X509_PKEY_new.3 +++ /dev/null | |||
| @@ -1,92 +0,0 @@ | |||
| 1 | .\" $OpenBSD: X509_PKEY_new.3,v 1.1 2021/10/19 10:39:33 schwarze Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | ||
| 4 | .\" | ||
| 5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 7 | .\" copyright notice and this permission notice appear in all copies. | ||
| 8 | .\" | ||
| 9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | .\" | ||
| 17 | .Dd $Mdocdate: October 19 2021 $ | ||
| 18 | .Dt X509_PKEY_NEW 3 | ||
| 19 | .Os | ||
| 20 | .Sh NAME | ||
| 21 | .Nm X509_PKEY_new , | ||
| 22 | .Nm X509_PKEY_free | ||
| 23 | .Nd X.509 private key wrapper object | ||
| 24 | .Sh SYNOPSIS | ||
| 25 | .In openssl/x509.h | ||
| 26 | .Ft X509_PKEY * | ||
| 27 | .Fn X509_PKEY_new void | ||
| 28 | .Ft void | ||
| 29 | .Fn X509_PKEY_free "X509_PKEY *wrapper" | ||
| 30 | .Sh DESCRIPTION | ||
| 31 | .Vt X509_PKEY | ||
| 32 | is a reference-counted wrapper object that can store | ||
| 33 | .Bl -bullet -width 1n | ||
| 34 | .It | ||
| 35 | a pointer to an encrypted and ASN.1-encoded private key | ||
| 36 | .It | ||
| 37 | a pointer to an | ||
| 38 | .Vt EVP_PKEY | ||
| 39 | object representing the same key in decrypted form | ||
| 40 | .It | ||
| 41 | a pointer to an | ||
| 42 | .Vt X509_ALGOR | ||
| 43 | object identifying the algorithm used by the key | ||
| 44 | .El | ||
| 45 | .Pp | ||
| 46 | The object may contain only the encrypted key or only the decrypted | ||
| 47 | key or both. | ||
| 48 | .Pp | ||
| 49 | .Vt X509_PKEY | ||
| 50 | is used as a sub-object of the | ||
| 51 | .Vt X509_INFO | ||
| 52 | object created by | ||
| 53 | .Xr PEM_X509_INFO_read_bio 3 | ||
| 54 | if the PEM file contains any RSA, DSA, or EC PRIVATE KEY object. | ||
| 55 | .Pp | ||
| 56 | .Fn X509_PKEY_new | ||
| 57 | allocates and initializes an empty | ||
| 58 | .Vt X509_PKEY | ||
| 59 | object and sets its reference count to 1. | ||
| 60 | .Pp | ||
| 61 | .Fn X509_PKEY_free | ||
| 62 | decrements the reference count of the | ||
| 63 | .Fa wrapper | ||
| 64 | object by 1. | ||
| 65 | If the reference count reaches 0, | ||
| 66 | it frees all internal objects allocated by the | ||
| 67 | .Fa wrapper | ||
| 68 | as well as the storage needed for the | ||
| 69 | .Fa wrapper | ||
| 70 | object itself. | ||
| 71 | If | ||
| 72 | .Fa wrapper | ||
| 73 | is a | ||
| 74 | .Dv NULL | ||
| 75 | pointer, no action occurs. | ||
| 76 | .Sh RETURN VALUES | ||
| 77 | .Fn X509_PKEY_new | ||
| 78 | returns a pointer to the new | ||
| 79 | .Vt X509_PKEY | ||
| 80 | object or | ||
| 81 | .Dv NULL | ||
| 82 | if memory allocation fails. | ||
| 83 | .Sh SEE ALSO | ||
| 84 | .Xr EVP_PKEY_new 3 , | ||
| 85 | .Xr PEM_X509_INFO_read 3 , | ||
| 86 | .Xr X509_INFO_new 3 | ||
| 87 | .Sh HISTORY | ||
| 88 | .Fn X509_PKEY_new | ||
| 89 | and | ||
| 90 | .Fn X509_PKEY_free | ||
| 91 | first appeared in SSLeay 0.6.0 and have been available since | ||
| 92 | .Ox 2.4 . | ||
diff --git a/src/lib/libcrypto/man/X509_PUBKEY_new.3 b/src/lib/libcrypto/man/X509_PUBKEY_new.3 index df1c50bda2..1ef1afbc34 100644 --- a/src/lib/libcrypto/man/X509_PUBKEY_new.3 +++ b/src/lib/libcrypto/man/X509_PUBKEY_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_PUBKEY_new.3,v 1.18 2024/12/06 12:51:13 schwarze Exp $ | 1 | .\" $OpenBSD: X509_PUBKEY_new.3,v 1.19 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: December 6 2024 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt X509_PUBKEY_NEW 3 | 69 | .Dt X509_PUBKEY_NEW 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -86,6 +86,7 @@ | |||
| 86 | .Nm X509_PUBKEY_get0_param | 86 | .Nm X509_PUBKEY_get0_param |
| 87 | .Nd X.509 SubjectPublicKeyInfo structure | 87 | .Nd X.509 SubjectPublicKeyInfo structure |
| 88 | .Sh SYNOPSIS | 88 | .Sh SYNOPSIS |
| 89 | .Lb libcrypto | ||
| 89 | .In openssl/x509.h | 90 | .In openssl/x509.h |
| 90 | .Ft X509_PUBKEY * | 91 | .Ft X509_PUBKEY * |
| 91 | .Fn X509_PUBKEY_new void | 92 | .Fn X509_PUBKEY_new void |
diff --git a/src/lib/libcrypto/man/X509_PURPOSE_set.3 b/src/lib/libcrypto/man/X509_PURPOSE_set.3 index 1f723e9b9f..cb955f392c 100644 --- a/src/lib/libcrypto/man/X509_PURPOSE_set.3 +++ b/src/lib/libcrypto/man/X509_PURPOSE_set.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_PURPOSE_set.3,v 1.1 2021/07/23 14:27:32 schwarze Exp $ | 1 | .\" $OpenBSD: X509_PURPOSE_set.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: July 23 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_PURPOSE_SET 3 | 18 | .Dt X509_PURPOSE_SET 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -31,6 +31,7 @@ | |||
| 31 | .Nm X509_PURPOSE_get_trust | 31 | .Nm X509_PURPOSE_get_trust |
| 32 | .Nd purpose objects, indices, and identifiers | 32 | .Nd purpose objects, indices, and identifiers |
| 33 | .Sh SYNOPSIS | 33 | .Sh SYNOPSIS |
| 34 | .Lb libcrypto | ||
| 34 | .In openssl/x509v3.h | 35 | .In openssl/x509v3.h |
| 35 | .Ft int | 36 | .Ft int |
| 36 | .Fo X509_PURPOSE_set | 37 | .Fo X509_PURPOSE_set |
diff --git a/src/lib/libcrypto/man/X509_REQ_add1_attr.3 b/src/lib/libcrypto/man/X509_REQ_add1_attr.3 index f9b602dbef..6beb024039 100644 --- a/src/lib/libcrypto/man/X509_REQ_add1_attr.3 +++ b/src/lib/libcrypto/man/X509_REQ_add1_attr.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_REQ_add1_attr.3,v 1.4 2024/09/02 07:56:28 tb Exp $ | 1 | .\" $OpenBSD: X509_REQ_add1_attr.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: September 2 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_REQ_ADD1_ATTR 3 | 18 | .Dt X509_REQ_ADD1_ATTR 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -29,6 +29,7 @@ | |||
| 29 | .Nm X509_REQ_get_attr_by_NID | 29 | .Nm X509_REQ_get_attr_by_NID |
| 30 | .Nd X.501 Attributes of PKCS#10 certification requests | 30 | .Nd X.501 Attributes of PKCS#10 certification requests |
| 31 | .Sh SYNOPSIS | 31 | .Sh SYNOPSIS |
| 32 | .Lb libcrypto | ||
| 32 | .In openssl/x509.h | 33 | .In openssl/x509.h |
| 33 | .Ft int | 34 | .Ft int |
| 34 | .Fo X509_REQ_add1_attr | 35 | .Fo X509_REQ_add1_attr |
diff --git a/src/lib/libcrypto/man/X509_REQ_add_extensions.3 b/src/lib/libcrypto/man/X509_REQ_add_extensions.3 index ff33edf474..804e787947 100644 --- a/src/lib/libcrypto/man/X509_REQ_add_extensions.3 +++ b/src/lib/libcrypto/man/X509_REQ_add_extensions.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_REQ_add_extensions.3,v 1.2 2024/08/18 11:04:55 tb Exp $ | 1 | .\" $OpenBSD: X509_REQ_add_extensions.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: August 18 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_REQ_ADD_EXTENSIONS 3 | 18 | .Dt X509_REQ_ADD_EXTENSIONS 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -24,6 +24,7 @@ | |||
| 24 | .Nm X509_REQ_extension_nid | 24 | .Nm X509_REQ_extension_nid |
| 25 | .Nd extensions in certification requests | 25 | .Nd extensions in certification requests |
| 26 | .Sh SYNOPSIS | 26 | .Sh SYNOPSIS |
| 27 | .Lb libcrypto | ||
| 27 | .In openssl/x509.h | 28 | .In openssl/x509.h |
| 28 | .Ft int | 29 | .Ft int |
| 29 | .Fo X509_REQ_add_extensions | 30 | .Fo X509_REQ_add_extensions |
diff --git a/src/lib/libcrypto/man/X509_REQ_new.3 b/src/lib/libcrypto/man/X509_REQ_new.3 index 0a5828d5d4..a62f2c3acb 100644 --- a/src/lib/libcrypto/man/X509_REQ_new.3 +++ b/src/lib/libcrypto/man/X509_REQ_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_REQ_new.3,v 1.11 2021/10/29 09:42:07 schwarze Exp $ | 1 | .\" $OpenBSD: X509_REQ_new.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016, 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016, 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: October 29 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_REQ_NEW 3 | 18 | .Dt X509_REQ_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -26,6 +26,7 @@ | |||
| 26 | .Nm X509_REQ_INFO_free | 26 | .Nm X509_REQ_INFO_free |
| 27 | .Nd PKCS#10 certification requests | 27 | .Nd PKCS#10 certification requests |
| 28 | .Sh SYNOPSIS | 28 | .Sh SYNOPSIS |
| 29 | .Lb libcrypto | ||
| 29 | .In openssl/x509.h | 30 | .In openssl/x509.h |
| 30 | .Ft X509_REQ * | 31 | .Ft X509_REQ * |
| 31 | .Fn X509_REQ_new void | 32 | .Fn X509_REQ_new void |
diff --git a/src/lib/libcrypto/man/X509_REQ_print_ex.3 b/src/lib/libcrypto/man/X509_REQ_print_ex.3 index eee06abb21..8d87396b14 100644 --- a/src/lib/libcrypto/man/X509_REQ_print_ex.3 +++ b/src/lib/libcrypto/man/X509_REQ_print_ex.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_REQ_print_ex.3,v 1.3 2025/03/09 14:02:46 tb Exp $ | 1 | .\" $OpenBSD: X509_REQ_print_ex.3,v 1.4 2025/06/08 22:30:52 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 9 2025 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_REQ_PRINT_EX 3 | 18 | .Dt X509_REQ_PRINT_EX 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -23,6 +23,8 @@ | |||
| 23 | .Nm X509_REQ_print_fp | 23 | .Nm X509_REQ_print_fp |
| 24 | .Nd pretty-print a PKCS#10 certification request | 24 | .Nd pretty-print a PKCS#10 certification request |
| 25 | .Sh SYNOPSIS | 25 | .Sh SYNOPSIS |
| 26 | .Lb libcrypto | ||
| 27 | .In openssl/x509.h | ||
| 26 | .Ft int | 28 | .Ft int |
| 27 | .Fo X509_REQ_print_ex | 29 | .Fo X509_REQ_print_ex |
| 28 | .Fa "BIO *bio" | 30 | .Fa "BIO *bio" |
diff --git a/src/lib/libcrypto/man/X509_REVOKED_new.3 b/src/lib/libcrypto/man/X509_REVOKED_new.3 index c1a50d1c9a..6dffcfd03e 100644 --- a/src/lib/libcrypto/man/X509_REVOKED_new.3 +++ b/src/lib/libcrypto/man/X509_REVOKED_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_REVOKED_new.3,v 1.12 2021/07/19 13:16:43 schwarze Exp $ | 1 | .\" $OpenBSD: X509_REVOKED_new.3,v 1.13 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: | 2 | .\" full merge up to: |
| 3 | .\" OpenSSL man3/X509_CRL_get0_by_serial cdd6c8c5 Mar 20 12:29:37 2017 +0100 | 3 | .\" OpenSSL man3/X509_CRL_get0_by_serial cdd6c8c5 Mar 20 12:29:37 2017 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: July 19 2021 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt X509_REVOKED_NEW 3 | 70 | .Dt X509_REVOKED_NEW 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -79,6 +79,7 @@ | |||
| 79 | .Nm X509_REVOKED_set_revocationDate | 79 | .Nm X509_REVOKED_set_revocationDate |
| 80 | .Nd create, change, and inspect an X.509 CRL revoked entry | 80 | .Nd create, change, and inspect an X.509 CRL revoked entry |
| 81 | .Sh SYNOPSIS | 81 | .Sh SYNOPSIS |
| 82 | .Lb libcrypto | ||
| 82 | .In openssl/x509.h | 83 | .In openssl/x509.h |
| 83 | .Ft X509_REVOKED * | 84 | .Ft X509_REVOKED * |
| 84 | .Fn X509_REVOKED_new void | 85 | .Fn X509_REVOKED_new void |
diff --git a/src/lib/libcrypto/man/X509_SIG_get0.3 b/src/lib/libcrypto/man/X509_SIG_get0.3 index 456261ca3f..339fcc0cf5 100644 --- a/src/lib/libcrypto/man/X509_SIG_get0.3 +++ b/src/lib/libcrypto/man/X509_SIG_get0.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_SIG_get0.3,v 1.1 2021/10/23 15:39:06 tb Exp $ | 1 | .\" $OpenBSD: X509_SIG_get0.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 | 2 | .\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: October 23 2021 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt X509_SIG_GET0 3 | 53 | .Dt X509_SIG_GET0 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm X509_SIG_getm | 57 | .Nm X509_SIG_getm |
| 58 | .Nd DigestInfo functions | 58 | .Nd DigestInfo functions |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/x509.h | 61 | .In openssl/x509.h |
| 61 | .Ft void | 62 | .Ft void |
| 62 | .Fo X509_SIG_get0 | 63 | .Fo X509_SIG_get0 |
diff --git a/src/lib/libcrypto/man/X509_SIG_new.3 b/src/lib/libcrypto/man/X509_SIG_new.3 index 8e6b29dea5..8fafc00c98 100644 --- a/src/lib/libcrypto/man/X509_SIG_new.3 +++ b/src/lib/libcrypto/man/X509_SIG_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_SIG_new.3,v 1.5 2021/10/27 11:24:47 schwarze Exp $ | 1 | .\" $OpenBSD: X509_SIG_new.3,v 1.6 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: October 27 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_SIG_NEW 3 | 18 | .Dt X509_SIG_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm X509_SIG_free | 22 | .Nm X509_SIG_free |
| 23 | .Nd PKCS#7 digest information | 23 | .Nd PKCS#7 digest information |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/x509.h | 26 | .In openssl/x509.h |
| 26 | .Ft X509_SIG * | 27 | .Ft X509_SIG * |
| 27 | .Fn X509_SIG_new void | 28 | .Fn X509_SIG_new void |
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_get_error.3 b/src/lib/libcrypto/man/X509_STORE_CTX_get_error.3 index 1f221563cb..5eb2bfe8cb 100644 --- a/src/lib/libcrypto/man/X509_STORE_CTX_get_error.3 +++ b/src/lib/libcrypto/man/X509_STORE_CTX_get_error.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_STORE_CTX_get_error.3,v 1.28 2023/06/06 16:20:13 schwarze Exp $ | 1 | .\" $OpenBSD: X509_STORE_CTX_get_error.3,v 1.29 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: | 2 | .\" full merge up to: |
| 3 | .\" OpenSSL man3/X509_STORE_CTX_get_error 24a535ea Sep 22 13:14:20 2020 +0100 | 3 | .\" OpenSSL man3/X509_STORE_CTX_get_error 24a535ea Sep 22 13:14:20 2020 +0100 |
| 4 | .\" OpenSSL man3/X509_STORE_CTX_new 24a535ea Sep 22 13:14:20 2020 +0100 | 4 | .\" OpenSSL man3/X509_STORE_CTX_new 24a535ea Sep 22 13:14:20 2020 +0100 |
| @@ -68,7 +68,7 @@ | |||
| 68 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 68 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 69 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 69 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 70 | .\" | 70 | .\" |
| 71 | .Dd $Mdocdate: June 6 2023 $ | 71 | .Dd $Mdocdate: June 8 2025 $ |
| 72 | .Dt X509_STORE_CTX_GET_ERROR 3 | 72 | .Dt X509_STORE_CTX_GET_ERROR 3 |
| 73 | .Os | 73 | .Os |
| 74 | .Sh NAME | 74 | .Sh NAME |
| @@ -89,6 +89,7 @@ | |||
| 89 | .Nm X509_verify_cert_error_string | 89 | .Nm X509_verify_cert_error_string |
| 90 | .Nd get or set certificate verification status information | 90 | .Nd get or set certificate verification status information |
| 91 | .Sh SYNOPSIS | 91 | .Sh SYNOPSIS |
| 92 | .Lb libcrypto | ||
| 92 | .In openssl/x509_vfy.h | 93 | .In openssl/x509_vfy.h |
| 93 | .Ft int | 94 | .Ft int |
| 94 | .Fo X509_STORE_CTX_get_error | 95 | .Fo X509_STORE_CTX_get_error |
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 b/src/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 index bfec65a123..1c34efa947 100644 --- a/src/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 +++ b/src/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_STORE_CTX_get_ex_new_index.3,v 1.6 2021/07/29 08:32:13 schwarze Exp $ | 1 | .\" $OpenBSD: X509_STORE_CTX_get_ex_new_index.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 | 2 | .\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: July 29 2021 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt X509_STORE_CTX_GET_EX_NEW_INDEX 3 | 52 | .Dt X509_STORE_CTX_GET_EX_NEW_INDEX 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -59,6 +59,7 @@ | |||
| 59 | .Nm X509_STORE_CTX_get_app_data | 59 | .Nm X509_STORE_CTX_get_app_data |
| 60 | .Nd add application specific data to X509_STORE_CTX structures | 60 | .Nd add application specific data to X509_STORE_CTX structures |
| 61 | .Sh SYNOPSIS | 61 | .Sh SYNOPSIS |
| 62 | .Lb libcrypto | ||
| 62 | .In openssl/x509_vfy.h | 63 | .In openssl/x509_vfy.h |
| 63 | .Ft int | 64 | .Ft int |
| 64 | .Fo X509_STORE_CTX_get_ex_new_index | 65 | .Fo X509_STORE_CTX_get_ex_new_index |
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_new.3 b/src/lib/libcrypto/man/X509_STORE_CTX_new.3 index 96af7a8afb..4c0f8c5857 100644 --- a/src/lib/libcrypto/man/X509_STORE_CTX_new.3 +++ b/src/lib/libcrypto/man/X509_STORE_CTX_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_STORE_CTX_new.3,v 1.27 2022/11/16 14:55:40 schwarze Exp $ | 1 | .\" $OpenBSD: X509_STORE_CTX_new.3,v 1.28 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL aae41f8c Jun 25 09:47:15 2015 +0100 | 2 | .\" full merge up to: OpenSSL aae41f8c Jun 25 09:47:15 2015 +0100 |
| 3 | .\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 | 3 | .\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -67,7 +67,7 @@ | |||
| 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 69 | .\" | 69 | .\" |
| 70 | .Dd $Mdocdate: November 16 2022 $ | 70 | .Dd $Mdocdate: June 8 2025 $ |
| 71 | .Dt X509_STORE_CTX_NEW 3 | 71 | .Dt X509_STORE_CTX_NEW 3 |
| 72 | .Os | 72 | .Os |
| 73 | .Sh NAME | 73 | .Sh NAME |
| @@ -89,6 +89,7 @@ | |||
| 89 | .\" X509_STORE_CTX_set_verify moved to X509_STORE_CTX_set_verify(3) | 89 | .\" X509_STORE_CTX_set_verify moved to X509_STORE_CTX_set_verify(3) |
| 90 | .Nd X509_STORE_CTX initialisation | 90 | .Nd X509_STORE_CTX initialisation |
| 91 | .Sh SYNOPSIS | 91 | .Sh SYNOPSIS |
| 92 | .Lb libcrypto | ||
| 92 | .In openssl/x509_vfy.h | 93 | .In openssl/x509_vfy.h |
| 93 | .Ft X509_STORE_CTX * | 94 | .Ft X509_STORE_CTX * |
| 94 | .Fn X509_STORE_CTX_new void | 95 | .Fn X509_STORE_CTX_new void |
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_set_flags.3 b/src/lib/libcrypto/man/X509_STORE_CTX_set_flags.3 index 04bb202bac..028d4da810 100644 --- a/src/lib/libcrypto/man/X509_STORE_CTX_set_flags.3 +++ b/src/lib/libcrypto/man/X509_STORE_CTX_set_flags.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_STORE_CTX_set_flags.3,v 1.8 2024/08/29 20:21:10 tb Exp $ | 1 | .\" $OpenBSD: X509_STORE_CTX_set_flags.3,v 1.9 2025/06/08 22:37:23 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL aae41f8c Jun 25 09:47:15 2015 +0100 | 2 | .\" full merge up to: OpenSSL aae41f8c Jun 25 09:47:15 2015 +0100 |
| 3 | .\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 | 3 | .\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -67,7 +67,7 @@ | |||
| 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 69 | .\" | 69 | .\" |
| 70 | .Dd $Mdocdate: August 29 2024 $ | 70 | .Dd $Mdocdate: June 8 2025 $ |
| 71 | .Dt X509_STORE_CTX_SET_FLAGS 3 | 71 | .Dt X509_STORE_CTX_SET_FLAGS 3 |
| 72 | .Os | 72 | .Os |
| 73 | .Sh NAME | 73 | .Sh NAME |
| @@ -76,13 +76,12 @@ | |||
| 76 | .Nm X509_STORE_CTX_set_depth , | 76 | .Nm X509_STORE_CTX_set_depth , |
| 77 | .Nm X509_STORE_CTX_set_trust , | 77 | .Nm X509_STORE_CTX_set_trust , |
| 78 | .Nm X509_STORE_CTX_set_purpose , | 78 | .Nm X509_STORE_CTX_set_purpose , |
| 79 | .\" .Nm X509_STORE_CTX_purpose_inherit is intentionally undocumented | ||
| 80 | .\" because it will be removed in the next major bump. | ||
| 81 | .Nm X509_STORE_CTX_get0_param , | 79 | .Nm X509_STORE_CTX_get0_param , |
| 82 | .Nm X509_STORE_CTX_set0_param , | 80 | .Nm X509_STORE_CTX_set0_param , |
| 83 | .Nm X509_STORE_CTX_set_default | 81 | .Nm X509_STORE_CTX_set_default |
| 84 | .Nd X509_STORE_CTX parameter initialisation | 82 | .Nd X509_STORE_CTX parameter initialisation |
| 85 | .Sh SYNOPSIS | 83 | .Sh SYNOPSIS |
| 84 | .Lb libcrypto | ||
| 86 | .In openssl/x509_vfy.h | 85 | .In openssl/x509_vfy.h |
| 87 | .Ft void | 86 | .Ft void |
| 88 | .Fo X509_STORE_CTX_set_flags | 87 | .Fo X509_STORE_CTX_set_flags |
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_set_verify.3 b/src/lib/libcrypto/man/X509_STORE_CTX_set_verify.3 index 8c27deea5d..4a319ed8bb 100644 --- a/src/lib/libcrypto/man/X509_STORE_CTX_set_verify.3 +++ b/src/lib/libcrypto/man/X509_STORE_CTX_set_verify.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_STORE_CTX_set_verify.3,v 1.8 2024/06/07 05:51:39 tb Exp $ | 1 | .\" $OpenBSD: X509_STORE_CTX_set_verify.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021, 2022 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021, 2022 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" Copyright (c) 2023 Job Snijders <job@openbsd.org> | 4 | .\" Copyright (c) 2023 Job Snijders <job@openbsd.org> |
| @@ -15,7 +15,7 @@ | |||
| 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 | .\" | 17 | .\" |
| 18 | .Dd $Mdocdate: June 7 2024 $ | 18 | .Dd $Mdocdate: June 8 2025 $ |
| 19 | .Dt X509_STORE_CTX_SET_VERIFY 3 | 19 | .Dt X509_STORE_CTX_SET_VERIFY 3 |
| 20 | .Os | 20 | .Os |
| 21 | .Sh NAME | 21 | .Sh NAME |
| @@ -31,6 +31,7 @@ | |||
| 31 | .Nm X509_STORE_CTX_get_check_issued | 31 | .Nm X509_STORE_CTX_get_check_issued |
| 32 | .Nd user-defined certificate chain verification function | 32 | .Nd user-defined certificate chain verification function |
| 33 | .Sh SYNOPSIS | 33 | .Sh SYNOPSIS |
| 34 | .Lb libcrypto | ||
| 34 | .In openssl/x509_vfy.h | 35 | .In openssl/x509_vfy.h |
| 35 | .Ft typedef int | 36 | .Ft typedef int |
| 36 | .Fo (*X509_STORE_CTX_verify_fn) | 37 | .Fo (*X509_STORE_CTX_verify_fn) |
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 b/src/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 index 0fe086b721..29f1e79b62 100644 --- a/src/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 +++ b/src/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_STORE_CTX_set_verify_cb.3,v 1.12 2023/05/30 07:37:34 op Exp $ | 1 | .\" $OpenBSD: X509_STORE_CTX_set_verify_cb.3,v 1.13 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400 | 2 | .\" full merge up to: OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400 |
| 3 | .\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 | 3 | .\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: May 30 2023 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt X509_STORE_CTX_SET_VERIFY_CB 3 | 70 | .Dt X509_STORE_CTX_SET_VERIFY_CB 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -75,6 +75,7 @@ | |||
| 75 | .Nm X509_STORE_CTX_get_verify_cb | 75 | .Nm X509_STORE_CTX_get_verify_cb |
| 76 | .Nd set and retrieve verification callback | 76 | .Nd set and retrieve verification callback |
| 77 | .Sh SYNOPSIS | 77 | .Sh SYNOPSIS |
| 78 | .Lb libcrypto | ||
| 78 | .In openssl/x509_vfy.h | 79 | .In openssl/x509_vfy.h |
| 79 | .Ft typedef int | 80 | .Ft typedef int |
| 80 | .Fo (*X509_STORE_CTX_verify_cb) | 81 | .Fo (*X509_STORE_CTX_verify_cb) |
diff --git a/src/lib/libcrypto/man/X509_STORE_get_by_subject.3 b/src/lib/libcrypto/man/X509_STORE_get_by_subject.3 index 0f6fbd8410..a8379ad5cb 100644 --- a/src/lib/libcrypto/man/X509_STORE_get_by_subject.3 +++ b/src/lib/libcrypto/man/X509_STORE_get_by_subject.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_STORE_get_by_subject.3,v 1.6 2024/05/12 05:08:59 tb Exp $ | 1 | .\" $OpenBSD: X509_STORE_get_by_subject.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021, 2023 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021, 2023 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: May 12 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_STORE_GET_BY_SUBJECT 3 | 18 | .Dt X509_STORE_GET_BY_SUBJECT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -28,6 +28,7 @@ | |||
| 28 | .Nm X509_STORE_get1_crls | 28 | .Nm X509_STORE_get1_crls |
| 29 | .Nd retrieve objects from a certificate store | 29 | .Nd retrieve objects from a certificate store |
| 30 | .Sh SYNOPSIS | 30 | .Sh SYNOPSIS |
| 31 | .Lb libcrypto | ||
| 31 | .In openssl/x509_vfy.h | 32 | .In openssl/x509_vfy.h |
| 32 | .Ft int | 33 | .Ft int |
| 33 | .Fo X509_STORE_CTX_get_by_subject | 34 | .Fo X509_STORE_CTX_get_by_subject |
diff --git a/src/lib/libcrypto/man/X509_STORE_load_locations.3 b/src/lib/libcrypto/man/X509_STORE_load_locations.3 index a8177b0fd4..d876ef831a 100644 --- a/src/lib/libcrypto/man/X509_STORE_load_locations.3 +++ b/src/lib/libcrypto/man/X509_STORE_load_locations.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_STORE_load_locations.3,v 1.12 2024/09/02 07:20:21 tb Exp $ | 1 | .\" $OpenBSD: X509_STORE_load_locations.3,v 1.13 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: | 2 | .\" full merge up to: |
| 3 | .\" OpenSSL X509_STORE_add_cert b0edda11 Mar 20 13:00:17 2018 +0000 | 3 | .\" OpenSSL X509_STORE_add_cert b0edda11 Mar 20 13:00:17 2018 +0000 |
| 4 | .\" | 4 | .\" |
| @@ -16,7 +16,7 @@ | |||
| 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 18 | .\" | 18 | .\" |
| 19 | .Dd $Mdocdate: September 2 2024 $ | 19 | .Dd $Mdocdate: June 8 2025 $ |
| 20 | .Dt X509_STORE_LOAD_LOCATIONS 3 | 20 | .Dt X509_STORE_LOAD_LOCATIONS 3 |
| 21 | .Os | 21 | .Os |
| 22 | .Sh NAME | 22 | .Sh NAME |
| @@ -26,6 +26,7 @@ | |||
| 26 | .Nm X509_STORE_add_lookup | 26 | .Nm X509_STORE_add_lookup |
| 27 | .Nd configure files and directories used by a certificate store | 27 | .Nd configure files and directories used by a certificate store |
| 28 | .Sh SYNOPSIS | 28 | .Sh SYNOPSIS |
| 29 | .Lb libcrypto | ||
| 29 | .In openssl/x509_vfy.h | 30 | .In openssl/x509_vfy.h |
| 30 | .Ft int | 31 | .Ft int |
| 31 | .Fo X509_STORE_load_locations | 32 | .Fo X509_STORE_load_locations |
diff --git a/src/lib/libcrypto/man/X509_STORE_new.3 b/src/lib/libcrypto/man/X509_STORE_new.3 index a17da03a41..e1d146da43 100644 --- a/src/lib/libcrypto/man/X509_STORE_new.3 +++ b/src/lib/libcrypto/man/X509_STORE_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_STORE_new.3,v 1.7 2021/11/17 16:08:32 schwarze Exp $ | 1 | .\" $OpenBSD: X509_STORE_new.3,v 1.8 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 05ea606a May 20 20:52:46 2016 -0400 | 2 | .\" full merge up to: OpenSSL 05ea606a May 20 20:52:46 2016 -0400 |
| 3 | .\" selective merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 3 | .\" selective merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 4 | .\" | 4 | .\" |
| @@ -67,7 +67,7 @@ | |||
| 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 69 | .\" | 69 | .\" |
| 70 | .Dd $Mdocdate: November 17 2021 $ | 70 | .Dd $Mdocdate: June 8 2025 $ |
| 71 | .Dt X509_STORE_NEW 3 | 71 | .Dt X509_STORE_NEW 3 |
| 72 | .Os | 72 | .Os |
| 73 | .Sh NAME | 73 | .Sh NAME |
| @@ -76,6 +76,7 @@ | |||
| 76 | .Nm X509_STORE_free | 76 | .Nm X509_STORE_free |
| 77 | .Nd allocate and free X.509 certificate stores | 77 | .Nd allocate and free X.509 certificate stores |
| 78 | .Sh SYNOPSIS | 78 | .Sh SYNOPSIS |
| 79 | .Lb libcrypto | ||
| 79 | .In openssl/x509_vfy.h | 80 | .In openssl/x509_vfy.h |
| 80 | .Ft X509_STORE * | 81 | .Ft X509_STORE * |
| 81 | .Fn X509_STORE_new void | 82 | .Fn X509_STORE_new void |
diff --git a/src/lib/libcrypto/man/X509_STORE_set1_param.3 b/src/lib/libcrypto/man/X509_STORE_set1_param.3 index 527fe652e5..d96a33a8fa 100644 --- a/src/lib/libcrypto/man/X509_STORE_set1_param.3 +++ b/src/lib/libcrypto/man/X509_STORE_set1_param.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_STORE_set1_param.3,v 1.22 2024/03/14 22:19:12 tb Exp $ | 1 | .\" $OpenBSD: X509_STORE_set1_param.3,v 1.23 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" content checked up to: | 2 | .\" content checked up to: |
| 3 | .\" OpenSSL man3/X509_STORE_add_cert b0edda11 Mar 20 13:00:17 2018 +0000 | 3 | .\" OpenSSL man3/X509_STORE_add_cert b0edda11 Mar 20 13:00:17 2018 +0000 |
| 4 | .\" OpenSSL man3/X509_STORE_get0_param e90fc053 Jul 15 09:39:45 2017 -0400 | 4 | .\" OpenSSL man3/X509_STORE_get0_param e90fc053 Jul 15 09:39:45 2017 -0400 |
| @@ -17,7 +17,7 @@ | |||
| 17 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 17 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 18 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 18 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 19 | .\" | 19 | .\" |
| 20 | .Dd $Mdocdate: March 14 2024 $ | 20 | .Dd $Mdocdate: June 8 2025 $ |
| 21 | .Dt X509_STORE_SET1_PARAM 3 | 21 | .Dt X509_STORE_SET1_PARAM 3 |
| 22 | .Os | 22 | .Os |
| 23 | .Sh NAME | 23 | .Sh NAME |
| @@ -36,6 +36,7 @@ | |||
| 36 | .Nm X509_STORE_get_ex_data | 36 | .Nm X509_STORE_get_ex_data |
| 37 | .Nd get and set X509_STORE data | 37 | .Nd get and set X509_STORE data |
| 38 | .Sh SYNOPSIS | 38 | .Sh SYNOPSIS |
| 39 | .Lb libcrypto | ||
| 39 | .In openssl/x509_vfy.h | 40 | .In openssl/x509_vfy.h |
| 40 | .Ft int | 41 | .Ft int |
| 41 | .Fo X509_STORE_set1_param | 42 | .Fo X509_STORE_set1_param |
diff --git a/src/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 b/src/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 index bdd5ea5044..a09e6741a2 100644 --- a/src/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 +++ b/src/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_STORE_set_verify_cb_func.3,v 1.12 2022/11/16 14:51:08 schwarze Exp $ | 1 | .\" $OpenBSD: X509_STORE_set_verify_cb_func.3,v 1.13 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 05ea606a May 20 20:52:46 2016 -0400 | 2 | .\" full merge up to: OpenSSL 05ea606a May 20 20:52:46 2016 -0400 |
| 3 | .\" selective merge up to: OpenSSL 315c47e0 Dec 1 14:22:16 2020 +0100 | 3 | .\" selective merge up to: OpenSSL 315c47e0 Dec 1 14:22:16 2020 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: November 16 2022 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt X509_STORE_SET_VERIFY_CB_FUNC 3 | 53 | .Dt X509_STORE_SET_VERIFY_CB_FUNC 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm X509_STORE_get_verify_cb | 58 | .Nm X509_STORE_get_verify_cb |
| 59 | .Nd set verification callback | 59 | .Nd set verification callback |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libcrypto | ||
| 61 | .In openssl/x509_vfy.h | 62 | .In openssl/x509_vfy.h |
| 62 | .Ft void | 63 | .Ft void |
| 63 | .Fo X509_STORE_set_verify_cb | 64 | .Fo X509_STORE_set_verify_cb |
diff --git a/src/lib/libcrypto/man/X509_VERIFY_PARAM_new.3 b/src/lib/libcrypto/man/X509_VERIFY_PARAM_new.3 index a22d2b1b4b..333b3860e0 100644 --- a/src/lib/libcrypto/man/X509_VERIFY_PARAM_new.3 +++ b/src/lib/libcrypto/man/X509_VERIFY_PARAM_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_VERIFY_PARAM_new.3,v 1.5 2023/05/24 09:57:50 tb Exp $ | 1 | .\" $OpenBSD: X509_VERIFY_PARAM_new.3,v 1.6 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2018, 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2018, 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: May 24 2023 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_VERIFY_PARAM_NEW 3 | 18 | .Dt X509_VERIFY_PARAM_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -38,6 +38,7 @@ | |||
| 38 | .\" X509_VP_FLAG_ONCE | 38 | .\" X509_VP_FLAG_ONCE |
| 39 | .Nd X509 verification parameter objects | 39 | .Nd X509 verification parameter objects |
| 40 | .Sh SYNOPSIS | 40 | .Sh SYNOPSIS |
| 41 | .Lb libcrypto | ||
| 41 | .In openssl/x509_vfy.h | 42 | .In openssl/x509_vfy.h |
| 42 | .Ft X509_VERIFY_PARAM * | 43 | .Ft X509_VERIFY_PARAM * |
| 43 | .Fo X509_VERIFY_PARAM_new | 44 | .Fo X509_VERIFY_PARAM_new |
diff --git a/src/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 b/src/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 index a0ae839f9a..4c72be0267 100644 --- a/src/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 +++ b/src/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_VERIFY_PARAM_set_flags.3,v 1.29 2023/04/30 19:40:23 tb Exp $ | 1 | .\" $OpenBSD: X509_VERIFY_PARAM_set_flags.3,v 1.32 2025/11/07 19:59:31 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL d33def66 Feb 9 14:17:13 2016 -0500 | 2 | .\" full merge up to: OpenSSL d33def66 Feb 9 14:17:13 2016 -0500 |
| 3 | .\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 | 3 | .\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -68,7 +68,7 @@ | |||
| 68 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 68 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 69 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 69 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 70 | .\" | 70 | .\" |
| 71 | .Dd $Mdocdate: April 30 2023 $ | 71 | .Dd $Mdocdate: November 7 2025 $ |
| 72 | .Dt X509_VERIFY_PARAM_SET_FLAGS 3 | 72 | .Dt X509_VERIFY_PARAM_SET_FLAGS 3 |
| 73 | .Os | 73 | .Os |
| 74 | .Sh NAME | 74 | .Sh NAME |
| @@ -88,6 +88,7 @@ | |||
| 88 | .Nm X509_VERIFY_PARAM_set_auth_level , | 88 | .Nm X509_VERIFY_PARAM_set_auth_level , |
| 89 | .Nm X509_VERIFY_PARAM_set1_host , | 89 | .Nm X509_VERIFY_PARAM_set1_host , |
| 90 | .Nm X509_VERIFY_PARAM_add1_host , | 90 | .Nm X509_VERIFY_PARAM_add1_host , |
| 91 | .Nm X509_VERIFY_PARAM_get_hostflags , | ||
| 91 | .Nm X509_VERIFY_PARAM_set_hostflags , | 92 | .Nm X509_VERIFY_PARAM_set_hostflags , |
| 92 | .Nm X509_VERIFY_PARAM_get0_peername , | 93 | .Nm X509_VERIFY_PARAM_get0_peername , |
| 93 | .Nm X509_VERIFY_PARAM_set1_email , | 94 | .Nm X509_VERIFY_PARAM_set1_email , |
| @@ -95,6 +96,7 @@ | |||
| 95 | .Nm X509_VERIFY_PARAM_set1_ip_asc | 96 | .Nm X509_VERIFY_PARAM_set1_ip_asc |
| 96 | .Nd X509 verification parameters | 97 | .Nd X509 verification parameters |
| 97 | .Sh SYNOPSIS | 98 | .Sh SYNOPSIS |
| 99 | .Lb libcrypto | ||
| 98 | .In openssl/x509_vfy.h | 100 | .In openssl/x509_vfy.h |
| 99 | .Ft const char * | 101 | .Ft const char * |
| 100 | .Fo X509_VERIFY_PARAM_get0_name | 102 | .Fo X509_VERIFY_PARAM_get0_name |
| @@ -174,6 +176,10 @@ | |||
| 174 | .Fa "const char *name" | 176 | .Fa "const char *name" |
| 175 | .Fa "size_t namelen" | 177 | .Fa "size_t namelen" |
| 176 | .Fc | 178 | .Fc |
| 179 | .Ft unsigned int | ||
| 180 | .Fo X509_VERIFY_PARAM_get_hostflags | ||
| 181 | .Fa "const X509_VERIFY_PARAM *param" | ||
| 182 | .Fc | ||
| 177 | .Ft void | 183 | .Ft void |
| 178 | .Fo X509_VERIFY_PARAM_set_hostflags | 184 | .Fo X509_VERIFY_PARAM_set_hostflags |
| 179 | .Fa "X509_VERIFY_PARAM *param" | 185 | .Fa "X509_VERIFY_PARAM *param" |
| @@ -505,6 +511,11 @@ is unset. | |||
| 505 | .Fn X509_VERIFY_PARAM_get_depth | 511 | .Fn X509_VERIFY_PARAM_get_depth |
| 506 | returns the current verification depth. | 512 | returns the current verification depth. |
| 507 | .Pp | 513 | .Pp |
| 514 | .Fn X509_VERIFY_PARAM_get_hostflags | ||
| 515 | returns the host flags previously set by a call to | ||
| 516 | .Fn X509_VERIFY_PARAM_set_hostflags | ||
| 517 | or 0 by default. | ||
| 518 | .Pp | ||
| 508 | .Fn X509_VERIFY_PARAM_get0_name | 519 | .Fn X509_VERIFY_PARAM_get0_name |
| 509 | and | 520 | and |
| 510 | .Fn X509_VERIFY_PARAM_get0_peername | 521 | .Fn X509_VERIFY_PARAM_get0_peername |
| @@ -722,6 +733,10 @@ first appeared in OpenSSL 1.1.0 and | |||
| 722 | in OpenSSL 1.1.0d. | 733 | in OpenSSL 1.1.0d. |
| 723 | Both functions have been available since | 734 | Both functions have been available since |
| 724 | .Ox 7.2 . | 735 | .Ox 7.2 . |
| 736 | .Pp | ||
| 737 | .Fn X509_VERIFY_PARAM_get_hostflags | ||
| 738 | first appeared in OpenSSL 1.1.0i and has been available since | ||
| 739 | .Ox 7.9 . | ||
| 725 | .Sh BUGS | 740 | .Sh BUGS |
| 726 | Delta CRL checking is currently primitive. | 741 | Delta CRL checking is currently primitive. |
| 727 | Only a single delta can be used and (partly due to limitations of | 742 | Only a single delta can be used and (partly due to limitations of |
diff --git a/src/lib/libcrypto/man/X509_add1_trust_object.3 b/src/lib/libcrypto/man/X509_add1_trust_object.3 index 067bf64464..e1ca67a8f3 100644 --- a/src/lib/libcrypto/man/X509_add1_trust_object.3 +++ b/src/lib/libcrypto/man/X509_add1_trust_object.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_add1_trust_object.3,v 1.4 2024/09/02 08:04:32 tb Exp $ | 1 | .\" $OpenBSD: X509_add1_trust_object.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: September 2 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_ADD1_TRUST_OBJECT 3 | 18 | .Dt X509_ADD1_TRUST_OBJECT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -24,6 +24,7 @@ | |||
| 24 | .Nm X509_reject_clear | 24 | .Nm X509_reject_clear |
| 25 | .Nd mark an X.509 certificate as intended for a specific purpose | 25 | .Nd mark an X.509 certificate as intended for a specific purpose |
| 26 | .Sh SYNOPSIS | 26 | .Sh SYNOPSIS |
| 27 | .Lb libcrypto | ||
| 27 | .In openssl/x509.h | 28 | .In openssl/x509.h |
| 28 | .Ft int | 29 | .Ft int |
| 29 | .Fo X509_add1_trust_object | 30 | .Fo X509_add1_trust_object |
diff --git a/src/lib/libcrypto/man/X509_check_ca.3 b/src/lib/libcrypto/man/X509_check_ca.3 index 114bac69e7..2aa496b6ff 100644 --- a/src/lib/libcrypto/man/X509_check_ca.3 +++ b/src/lib/libcrypto/man/X509_check_ca.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_check_ca.3,v 1.7 2022/05/10 19:44:29 tb Exp $ | 1 | .\" $OpenBSD: X509_check_ca.3,v 1.8 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Victor B. Wagner <vitus@cryptocom.ru>. | 4 | .\" This file was written by Victor B. Wagner <vitus@cryptocom.ru>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: May 10 2022 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt X509_CHECK_CA 3 | 52 | .Dt X509_CHECK_CA 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm X509_check_ca | 55 | .Nm X509_check_ca |
| 56 | .Nd check whether a certificate is a CA certificate | 56 | .Nd check whether a certificate is a CA certificate |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/x509v3.h | 59 | .In openssl/x509v3.h |
| 59 | .Ft int | 60 | .Ft int |
| 60 | .Fo X509_check_ca | 61 | .Fo X509_check_ca |
diff --git a/src/lib/libcrypto/man/X509_check_host.3 b/src/lib/libcrypto/man/X509_check_host.3 index dbc56c0d21..be3190b2d2 100644 --- a/src/lib/libcrypto/man/X509_check_host.3 +++ b/src/lib/libcrypto/man/X509_check_host.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_check_host.3,v 1.6 2020/09/17 08:04:22 schwarze Exp $ | 1 | .\" $OpenBSD: X509_check_host.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL a09e4d24 Jun 12 01:56:31 2014 -0400 | 2 | .\" full merge up to: OpenSSL a09e4d24 Jun 12 01:56:31 2014 -0400 |
| 3 | .\" selective merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 | 3 | .\" selective merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 |
| 4 | .\" | 4 | .\" |
| @@ -51,7 +51,7 @@ | |||
| 51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 53 | .\" | 53 | .\" |
| 54 | .Dd $Mdocdate: September 17 2020 $ | 54 | .Dd $Mdocdate: June 8 2025 $ |
| 55 | .Dt X509_CHECK_HOST 3 | 55 | .Dt X509_CHECK_HOST 3 |
| 56 | .Os | 56 | .Os |
| 57 | .Sh NAME | 57 | .Sh NAME |
| @@ -61,6 +61,7 @@ | |||
| 61 | .Nm X509_check_ip_asc | 61 | .Nm X509_check_ip_asc |
| 62 | .Nd X.509 certificate matching | 62 | .Nd X.509 certificate matching |
| 63 | .Sh SYNOPSIS | 63 | .Sh SYNOPSIS |
| 64 | .Lb libcrypto | ||
| 64 | .In openssl/x509v3.h | 65 | .In openssl/x509v3.h |
| 65 | .Ft int | 66 | .Ft int |
| 66 | .Fo X509_check_host | 67 | .Fo X509_check_host |
diff --git a/src/lib/libcrypto/man/X509_check_issued.3 b/src/lib/libcrypto/man/X509_check_issued.3 index f8c2a5297a..24457674d5 100644 --- a/src/lib/libcrypto/man/X509_check_issued.3 +++ b/src/lib/libcrypto/man/X509_check_issued.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_check_issued.3,v 1.4 2019/06/06 01:06:59 schwarze Exp $ | 1 | .\" $OpenBSD: X509_check_issued.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Victor B. Wagner <vitus@cryptocom.ru>. | 4 | .\" This file was written by Victor B. Wagner <vitus@cryptocom.ru>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 6 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt X509_CHECK_ISSUED 3 | 52 | .Dt X509_CHECK_ISSUED 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm X509_check_issued | 55 | .Nm X509_check_issued |
| 56 | .Nd check whether a certificate was issued using a given CA certificate | 56 | .Nd check whether a certificate was issued using a given CA certificate |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/x509v3.h | 59 | .In openssl/x509v3.h |
| 59 | .Ft int | 60 | .Ft int |
| 60 | .Fo X509_check_issued | 61 | .Fo X509_check_issued |
diff --git a/src/lib/libcrypto/man/X509_check_private_key.3 b/src/lib/libcrypto/man/X509_check_private_key.3 index 31df2126cc..61ff091728 100644 --- a/src/lib/libcrypto/man/X509_check_private_key.3 +++ b/src/lib/libcrypto/man/X509_check_private_key.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_check_private_key.3,v 1.6 2019/06/06 01:06:59 schwarze Exp $ | 1 | .\" $OpenBSD: X509_check_private_key.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL X509_check_private_key.pod 09ddb878 Jun 5 03:56:07 2017 +0800 | 2 | .\" OpenSSL X509_check_private_key.pod 09ddb878 Jun 5 03:56:07 2017 +0800 |
| 3 | .\" | 3 | .\" |
| 4 | .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> | 4 | .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> |
| @@ -15,7 +15,7 @@ | |||
| 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 | .\" | 17 | .\" |
| 18 | .Dd $Mdocdate: June 6 2019 $ | 18 | .Dd $Mdocdate: June 8 2025 $ |
| 19 | .Dt X509_CHECK_PRIVATE_KEY 3 | 19 | .Dt X509_CHECK_PRIVATE_KEY 3 |
| 20 | .Os | 20 | .Os |
| 21 | .Sh NAME | 21 | .Sh NAME |
| @@ -23,6 +23,7 @@ | |||
| 23 | .Nm X509_REQ_check_private_key | 23 | .Nm X509_REQ_check_private_key |
| 24 | .Nd compare public key components | 24 | .Nd compare public key components |
| 25 | .Sh SYNOPSIS | 25 | .Sh SYNOPSIS |
| 26 | .Lb libcrypto | ||
| 26 | .In openssl/x509.h | 27 | .In openssl/x509.h |
| 27 | .Ft int | 28 | .Ft int |
| 28 | .Fo X509_check_private_key | 29 | .Fo X509_check_private_key |
diff --git a/src/lib/libcrypto/man/X509_check_purpose.3 b/src/lib/libcrypto/man/X509_check_purpose.3 index 8fea6679fc..86ee53f559 100644 --- a/src/lib/libcrypto/man/X509_check_purpose.3 +++ b/src/lib/libcrypto/man/X509_check_purpose.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_check_purpose.3,v 1.12 2024/09/02 08:04:32 tb Exp $ | 1 | .\" $OpenBSD: X509_check_purpose.3,v 1.13 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2019, 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2019, 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: September 2 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_CHECK_PURPOSE 3 | 18 | .Dt X509_CHECK_PURPOSE 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm X509_check_purpose | 21 | .Nm X509_check_purpose |
| 22 | .Nd check intended usage of a public key | 22 | .Nd check intended usage of a public key |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/x509v3.h | 25 | .In openssl/x509v3.h |
| 25 | .Ft int | 26 | .Ft int |
| 26 | .Fo X509_check_purpose | 27 | .Fo X509_check_purpose |
diff --git a/src/lib/libcrypto/man/X509_cmp.3 b/src/lib/libcrypto/man/X509_cmp.3 index b1cdec1773..e025f5c8c0 100644 --- a/src/lib/libcrypto/man/X509_cmp.3 +++ b/src/lib/libcrypto/man/X509_cmp.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_cmp.3,v 1.4 2024/06/07 14:00:09 job Exp $ | 1 | .\" $OpenBSD: X509_cmp.3,v 1.5 2025/06/08 22:37:23 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL ea5d4b89 Jun 6 11:42:02 2019 +0800 | 2 | .\" full merge up to: OpenSSL ea5d4b89 Jun 6 11:42:02 2019 +0800 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: June 7 2024 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt X509_CMP 3 | 69 | .Dt X509_CMP 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -79,10 +79,8 @@ | |||
| 79 | .Nm X509_CRL_cmp , | 79 | .Nm X509_CRL_cmp , |
| 80 | .Nm X509_CRL_match | 80 | .Nm X509_CRL_match |
| 81 | .Nd compare X.509 certificates and related values | 81 | .Nd compare X.509 certificates and related values |
| 82 | .\" The function name_cmp() is intentionally undocumented. | ||
| 83 | .\" It was a mistake to make it public in the first place, | ||
| 84 | .\" and it is no longer part of the public API in OpenSSL 1.1. | ||
| 85 | .Sh SYNOPSIS | 82 | .Sh SYNOPSIS |
| 83 | .Lb libcrypto | ||
| 86 | .In openssl/x509.h | 84 | .In openssl/x509.h |
| 87 | .Ft int | 85 | .Ft int |
| 88 | .Fo X509_cmp | 86 | .Fo X509_cmp |
diff --git a/src/lib/libcrypto/man/X509_cmp_time.3 b/src/lib/libcrypto/man/X509_cmp_time.3 index bb430dfbb7..2ac584ad09 100644 --- a/src/lib/libcrypto/man/X509_cmp_time.3 +++ b/src/lib/libcrypto/man/X509_cmp_time.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_cmp_time.3,v 1.12 2024/03/05 18:30:40 tb Exp $ | 1 | .\" $OpenBSD: X509_cmp_time.3,v 1.13 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 | 2 | .\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: March 5 2024 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt X509_CMP_TIME 3 | 69 | .Dt X509_CMP_TIME 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -76,6 +76,7 @@ | |||
| 76 | .Nm X509_gmtime_adj | 76 | .Nm X509_gmtime_adj |
| 77 | .Nd ASN.1 Time utilities | 77 | .Nd ASN.1 Time utilities |
| 78 | .Sh SYNOPSIS | 78 | .Sh SYNOPSIS |
| 79 | .Lb libcrypto | ||
| 79 | .In openssl/x509.h | 80 | .In openssl/x509.h |
| 80 | .Ft int | 81 | .Ft int |
| 81 | .Fo X509_cmp_time | 82 | .Fo X509_cmp_time |
diff --git a/src/lib/libcrypto/man/X509_digest.3 b/src/lib/libcrypto/man/X509_digest.3 index 7627e07731..991d1990b2 100644 --- a/src/lib/libcrypto/man/X509_digest.3 +++ b/src/lib/libcrypto/man/X509_digest.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_digest.3,v 1.8 2019/08/20 13:27:19 schwarze Exp $ | 1 | .\" $OpenBSD: X509_digest.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 1212818e Sep 11 13:22:14 2018 +0100 | 2 | .\" full merge up to: OpenSSL 1212818e Sep 11 13:22:14 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Rich Salz <rsalz@openssl.org> | 4 | .\" This file was written by Rich Salz <rsalz@openssl.org> |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: August 20 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt X509_DIGEST 3 | 52 | .Dt X509_DIGEST 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -60,6 +60,7 @@ | |||
| 60 | .Nm PKCS7_ISSUER_AND_SERIAL_digest | 60 | .Nm PKCS7_ISSUER_AND_SERIAL_digest |
| 61 | .Nd get digests of various objects | 61 | .Nd get digests of various objects |
| 62 | .Sh SYNOPSIS | 62 | .Sh SYNOPSIS |
| 63 | .Lb libcrypto | ||
| 63 | .In openssl/x509.h | 64 | .In openssl/x509.h |
| 64 | .Ft int | 65 | .Ft int |
| 65 | .Fo X509_digest | 66 | .Fo X509_digest |
diff --git a/src/lib/libcrypto/man/X509_find_by_subject.3 b/src/lib/libcrypto/man/X509_find_by_subject.3 index 98a76a1fca..962eb80854 100644 --- a/src/lib/libcrypto/man/X509_find_by_subject.3 +++ b/src/lib/libcrypto/man/X509_find_by_subject.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_find_by_subject.3,v 1.1 2021/07/04 12:56:27 schwarze Exp $ | 1 | .\" $OpenBSD: X509_find_by_subject.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: July 4 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_FIND_BY_SUBJECT 3 | 18 | .Dt X509_FIND_BY_SUBJECT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm X509_find_by_issuer_and_serial | 22 | .Nm X509_find_by_issuer_and_serial |
| 23 | .Nd search an array of X.509 certificates | 23 | .Nd search an array of X.509 certificates |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/x509.h | 26 | .In openssl/x509.h |
| 26 | .Ft X509 * | 27 | .Ft X509 * |
| 27 | .Fo X509_find_by_subject | 28 | .Fo X509_find_by_subject |
diff --git a/src/lib/libcrypto/man/X509_get0_notBefore.3 b/src/lib/libcrypto/man/X509_get0_notBefore.3 index 5e5c08b79a..5ac075fe31 100644 --- a/src/lib/libcrypto/man/X509_get0_notBefore.3 +++ b/src/lib/libcrypto/man/X509_get0_notBefore.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_get0_notBefore.3,v 1.7 2024/03/05 18:30:40 tb Exp $ | 1 | .\" $OpenBSD: X509_get0_notBefore.3,v 1.8 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" content checked up to: OpenSSL 27b138e9 May 19 00:16:38 2017 +0000 | 2 | .\" content checked up to: OpenSSL 27b138e9 May 19 00:16:38 2017 +0000 |
| 3 | .\" | 3 | .\" |
| 4 | .\" Copyright (c) 2018, 2020 Ingo Schwarze <schwarze@openbsd.org> | 4 | .\" Copyright (c) 2018, 2020 Ingo Schwarze <schwarze@openbsd.org> |
| @@ -15,7 +15,7 @@ | |||
| 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 | .\" | 17 | .\" |
| 18 | .Dd $Mdocdate: March 5 2024 $ | 18 | .Dd $Mdocdate: June 8 2025 $ |
| 19 | .Dt X509_GET0_NOTBEFORE 3 | 19 | .Dt X509_GET0_NOTBEFORE 3 |
| 20 | .Os | 20 | .Os |
| 21 | .Sh NAME | 21 | .Sh NAME |
| @@ -39,6 +39,7 @@ | |||
| 39 | .Nm X509_CRL_set_nextUpdate | 39 | .Nm X509_CRL_set_nextUpdate |
| 40 | .Nd get and set certificate and CRL validity dates | 40 | .Nd get and set certificate and CRL validity dates |
| 41 | .Sh SYNOPSIS | 41 | .Sh SYNOPSIS |
| 42 | .Lb libcrypto | ||
| 42 | .In openssl/x509.h | 43 | .In openssl/x509.h |
| 43 | .Ft const ASN1_TIME * | 44 | .Ft const ASN1_TIME * |
| 44 | .Fo X509_get0_notBefore | 45 | .Fo X509_get0_notBefore |
diff --git a/src/lib/libcrypto/man/X509_get0_signature.3 b/src/lib/libcrypto/man/X509_get0_signature.3 index dc3be2c70a..6cebb94e56 100644 --- a/src/lib/libcrypto/man/X509_get0_signature.3 +++ b/src/lib/libcrypto/man/X509_get0_signature.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_get0_signature.3,v 1.9 2024/08/28 07:18:55 tb Exp $ | 1 | .\" $OpenBSD: X509_get0_signature.3,v 1.12 2025/07/06 09:32:08 tb Exp $ |
| 2 | .\" selective merge up to: | 2 | .\" selective merge up to: |
| 3 | .\" OpenSSL man3/X509_get0_signature 2f7a2520 Apr 25 17:28:08 2017 +0100 | 3 | .\" OpenSSL man3/X509_get0_signature 2f7a2520 Apr 25 17:28:08 2017 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: August 28 2024 $ | 69 | .Dd $Mdocdate: July 6 2025 $ |
| 70 | .Dt X509_GET0_SIGNATURE 3 | 70 | .Dt X509_GET0_SIGNATURE 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -82,6 +82,7 @@ | |||
| 82 | .Nm X509_get_signature_info | 82 | .Nm X509_get_signature_info |
| 83 | .Nd signature information | 83 | .Nd signature information |
| 84 | .Sh SYNOPSIS | 84 | .Sh SYNOPSIS |
| 85 | .Lb libcrypto | ||
| 85 | .In openssl/x509.h | 86 | .In openssl/x509.h |
| 86 | .Ft void | 87 | .Ft void |
| 87 | .Fo X509_get0_signature | 88 | .Fo X509_get0_signature |
| @@ -212,11 +213,11 @@ For a supported EdDSA algorithm (in LibreSSL this is Ed25519) | |||
| 212 | this flag is always set. | 213 | this flag is always set. |
| 213 | For an RSASSA-PSS PSS algorithm this flag is set if | 214 | For an RSASSA-PSS PSS algorithm this flag is set if |
| 214 | the parameters are DER encoded, | 215 | the parameters are DER encoded, |
| 215 | the digest algorithm is one of SHA256, SHA384, or SHA512, | 216 | the digest algorithm is one of SHA-256, SHA-384, or SHA-512, |
| 216 | the same digest algorithm is used in the mask generation function, | 217 | the same digest algorithm is used in the mask generation function, |
| 217 | and the salt length is equal to the digest algorithm's output length. | 218 | and the salt length is equal to the digest algorithm's output length. |
| 218 | For all other signature algorithms this flag is set if the digest | 219 | For all other signature algorithms this flag is set if the digest |
| 219 | algorithm is one of SHA1, SHA256, SHA384, or SHA512. | 220 | algorithm is one of SHA-1, SHA-256, SHA-384, or SHA-512. |
| 220 | .El | 221 | .El |
| 221 | .Pp | 222 | .Pp |
| 222 | .Fn X509_get_signature_info | 223 | .Fn X509_get_signature_info |
| @@ -276,5 +277,12 @@ refer to the information available from the certificate signature | |||
| 276 | (such as the signing digest). | 277 | (such as the signing digest). |
| 277 | In some cases the actual security of the signature is smaller | 278 | In some cases the actual security of the signature is smaller |
| 278 | because the signing key is less secure. | 279 | because the signing key is less secure. |
| 279 | For example in a certificate signed using SHA512 | 280 | For example in a certificate signed using SHA-512 |
| 280 | and a 1024-bit RSA key. | 281 | and a 1024-bit RSA key. |
| 282 | .Sh BUGS | ||
| 283 | The signatures of | ||
| 284 | .Fn X509_get0_signature , | ||
| 285 | .Fn X509_REQ_get0_signature , | ||
| 286 | and | ||
| 287 | .Fn X509_CRL_get0_signature | ||
| 288 | are inconsistent. | ||
diff --git a/src/lib/libcrypto/man/X509_get1_email.3 b/src/lib/libcrypto/man/X509_get1_email.3 index c38a604899..020708d227 100644 --- a/src/lib/libcrypto/man/X509_get1_email.3 +++ b/src/lib/libcrypto/man/X509_get1_email.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_get1_email.3,v 1.1 2019/08/23 12:23:39 schwarze Exp $ | 1 | .\" $OpenBSD: X509_get1_email.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: August 23 2019 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_GET1_EMAIL 3 | 18 | .Dt X509_GET1_EMAIL 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -23,6 +23,7 @@ | |||
| 23 | .Nm X509_email_free | 23 | .Nm X509_email_free |
| 24 | .Nd utilities for stacks of strings | 24 | .Nd utilities for stacks of strings |
| 25 | .Sh SYNOPSIS | 25 | .Sh SYNOPSIS |
| 26 | .Lb libcrypto | ||
| 26 | .In openssl/x509v3.h | 27 | .In openssl/x509v3.h |
| 27 | .Vt typedef char *OPENSSL_STRING ; | 28 | .Vt typedef char *OPENSSL_STRING ; |
| 28 | .Ft STACK_OF(OPENSSL_STRING) * | 29 | .Ft STACK_OF(OPENSSL_STRING) * |
diff --git a/src/lib/libcrypto/man/X509_get_extension_flags.3 b/src/lib/libcrypto/man/X509_get_extension_flags.3 index 1d7f29c687..1d15be407e 100644 --- a/src/lib/libcrypto/man/X509_get_extension_flags.3 +++ b/src/lib/libcrypto/man/X509_get_extension_flags.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_get_extension_flags.3,v 1.4 2023/04/30 19:40:23 tb Exp $ | 1 | .\" $OpenBSD: X509_get_extension_flags.3,v 1.6 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 361136f4 Sep 1 18:56:58 2015 +0100 | 2 | .\" full merge up to: OpenSSL 361136f4 Sep 1 18:56:58 2015 +0100 |
| 3 | .\" selective merge up to: OpenSSL 2b2e3106f Feb 16 15:04:45 2021 +0000 | 3 | .\" selective merge up to: OpenSSL 2b2e3106f Feb 16 15:04:45 2021 +0000 |
| 4 | .\" | 4 | .\" |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: April 30 2023 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt X509_GET_EXTENSION_FLAGS 3 | 53 | .Dt X509_GET_EXTENSION_FLAGS 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm X509_get_extended_key_usage | 58 | .Nm X509_get_extended_key_usage |
| 59 | .Nd retrieve certificate extension data | 59 | .Nd retrieve certificate extension data |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libcrypto | ||
| 61 | .In openssl/x509v3.h | 62 | .In openssl/x509v3.h |
| 62 | .Ft uint32_t | 63 | .Ft uint32_t |
| 63 | .Fo X509_get_extension_flags | 64 | .Fo X509_get_extension_flags |
| @@ -106,8 +107,8 @@ ASN1 object itself. | |||
| 106 | .\" EXFLAG_NO_FINGERPRINT is not available in LibreSSL. Do we need | 107 | .\" EXFLAG_NO_FINGERPRINT is not available in LibreSSL. Do we need |
| 107 | .\" https://github.com/openssl/openssl/issues/13698 and the fix it fixes? | 108 | .\" https://github.com/openssl/openssl/issues/13698 and the fix it fixes? |
| 108 | .\".It Dv EXFLAG_NO_FINGERPRINT | 109 | .\".It Dv EXFLAG_NO_FINGERPRINT |
| 109 | .\" Failed to compute the internal SHA1 hash value of the certificate. | 110 | .\" Failed to compute the internal SHA-1 hash value of the certificate. |
| 110 | .\" This may be due to malloc failure or because no SHA1 implementation was | 111 | .\" This may be due to malloc failure or because no SHA-1 implementation was |
| 111 | .\" found. | 112 | .\" found. |
| 112 | .It Dv EXFLAG_INVALID_POLICY | 113 | .It Dv EXFLAG_INVALID_POLICY |
| 113 | The | 114 | The |
diff --git a/src/lib/libcrypto/man/X509_get_pubkey.3 b/src/lib/libcrypto/man/X509_get_pubkey.3 index 0829397982..9af6f49a33 100644 --- a/src/lib/libcrypto/man/X509_get_pubkey.3 +++ b/src/lib/libcrypto/man/X509_get_pubkey.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_get_pubkey.3,v 1.13 2022/03/31 17:27:17 naddy Exp $ | 1 | .\" $OpenBSD: X509_get_pubkey.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" selective merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" selective merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: March 31 2022 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt X509_GET_PUBKEY 3 | 69 | .Dt X509_GET_PUBKEY 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -81,6 +81,7 @@ | |||
| 81 | .Nm X509_REQ_extract_key | 81 | .Nm X509_REQ_extract_key |
| 82 | .Nd get or set certificate or certificate request public key | 82 | .Nd get or set certificate or certificate request public key |
| 83 | .Sh SYNOPSIS | 83 | .Sh SYNOPSIS |
| 84 | .Lb libcrypto | ||
| 84 | .In openssl/x509.h | 85 | .In openssl/x509.h |
| 85 | .Ft EVP_PKEY * | 86 | .Ft EVP_PKEY * |
| 86 | .Fo X509_get_pubkey | 87 | .Fo X509_get_pubkey |
diff --git a/src/lib/libcrypto/man/X509_get_pubkey_parameters.3 b/src/lib/libcrypto/man/X509_get_pubkey_parameters.3 index 181361477e..b2611210d1 100644 --- a/src/lib/libcrypto/man/X509_get_pubkey_parameters.3 +++ b/src/lib/libcrypto/man/X509_get_pubkey_parameters.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_get_pubkey_parameters.3,v 1.2 2021/11/26 13:35:10 schwarze Exp $ | 1 | .\" $OpenBSD: X509_get_pubkey_parameters.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: November 26 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_GET_PUBKEY_PARAMETERS 3 | 18 | .Dt X509_GET_PUBKEY_PARAMETERS 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm X509_get_pubkey_parameters | 21 | .Nm X509_get_pubkey_parameters |
| 22 | .Nd copy public key parameters from a chain | 22 | .Nd copy public key parameters from a chain |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/x509.h | 25 | .In openssl/x509.h |
| 25 | .Ft int | 26 | .Ft int |
| 26 | .Fo X509_get_pubkey_parameters | 27 | .Fo X509_get_pubkey_parameters |
diff --git a/src/lib/libcrypto/man/X509_get_serialNumber.3 b/src/lib/libcrypto/man/X509_get_serialNumber.3 index 7d757c7a71..56f108f3d7 100644 --- a/src/lib/libcrypto/man/X509_get_serialNumber.3 +++ b/src/lib/libcrypto/man/X509_get_serialNumber.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_get_serialNumber.3,v 1.5 2020/06/19 12:01:20 schwarze Exp $ | 1 | .\" $OpenBSD: X509_get_serialNumber.3,v 1.6 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 | 2 | .\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 19 2020 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt X509_GET_SERIALNUMBER 3 | 52 | .Dt X509_GET_SERIALNUMBER 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm X509_set_serialNumber | 57 | .Nm X509_set_serialNumber |
| 58 | .Nd get or set certificate serial number | 58 | .Nd get or set certificate serial number |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/x509.h | 61 | .In openssl/x509.h |
| 61 | .Ft ASN1_INTEGER * | 62 | .Ft ASN1_INTEGER * |
| 62 | .Fo X509_get_serialNumber | 63 | .Fo X509_get_serialNumber |
diff --git a/src/lib/libcrypto/man/X509_get_subject_name.3 b/src/lib/libcrypto/man/X509_get_subject_name.3 index fb9611f645..8dc19080f6 100644 --- a/src/lib/libcrypto/man/X509_get_subject_name.3 +++ b/src/lib/libcrypto/man/X509_get_subject_name.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_get_subject_name.3,v 1.10 2020/10/21 17:17:44 tb Exp $ | 1 | .\" $OpenBSD: X509_get_subject_name.3,v 1.11 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: October 21 2020 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt X509_GET_SUBJECT_NAME 3 | 52 | .Dt X509_GET_SUBJECT_NAME 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -62,6 +62,7 @@ | |||
| 62 | .Nm X509_CRL_set_issuer_name | 62 | .Nm X509_CRL_set_issuer_name |
| 63 | .Nd get and set issuer or subject names | 63 | .Nd get and set issuer or subject names |
| 64 | .Sh SYNOPSIS | 64 | .Sh SYNOPSIS |
| 65 | .Lb libcrypto | ||
| 65 | .In openssl/x509.h | 66 | .In openssl/x509.h |
| 66 | .Ft X509_NAME * | 67 | .Ft X509_NAME * |
| 67 | .Fo X509_get_subject_name | 68 | .Fo X509_get_subject_name |
diff --git a/src/lib/libcrypto/man/X509_get_version.3 b/src/lib/libcrypto/man/X509_get_version.3 index ee46ff7c8c..d539053d81 100644 --- a/src/lib/libcrypto/man/X509_get_version.3 +++ b/src/lib/libcrypto/man/X509_get_version.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_get_version.3,v 1.8 2020/10/21 17:17:44 tb Exp $ | 1 | .\" $OpenBSD: X509_get_version.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: October 21 2020 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt X509_GET_VERSION 3 | 52 | .Dt X509_GET_VERSION 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -60,6 +60,7 @@ | |||
| 60 | .Nm X509_CRL_set_version | 60 | .Nm X509_CRL_set_version |
| 61 | .Nd get or set certificate, certificate request, or CRL version | 61 | .Nd get or set certificate, certificate request, or CRL version |
| 62 | .Sh SYNOPSIS | 62 | .Sh SYNOPSIS |
| 63 | .Lb libcrypto | ||
| 63 | .In openssl/x509.h | 64 | .In openssl/x509.h |
| 64 | .Ft long | 65 | .Ft long |
| 65 | .Fo X509_get_version | 66 | .Fo X509_get_version |
diff --git a/src/lib/libcrypto/man/X509_keyid_set1.3 b/src/lib/libcrypto/man/X509_keyid_set1.3 index c529fc742b..e1668f976a 100644 --- a/src/lib/libcrypto/man/X509_keyid_set1.3 +++ b/src/lib/libcrypto/man/X509_keyid_set1.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_keyid_set1.3,v 1.2 2021/07/09 14:41:14 tb Exp $ | 1 | .\" $OpenBSD: X509_keyid_set1.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: July 9 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_KEYID_SET1 3 | 18 | .Dt X509_KEYID_SET1 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -24,6 +24,7 @@ | |||
| 24 | .Nm X509_alias_get0 | 24 | .Nm X509_alias_get0 |
| 25 | .Nd auxiliary certificate data for PKCS#12 | 25 | .Nd auxiliary certificate data for PKCS#12 |
| 26 | .Sh SYNOPSIS | 26 | .Sh SYNOPSIS |
| 27 | .Lb libcrypto | ||
| 27 | .In openssl/x509.h | 28 | .In openssl/x509.h |
| 28 | .Ft int | 29 | .Ft int |
| 29 | .Fo X509_keyid_set1 | 30 | .Fo X509_keyid_set1 |
diff --git a/src/lib/libcrypto/man/X509_load_cert_file.3 b/src/lib/libcrypto/man/X509_load_cert_file.3 index 95a83dd00e..04a666da25 100644 --- a/src/lib/libcrypto/man/X509_load_cert_file.3 +++ b/src/lib/libcrypto/man/X509_load_cert_file.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_load_cert_file.3,v 1.1 2021/11/09 16:23:04 schwarze Exp $ | 1 | .\" $OpenBSD: X509_load_cert_file.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: November 9 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_LOAD_CERT_FILE 3 | 18 | .Dt X509_LOAD_CERT_FILE 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -23,6 +23,7 @@ | |||
| 23 | .Nm X509_load_cert_crl_file | 23 | .Nm X509_load_cert_crl_file |
| 24 | .Nd read, decode, and cache certificates and CRLs | 24 | .Nd read, decode, and cache certificates and CRLs |
| 25 | .Sh SYNOPSIS | 25 | .Sh SYNOPSIS |
| 26 | .Lb libcrypto | ||
| 26 | .In openssl/x509_vfy.h | 27 | .In openssl/x509_vfy.h |
| 27 | .Ft int | 28 | .Ft int |
| 28 | .Fo X509_load_cert_file | 29 | .Fo X509_load_cert_file |
diff --git a/src/lib/libcrypto/man/X509_new.3 b/src/lib/libcrypto/man/X509_new.3 index 7b62363d4d..b6140b24b0 100644 --- a/src/lib/libcrypto/man/X509_new.3 +++ b/src/lib/libcrypto/man/X509_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_new.3,v 1.45 2024/09/02 08:04:32 tb Exp $ | 1 | .\" $OpenBSD: X509_new.3,v 1.47 2025/07/16 17:59:10 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: September 2 2024 $ | 69 | .Dd $Mdocdate: July 16 2025 $ |
| 70 | .Dt X509_NEW 3 | 70 | .Dt X509_NEW 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -78,6 +78,7 @@ | |||
| 78 | .Nm X509_chain_up_ref | 78 | .Nm X509_chain_up_ref |
| 79 | .Nd X.509 certificate object | 79 | .Nd X.509 certificate object |
| 80 | .Sh SYNOPSIS | 80 | .Sh SYNOPSIS |
| 81 | .Lb libcrypto | ||
| 81 | .In openssl/x509.h | 82 | .In openssl/x509.h |
| 82 | .Ft X509 * | 83 | .Ft X509 * |
| 83 | .Fn X509_new void | 84 | .Fn X509_new void |
| @@ -230,7 +231,6 @@ if an error occurs. | |||
| 230 | .Xr X509_LOOKUP_new 3 , | 231 | .Xr X509_LOOKUP_new 3 , |
| 231 | .Xr X509_NAME_new 3 , | 232 | .Xr X509_NAME_new 3 , |
| 232 | .Xr X509_OBJECT_new 3 , | 233 | .Xr X509_OBJECT_new 3 , |
| 233 | .Xr X509_PKEY_new 3 , | ||
| 234 | .Xr X509_print_ex 3 , | 234 | .Xr X509_print_ex 3 , |
| 235 | .Xr X509_PUBKEY_new 3 , | 235 | .Xr X509_PUBKEY_new 3 , |
| 236 | .Xr X509_PURPOSE_set 3 , | 236 | .Xr X509_PURPOSE_set 3 , |
diff --git a/src/lib/libcrypto/man/X509_ocspid_print.3 b/src/lib/libcrypto/man/X509_ocspid_print.3 index b9b6c92fbb..7b0493c655 100644 --- a/src/lib/libcrypto/man/X509_ocspid_print.3 +++ b/src/lib/libcrypto/man/X509_ocspid_print.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_ocspid_print.3,v 1.1 2021/08/06 21:45:55 schwarze Exp $ | 1 | .\" $OpenBSD: X509_ocspid_print.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: August 6 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_OCSPID_PRINT 3 | 18 | .Dt X509_OCSPID_PRINT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm X509_ocspid_print | 21 | .Nm X509_ocspid_print |
| 22 | .Nd pretty-print hashes of subject name and public key | 22 | .Nd pretty-print hashes of subject name and public key |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/x509.h | 25 | .In openssl/x509.h |
| 25 | .Ft int | 26 | .Ft int |
| 26 | .Fo X509_ocspid_print | 27 | .Fo X509_ocspid_print |
diff --git a/src/lib/libcrypto/man/X509_print_ex.3 b/src/lib/libcrypto/man/X509_print_ex.3 index c769e77c32..627ef25a79 100644 --- a/src/lib/libcrypto/man/X509_print_ex.3 +++ b/src/lib/libcrypto/man/X509_print_ex.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_print_ex.3,v 1.5 2025/03/09 14:02:46 tb Exp $ | 1 | .\" $OpenBSD: X509_print_ex.3,v 1.7 2025/07/01 06:47:56 tb Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 9 2025 $ | 17 | .Dd $Mdocdate: July 1 2025 $ |
| 18 | .Dt X509_PRINT_EX 3 | 18 | .Dt X509_PRINT_EX 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -25,6 +25,7 @@ | |||
| 25 | .Nm X509_print_fp | 25 | .Nm X509_print_fp |
| 26 | .Nd pretty-print an X.509 certificate | 26 | .Nd pretty-print an X.509 certificate |
| 27 | .Sh SYNOPSIS | 27 | .Sh SYNOPSIS |
| 28 | .Lb libcrypto | ||
| 28 | .In openssl/x509.h | 29 | .In openssl/x509.h |
| 29 | .Ft int | 30 | .Ft int |
| 30 | .Fo X509_print_ex | 31 | .Fo X509_print_ex |
| @@ -132,6 +133,11 @@ with | |||
| 132 | .Xr EVP_PKEY_print_public 3 . | 133 | .Xr EVP_PKEY_print_public 3 . |
| 133 | .Pq Dv X509_FLAG_NO_PUBKEY | 134 | .Pq Dv X509_FLAG_NO_PUBKEY |
| 134 | .It | 135 | .It |
| 136 | If an issuer or a subject unique identifier is present, its hex dump | ||
| 137 | is printed with | ||
| 138 | .Xr X509_signature_dump 3 . | ||
| 139 | .Pq Dv X509_FLAG_NO_IDS | ||
| 140 | .It | ||
| 135 | All X.509 extensions contained in the certificate are printed with | 141 | All X.509 extensions contained in the certificate are printed with |
| 136 | .Xr X509V3_extensions_print 3 . | 142 | .Xr X509V3_extensions_print 3 . |
| 137 | .Pq Dv X509_FLAG_NO_EXTENSIONS | 143 | .Pq Dv X509_FLAG_NO_EXTENSIONS |
diff --git a/src/lib/libcrypto/man/X509_sign.3 b/src/lib/libcrypto/man/X509_sign.3 index 059d92bac5..9e9df1e98d 100644 --- a/src/lib/libcrypto/man/X509_sign.3 +++ b/src/lib/libcrypto/man/X509_sign.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_sign.3,v 1.11 2024/03/06 02:34:14 tb Exp $ | 1 | .\" $OpenBSD: X509_sign.3,v 1.13 2025/07/11 18:42:51 tb Exp $ |
| 2 | .\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 | 2 | .\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 6 2024 $ | 51 | .Dd $Mdocdate: July 11 2025 $ |
| 52 | .Dt X509_SIGN 3 | 52 | .Dt X509_SIGN 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -63,6 +63,7 @@ | |||
| 63 | .Nm X509_CRL_verify | 63 | .Nm X509_CRL_verify |
| 64 | .Nd sign or verify certificate, certificate request, or CRL signature | 64 | .Nd sign or verify certificate, certificate request, or CRL signature |
| 65 | .Sh SYNOPSIS | 65 | .Sh SYNOPSIS |
| 66 | .Lb libcrypto | ||
| 66 | .In openssl/x509.h | 67 | .In openssl/x509.h |
| 67 | .Ft int | 68 | .Ft int |
| 68 | .Fo X509_sign | 69 | .Fo X509_sign |
| @@ -77,8 +78,8 @@ | |||
| 77 | .Fc | 78 | .Fc |
| 78 | .Ft int | 79 | .Ft int |
| 79 | .Fo X509_verify | 80 | .Fo X509_verify |
| 80 | .Fa "X509 *a" | 81 | .Fa "X509 *x" |
| 81 | .Fa "EVP_PKEY *r" | 82 | .Fa "EVP_PKEY *pkey" |
| 82 | .Fc | 83 | .Fc |
| 83 | .Ft int | 84 | .Ft int |
| 84 | .Fo X509_REQ_sign | 85 | .Fo X509_REQ_sign |
| @@ -93,8 +94,8 @@ | |||
| 93 | .Fc | 94 | .Fc |
| 94 | .Ft int | 95 | .Ft int |
| 95 | .Fo X509_REQ_verify | 96 | .Fo X509_REQ_verify |
| 96 | .Fa "X509_REQ *a" | 97 | .Fa "X509_REQ *x" |
| 97 | .Fa "EVP_PKEY *r" | 98 | .Fa "EVP_PKEY *pkey" |
| 98 | .Fc | 99 | .Fc |
| 99 | .Ft int | 100 | .Ft int |
| 100 | .Fo X509_CRL_sign | 101 | .Fo X509_CRL_sign |
| @@ -109,8 +110,8 @@ | |||
| 109 | .Fc | 110 | .Fc |
| 110 | .Ft int | 111 | .Ft int |
| 111 | .Fo X509_CRL_verify | 112 | .Fo X509_CRL_verify |
| 112 | .Fa "X509_CRL *a" | 113 | .Fa "X509_CRL *x" |
| 113 | .Fa "EVP_PKEY *r" | 114 | .Fa "EVP_PKEY *pkey" |
| 114 | .Fc | 115 | .Fc |
| 115 | .Sh DESCRIPTION | 116 | .Sh DESCRIPTION |
| 116 | .Fn X509_sign | 117 | .Fn X509_sign |
diff --git a/src/lib/libcrypto/man/X509_signature_dump.3 b/src/lib/libcrypto/man/X509_signature_dump.3 index 3333a615bf..c5b9277e0c 100644 --- a/src/lib/libcrypto/man/X509_signature_dump.3 +++ b/src/lib/libcrypto/man/X509_signature_dump.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_signature_dump.3,v 1.3 2024/12/06 12:51:13 schwarze Exp $ | 1 | .\" $OpenBSD: X509_signature_dump.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 6 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509_SIGNATURE_DUMP 3 | 18 | .Dt X509_SIGNATURE_DUMP 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm X509_signature_print | 22 | .Nm X509_signature_print |
| 23 | .Nd pretty-print ASN.1 strings | 23 | .Nd pretty-print ASN.1 strings |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/x509.h | 26 | .In openssl/x509.h |
| 26 | .Ft int | 27 | .Ft int |
| 27 | .Fo X509_signature_dump | 28 | .Fo X509_signature_dump |
diff --git a/src/lib/libcrypto/man/X509_verify_cert.3 b/src/lib/libcrypto/man/X509_verify_cert.3 index 9c085d7780..7897e09f80 100644 --- a/src/lib/libcrypto/man/X509_verify_cert.3 +++ b/src/lib/libcrypto/man/X509_verify_cert.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509_verify_cert.3,v 1.8 2019/06/06 01:06:59 schwarze Exp $ | 1 | .\" $OpenBSD: X509_verify_cert.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 6 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt X509_VERIFY_CERT 3 | 52 | .Dt X509_VERIFY_CERT 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm X509_verify_cert | 55 | .Nm X509_verify_cert |
| 56 | .Nd discover and verify X509 certificate chain | 56 | .Nd discover and verify X509 certificate chain |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/x509.h | 59 | .In openssl/x509.h |
| 59 | .Ft int | 60 | .Ft int |
| 60 | .Fo X509_verify_cert | 61 | .Fo X509_verify_cert |
diff --git a/src/lib/libcrypto/man/X509v3_addr_add_inherit.3 b/src/lib/libcrypto/man/X509v3_addr_add_inherit.3 index 4b2d150c86..d33de1f6a8 100644 --- a/src/lib/libcrypto/man/X509v3_addr_add_inherit.3 +++ b/src/lib/libcrypto/man/X509v3_addr_add_inherit.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509v3_addr_add_inherit.3,v 1.11 2023/10/01 22:46:21 tb Exp $ | 1 | .\" $OpenBSD: X509v3_addr_add_inherit.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> | 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: October 1 2023 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509V3_ADDR_ADD_INHERIT 3 | 18 | .Dt X509V3_ADDR_ADD_INHERIT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -25,6 +25,7 @@ | |||
| 25 | .Nm X509v3_addr_is_canonical | 25 | .Nm X509v3_addr_is_canonical |
| 26 | .Nd RFC 3779 IP address delegation extensions | 26 | .Nd RFC 3779 IP address delegation extensions |
| 27 | .Sh SYNOPSIS | 27 | .Sh SYNOPSIS |
| 28 | .Lb libcrypto | ||
| 28 | .In openssl/x509v3.h | 29 | .In openssl/x509v3.h |
| 29 | .Ft int | 30 | .Ft int |
| 30 | .Fo X509v3_addr_add_inherit | 31 | .Fo X509v3_addr_add_inherit |
diff --git a/src/lib/libcrypto/man/X509v3_addr_get_range.3 b/src/lib/libcrypto/man/X509v3_addr_get_range.3 index e0d83b1162..7ad279d7cc 100644 --- a/src/lib/libcrypto/man/X509v3_addr_get_range.3 +++ b/src/lib/libcrypto/man/X509v3_addr_get_range.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509v3_addr_get_range.3,v 1.2 2023/09/30 14:12:40 schwarze Exp $ | 1 | .\" $OpenBSD: X509v3_addr_get_range.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> | 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: September 30 2023 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509V3_ADDR_GET_RANGE 3 | 18 | .Dt X509V3_ADDR_GET_RANGE 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm X509v3_addr_get_range | 22 | .Nm X509v3_addr_get_range |
| 23 | .Nd parse helpers for the IP address delegation extension | 23 | .Nd parse helpers for the IP address delegation extension |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/x509v3.h | 26 | .In openssl/x509v3.h |
| 26 | .Ft unsigned | 27 | .Ft unsigned |
| 27 | .Fn X509v3_addr_get_afi "const IPAddressFamily *af" | 28 | .Fn X509v3_addr_get_afi "const IPAddressFamily *af" |
diff --git a/src/lib/libcrypto/man/X509v3_addr_inherits.3 b/src/lib/libcrypto/man/X509v3_addr_inherits.3 index 8e3cecf7ae..0da24ad10f 100644 --- a/src/lib/libcrypto/man/X509v3_addr_inherits.3 +++ b/src/lib/libcrypto/man/X509v3_addr_inherits.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509v3_addr_inherits.3,v 1.3 2023/09/30 14:21:57 schwarze Exp $ | 1 | .\" $OpenBSD: X509v3_addr_inherits.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> | 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: September 30 2023 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509V3_ADDR_INHERITS 3 | 18 | .Dt X509V3_ADDR_INHERITS 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm X509v3_asid_inherits | 22 | .Nm X509v3_asid_inherits |
| 23 | .Nd RFC 3779 inheritance | 23 | .Nd RFC 3779 inheritance |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/x509v3.h | 26 | .In openssl/x509v3.h |
| 26 | .Ft int | 27 | .Ft int |
| 27 | .Fn X509v3_addr_inherits "IPAddrBlocks *addrblocks" | 28 | .Fn X509v3_addr_inherits "IPAddrBlocks *addrblocks" |
diff --git a/src/lib/libcrypto/man/X509v3_addr_subset.3 b/src/lib/libcrypto/man/X509v3_addr_subset.3 index 93714a26fa..5629d9c3cf 100644 --- a/src/lib/libcrypto/man/X509v3_addr_subset.3 +++ b/src/lib/libcrypto/man/X509v3_addr_subset.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509v3_addr_subset.3,v 1.2 2023/09/30 14:24:00 schwarze Exp $ | 1 | .\" $OpenBSD: X509v3_addr_subset.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> | 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: September 30 2023 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509V3_ADDR_SUBSET 3 | 18 | .Dt X509V3_ADDR_SUBSET 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm X509v3_asid_subset | 22 | .Nm X509v3_asid_subset |
| 23 | .Nd RFC 3779 subset relationship | 23 | .Nd RFC 3779 subset relationship |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/x509v3.h | 26 | .In openssl/x509v3.h |
| 26 | .Ft int | 27 | .Ft int |
| 27 | .Fn X509v3_addr_subset "IPAddrBlocks *child" "IPAddrBlocks *parent" | 28 | .Fn X509v3_addr_subset "IPAddrBlocks *child" "IPAddrBlocks *parent" |
diff --git a/src/lib/libcrypto/man/X509v3_addr_validate_path.3 b/src/lib/libcrypto/man/X509v3_addr_validate_path.3 index fe6065d599..5bafc6eba4 100644 --- a/src/lib/libcrypto/man/X509v3_addr_validate_path.3 +++ b/src/lib/libcrypto/man/X509v3_addr_validate_path.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509v3_addr_validate_path.3,v 1.5 2023/09/30 19:07:38 tb Exp $ | 1 | .\" $OpenBSD: X509v3_addr_validate_path.3,v 1.6 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> | 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: September 30 2023 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509V3_ADDR_VALIDATE_PATH 3 | 18 | .Dt X509V3_ADDR_VALIDATE_PATH 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -24,6 +24,7 @@ | |||
| 24 | .Nm X509v3_asid_validate_resource_set | 24 | .Nm X509v3_asid_validate_resource_set |
| 25 | .Nd RFC 3779 path validation for IP address and AS number delegation | 25 | .Nd RFC 3779 path validation for IP address and AS number delegation |
| 26 | .Sh SYNOPSIS | 26 | .Sh SYNOPSIS |
| 27 | .Lb libcrypto | ||
| 27 | .In openssl/x509v3.h | 28 | .In openssl/x509v3.h |
| 28 | .Ft int | 29 | .Ft int |
| 29 | .Fn X509v3_addr_validate_path "X509_STORE_CTX *ctx" | 30 | .Fn X509v3_addr_validate_path "X509_STORE_CTX *ctx" |
diff --git a/src/lib/libcrypto/man/X509v3_asid_add_id_or_range.3 b/src/lib/libcrypto/man/X509v3_asid_add_id_or_range.3 index 81221ca9bc..6378f45ae8 100644 --- a/src/lib/libcrypto/man/X509v3_asid_add_id_or_range.3 +++ b/src/lib/libcrypto/man/X509v3_asid_add_id_or_range.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509v3_asid_add_id_or_range.3,v 1.9 2023/09/30 18:16:44 tb Exp $ | 1 | .\" $OpenBSD: X509v3_asid_add_id_or_range.3,v 1.10 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> | 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: September 30 2023 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt X509V3_ASID_ADD_ID_OR_RANGE 3 | 18 | .Dt X509V3_ASID_ADD_ID_OR_RANGE 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -24,6 +24,7 @@ | |||
| 24 | .Nm X509v3_asid_is_canonical | 24 | .Nm X509v3_asid_is_canonical |
| 25 | .Nd RFC 3779 autonomous system identifier delegation extension | 25 | .Nd RFC 3779 autonomous system identifier delegation extension |
| 26 | .Sh SYNOPSIS | 26 | .Sh SYNOPSIS |
| 27 | .Lb libcrypto | ||
| 27 | .In openssl/x509v3.h | 28 | .In openssl/x509v3.h |
| 28 | .Ft int | 29 | .Ft int |
| 29 | .Fo X509v3_asid_add_id_or_range | 30 | .Fo X509v3_asid_add_id_or_range |
diff --git a/src/lib/libcrypto/man/X509v3_get_ext_by_NID.3 b/src/lib/libcrypto/man/X509v3_get_ext_by_NID.3 index 8c7c159f80..63f8180151 100644 --- a/src/lib/libcrypto/man/X509v3_get_ext_by_NID.3 +++ b/src/lib/libcrypto/man/X509v3_get_ext_by_NID.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: X509v3_get_ext_by_NID.3,v 1.15 2024/05/22 09:44:10 tb Exp $ | 1 | .\" $OpenBSD: X509v3_get_ext_by_NID.3,v 1.16 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL fd38836b Jun 20 15:25:43 2018 +0100 | 2 | .\" full merge up to: OpenSSL fd38836b Jun 20 15:25:43 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: May 22 2024 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt X509V3_GET_EXT_BY_NID 3 | 52 | .Dt X509V3_GET_EXT_BY_NID 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -82,6 +82,7 @@ | |||
| 82 | .Nm X509_REVOKED_add_ext | 82 | .Nm X509_REVOKED_add_ext |
| 83 | .Nd extension stack utility functions | 83 | .Nd extension stack utility functions |
| 84 | .Sh SYNOPSIS | 84 | .Sh SYNOPSIS |
| 85 | .Lb libcrypto | ||
| 85 | .In openssl/x509.h | 86 | .In openssl/x509.h |
| 86 | .Ft int | 87 | .Ft int |
| 87 | .Fo X509v3_get_ext_count | 88 | .Fo X509v3_get_ext_count |
diff --git a/src/lib/libcrypto/man/a2d_ASN1_OBJECT.3 b/src/lib/libcrypto/man/a2d_ASN1_OBJECT.3 index 7d36a54be2..ed5e7b21f6 100644 --- a/src/lib/libcrypto/man/a2d_ASN1_OBJECT.3 +++ b/src/lib/libcrypto/man/a2d_ASN1_OBJECT.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: a2d_ASN1_OBJECT.3,v 1.3 2023/08/09 17:34:39 schwarze Exp $ | 1 | .\" $OpenBSD: a2d_ASN1_OBJECT.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: August 9 2023 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt A2D_ASN1_OBJECT 3 | 18 | .Dt A2D_ASN1_OBJECT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm a2d_ASN1_OBJECT | 21 | .Nm a2d_ASN1_OBJECT |
| 22 | .Nd DER content octets of an ASN.1 object identifier | 22 | .Nd DER content octets of an ASN.1 object identifier |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libcrypto | ||
| 24 | .In openssl/asn1.h | 25 | .In openssl/asn1.h |
| 25 | .Ft int | 26 | .Ft int |
| 26 | .Fo a2d_ASN1_OBJECT | 27 | .Fo a2d_ASN1_OBJECT |
diff --git a/src/lib/libcrypto/man/a2i_ipadd.3 b/src/lib/libcrypto/man/a2i_ipadd.3 index 1372b2acfd..1fea5e1a05 100644 --- a/src/lib/libcrypto/man/a2i_ipadd.3 +++ b/src/lib/libcrypto/man/a2i_ipadd.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: a2i_ipadd.3,v 1.1 2024/12/27 15:30:17 schwarze Exp $ | 1 | .\" $OpenBSD: a2i_ipadd.3,v 1.2 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 27 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt A2I_IPADD 3 | 18 | .Dt A2I_IPADD 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -23,6 +23,7 @@ | |||
| 23 | .Nm a2i_IPADDRESS_NC | 23 | .Nm a2i_IPADDRESS_NC |
| 24 | .Nd parse Internet Protocol addresses into ASN.1 OCTET STRINGs for X.509 | 24 | .Nd parse Internet Protocol addresses into ASN.1 OCTET STRINGs for X.509 |
| 25 | .Sh SYNOPSIS | 25 | .Sh SYNOPSIS |
| 26 | .Lb libcrypto | ||
| 26 | .In openssl/x509v3.h | 27 | .In openssl/x509v3.h |
| 27 | .Ft int | 28 | .Ft int |
| 28 | .Fo a2i_ipadd | 29 | .Fo a2i_ipadd |
diff --git a/src/lib/libcrypto/man/bn_dump.3 b/src/lib/libcrypto/man/bn_dump.3 deleted file mode 100644 index b4272441e5..0000000000 --- a/src/lib/libcrypto/man/bn_dump.3 +++ /dev/null | |||
| @@ -1,415 +0,0 @@ | |||
| 1 | .\" $OpenBSD: bn_dump.3,v 1.9 2023/11/16 18:10:19 schwarze Exp $ | ||
| 2 | .\" full merge up to: | ||
| 3 | .\" OpenSSL crypto/bn/README.pod aebb9aac Jul 19 09:27:53 2016 -0400 | ||
| 4 | .\" | ||
| 5 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | ||
| 6 | .\" Copyright (c) 2000, 2003, 2006, 2009 The OpenSSL Project. | ||
| 7 | .\" All rights reserved. | ||
| 8 | .\" | ||
| 9 | .\" Redistribution and use in source and binary forms, with or without | ||
| 10 | .\" modification, are permitted provided that the following conditions | ||
| 11 | .\" are met: | ||
| 12 | .\" | ||
| 13 | .\" 1. Redistributions of source code must retain the above copyright | ||
| 14 | .\" notice, this list of conditions and the following disclaimer. | ||
| 15 | .\" | ||
| 16 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
| 17 | .\" notice, this list of conditions and the following disclaimer in | ||
| 18 | .\" the documentation and/or other materials provided with the | ||
| 19 | .\" distribution. | ||
| 20 | .\" | ||
| 21 | .\" 3. All advertising materials mentioning features or use of this | ||
| 22 | .\" software must display the following acknowledgment: | ||
| 23 | .\" "This product includes software developed by the OpenSSL Project | ||
| 24 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 25 | .\" | ||
| 26 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 27 | .\" endorse or promote products derived from this software without | ||
| 28 | .\" prior written permission. For written permission, please contact | ||
| 29 | .\" openssl-core@openssl.org. | ||
| 30 | .\" | ||
| 31 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
| 32 | .\" nor may "OpenSSL" appear in their names without prior written | ||
| 33 | .\" permission of the OpenSSL Project. | ||
| 34 | .\" | ||
| 35 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
| 36 | .\" acknowledgment: | ||
| 37 | .\" "This product includes software developed by the OpenSSL Project | ||
| 38 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 39 | .\" | ||
| 40 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 41 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 42 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 43 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 44 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 45 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 46 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 47 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 49 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 52 | .\" | ||
| 53 | .Dd $Mdocdate: November 16 2023 $ | ||
| 54 | .Dt BN_DUMP 3 | ||
| 55 | .Os | ||
| 56 | .Sh NAME | ||
| 57 | .Nm bn_mul_words , | ||
| 58 | .Nm bn_mul_add_words , | ||
| 59 | .Nm bn_sqr_words , | ||
| 60 | .Nm bn_div_words , | ||
| 61 | .Nm bn_add_words , | ||
| 62 | .Nm bn_sub_words , | ||
| 63 | .Nm bn_mul_comba4 , | ||
| 64 | .Nm bn_mul_comba8 , | ||
| 65 | .Nm bn_sqr_comba4 , | ||
| 66 | .Nm bn_sqr_comba8 , | ||
| 67 | .Nm bn_mul_normal , | ||
| 68 | .Nm bn_expand , | ||
| 69 | .Nm bn_wexpand | ||
| 70 | .Nd BIGNUM library internal functions | ||
| 71 | .Sh SYNOPSIS | ||
| 72 | .Fd #include "bn_local.h" | ||
| 73 | .Ft BN_ULONG | ||
| 74 | .Fo bn_mul_words | ||
| 75 | .Fa "BN_ULONG *rp" | ||
| 76 | .Fa "BN_ULONG *ap" | ||
| 77 | .Fa "int num" | ||
| 78 | .Fa "BN_ULONG w" | ||
| 79 | .Fc | ||
| 80 | .Ft BN_ULONG | ||
| 81 | .Fo bn_mul_add_words | ||
| 82 | .Fa "BN_ULONG *rp" | ||
| 83 | .Fa "BN_ULONG *ap" | ||
| 84 | .Fa "int num" | ||
| 85 | .Fa "BN_ULONG w" | ||
| 86 | .Fc | ||
| 87 | .Ft void | ||
| 88 | .Fo bn_sqr_words | ||
| 89 | .Fa "BN_ULONG *rp" | ||
| 90 | .Fa "BN_ULONG *ap" | ||
| 91 | .Fa "int num" | ||
| 92 | .Fc | ||
| 93 | .Ft BN_ULONG | ||
| 94 | .Fo bn_div_words | ||
| 95 | .Fa "BN_ULONG h" | ||
| 96 | .Fa "BN_ULONG l" | ||
| 97 | .Fa "BN_ULONG d" | ||
| 98 | .Fc | ||
| 99 | .Ft BN_ULONG | ||
| 100 | .Fo bn_add_words | ||
| 101 | .Fa "BN_ULONG *rp" | ||
| 102 | .Fa "BN_ULONG *ap" | ||
| 103 | .Fa "BN_ULONG *bp" | ||
| 104 | .Fa "int num" | ||
| 105 | .Fc | ||
| 106 | .Ft BN_ULONG | ||
| 107 | .Fo bn_sub_words | ||
| 108 | .Fa "BN_ULONG *rp" | ||
| 109 | .Fa "BN_ULONG *ap" | ||
| 110 | .Fa "BN_ULONG *bp" | ||
| 111 | .Fa "int num" | ||
| 112 | .Fc | ||
| 113 | .Ft void | ||
| 114 | .Fo bn_mul_comba4 | ||
| 115 | .Fa "BN_ULONG *r" | ||
| 116 | .Fa "BN_ULONG *a" | ||
| 117 | .Fa "BN_ULONG *b" | ||
| 118 | .Fc | ||
| 119 | .Ft void | ||
| 120 | .Fo bn_mul_comba8 | ||
| 121 | .Fa "BN_ULONG *r" | ||
| 122 | .Fa "BN_ULONG *a" | ||
| 123 | .Fa "BN_ULONG *b" | ||
| 124 | .Fc | ||
| 125 | .Ft void | ||
| 126 | .Fo bn_sqr_comba4 | ||
| 127 | .Fa "BN_ULONG *r" | ||
| 128 | .Fa "BN_ULONG *a" | ||
| 129 | .Fc | ||
| 130 | .Ft void | ||
| 131 | .Fo bn_sqr_comba8 | ||
| 132 | .Fa "BN_ULONG *r" | ||
| 133 | .Fa "BN_ULONG *a" | ||
| 134 | .Fc | ||
| 135 | .Ft void | ||
| 136 | .Fo bn_mul_normal | ||
| 137 | .Fa "BN_ULONG *r" | ||
| 138 | .Fa "BN_ULONG *a" | ||
| 139 | .Fa "int na" | ||
| 140 | .Fa "BN_ULONG *b" | ||
| 141 | .Fa "int nb" | ||
| 142 | .Fc | ||
| 143 | .Ft BIGNUM * | ||
| 144 | .Fo bn_expand | ||
| 145 | .Fa "BIGNUM *a" | ||
| 146 | .Fa "int bits" | ||
| 147 | .Fc | ||
| 148 | .Ft BIGNUM * | ||
| 149 | .Fo bn_wexpand | ||
| 150 | .Fa "BIGNUM *a" | ||
| 151 | .Fa "int n" | ||
| 152 | .Fc | ||
| 153 | .Sh DESCRIPTION | ||
| 154 | This page documents some internal functions used by the | ||
| 155 | .Vt BIGNUM | ||
| 156 | implementation. | ||
| 157 | They are described here to facilitate debugging and extending the | ||
| 158 | library. | ||
| 159 | They are | ||
| 160 | .Em not | ||
| 161 | to be used by applications. | ||
| 162 | .Ss The BIGNUM structure | ||
| 163 | .Bd -literal | ||
| 164 | typedef struct bignum_st BIGNUM; | ||
| 165 | |||
| 166 | struct bignum_st { | ||
| 167 | BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */ | ||
| 168 | int top; /* Index of last used d +1. */ | ||
| 169 | /* The next are internal book keeping for bn_expand. */ | ||
| 170 | int dmax; /* Size of the d array. */ | ||
| 171 | int neg; /* one if the number is negative */ | ||
| 172 | int flags; | ||
| 173 | }; | ||
| 174 | .Ed | ||
| 175 | .Pp | ||
| 176 | The integer value is stored in | ||
| 177 | .Fa d , | ||
| 178 | a | ||
| 179 | .Xr malloc 3 Ap ed | ||
| 180 | array of words | ||
| 181 | .Pq Vt BN_ULONG , | ||
| 182 | least significant word first. | ||
| 183 | .Vt BN_ULONG | ||
| 184 | is a macro that expands to | ||
| 185 | .Vt unsigned long Pq = Vt uint64_t | ||
| 186 | on | ||
| 187 | .Dv _LP64 | ||
| 188 | platforms and | ||
| 189 | .Vt unsigned int Pq = Vt uint32_t | ||
| 190 | elsewhere. | ||
| 191 | .Pp | ||
| 192 | .Fa dmax | ||
| 193 | is the size of the | ||
| 194 | .Fa d | ||
| 195 | array that has been allocated. | ||
| 196 | .Fa top | ||
| 197 | is the number of words being used, so for a value of 4, bn.d[0]=4 and | ||
| 198 | bn.top=1. | ||
| 199 | .Fa neg | ||
| 200 | is 1 if the number is negative. | ||
| 201 | When a | ||
| 202 | .Vt BIGNUM | ||
| 203 | is 0, the | ||
| 204 | .Fa d | ||
| 205 | field can be | ||
| 206 | .Dv NULL | ||
| 207 | and | ||
| 208 | .Fa top | ||
| 209 | == 0. | ||
| 210 | .Pp | ||
| 211 | .Fa flags | ||
| 212 | is a bit field of flags which are defined in | ||
| 213 | .In openssl/bn.h . | ||
| 214 | The flags begin with | ||
| 215 | .Dv BN_FLG_ . | ||
| 216 | The functions | ||
| 217 | .Xr BN_set_flags 3 | ||
| 218 | and | ||
| 219 | .Xr BN_get_flags 3 | ||
| 220 | enable or inspect | ||
| 221 | .Fa flags . | ||
| 222 | .Pp | ||
| 223 | Various routines in this library require the use of temporary | ||
| 224 | .Vt BIGNUM | ||
| 225 | variables during their execution. | ||
| 226 | Since dynamic memory allocation to create | ||
| 227 | .Vt BIGNUM Ns s | ||
| 228 | is rather expensive when used in conjunction with repeated subroutine | ||
| 229 | calls, the | ||
| 230 | .Vt BN_CTX | ||
| 231 | structure is used. | ||
| 232 | This structure contains BN_CTX_NUM | ||
| 233 | .Vt BIGNUM Ns s ; | ||
| 234 | see | ||
| 235 | .Xr BN_CTX_start 3 . | ||
| 236 | .Ss Low level arithmetic operations | ||
| 237 | These functions are implemented in C and for several platforms in | ||
| 238 | assembly language: | ||
| 239 | .Pp | ||
| 240 | .Fn bn_mul_words rp ap num w | ||
| 241 | operates on the | ||
| 242 | .Fa num | ||
| 243 | word arrays | ||
| 244 | .Fa rp | ||
| 245 | and | ||
| 246 | .Fa ap . | ||
| 247 | It computes | ||
| 248 | .Fa ap | ||
| 249 | * | ||
| 250 | .Fa w , | ||
| 251 | places the result in | ||
| 252 | .Fa rp , | ||
| 253 | and returns the high word (carry). | ||
| 254 | .Pp | ||
| 255 | .Fn bn_mul_add_words rp ap num w | ||
| 256 | operates on the | ||
| 257 | .Fa num | ||
| 258 | word arrays | ||
| 259 | .Fa rp | ||
| 260 | and | ||
| 261 | .Fa ap . | ||
| 262 | It computes | ||
| 263 | .Fa ap | ||
| 264 | * | ||
| 265 | .Fa w | ||
| 266 | + | ||
| 267 | .Fa rp , | ||
| 268 | places the result in | ||
| 269 | .Fa rp , | ||
| 270 | and returns the high word (carry). | ||
| 271 | .Pp | ||
| 272 | .Fn bn_sqr_words rp ap num | ||
| 273 | operates on the | ||
| 274 | .Fa num | ||
| 275 | word array | ||
| 276 | .Fa ap | ||
| 277 | and the | ||
| 278 | .Pf 2* Fa num | ||
| 279 | word array | ||
| 280 | .Fa ap . | ||
| 281 | It computes | ||
| 282 | .Fa ap | ||
| 283 | * | ||
| 284 | .Fa ap | ||
| 285 | word-wise, and places the low and high bytes of the result in | ||
| 286 | .Fa rp . | ||
| 287 | .Pp | ||
| 288 | .Fn bn_div_words h l d | ||
| 289 | divides the two word number | ||
| 290 | .Pq Fa h , Fa l | ||
| 291 | by | ||
| 292 | .Fa d | ||
| 293 | and returns the result. | ||
| 294 | .Pp | ||
| 295 | .Fn bn_add_words rp ap bp num | ||
| 296 | operates on the | ||
| 297 | .Fa num | ||
| 298 | word arrays | ||
| 299 | .Fa ap , | ||
| 300 | .Fa bp | ||
| 301 | and | ||
| 302 | .Fa rp . | ||
| 303 | It computes | ||
| 304 | .Fa ap | ||
| 305 | + | ||
| 306 | .Fa bp , | ||
| 307 | places the result in | ||
| 308 | .Fa rp , | ||
| 309 | and returns the high word (carry). | ||
| 310 | .Pp | ||
| 311 | .Fn bn_sub_words rp ap bp num | ||
| 312 | operates on the | ||
| 313 | .Fa num | ||
| 314 | word arrays | ||
| 315 | .Fa ap , | ||
| 316 | .Fa bp | ||
| 317 | and | ||
| 318 | .Fa rp . | ||
| 319 | It computes | ||
| 320 | .Fa ap | ||
| 321 | - | ||
| 322 | .Fa bp , | ||
| 323 | places the result in | ||
| 324 | .Fa rp , | ||
| 325 | and returns the carry (1 if | ||
| 326 | .Fa bp | ||
| 327 | \(ra | ||
| 328 | .Fa ap , | ||
| 329 | 0 otherwise). | ||
| 330 | .Pp | ||
| 331 | .Fn bn_mul_comba4 r a b | ||
| 332 | operates on the 4 word arrays | ||
| 333 | .Fa a | ||
| 334 | and | ||
| 335 | .Fa b | ||
| 336 | and the 8-word array | ||
| 337 | .Fa r . | ||
| 338 | It computes | ||
| 339 | .Fa a Ns * Ns Fa b | ||
| 340 | and places the result in | ||
| 341 | .Fa r . | ||
| 342 | .Pp | ||
| 343 | .Fn bn_mul_comba8 r a b | ||
| 344 | operates on the 8-word arrays | ||
| 345 | .Fa a | ||
| 346 | and | ||
| 347 | .Fa b | ||
| 348 | and the 16-word array | ||
| 349 | .Fa r . | ||
| 350 | It computes | ||
| 351 | .Fa a Ns * Ns Fa b | ||
| 352 | and places the result in | ||
| 353 | .Fa r . | ||
| 354 | .Pp | ||
| 355 | .Fn bn_sqr_comba4 r a b | ||
| 356 | operates on the 4-word arrays | ||
| 357 | .Fa a | ||
| 358 | and | ||
| 359 | .Fa b | ||
| 360 | and the 8-word array | ||
| 361 | .Fa r . | ||
| 362 | .Pp | ||
| 363 | .Fn bn_sqr_comba8 r a b | ||
| 364 | operates on the 8-word arrays | ||
| 365 | .Fa a | ||
| 366 | and | ||
| 367 | .Fa b | ||
| 368 | and the 16 word array | ||
| 369 | .Fa r . | ||
| 370 | .Pp | ||
| 371 | The following functions are implemented in C: | ||
| 372 | .Pp | ||
| 373 | .Fn bn_mul_normal r a na b nb | ||
| 374 | operates on the | ||
| 375 | .Fa na | ||
| 376 | word array | ||
| 377 | .Fa a , | ||
| 378 | the | ||
| 379 | .Fa nb | ||
| 380 | word array | ||
| 381 | .Fa b | ||
| 382 | and the | ||
| 383 | .Fa na Ns + Ns Fa nb | ||
| 384 | word array | ||
| 385 | .Fa r . | ||
| 386 | It computes | ||
| 387 | .Fa a Ns * Ns Fa b | ||
| 388 | and places the result in | ||
| 389 | .Fa r . | ||
| 390 | .Pp | ||
| 391 | .Xr BN_mul 3 | ||
| 392 | calls | ||
| 393 | .Fn bn_mul_comba4 | ||
| 394 | if both factors are 4 words long, | ||
| 395 | .Fn bn_mul_comba8 | ||
| 396 | if both factors are 8 words long, | ||
| 397 | or | ||
| 398 | .Fn bn_mul_normal | ||
| 399 | otherwise. | ||
| 400 | .Ss Size changes | ||
| 401 | .Fn bn_expand | ||
| 402 | ensures that | ||
| 403 | .Fa b | ||
| 404 | has enough space for a | ||
| 405 | .Fa bits | ||
| 406 | bit number. | ||
| 407 | .Fn bn_wexpand | ||
| 408 | ensures that | ||
| 409 | .Fa b | ||
| 410 | has enough space for an | ||
| 411 | .Fa n | ||
| 412 | word number. | ||
| 413 | They return 0 on error or 1 otherwise. | ||
| 414 | .Sh SEE ALSO | ||
| 415 | .Xr BN_new 3 | ||
diff --git a/src/lib/libcrypto/man/crypto.3 b/src/lib/libcrypto/man/crypto.3 index f1367e9e62..ddc8b05686 100644 --- a/src/lib/libcrypto/man/crypto.3 +++ b/src/lib/libcrypto/man/crypto.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: crypto.3,v 1.30 2024/12/07 19:22:15 schwarze Exp $ | 1 | .\" $OpenBSD: crypto.3,v 1.31 2025/04/25 20:04:09 tb Exp $ |
| 2 | .\" OpenSSL a9c85cea Nov 11 09:33:55 2016 +0100 | 2 | .\" OpenSSL a9c85cea Nov 11 09:33:55 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: December 7 2024 $ | 69 | .Dd $Mdocdate: April 25 2025 $ |
| 70 | .Dt CRYPTO 3 | 70 | .Dt CRYPTO 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -153,7 +153,7 @@ error reporting: see | |||
| 153 | include | 153 | include |
| 154 | .Xr BIO_f_buffer 3 , | 154 | .Xr BIO_f_buffer 3 , |
| 155 | .Xr BN_new 3 , | 155 | .Xr BN_new 3 , |
| 156 | .Xr EC_GROUP_new 3 , | 156 | .Xr EC_GROUP_new_by_curve_name 3 , |
| 157 | .Xr lh_new 3 , | 157 | .Xr lh_new 3 , |
| 158 | and | 158 | and |
| 159 | .Xr STACK_OF 3 . | 159 | .Xr STACK_OF 3 . |
diff --git a/src/lib/libcrypto/man/d2i_ASN1_NULL.3 b/src/lib/libcrypto/man/d2i_ASN1_NULL.3 index 037c9c93e1..06aafc08a2 100644 --- a/src/lib/libcrypto/man/d2i_ASN1_NULL.3 +++ b/src/lib/libcrypto/man/d2i_ASN1_NULL.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_ASN1_NULL.3,v 1.5 2023/09/26 09:36:22 tb Exp $ | 1 | .\" $OpenBSD: d2i_ASN1_NULL.3,v 1.6 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: September 26 2023 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt D2I_ASN1_NULL 3 | 18 | .Dt D2I_ASN1_NULL 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm i2d_ASN1_NULL | 22 | .Nm i2d_ASN1_NULL |
| 23 | .Nd decode and encode an ASN.1 NULL type | 23 | .Nd decode and encode an ASN.1 NULL type |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/asn1.h | 26 | .In openssl/asn1.h |
| 26 | .Ft ASN1_NULL * | 27 | .Ft ASN1_NULL * |
| 27 | .Fo d2i_ASN1_NULL | 28 | .Fo d2i_ASN1_NULL |
diff --git a/src/lib/libcrypto/man/d2i_ASN1_OBJECT.3 b/src/lib/libcrypto/man/d2i_ASN1_OBJECT.3 index bbb70ad8c6..3d90c60e0b 100644 --- a/src/lib/libcrypto/man/d2i_ASN1_OBJECT.3 +++ b/src/lib/libcrypto/man/d2i_ASN1_OBJECT.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_ASN1_OBJECT.3,v 1.15 2025/03/14 21:32:15 tb Exp $ | 1 | .\" $OpenBSD: d2i_ASN1_OBJECT.3,v 1.16 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2017, 2022, 2023 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2017, 2022, 2023 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 14 2025 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt D2I_ASN1_OBJECT 3 | 18 | .Dt D2I_ASN1_OBJECT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -24,6 +24,7 @@ | |||
| 24 | .Nm OBJ_length | 24 | .Nm OBJ_length |
| 25 | .Nd decode and encode ASN.1 object identifiers | 25 | .Nd decode and encode ASN.1 object identifiers |
| 26 | .Sh SYNOPSIS | 26 | .Sh SYNOPSIS |
| 27 | .Lb libcrypto | ||
| 27 | .In openssl/asn1.h | 28 | .In openssl/asn1.h |
| 28 | .Ft ASN1_OBJECT * | 29 | .Ft ASN1_OBJECT * |
| 29 | .Fo d2i_ASN1_OBJECT | 30 | .Fo d2i_ASN1_OBJECT |
diff --git a/src/lib/libcrypto/man/d2i_ASN1_OCTET_STRING.3 b/src/lib/libcrypto/man/d2i_ASN1_OCTET_STRING.3 index d544af0fe4..bd4b900193 100644 --- a/src/lib/libcrypto/man/d2i_ASN1_OCTET_STRING.3 +++ b/src/lib/libcrypto/man/d2i_ASN1_OCTET_STRING.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_ASN1_OCTET_STRING.3,v 1.20 2024/02/13 12:38:43 job Exp $ | 1 | .\" $OpenBSD: d2i_ASN1_OCTET_STRING.3,v 1.21 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: February 13 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt D2I_ASN1_OCTET_STRING 3 | 18 | .Dt D2I_ASN1_OCTET_STRING 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm i2d_ASN1_TIME | 57 | .Nm i2d_ASN1_TIME |
| 58 | .Nd decode and encode ASN1_STRING objects | 58 | .Nd decode and encode ASN1_STRING objects |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libcrypto | ||
| 60 | .In openssl/asn1.h | 61 | .In openssl/asn1.h |
| 61 | .Ft ASN1_OCTET_STRING * | 62 | .Ft ASN1_OCTET_STRING * |
| 62 | .Fo d2i_ASN1_OCTET_STRING | 63 | .Fo d2i_ASN1_OCTET_STRING |
diff --git a/src/lib/libcrypto/man/d2i_ASN1_SEQUENCE_ANY.3 b/src/lib/libcrypto/man/d2i_ASN1_SEQUENCE_ANY.3 index 654f0b1e6b..bd54520005 100644 --- a/src/lib/libcrypto/man/d2i_ASN1_SEQUENCE_ANY.3 +++ b/src/lib/libcrypto/man/d2i_ASN1_SEQUENCE_ANY.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_ASN1_SEQUENCE_ANY.3,v 1.3 2021/12/09 19:05:09 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_ASN1_SEQUENCE_ANY.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2017, 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2017, 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 9 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt D2I_ASN1_SEQUENCE_ANY 3 | 18 | .Dt D2I_ASN1_SEQUENCE_ANY 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -24,6 +24,7 @@ | |||
| 24 | .Nm i2d_ASN1_SET_ANY | 24 | .Nm i2d_ASN1_SET_ANY |
| 25 | .Nd decode and encode ASN.1 sequences and sets | 25 | .Nd decode and encode ASN.1 sequences and sets |
| 26 | .Sh SYNOPSIS | 26 | .Sh SYNOPSIS |
| 27 | .Lb libcrypto | ||
| 27 | .In openssl/asn1.h | 28 | .In openssl/asn1.h |
| 28 | .Ft ASN1_SEQUENCE_ANY * | 29 | .Ft ASN1_SEQUENCE_ANY * |
| 29 | .Fo d2i_ASN1_SEQUENCE_ANY | 30 | .Fo d2i_ASN1_SEQUENCE_ANY |
diff --git a/src/lib/libcrypto/man/d2i_AUTHORITY_KEYID.3 b/src/lib/libcrypto/man/d2i_AUTHORITY_KEYID.3 index 413f41e179..de1acfb6e1 100644 --- a/src/lib/libcrypto/man/d2i_AUTHORITY_KEYID.3 +++ b/src/lib/libcrypto/man/d2i_AUTHORITY_KEYID.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_AUTHORITY_KEYID.3,v 1.2 2018/03/21 16:09:51 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_AUTHORITY_KEYID.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 21 2018 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt D2I_AUTHORITY_KEYID 3 | 18 | .Dt D2I_AUTHORITY_KEYID 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm i2d_AUTHORITY_KEYID | 22 | .Nm i2d_AUTHORITY_KEYID |
| 23 | .Nd decode and encode X.509 authority key identifiers | 23 | .Nd decode and encode X.509 authority key identifiers |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/x509v3.h | 26 | .In openssl/x509v3.h |
| 26 | .Ft AUTHORITY_KEYID * | 27 | .Ft AUTHORITY_KEYID * |
| 27 | .Fo d2i_AUTHORITY_KEYID | 28 | .Fo d2i_AUTHORITY_KEYID |
diff --git a/src/lib/libcrypto/man/d2i_BASIC_CONSTRAINTS.3 b/src/lib/libcrypto/man/d2i_BASIC_CONSTRAINTS.3 index 2964a1f90e..b90c13df06 100644 --- a/src/lib/libcrypto/man/d2i_BASIC_CONSTRAINTS.3 +++ b/src/lib/libcrypto/man/d2i_BASIC_CONSTRAINTS.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_BASIC_CONSTRAINTS.3,v 1.3 2018/03/22 21:08:22 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_BASIC_CONSTRAINTS.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 22 2018 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt D2I_BASIC_CONSTRAINTS 3 | 18 | .Dt D2I_BASIC_CONSTRAINTS 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -24,6 +24,7 @@ | |||
| 24 | .Nm i2d_EXTENDED_KEY_USAGE | 24 | .Nm i2d_EXTENDED_KEY_USAGE |
| 25 | .Nd decode and encode X.509 key usage purposes | 25 | .Nd decode and encode X.509 key usage purposes |
| 26 | .Sh SYNOPSIS | 26 | .Sh SYNOPSIS |
| 27 | .Lb libcrypto | ||
| 27 | .In openssl/x509v3.h | 28 | .In openssl/x509v3.h |
| 28 | .Ft BASIC_CONSTRAINTS * | 29 | .Ft BASIC_CONSTRAINTS * |
| 29 | .Fo d2i_BASIC_CONSTRAINTS | 30 | .Fo d2i_BASIC_CONSTRAINTS |
diff --git a/src/lib/libcrypto/man/d2i_CMS_ContentInfo.3 b/src/lib/libcrypto/man/d2i_CMS_ContentInfo.3 index 0c61047c42..f4238d664d 100644 --- a/src/lib/libcrypto/man/d2i_CMS_ContentInfo.3 +++ b/src/lib/libcrypto/man/d2i_CMS_ContentInfo.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_CMS_ContentInfo.3,v 1.3 2019/11/02 15:39:46 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_CMS_ContentInfo.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> | 2 | .\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> |
| 3 | .\" | 3 | .\" |
| 4 | .\" Permission to use, copy, modify, and distribute this software for any | 4 | .\" Permission to use, copy, modify, and distribute this software for any |
| @@ -13,7 +13,7 @@ | |||
| 13 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 13 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 14 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | .\" | 15 | .\" |
| 16 | .Dd $Mdocdate: November 2 2019 $ | 16 | .Dd $Mdocdate: June 8 2025 $ |
| 17 | .Dt D2I_CMS_CONTENTINFO 3 | 17 | .Dt D2I_CMS_CONTENTINFO 3 |
| 18 | .Os | 18 | .Os |
| 19 | .Sh NAME | 19 | .Sh NAME |
| @@ -25,6 +25,7 @@ | |||
| 25 | .Nm i2d_CMS_ReceiptRequest | 25 | .Nm i2d_CMS_ReceiptRequest |
| 26 | .Nd decode and encode Cryptographic Message Syntax data | 26 | .Nd decode and encode Cryptographic Message Syntax data |
| 27 | .Sh SYNOPSIS | 27 | .Sh SYNOPSIS |
| 28 | .Lb libcrypto | ||
| 28 | .In openssl/cms.h | 29 | .In openssl/cms.h |
| 29 | .Ft CMS_ContentInfo * | 30 | .Ft CMS_ContentInfo * |
| 30 | .Fo d2i_CMS_ContentInfo | 31 | .Fo d2i_CMS_ContentInfo |
diff --git a/src/lib/libcrypto/man/d2i_DHparams.3 b/src/lib/libcrypto/man/d2i_DHparams.3 index 7fd9878dc0..f3cbd21f13 100644 --- a/src/lib/libcrypto/man/d2i_DHparams.3 +++ b/src/lib/libcrypto/man/d2i_DHparams.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_DHparams.3,v 1.8 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_DHparams.3,v 1.9 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 | 2 | .\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> and | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> and |
| @@ -50,7 +50,7 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: March 27 2018 $ | 53 | .Dd $Mdocdate: June 8 2025 $ |
| 54 | .Dt D2I_DHPARAMS 3 | 54 | .Dt D2I_DHPARAMS 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm i2d_DHparams | 58 | .Nm i2d_DHparams |
| 59 | .Nd PKCS#3 DH parameter functions | 59 | .Nd PKCS#3 DH parameter functions |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libcrypto | ||
| 61 | .In openssl/dh.h | 62 | .In openssl/dh.h |
| 62 | .Ft DH * | 63 | .Ft DH * |
| 63 | .Fo d2i_DHparams | 64 | .Fo d2i_DHparams |
diff --git a/src/lib/libcrypto/man/d2i_DIST_POINT.3 b/src/lib/libcrypto/man/d2i_DIST_POINT.3 index 34bdb26fb4..0e49dfeeb3 100644 --- a/src/lib/libcrypto/man/d2i_DIST_POINT.3 +++ b/src/lib/libcrypto/man/d2i_DIST_POINT.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_DIST_POINT.3,v 1.4 2018/03/23 04:34:23 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_DIST_POINT.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 23 2018 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt D2I_DIST_POINT 3 | 18 | .Dt D2I_DIST_POINT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -32,6 +32,7 @@ | |||
| 32 | .Nm i2d_AUTHORITY_INFO_ACCESS | 32 | .Nm i2d_AUTHORITY_INFO_ACCESS |
| 33 | .Nd decode and encode X.509 data access extensions | 33 | .Nd decode and encode X.509 data access extensions |
| 34 | .Sh SYNOPSIS | 34 | .Sh SYNOPSIS |
| 35 | .Lb libcrypto | ||
| 35 | .In openssl/x509v3.h | 36 | .In openssl/x509v3.h |
| 36 | .Ft DIST_POINT * | 37 | .Ft DIST_POINT * |
| 37 | .Fo d2i_DIST_POINT | 38 | .Fo d2i_DIST_POINT |
diff --git a/src/lib/libcrypto/man/d2i_DSAPublicKey.3 b/src/lib/libcrypto/man/d2i_DSAPublicKey.3 index 37ef22e1b9..62dcc45082 100644 --- a/src/lib/libcrypto/man/d2i_DSAPublicKey.3 +++ b/src/lib/libcrypto/man/d2i_DSAPublicKey.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_DSAPublicKey.3,v 1.14 2018/08/26 17:03:32 tb Exp $ | 1 | .\" $OpenBSD: d2i_DSAPublicKey.3,v 1.15 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400 | 2 | .\" OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: August 26 2018 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt D2I_DSAPUBLICKEY 3 | 53 | .Dt D2I_DSAPUBLICKEY 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -78,6 +78,7 @@ | |||
| 78 | .Nm i2d_DSA_SIG | 78 | .Nm i2d_DSA_SIG |
| 79 | .Nd decode and encode DSA keys | 79 | .Nd decode and encode DSA keys |
| 80 | .Sh SYNOPSIS | 80 | .Sh SYNOPSIS |
| 81 | .Lb libcrypto | ||
| 81 | .In openssl/dsa.h | 82 | .In openssl/dsa.h |
| 82 | .Ft DSA * | 83 | .Ft DSA * |
| 83 | .Fo d2i_DSAPublicKey | 84 | .Fo d2i_DSAPublicKey |
diff --git a/src/lib/libcrypto/man/d2i_ECPKParameters.3 b/src/lib/libcrypto/man/d2i_ECPKParameters.3 index c4ede82f3b..8e824951d6 100644 --- a/src/lib/libcrypto/man/d2i_ECPKParameters.3 +++ b/src/lib/libcrypto/man/d2i_ECPKParameters.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_ECPKParameters.3,v 1.13 2024/10/24 21:42:10 tb Exp $ | 1 | .\" $OpenBSD: d2i_ECPKParameters.3,v 1.15 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL 05ea606a May 20 20:52:46 2016 -0400 | 2 | .\" OpenSSL 05ea606a May 20 20:52:46 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: October 24 2024 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt D2I_ECPKPARAMETERS 3 | 69 | .Dt D2I_ECPKPARAMETERS 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -98,6 +98,7 @@ | |||
| 98 | .Nm i2d_EC_PUBKEY_fp | 98 | .Nm i2d_EC_PUBKEY_fp |
| 99 | .Nd decode and encode ASN.1 representations of elliptic curve entities | 99 | .Nd decode and encode ASN.1 representations of elliptic curve entities |
| 100 | .Sh SYNOPSIS | 100 | .Sh SYNOPSIS |
| 101 | .Lb libcrypto | ||
| 101 | .In openssl/ec.h | 102 | .In openssl/ec.h |
| 102 | .Ft EC_GROUP * | 103 | .Ft EC_GROUP * |
| 103 | .Fo d2i_ECPKParameters | 104 | .Fo d2i_ECPKParameters |
| @@ -418,8 +419,7 @@ and | |||
| 418 | return 1 for success or 0 if an error occurs. | 419 | return 1 for success or 0 if an error occurs. |
| 419 | .Sh SEE ALSO | 420 | .Sh SEE ALSO |
| 420 | .Xr ASN1_item_d2i 3 , | 421 | .Xr ASN1_item_d2i 3 , |
| 421 | .Xr EC_GROUP_copy 3 , | 422 | .Xr EC_GROUP_new_by_curve_name 3 , |
| 422 | .Xr EC_GROUP_new 3 , | ||
| 423 | .Xr EC_KEY_new 3 , | 423 | .Xr EC_KEY_new 3 , |
| 424 | .Xr EVP_PKEY_set1_EC_KEY 3 , | 424 | .Xr EVP_PKEY_set1_EC_KEY 3 , |
| 425 | .Xr PEM_write_ECPrivateKey 3 , | 425 | .Xr PEM_write_ECPrivateKey 3 , |
diff --git a/src/lib/libcrypto/man/d2i_ESS_SIGNING_CERT.3 b/src/lib/libcrypto/man/d2i_ESS_SIGNING_CERT.3 index c1d61d3b5e..0305ca78a1 100644 --- a/src/lib/libcrypto/man/d2i_ESS_SIGNING_CERT.3 +++ b/src/lib/libcrypto/man/d2i_ESS_SIGNING_CERT.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_ESS_SIGNING_CERT.3,v 1.2 2018/03/23 04:34:23 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_ESS_SIGNING_CERT.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 23 2018 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt D2I_ESS_SIGNING_CERT 3 | 18 | .Dt D2I_ESS_SIGNING_CERT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -26,6 +26,7 @@ | |||
| 26 | .Nm i2d_ESS_ISSUER_SERIAL | 26 | .Nm i2d_ESS_ISSUER_SERIAL |
| 27 | .Nd decode and encode signing certificates for S/MIME | 27 | .Nd decode and encode signing certificates for S/MIME |
| 28 | .Sh SYNOPSIS | 28 | .Sh SYNOPSIS |
| 29 | .Lb libcrypto | ||
| 29 | .In openssl/ts.h | 30 | .In openssl/ts.h |
| 30 | .Ft ESS_SIGNING_CERT * | 31 | .Ft ESS_SIGNING_CERT * |
| 31 | .Fo d2i_ESS_SIGNING_CERT | 32 | .Fo d2i_ESS_SIGNING_CERT |
diff --git a/src/lib/libcrypto/man/d2i_GENERAL_NAME.3 b/src/lib/libcrypto/man/d2i_GENERAL_NAME.3 index bfdcc6c67c..557e5ce353 100644 --- a/src/lib/libcrypto/man/d2i_GENERAL_NAME.3 +++ b/src/lib/libcrypto/man/d2i_GENERAL_NAME.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_GENERAL_NAME.3,v 1.4 2018/03/22 21:08:22 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_GENERAL_NAME.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 22 2018 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt D2I_GENERAL_NAME 3 | 18 | .Dt D2I_GENERAL_NAME 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -28,6 +28,7 @@ | |||
| 28 | .Nm i2d_OTHERNAME | 28 | .Nm i2d_OTHERNAME |
| 29 | .Nd decode and encode names for use in X.509 extensions | 29 | .Nd decode and encode names for use in X.509 extensions |
| 30 | .Sh SYNOPSIS | 30 | .Sh SYNOPSIS |
| 31 | .Lb libcrypto | ||
| 31 | .In openssl/x509v3.h | 32 | .In openssl/x509v3.h |
| 32 | .Ft GENERAL_NAME * | 33 | .Ft GENERAL_NAME * |
| 33 | .Fo d2i_GENERAL_NAME | 34 | .Fo d2i_GENERAL_NAME |
diff --git a/src/lib/libcrypto/man/d2i_OCSP_REQUEST.3 b/src/lib/libcrypto/man/d2i_OCSP_REQUEST.3 index 07a990556d..7d27d2b4c1 100644 --- a/src/lib/libcrypto/man/d2i_OCSP_REQUEST.3 +++ b/src/lib/libcrypto/man/d2i_OCSP_REQUEST.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_OCSP_REQUEST.3,v 1.3 2021/03/12 05:18:00 jsg Exp $ | 1 | .\" $OpenBSD: d2i_OCSP_REQUEST.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 12 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt D2I_OCSP_REQUEST 3 | 18 | .Dt D2I_OCSP_REQUEST 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -32,6 +32,7 @@ | |||
| 32 | .Nm i2d_OCSP_SERVICELOC | 32 | .Nm i2d_OCSP_SERVICELOC |
| 33 | .Nd decode and encode OCSP requests | 33 | .Nd decode and encode OCSP requests |
| 34 | .Sh SYNOPSIS | 34 | .Sh SYNOPSIS |
| 35 | .Lb libcrypto | ||
| 35 | .In openssl/ocsp.h | 36 | .In openssl/ocsp.h |
| 36 | .Ft OCSP_REQUEST * | 37 | .Ft OCSP_REQUEST * |
| 37 | .Fo d2i_OCSP_REQUEST | 38 | .Fo d2i_OCSP_REQUEST |
diff --git a/src/lib/libcrypto/man/d2i_OCSP_RESPONSE.3 b/src/lib/libcrypto/man/d2i_OCSP_RESPONSE.3 index 716e85dc6e..a89c566c12 100644 --- a/src/lib/libcrypto/man/d2i_OCSP_RESPONSE.3 +++ b/src/lib/libcrypto/man/d2i_OCSP_RESPONSE.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_OCSP_RESPONSE.3,v 1.4 2021/03/12 05:18:00 jsg Exp $ | 1 | .\" $OpenBSD: d2i_OCSP_RESPONSE.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 12 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt D2I_OCSP_RESPONSE 3 | 18 | .Dt D2I_OCSP_RESPONSE 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -38,6 +38,7 @@ | |||
| 38 | .Nm i2d_OCSP_CRLID | 38 | .Nm i2d_OCSP_CRLID |
| 39 | .Nd decode and encode OCSP responses | 39 | .Nd decode and encode OCSP responses |
| 40 | .Sh SYNOPSIS | 40 | .Sh SYNOPSIS |
| 41 | .Lb libcrypto | ||
| 41 | .In openssl/ocsp.h | 42 | .In openssl/ocsp.h |
| 42 | .Ft OCSP_RESPONSE * | 43 | .Ft OCSP_RESPONSE * |
| 43 | .Fo d2i_OCSP_RESPONSE | 44 | .Fo d2i_OCSP_RESPONSE |
diff --git a/src/lib/libcrypto/man/d2i_PKCS12.3 b/src/lib/libcrypto/man/d2i_PKCS12.3 index 55272d1f36..2dda946a3f 100644 --- a/src/lib/libcrypto/man/d2i_PKCS12.3 +++ b/src/lib/libcrypto/man/d2i_PKCS12.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_PKCS12.3,v 1.2 2018/03/21 17:57:48 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_PKCS12.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 21 2018 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt D2I_PKCS12 3 | 18 | .Dt D2I_PKCS12 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -32,6 +32,7 @@ | |||
| 32 | .Nm i2d_PKCS12_BAGS | 32 | .Nm i2d_PKCS12_BAGS |
| 33 | .Nd decode and encode PKCS#12 structures | 33 | .Nd decode and encode PKCS#12 structures |
| 34 | .Sh SYNOPSIS | 34 | .Sh SYNOPSIS |
| 35 | .Lb libcrypto | ||
| 35 | .In openssl/pkcs12.h | 36 | .In openssl/pkcs12.h |
| 36 | .Ft PKCS12 * | 37 | .Ft PKCS12 * |
| 37 | .Fo d2i_PKCS12 | 38 | .Fo d2i_PKCS12 |
diff --git a/src/lib/libcrypto/man/d2i_PKCS7.3 b/src/lib/libcrypto/man/d2i_PKCS7.3 index e587787465..6d72433b7d 100644 --- a/src/lib/libcrypto/man/d2i_PKCS7.3 +++ b/src/lib/libcrypto/man/d2i_PKCS7.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_PKCS7.3,v 1.7 2023/04/25 18:05:07 tb Exp $ | 1 | .\" $OpenBSD: d2i_PKCS7.3,v 1.8 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: April 25 2023 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt D2I_PKCS7 3 | 18 | .Dt D2I_PKCS7 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -44,6 +44,7 @@ | |||
| 44 | .Nm i2d_PKCS7_SIGN_ENVELOPE | 44 | .Nm i2d_PKCS7_SIGN_ENVELOPE |
| 45 | .Nd decode and encode PKCS#7 data structures | 45 | .Nd decode and encode PKCS#7 data structures |
| 46 | .Sh SYNOPSIS | 46 | .Sh SYNOPSIS |
| 47 | .Lb libcrypto | ||
| 47 | .In openssl/pkcs7.h | 48 | .In openssl/pkcs7.h |
| 48 | .Ft PKCS7 * | 49 | .Ft PKCS7 * |
| 49 | .Fo d2i_PKCS7 | 50 | .Fo d2i_PKCS7 |
diff --git a/src/lib/libcrypto/man/d2i_PKCS8PrivateKey_bio.3 b/src/lib/libcrypto/man/d2i_PKCS8PrivateKey_bio.3 index 58dd989fae..41ab7ebcba 100644 --- a/src/lib/libcrypto/man/d2i_PKCS8PrivateKey_bio.3 +++ b/src/lib/libcrypto/man/d2i_PKCS8PrivateKey_bio.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_PKCS8PrivateKey_bio.3,v 1.11 2019/06/07 19:28:52 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_PKCS8PrivateKey_bio.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 | 2 | .\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 7 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt D2I_PKCS8PRIVATEKEY_BIO 3 | 52 | .Dt D2I_PKCS8PRIVATEKEY_BIO 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -60,6 +60,7 @@ | |||
| 60 | .Nm i2d_PKCS8PrivateKey_nid_fp | 60 | .Nm i2d_PKCS8PrivateKey_nid_fp |
| 61 | .Nd PKCS#8 format private key functions | 61 | .Nd PKCS#8 format private key functions |
| 62 | .Sh SYNOPSIS | 62 | .Sh SYNOPSIS |
| 63 | .Lb libcrypto | ||
| 63 | .In openssl/evp.h | 64 | .In openssl/evp.h |
| 64 | .Ft EVP_PKEY * | 65 | .Ft EVP_PKEY * |
| 65 | .Fo d2i_PKCS8PrivateKey_bio | 66 | .Fo d2i_PKCS8PrivateKey_bio |
diff --git a/src/lib/libcrypto/man/d2i_PKCS8_PRIV_KEY_INFO.3 b/src/lib/libcrypto/man/d2i_PKCS8_PRIV_KEY_INFO.3 index 1ac0f2c308..583fd536f2 100644 --- a/src/lib/libcrypto/man/d2i_PKCS8_PRIV_KEY_INFO.3 +++ b/src/lib/libcrypto/man/d2i_PKCS8_PRIV_KEY_INFO.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_PKCS8_PRIV_KEY_INFO.3,v 1.3 2018/03/21 21:18:08 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_PKCS8_PRIV_KEY_INFO.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 21 2018 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt D2I_PKCS8_PRIV_KEY_INFO 3 | 18 | .Dt D2I_PKCS8_PRIV_KEY_INFO 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -26,6 +26,7 @@ | |||
| 26 | .Nm i2d_PKCS8_PRIV_KEY_INFO_fp | 26 | .Nm i2d_PKCS8_PRIV_KEY_INFO_fp |
| 27 | .Nd decode and encode PKCS#8 private key | 27 | .Nd decode and encode PKCS#8 private key |
| 28 | .Sh SYNOPSIS | 28 | .Sh SYNOPSIS |
| 29 | .Lb libcrypto | ||
| 29 | .In openssl/x509.h | 30 | .In openssl/x509.h |
| 30 | .Ft PKCS8_PRIV_KEY_INFO * | 31 | .Ft PKCS8_PRIV_KEY_INFO * |
| 31 | .Fo d2i_PKCS8_PRIV_KEY_INFO | 32 | .Fo d2i_PKCS8_PRIV_KEY_INFO |
diff --git a/src/lib/libcrypto/man/d2i_PKEY_USAGE_PERIOD.3 b/src/lib/libcrypto/man/d2i_PKEY_USAGE_PERIOD.3 index df8639264c..1c3a215a38 100644 --- a/src/lib/libcrypto/man/d2i_PKEY_USAGE_PERIOD.3 +++ b/src/lib/libcrypto/man/d2i_PKEY_USAGE_PERIOD.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_PKEY_USAGE_PERIOD.3,v 1.2 2018/03/21 16:09:51 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_PKEY_USAGE_PERIOD.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 21 2018 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt D2I_PKEY_USAGE_PERIOD 3 | 18 | .Dt D2I_PKEY_USAGE_PERIOD 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm i2d_PKEY_USAGE_PERIOD | 22 | .Nm i2d_PKEY_USAGE_PERIOD |
| 23 | .Nd decode and encode X.509 key usage period extensions | 23 | .Nd decode and encode X.509 key usage period extensions |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/x509v3.h | 26 | .In openssl/x509v3.h |
| 26 | .Ft PKEY_USAGE_PERIOD * | 27 | .Ft PKEY_USAGE_PERIOD * |
| 27 | .Fo d2i_PKEY_USAGE_PERIOD | 28 | .Fo d2i_PKEY_USAGE_PERIOD |
diff --git a/src/lib/libcrypto/man/d2i_POLICYINFO.3 b/src/lib/libcrypto/man/d2i_POLICYINFO.3 index bae78b17c7..c335edc1df 100644 --- a/src/lib/libcrypto/man/d2i_POLICYINFO.3 +++ b/src/lib/libcrypto/man/d2i_POLICYINFO.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_POLICYINFO.3,v 1.2 2018/03/21 17:57:48 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_POLICYINFO.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 21 2018 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt D2I_POLICYINFO 3 | 18 | .Dt D2I_POLICYINFO 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -30,6 +30,7 @@ | |||
| 30 | .Nm i2d_NOTICEREF | 30 | .Nm i2d_NOTICEREF |
| 31 | .Nd decode and encode X.509 certificate policies | 31 | .Nd decode and encode X.509 certificate policies |
| 32 | .Sh SYNOPSIS | 32 | .Sh SYNOPSIS |
| 33 | .Lb libcrypto | ||
| 33 | .In openssl/x509v3.h | 34 | .In openssl/x509v3.h |
| 34 | .Ft POLICYINFO * | 35 | .Ft POLICYINFO * |
| 35 | .Fo d2i_POLICYINFO | 36 | .Fo d2i_POLICYINFO |
diff --git a/src/lib/libcrypto/man/d2i_PrivateKey.3 b/src/lib/libcrypto/man/d2i_PrivateKey.3 index b544ea0e9a..48f1b93a19 100644 --- a/src/lib/libcrypto/man/d2i_PrivateKey.3 +++ b/src/lib/libcrypto/man/d2i_PrivateKey.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_PrivateKey.3,v 1.11 2024/10/24 21:42:10 tb Exp $ | 1 | .\" $OpenBSD: d2i_PrivateKey.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL b0edda11 Mar 20 13:00:17 2018 +0000 | 2 | .\" full merge up to: OpenSSL b0edda11 Mar 20 13:00:17 2018 +0000 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: October 24 2024 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt D2I_PRIVATEKEY 3 | 69 | .Dt D2I_PRIVATEKEY 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -82,6 +82,7 @@ | |||
| 82 | .Nm i2d_PublicKey | 82 | .Nm i2d_PublicKey |
| 83 | .Nd decode and encode EVP_PKEY objects | 83 | .Nd decode and encode EVP_PKEY objects |
| 84 | .Sh SYNOPSIS | 84 | .Sh SYNOPSIS |
| 85 | .Lb libcrypto | ||
| 85 | .In openssl/evp.h | 86 | .In openssl/evp.h |
| 86 | .Ft EVP_PKEY * | 87 | .Ft EVP_PKEY * |
| 87 | .Fo d2i_PrivateKey | 88 | .Fo d2i_PrivateKey |
diff --git a/src/lib/libcrypto/man/d2i_RSAPublicKey.3 b/src/lib/libcrypto/man/d2i_RSAPublicKey.3 index d6c376d84b..3f738641df 100644 --- a/src/lib/libcrypto/man/d2i_RSAPublicKey.3 +++ b/src/lib/libcrypto/man/d2i_RSAPublicKey.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_RSAPublicKey.3,v 1.13 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_RSAPublicKey.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400 | 2 | .\" OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -67,7 +67,7 @@ | |||
| 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 69 | .\" | 69 | .\" |
| 70 | .Dd $Mdocdate: March 27 2018 $ | 70 | .Dd $Mdocdate: June 8 2025 $ |
| 71 | .Dt D2I_RSAPUBLICKEY 3 | 71 | .Dt D2I_RSAPUBLICKEY 3 |
| 72 | .Os | 72 | .Os |
| 73 | .Sh NAME | 73 | .Sh NAME |
| @@ -95,6 +95,7 @@ | |||
| 95 | .Nm i2d_RSA_PUBKEY_fp | 95 | .Nm i2d_RSA_PUBKEY_fp |
| 96 | .Nd decode and encode RSA keys and parameters | 96 | .Nd decode and encode RSA keys and parameters |
| 97 | .Sh SYNOPSIS | 97 | .Sh SYNOPSIS |
| 98 | .Lb libcrypto | ||
| 98 | .In openssl/rsa.h | 99 | .In openssl/rsa.h |
| 99 | .Ft RSA * | 100 | .Ft RSA * |
| 100 | .Fo d2i_RSAPublicKey | 101 | .Fo d2i_RSAPublicKey |
diff --git a/src/lib/libcrypto/man/d2i_TS_REQ.3 b/src/lib/libcrypto/man/d2i_TS_REQ.3 index 9f7c860fa1..87e9a402b8 100644 --- a/src/lib/libcrypto/man/d2i_TS_REQ.3 +++ b/src/lib/libcrypto/man/d2i_TS_REQ.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_TS_REQ.3,v 1.2 2018/03/23 04:34:23 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_TS_REQ.3,v 1.3 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 23 2018 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt D2I_TS_REQ 3 | 18 | .Dt D2I_TS_REQ 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -48,6 +48,7 @@ | |||
| 48 | .Nm i2d_TS_MSG_IMPRINT_fp | 48 | .Nm i2d_TS_MSG_IMPRINT_fp |
| 49 | .Nd decode and encode X.509 time-stamp protocol structures | 49 | .Nd decode and encode X.509 time-stamp protocol structures |
| 50 | .Sh SYNOPSIS | 50 | .Sh SYNOPSIS |
| 51 | .Lb libcrypto | ||
| 51 | .In openssl/ts.h | 52 | .In openssl/ts.h |
| 52 | .Ft TS_REQ * | 53 | .Ft TS_REQ * |
| 53 | .Fo d2i_TS_REQ | 54 | .Fo d2i_TS_REQ |
diff --git a/src/lib/libcrypto/man/d2i_X509.3 b/src/lib/libcrypto/man/d2i_X509.3 index 6102e49e0e..2905e49aca 100644 --- a/src/lib/libcrypto/man/d2i_X509.3 +++ b/src/lib/libcrypto/man/d2i_X509.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_X509.3,v 1.11 2021/10/27 10:35:43 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_X509.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL d2i_X509.pod checked up to: | 2 | .\" OpenSSL d2i_X509.pod checked up to: |
| 3 | .\" 256989ce4 Jun 19 15:00:32 2020 +0200 | 3 | .\" 256989ce4 Jun 19 15:00:32 2020 +0200 |
| 4 | .\" OpenSSL i2d_re_X509_tbs.pod checked up to: | 4 | .\" OpenSSL i2d_re_X509_tbs.pod checked up to: |
| @@ -71,7 +71,7 @@ | |||
| 71 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 71 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 72 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 72 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 73 | .\" | 73 | .\" |
| 74 | .Dd $Mdocdate: October 27 2021 $ | 74 | .Dd $Mdocdate: June 8 2025 $ |
| 75 | .Dt D2I_X509 3 | 75 | .Dt D2I_X509 3 |
| 76 | .Os | 76 | .Os |
| 77 | .Sh NAME | 77 | .Sh NAME |
| @@ -94,6 +94,7 @@ | |||
| 94 | .Nm i2d_re_X509_REQ_tbs | 94 | .Nm i2d_re_X509_REQ_tbs |
| 95 | .Nd decode and encode X.509 certificates | 95 | .Nd decode and encode X.509 certificates |
| 96 | .Sh SYNOPSIS | 96 | .Sh SYNOPSIS |
| 97 | .Lb libcrypto | ||
| 97 | .In openssl/x509.h | 98 | .In openssl/x509.h |
| 98 | .Ft X509 * | 99 | .Ft X509 * |
| 99 | .Fo d2i_X509 | 100 | .Fo d2i_X509 |
diff --git a/src/lib/libcrypto/man/d2i_X509_ALGOR.3 b/src/lib/libcrypto/man/d2i_X509_ALGOR.3 index 252f3fc344..2691ceda85 100644 --- a/src/lib/libcrypto/man/d2i_X509_ALGOR.3 +++ b/src/lib/libcrypto/man/d2i_X509_ALGOR.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_X509_ALGOR.3,v 1.11 2025/03/14 21:32:15 tb Exp $ | 1 | .\" $OpenBSD: d2i_X509_ALGOR.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016, 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016, 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 14 2025 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt D2I_X509_ALGOR 3 | 18 | .Dt D2I_X509_ALGOR 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -24,6 +24,7 @@ | |||
| 24 | .Nm i2d_X509_ALGORS | 24 | .Nm i2d_X509_ALGORS |
| 25 | .Nd decode and encode algorithm identifiers | 25 | .Nd decode and encode algorithm identifiers |
| 26 | .Sh SYNOPSIS | 26 | .Sh SYNOPSIS |
| 27 | .Lb libcrypto | ||
| 27 | .In openssl/x509.h | 28 | .In openssl/x509.h |
| 28 | .Ft X509_ALGOR * | 29 | .Ft X509_ALGOR * |
| 29 | .Fo d2i_X509_ALGOR | 30 | .Fo d2i_X509_ALGOR |
diff --git a/src/lib/libcrypto/man/d2i_X509_ATTRIBUTE.3 b/src/lib/libcrypto/man/d2i_X509_ATTRIBUTE.3 index 6b070e5e51..be4924d3e0 100644 --- a/src/lib/libcrypto/man/d2i_X509_ATTRIBUTE.3 +++ b/src/lib/libcrypto/man/d2i_X509_ATTRIBUTE.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_X509_ATTRIBUTE.3,v 1.3 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_X509_ATTRIBUTE.3,v 1.4 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 27 2018 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt D2I_X509_ATTRIBUTE 3 | 18 | .Dt D2I_X509_ATTRIBUTE 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -25,6 +25,7 @@ | |||
| 25 | .\" The type in called "Attribute" with capital "A", not "attribute". | 25 | .\" The type in called "Attribute" with capital "A", not "attribute". |
| 26 | .Nd decode and encode generic X.501 Attribute | 26 | .Nd decode and encode generic X.501 Attribute |
| 27 | .Sh SYNOPSIS | 27 | .Sh SYNOPSIS |
| 28 | .Lb libcrypto | ||
| 28 | .In openssl/x509.h | 29 | .In openssl/x509.h |
| 29 | .Ft X509_ATTRIBUTE * | 30 | .Ft X509_ATTRIBUTE * |
| 30 | .Fo d2i_X509_ATTRIBUTE | 31 | .Fo d2i_X509_ATTRIBUTE |
diff --git a/src/lib/libcrypto/man/d2i_X509_CRL.3 b/src/lib/libcrypto/man/d2i_X509_CRL.3 index 79c1ed9f8c..040ac0395f 100644 --- a/src/lib/libcrypto/man/d2i_X509_CRL.3 +++ b/src/lib/libcrypto/man/d2i_X509_CRL.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_X509_CRL.3,v 1.10 2025/03/15 15:17:41 tb Exp $ | 1 | .\" $OpenBSD: d2i_X509_CRL.3,v 1.11 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016, 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016, 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 15 2025 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt D2I_X509_CRL 3 | 18 | .Dt D2I_X509_CRL 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -30,6 +30,7 @@ | |||
| 30 | .Nm i2d_X509_REVOKED | 30 | .Nm i2d_X509_REVOKED |
| 31 | .Nd decode and encode X.509 certificate revocation lists | 31 | .Nd decode and encode X.509 certificate revocation lists |
| 32 | .Sh SYNOPSIS | 32 | .Sh SYNOPSIS |
| 33 | .Lb libcrypto | ||
| 33 | .In openssl/x509.h | 34 | .In openssl/x509.h |
| 34 | .Ft X509_CRL * | 35 | .Ft X509_CRL * |
| 35 | .Fo d2i_X509_CRL | 36 | .Fo d2i_X509_CRL |
diff --git a/src/lib/libcrypto/man/d2i_X509_EXTENSION.3 b/src/lib/libcrypto/man/d2i_X509_EXTENSION.3 index 46a680c1ba..3e1011d180 100644 --- a/src/lib/libcrypto/man/d2i_X509_EXTENSION.3 +++ b/src/lib/libcrypto/man/d2i_X509_EXTENSION.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_X509_EXTENSION.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_X509_EXTENSION.3,v 1.5 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: March 27 2018 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt D2I_X509_EXTENSION 3 | 18 | .Dt D2I_X509_EXTENSION 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -26,6 +26,7 @@ | |||
| 26 | .\" The ASN.1 structure is called "Extensions", not "extensions". | 26 | .\" The ASN.1 structure is called "Extensions", not "extensions". |
| 27 | .Nd decode and encode X.509 Extensions | 27 | .Nd decode and encode X.509 Extensions |
| 28 | .Sh SYNOPSIS | 28 | .Sh SYNOPSIS |
| 29 | .Lb libcrypto | ||
| 29 | .In openssl/x509.h | 30 | .In openssl/x509.h |
| 30 | .Ft X509_EXTENSION * | 31 | .Ft X509_EXTENSION * |
| 31 | .Fo d2i_X509_EXTENSION | 32 | .Fo d2i_X509_EXTENSION |
diff --git a/src/lib/libcrypto/man/d2i_X509_NAME.3 b/src/lib/libcrypto/man/d2i_X509_NAME.3 index f5cafaee97..c8df55f10d 100644 --- a/src/lib/libcrypto/man/d2i_X509_NAME.3 +++ b/src/lib/libcrypto/man/d2i_X509_NAME.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_X509_NAME.3,v 1.18 2025/03/14 21:32:15 tb Exp $ | 1 | .\" $OpenBSD: d2i_X509_NAME.3,v 1.19 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" checked up to: | 2 | .\" checked up to: |
| 3 | .\" OpenSSL crypto/d2i_X509_NAME 4692340e Jun 7 15:49:08 2016 -0400 and | 3 | .\" OpenSSL crypto/d2i_X509_NAME 4692340e Jun 7 15:49:08 2016 -0400 and |
| 4 | .\" OpenSSL man3/X509_NAME_get0_der 99d63d46 Oct 26 13:56:48 2016 -0400 | 4 | .\" OpenSSL man3/X509_NAME_get0_der 99d63d46 Oct 26 13:56:48 2016 -0400 |
| @@ -17,7 +17,7 @@ | |||
| 17 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 17 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 18 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 18 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 19 | .\" | 19 | .\" |
| 20 | .Dd $Mdocdate: March 14 2025 $ | 20 | .Dd $Mdocdate: June 8 2025 $ |
| 21 | .Dt D2I_X509_NAME 3 | 21 | .Dt D2I_X509_NAME 3 |
| 22 | .Os | 22 | .Os |
| 23 | .Sh NAME | 23 | .Sh NAME |
| @@ -34,6 +34,7 @@ | |||
| 34 | .\" The type is called "Name" with capital "N", not "name". | 34 | .\" The type is called "Name" with capital "N", not "name". |
| 35 | .Nd decode and encode X.501 Name objects | 35 | .Nd decode and encode X.501 Name objects |
| 36 | .Sh SYNOPSIS | 36 | .Sh SYNOPSIS |
| 37 | .Lb libcrypto | ||
| 37 | .In openssl/x509.h | 38 | .In openssl/x509.h |
| 38 | .Ft X509_NAME * | 39 | .Ft X509_NAME * |
| 39 | .Fo d2i_X509_NAME | 40 | .Fo d2i_X509_NAME |
diff --git a/src/lib/libcrypto/man/d2i_X509_REQ.3 b/src/lib/libcrypto/man/d2i_X509_REQ.3 index 95785a2d25..0f113757ee 100644 --- a/src/lib/libcrypto/man/d2i_X509_REQ.3 +++ b/src/lib/libcrypto/man/d2i_X509_REQ.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_X509_REQ.3,v 1.7 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_X509_REQ.3,v 1.8 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400 | 2 | .\" OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 4 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| @@ -15,7 +15,7 @@ | |||
| 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 | .\" | 17 | .\" |
| 18 | .Dd $Mdocdate: March 27 2018 $ | 18 | .Dd $Mdocdate: June 8 2025 $ |
| 19 | .Dt D2I_X509_REQ 3 | 19 | .Dt D2I_X509_REQ 3 |
| 20 | .Os | 20 | .Os |
| 21 | .Sh NAME | 21 | .Sh NAME |
| @@ -29,6 +29,7 @@ | |||
| 29 | .Nm i2d_X509_REQ_INFO | 29 | .Nm i2d_X509_REQ_INFO |
| 30 | .Nd decode and encode PKCS#10 certification requests | 30 | .Nd decode and encode PKCS#10 certification requests |
| 31 | .Sh SYNOPSIS | 31 | .Sh SYNOPSIS |
| 32 | .Lb libcrypto | ||
| 32 | .In openssl/x509.h | 33 | .In openssl/x509.h |
| 33 | .Ft X509_REQ * | 34 | .Ft X509_REQ * |
| 34 | .Fo d2i_X509_REQ | 35 | .Fo d2i_X509_REQ |
diff --git a/src/lib/libcrypto/man/d2i_X509_SIG.3 b/src/lib/libcrypto/man/d2i_X509_SIG.3 index c9fbf86633..1700b2d728 100644 --- a/src/lib/libcrypto/man/d2i_X509_SIG.3 +++ b/src/lib/libcrypto/man/d2i_X509_SIG.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_X509_SIG.3,v 1.10 2025/03/14 21:32:15 tb Exp $ | 1 | .\" $OpenBSD: d2i_X509_SIG.3,v 1.11 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 | 2 | .\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 4 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| @@ -15,7 +15,7 @@ | |||
| 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 | .\" | 17 | .\" |
| 18 | .Dd $Mdocdate: March 14 2025 $ | 18 | .Dd $Mdocdate: June 8 2025 $ |
| 19 | .Dt D2I_X509_SIG 3 | 19 | .Dt D2I_X509_SIG 3 |
| 20 | .Os | 20 | .Os |
| 21 | .Sh NAME | 21 | .Sh NAME |
| @@ -29,6 +29,7 @@ | |||
| 29 | .\" These functions are misnamed. | 29 | .\" These functions are misnamed. |
| 30 | .Nd decode and encode PKCS#7 digest information | 30 | .Nd decode and encode PKCS#7 digest information |
| 31 | .Sh SYNOPSIS | 31 | .Sh SYNOPSIS |
| 32 | .Lb libcrypto | ||
| 32 | .In openssl/x509.h | 33 | .In openssl/x509.h |
| 33 | .Ft X509_SIG * | 34 | .Ft X509_SIG * |
| 34 | .Fo d2i_X509_SIG | 35 | .Fo d2i_X509_SIG |
diff --git a/src/lib/libcrypto/man/des_read_pw.3 b/src/lib/libcrypto/man/des_read_pw.3 index 7cb35b47f8..2ffe13bbe9 100644 --- a/src/lib/libcrypto/man/des_read_pw.3 +++ b/src/lib/libcrypto/man/des_read_pw.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: des_read_pw.3,v 1.12 2024/08/24 07:48:37 tb Exp $ | 1 | .\" $OpenBSD: des_read_pw.3,v 1.13 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL doc/crypto/des.pod | 2 | .\" full merge up to: OpenSSL doc/crypto/des.pod |
| 3 | .\" 53934822 Jun 9 16:39:19 2016 -0400 | 3 | .\" 53934822 Jun 9 16:39:19 2016 -0400 |
| 4 | .\" | 4 | .\" |
| @@ -66,7 +66,7 @@ | |||
| 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 68 | .\" | 68 | .\" |
| 69 | .Dd $Mdocdate: August 24 2024 $ | 69 | .Dd $Mdocdate: June 8 2025 $ |
| 70 | .Dt DES_READ_PW 3 | 70 | .Dt DES_READ_PW 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -76,6 +76,7 @@ | |||
| 76 | .Nm EVP_get_pw_prompt | 76 | .Nm EVP_get_pw_prompt |
| 77 | .Nd compatibility user interface functions | 77 | .Nd compatibility user interface functions |
| 78 | .Sh SYNOPSIS | 78 | .Sh SYNOPSIS |
| 79 | .Lb libcrypto | ||
| 79 | .In openssl/evp.h | 80 | .In openssl/evp.h |
| 80 | .Ft int | 81 | .Ft int |
| 81 | .Fo EVP_read_pw_string | 82 | .Fo EVP_read_pw_string |
diff --git a/src/lib/libcrypto/man/evp.3 b/src/lib/libcrypto/man/evp.3 index 2c54c0f981..3a7acf1ff8 100644 --- a/src/lib/libcrypto/man/evp.3 +++ b/src/lib/libcrypto/man/evp.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: evp.3,v 1.36 2024/12/06 14:27:49 schwarze Exp $ | 1 | .\" $OpenBSD: evp.3,v 1.38 2025/06/11 13:48:54 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL man7/evp 24a535ea Sep 22 13:14:20 2020 +0100 | 2 | .\" full merge up to: OpenSSL man7/evp 24a535ea Sep 22 13:14:20 2020 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>, | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>, |
| @@ -51,13 +51,14 @@ | |||
| 51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 53 | .\" | 53 | .\" |
| 54 | .Dd $Mdocdate: December 6 2024 $ | 54 | .Dd $Mdocdate: June 11 2025 $ |
| 55 | .Dt EVP 3 | 55 | .Dt EVP 3 |
| 56 | .Os | 56 | .Os |
| 57 | .Sh NAME | 57 | .Sh NAME |
| 58 | .Nm evp | 58 | .Nm evp |
| 59 | .Nd high-level cryptographic functions | 59 | .Nd high-level cryptographic functions |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libcrypto | ||
| 61 | .In openssl/evp.h | 62 | .In openssl/evp.h |
| 62 | .Sh DESCRIPTION | 63 | .Sh DESCRIPTION |
| 63 | The EVP library provides a high-level interface to cryptographic | 64 | The EVP library provides a high-level interface to cryptographic |
| @@ -75,7 +76,7 @@ in contexts like | |||
| 75 | .Xr EVP_SealInit 3 , | 76 | .Xr EVP_SealInit 3 , |
| 76 | .Xr PKCS7_encrypt 3 , | 77 | .Xr PKCS7_encrypt 3 , |
| 77 | or | 78 | or |
| 78 | .Xr SMIME_write_ASN1 3 . | 79 | .Xr SMIME_write_PKCS7 3 . |
| 79 | .Pp | 80 | .Pp |
| 80 | .Xr EVP_SealInit 3 | 81 | .Xr EVP_SealInit 3 |
| 81 | and | 82 | and |
diff --git a/src/lib/libcrypto/man/i2a_ASN1_STRING.3 b/src/lib/libcrypto/man/i2a_ASN1_STRING.3 index 7d46474775..c16259e565 100644 --- a/src/lib/libcrypto/man/i2a_ASN1_STRING.3 +++ b/src/lib/libcrypto/man/i2a_ASN1_STRING.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: i2a_ASN1_STRING.3,v 1.5 2024/12/27 15:30:17 schwarze Exp $ | 1 | .\" $OpenBSD: i2a_ASN1_STRING.3,v 1.6 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2019, 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2019, 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 27 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt I2A_ASN1_STRING 3 | 18 | .Dt I2A_ASN1_STRING 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -26,6 +26,7 @@ | |||
| 26 | .Nm a2i_ASN1_ENUMERATED | 26 | .Nm a2i_ASN1_ENUMERATED |
| 27 | .Nd hexadecimal dump of an ASN.1 string | 27 | .Nd hexadecimal dump of an ASN.1 string |
| 28 | .Sh SYNOPSIS | 28 | .Sh SYNOPSIS |
| 29 | .Lb libcrypto | ||
| 29 | .In openssl/asn1.h | 30 | .In openssl/asn1.h |
| 30 | .Ft int | 31 | .Ft int |
| 31 | .Fo i2a_ASN1_STRING | 32 | .Fo i2a_ASN1_STRING |
diff --git a/src/lib/libcrypto/man/i2d_CMS_bio_stream.3 b/src/lib/libcrypto/man/i2d_CMS_bio_stream.3 index b60468464c..403f7c2906 100644 --- a/src/lib/libcrypto/man/i2d_CMS_bio_stream.3 +++ b/src/lib/libcrypto/man/i2d_CMS_bio_stream.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: i2d_CMS_bio_stream.3,v 1.6 2023/05/01 07:28:11 tb Exp $ | 1 | .\" $OpenBSD: i2d_CMS_bio_stream.3,v 1.7 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 | 2 | .\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: May 1 2023 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt I2D_CMS_BIO_STREAM 3 | 52 | .Dt I2D_CMS_BIO_STREAM 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm i2d_CMS_bio_stream | 55 | .Nm i2d_CMS_bio_stream |
| 56 | .Nd output CMS_ContentInfo structure in BER format | 56 | .Nd output CMS_ContentInfo structure in BER format |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libcrypto | ||
| 58 | .In openssl/cms.h | 59 | .In openssl/cms.h |
| 59 | .Ft int | 60 | .Ft int |
| 60 | .Fo i2d_CMS_bio_stream | 61 | .Fo i2d_CMS_bio_stream |
diff --git a/src/lib/libcrypto/man/i2d_PKCS7_bio_stream.3 b/src/lib/libcrypto/man/i2d_PKCS7_bio_stream.3 index 7a47ba3026..3636960aa2 100644 --- a/src/lib/libcrypto/man/i2d_PKCS7_bio_stream.3 +++ b/src/lib/libcrypto/man/i2d_PKCS7_bio_stream.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: i2d_PKCS7_bio_stream.3,v 1.11 2023/05/01 07:28:11 tb Exp $ | 1 | .\" $OpenBSD: i2d_PKCS7_bio_stream.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 | 2 | .\" OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -49,13 +49,14 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: May 1 2023 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt I2D_PKCS7_BIO_STREAM 3 | 53 | .Dt I2D_PKCS7_BIO_STREAM 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| 56 | .Nm i2d_PKCS7_bio_stream | 56 | .Nm i2d_PKCS7_bio_stream |
| 57 | .Nd output PKCS7 structure in BER format | 57 | .Nd output PKCS7 structure in BER format |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libcrypto | ||
| 59 | .In openssl/pkcs7.h | 60 | .In openssl/pkcs7.h |
| 60 | .Ft int | 61 | .Ft int |
| 61 | .Fo i2d_PKCS7_bio_stream | 62 | .Fo i2d_PKCS7_bio_stream |
diff --git a/src/lib/libcrypto/man/lh_new.3 b/src/lib/libcrypto/man/lh_new.3 index 2550a7d2e7..cc0b3d6b96 100644 --- a/src/lib/libcrypto/man/lh_new.3 +++ b/src/lib/libcrypto/man/lh_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: lh_new.3,v 1.13 2024/03/05 22:15:29 tb Exp $ | 1 | .\" $OpenBSD: lh_new.3,v 1.14 2025/06/08 22:40:30 schwarze Exp $ |
| 2 | .\" full merge up to: | 2 | .\" full merge up to: |
| 3 | .\" OpenSSL doc/crypto/lhash.pod 1bc74519 May 20 08:11:46 2016 -0400 | 3 | .\" OpenSSL doc/crypto/lhash.pod 1bc74519 May 20 08:11:46 2016 -0400 |
| 4 | .\" selective merge up to: | 4 | .\" selective merge up to: |
| @@ -118,7 +118,7 @@ | |||
| 118 | .\" copied and put under another distribution licence | 118 | .\" copied and put under another distribution licence |
| 119 | .\" [including the GNU Public Licence.] | 119 | .\" [including the GNU Public Licence.] |
| 120 | .\" | 120 | .\" |
| 121 | .Dd $Mdocdate: March 5 2024 $ | 121 | .Dd $Mdocdate: June 8 2025 $ |
| 122 | .Dt LH_NEW 3 | 122 | .Dt LH_NEW 3 |
| 123 | .Os | 123 | .Os |
| 124 | .Sh NAME | 124 | .Sh NAME |
| @@ -137,6 +137,7 @@ | |||
| 137 | .Nm lh_strhash | 137 | .Nm lh_strhash |
| 138 | .Nd dynamic hash table | 138 | .Nd dynamic hash table |
| 139 | .Sh SYNOPSIS | 139 | .Sh SYNOPSIS |
| 140 | .Lb libcrypto | ||
| 140 | .In openssl/lhash.h | 141 | .In openssl/lhash.h |
| 141 | .Fn DECLARE_LHASH_OF <type> | 142 | .Fn DECLARE_LHASH_OF <type> |
| 142 | .Ft LHASH * | 143 | .Ft LHASH * |
diff --git a/src/lib/libcrypto/man/s2i_ASN1_INTEGER.3 b/src/lib/libcrypto/man/s2i_ASN1_INTEGER.3 index a2105bc4bc..16646c69d1 100644 --- a/src/lib/libcrypto/man/s2i_ASN1_INTEGER.3 +++ b/src/lib/libcrypto/man/s2i_ASN1_INTEGER.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: s2i_ASN1_INTEGER.3,v 1.9 2024/12/27 15:30:17 schwarze Exp $ | 1 | .\" $OpenBSD: s2i_ASN1_INTEGER.3,v 1.11 2025/06/13 18:34:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> | 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 27 2024 $ | 17 | .Dd $Mdocdate: June 13 2025 $ |
| 18 | .Dt S2I_ASN1_INTEGER 3 | 18 | .Dt S2I_ASN1_INTEGER 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -26,35 +26,36 @@ | |||
| 26 | .Nm s2i_ASN1_OCTET_STRING | 26 | .Nm s2i_ASN1_OCTET_STRING |
| 27 | .Nd ASN.1 data type conversion utilities for certificate extensions | 27 | .Nd ASN.1 data type conversion utilities for certificate extensions |
| 28 | .Sh SYNOPSIS | 28 | .Sh SYNOPSIS |
| 29 | .Lb libcrypto | ||
| 29 | .In openssl/asn1.h | 30 | .In openssl/asn1.h |
| 30 | .In openssl/x509v3.h | 31 | .In openssl/x509v3.h |
| 31 | .Ft "char *" | 32 | .Ft char * |
| 32 | .Fo i2s_ASN1_ENUMERATED | 33 | .Fo i2s_ASN1_ENUMERATED |
| 33 | .Fa "X509V3_EXT_METHOD *method" | 34 | .Fa "X509V3_EXT_METHOD *method" |
| 34 | .Fa "const ASN1_ENUMERATED *a" | 35 | .Fa "const ASN1_ENUMERATED *a" |
| 35 | .Fc | 36 | .Fc |
| 36 | .Ft "char *" | 37 | .Ft char * |
| 37 | .Fo i2s_ASN1_INTEGER | 38 | .Fo i2s_ASN1_INTEGER |
| 38 | .Fa "X509V3_EXT_METHOD *method" | 39 | .Fa "X509V3_EXT_METHOD *method" |
| 39 | .Fa "const ASN1_INTEGER *a" | 40 | .Fa "const ASN1_INTEGER *a" |
| 40 | .Fc | 41 | .Fc |
| 41 | .Ft "ASN1_INTEGER *" | 42 | .Ft ASN1_INTEGER * |
| 42 | .Fo s2i_ASN1_INTEGER | 43 | .Fo s2i_ASN1_INTEGER |
| 43 | .Fa "X509V3_EXT_METHOD *method" | 44 | .Fa "X509V3_EXT_METHOD *method" |
| 44 | .Fa "const char *value" | 45 | .Fa "const char *value" |
| 45 | .Fc | 46 | .Fc |
| 46 | .Ft "char *" | 47 | .Ft char * |
| 47 | .Fo i2s_ASN1_OCTET_STRING | 48 | .Fo i2s_ASN1_OCTET_STRING |
| 48 | .Fa "X509V3_EXT_METHOD *method" | 49 | .Fa "X509V3_EXT_METHOD *method" |
| 49 | .Fa "const ASN1_OCTET_STRING *aos" | 50 | .Fa "const ASN1_OCTET_STRING *aos" |
| 50 | .Fc | 51 | .Fc |
| 51 | .Ft "ASN1_OCTET_STRING *" | 52 | .Ft ASN1_OCTET_STRING * |
| 52 | .Fo s2i_ASN1_OCTET_STRING | 53 | .Fo s2i_ASN1_OCTET_STRING |
| 53 | .Fa "X509V3_EXT_METHOD *method" | 54 | .Fa "X509V3_EXT_METHOD *method" |
| 54 | .Fa "X509V3_CTX *ctx" | 55 | .Fa "X509V3_CTX *ctx" |
| 55 | .Fa "const char *value" | 56 | .Fa "const char *value" |
| 56 | .Fc | 57 | .Fc |
| 57 | .Ft "char *" | 58 | .Ft char * |
| 58 | .Fo i2s_ASN1_ENUMERATED_TABLE | 59 | .Fo i2s_ASN1_ENUMERATED_TABLE |
| 59 | .Fa "X509V3_EXT_METHOD *method" | 60 | .Fa "X509V3_EXT_METHOD *method" |
| 60 | .Fa "const ASN1_ENUMERATED *a" | 61 | .Fa "const ASN1_ENUMERATED *a" |
diff --git a/src/lib/libcrypto/man/v2i_ASN1_BIT_STRING.3 b/src/lib/libcrypto/man/v2i_ASN1_BIT_STRING.3 index 36d9f7496b..107a57ae35 100644 --- a/src/lib/libcrypto/man/v2i_ASN1_BIT_STRING.3 +++ b/src/lib/libcrypto/man/v2i_ASN1_BIT_STRING.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: v2i_ASN1_BIT_STRING.3,v 1.1 2024/12/24 09:48:56 schwarze Exp $ | 1 | .\" $OpenBSD: v2i_ASN1_BIT_STRING.3,v 1.2 2025/06/08 22:40:31 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 24 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt V2I_ASN1_BIT_STRING 3 | 18 | .Dt V2I_ASN1_BIT_STRING 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm i2v_ASN1_BIT_STRING | 22 | .Nm i2v_ASN1_BIT_STRING |
| 23 | .Nd ASN.1 BIT STRING utility functions for certificate extensions | 23 | .Nd ASN.1 BIT STRING utility functions for certificate extensions |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libcrypto | ||
| 25 | .In openssl/x509v3.h | 26 | .In openssl/x509v3.h |
| 26 | .Ft ASN1_BIT_STRING * | 27 | .Ft ASN1_BIT_STRING * |
| 27 | .Fo v2i_ASN1_BIT_STRING | 28 | .Fo v2i_ASN1_BIT_STRING |
diff --git a/src/lib/libcrypto/md5/md5.c b/src/lib/libcrypto/md5/md5.c index f1c9223d86..f5ad5570a4 100644 --- a/src/lib/libcrypto/md5/md5.c +++ b/src/lib/libcrypto/md5/md5.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: md5.c,v 1.25 2025/01/24 13:35:04 jsing Exp $ */ | 1 | /* $OpenBSD: md5.c,v 1.26 2026/01/17 14:53:09 jsing Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -70,11 +70,11 @@ | |||
| 70 | /* Ensure that MD5_LONG and uint32_t are equivalent size. */ | 70 | /* Ensure that MD5_LONG and uint32_t are equivalent size. */ |
| 71 | CTASSERT(sizeof(MD5_LONG) == sizeof(uint32_t)); | 71 | CTASSERT(sizeof(MD5_LONG) == sizeof(uint32_t)); |
| 72 | 72 | ||
| 73 | #ifdef MD5_ASM | 73 | #ifdef HAVE_MD5_BLOCK_DATA_ORDER |
| 74 | void md5_block_data_order(MD5_CTX *c, const void *p, size_t num); | 74 | void md5_block_data_order(MD5_CTX *c, const void *p, size_t num); |
| 75 | #endif | 75 | #endif |
| 76 | 76 | ||
| 77 | #ifndef MD5_ASM | 77 | #ifndef HAVE_MD5_BLOCK_DATA_ORDER |
| 78 | static inline uint32_t | 78 | static inline uint32_t |
| 79 | md5_F(uint32_t x, uint32_t y, uint32_t z) | 79 | md5_F(uint32_t x, uint32_t y, uint32_t z) |
| 80 | { | 80 | { |
diff --git a/src/lib/libcrypto/mlkem/mlkem.c b/src/lib/libcrypto/mlkem/mlkem.c new file mode 100644 index 0000000000..67b6f241a3 --- /dev/null +++ b/src/lib/libcrypto/mlkem/mlkem.c | |||
| @@ -0,0 +1,349 @@ | |||
| 1 | /* $OpenBSD: mlkem.c,v 1.7 2026/01/16 18:27:22 tb Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2025, Bob Beck <beck@obtuse.com> | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and/or distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | ||
| 12 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | ||
| 14 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | ||
| 15 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <stdlib.h> | ||
| 19 | #include <string.h> | ||
| 20 | |||
| 21 | #include <openssl/mlkem.h> | ||
| 22 | |||
| 23 | #include "mlkem_internal.h" | ||
| 24 | |||
| 25 | static inline int | ||
| 26 | private_key_is_new(const MLKEM_private_key *key) | ||
| 27 | { | ||
| 28 | return (key != NULL && | ||
| 29 | key->state == MLKEM_PRIVATE_KEY_UNINITIALIZED && | ||
| 30 | (key->rank == MLKEM768_RANK || key->rank == MLKEM1024_RANK)); | ||
| 31 | } | ||
| 32 | |||
| 33 | static inline int | ||
| 34 | private_key_is_valid(const MLKEM_private_key *key) | ||
| 35 | { | ||
| 36 | return (key != NULL && | ||
| 37 | key->state == MLKEM_PRIVATE_KEY_INITIALIZED && | ||
| 38 | (key->rank == MLKEM768_RANK || key->rank == MLKEM1024_RANK)); | ||
| 39 | } | ||
| 40 | |||
| 41 | static inline int | ||
| 42 | public_key_is_new(const MLKEM_public_key *key) | ||
| 43 | { | ||
| 44 | return (key != NULL && | ||
| 45 | key->state == MLKEM_PUBLIC_KEY_UNINITIALIZED && | ||
| 46 | (key->rank == MLKEM768_RANK || key->rank == MLKEM1024_RANK)); | ||
| 47 | } | ||
| 48 | |||
| 49 | static inline int | ||
| 50 | public_key_is_valid(const MLKEM_public_key *key) | ||
| 51 | { | ||
| 52 | return (key != NULL && | ||
| 53 | key->state == MLKEM_PUBLIC_KEY_INITIALIZED && | ||
| 54 | (key->rank == MLKEM768_RANK || key->rank == MLKEM1024_RANK)); | ||
| 55 | } | ||
| 56 | |||
| 57 | /* | ||
| 58 | * ML-KEM operations | ||
| 59 | */ | ||
| 60 | |||
| 61 | int | ||
| 62 | MLKEM_generate_key_external_entropy(MLKEM_private_key *private_key, | ||
| 63 | uint8_t **out_encoded_public_key, size_t *out_encoded_public_key_len, | ||
| 64 | const uint8_t *entropy) | ||
| 65 | { | ||
| 66 | uint8_t *k = NULL; | ||
| 67 | size_t k_len = 0; | ||
| 68 | int ret = 0; | ||
| 69 | |||
| 70 | if (*out_encoded_public_key != NULL) | ||
| 71 | goto err; | ||
| 72 | |||
| 73 | if (!private_key_is_new(private_key)) | ||
| 74 | goto err; | ||
| 75 | |||
| 76 | k_len = MLKEM768_PUBLIC_KEY_BYTES; | ||
| 77 | if (private_key->rank == MLKEM1024_RANK) | ||
| 78 | k_len = MLKEM1024_PUBLIC_KEY_BYTES; | ||
| 79 | |||
| 80 | if ((k = calloc(1, k_len)) == NULL) | ||
| 81 | goto err; | ||
| 82 | |||
| 83 | if (!mlkem_generate_key_external_entropy(k, private_key, entropy)) | ||
| 84 | goto err; | ||
| 85 | |||
| 86 | private_key->state = MLKEM_PRIVATE_KEY_INITIALIZED; | ||
| 87 | |||
| 88 | *out_encoded_public_key = k; | ||
| 89 | *out_encoded_public_key_len = k_len; | ||
| 90 | k = NULL; | ||
| 91 | k_len = 0; | ||
| 92 | |||
| 93 | ret = 1; | ||
| 94 | |||
| 95 | err: | ||
| 96 | freezero(k, k_len); | ||
| 97 | |||
| 98 | return ret; | ||
| 99 | } | ||
| 100 | |||
| 101 | int | ||
| 102 | MLKEM_generate_key(MLKEM_private_key *private_key, | ||
| 103 | uint8_t **out_encoded_public_key, size_t *out_encoded_public_key_len, | ||
| 104 | uint8_t **out_optional_seed, size_t *out_optional_seed_len) | ||
| 105 | { | ||
| 106 | uint8_t *entropy_buf = NULL; | ||
| 107 | int ret = 0; | ||
| 108 | |||
| 109 | if (*out_encoded_public_key != NULL) | ||
| 110 | goto err; | ||
| 111 | |||
| 112 | if (out_optional_seed != NULL && *out_optional_seed != NULL) | ||
| 113 | goto err; | ||
| 114 | |||
| 115 | if ((entropy_buf = calloc(1, MLKEM_SEED_LENGTH)) == NULL) | ||
| 116 | goto err; | ||
| 117 | |||
| 118 | arc4random_buf(entropy_buf, MLKEM_SEED_LENGTH); | ||
| 119 | if (!MLKEM_generate_key_external_entropy(private_key, | ||
| 120 | out_encoded_public_key, out_encoded_public_key_len, | ||
| 121 | entropy_buf)) | ||
| 122 | goto err; | ||
| 123 | |||
| 124 | if (out_optional_seed != NULL) { | ||
| 125 | *out_optional_seed = entropy_buf; | ||
| 126 | *out_optional_seed_len = MLKEM_SEED_LENGTH; | ||
| 127 | entropy_buf = NULL; | ||
| 128 | } | ||
| 129 | |||
| 130 | ret = 1; | ||
| 131 | |||
| 132 | err: | ||
| 133 | freezero(entropy_buf, MLKEM_SEED_LENGTH); | ||
| 134 | |||
| 135 | return ret; | ||
| 136 | } | ||
| 137 | LCRYPTO_ALIAS(MLKEM_generate_key); | ||
| 138 | |||
| 139 | int | ||
| 140 | MLKEM_private_key_from_seed(MLKEM_private_key *private_key, | ||
| 141 | const uint8_t *seed, size_t seed_len) | ||
| 142 | { | ||
| 143 | int ret = 0; | ||
| 144 | |||
| 145 | if (!private_key_is_new(private_key)) | ||
| 146 | goto err; | ||
| 147 | |||
| 148 | if (seed_len != MLKEM_SEED_LENGTH) | ||
| 149 | goto err; | ||
| 150 | |||
| 151 | if (!mlkem_private_key_from_seed(seed, seed_len, private_key)) | ||
| 152 | goto err; | ||
| 153 | |||
| 154 | private_key->state = MLKEM_PRIVATE_KEY_INITIALIZED; | ||
| 155 | |||
| 156 | ret = 1; | ||
| 157 | |||
| 158 | err: | ||
| 159 | |||
| 160 | return ret; | ||
| 161 | } | ||
| 162 | LCRYPTO_ALIAS(MLKEM_private_key_from_seed); | ||
| 163 | |||
| 164 | int | ||
| 165 | MLKEM_public_from_private(const MLKEM_private_key *private_key, | ||
| 166 | MLKEM_public_key *public_key) | ||
| 167 | { | ||
| 168 | if (!private_key_is_valid(private_key)) | ||
| 169 | return 0; | ||
| 170 | if (!public_key_is_new(public_key)) | ||
| 171 | return 0; | ||
| 172 | if (public_key->rank != private_key->rank) | ||
| 173 | return 0; | ||
| 174 | |||
| 175 | mlkem_public_from_private(private_key, public_key); | ||
| 176 | |||
| 177 | public_key->state = MLKEM_PUBLIC_KEY_INITIALIZED; | ||
| 178 | |||
| 179 | return 1; | ||
| 180 | } | ||
| 181 | LCRYPTO_ALIAS(MLKEM_public_from_private); | ||
| 182 | |||
| 183 | int | ||
| 184 | MLKEM_encap_external_entropy(const MLKEM_public_key *public_key, | ||
| 185 | const uint8_t *entropy, uint8_t **out_ciphertext, | ||
| 186 | size_t *out_ciphertext_len, uint8_t **out_shared_secret, | ||
| 187 | size_t *out_shared_secret_len) | ||
| 188 | { | ||
| 189 | uint8_t *secret = NULL; | ||
| 190 | uint8_t *ciphertext = NULL; | ||
| 191 | size_t ciphertext_len = 0; | ||
| 192 | int ret = 0; | ||
| 193 | |||
| 194 | if (*out_ciphertext != NULL) | ||
| 195 | goto err; | ||
| 196 | |||
| 197 | if (*out_shared_secret != NULL) | ||
| 198 | goto err; | ||
| 199 | |||
| 200 | if (!public_key_is_valid(public_key)) | ||
| 201 | goto err; | ||
| 202 | |||
| 203 | if ((secret = calloc(1, MLKEM_SHARED_SECRET_LENGTH)) == NULL) | ||
| 204 | goto err; | ||
| 205 | |||
| 206 | ciphertext_len = MLKEM_public_key_ciphertext_length(public_key); | ||
| 207 | |||
| 208 | if ((ciphertext = calloc(1, ciphertext_len)) == NULL) | ||
| 209 | goto err; | ||
| 210 | |||
| 211 | mlkem_encap_external_entropy(ciphertext, secret, public_key, entropy); | ||
| 212 | |||
| 213 | *out_ciphertext = ciphertext; | ||
| 214 | *out_ciphertext_len = ciphertext_len; | ||
| 215 | ciphertext = NULL; | ||
| 216 | *out_shared_secret = secret; | ||
| 217 | *out_shared_secret_len = MLKEM_SHARED_SECRET_LENGTH; | ||
| 218 | secret = NULL; | ||
| 219 | |||
| 220 | ret = 1; | ||
| 221 | |||
| 222 | err: | ||
| 223 | freezero(secret, MLKEM_SHARED_SECRET_LENGTH); | ||
| 224 | freezero(ciphertext, ciphertext_len); | ||
| 225 | |||
| 226 | return ret; | ||
| 227 | } | ||
| 228 | |||
| 229 | int | ||
| 230 | MLKEM_encap(const MLKEM_public_key *public_key, | ||
| 231 | uint8_t **out_ciphertext, size_t *out_ciphertext_len, | ||
| 232 | uint8_t **out_shared_secret, size_t *out_shared_secret_len) | ||
| 233 | { | ||
| 234 | uint8_t entropy[MLKEM_ENCAP_ENTROPY]; | ||
| 235 | int ret; | ||
| 236 | |||
| 237 | arc4random_buf(entropy, sizeof(entropy)); | ||
| 238 | ret = MLKEM_encap_external_entropy(public_key, entropy, out_ciphertext, | ||
| 239 | out_ciphertext_len, out_shared_secret, out_shared_secret_len); | ||
| 240 | explicit_bzero(entropy, sizeof(entropy)); | ||
| 241 | |||
| 242 | return ret; | ||
| 243 | } | ||
| 244 | LCRYPTO_ALIAS(MLKEM_encap); | ||
| 245 | |||
| 246 | int | ||
| 247 | MLKEM_decap(const MLKEM_private_key *private_key, | ||
| 248 | const uint8_t *ciphertext, size_t ciphertext_len, | ||
| 249 | uint8_t **out_shared_secret, size_t *out_shared_secret_len) | ||
| 250 | { | ||
| 251 | uint8_t *s = NULL; | ||
| 252 | int ret = 0; | ||
| 253 | |||
| 254 | if (*out_shared_secret != NULL) | ||
| 255 | goto err; | ||
| 256 | |||
| 257 | if (!private_key_is_valid(private_key)) | ||
| 258 | goto err; | ||
| 259 | |||
| 260 | if (ciphertext_len != MLKEM_private_key_ciphertext_length(private_key)) | ||
| 261 | goto err; | ||
| 262 | |||
| 263 | if ((s = calloc(1, MLKEM_SHARED_SECRET_LENGTH)) == NULL) | ||
| 264 | goto err; | ||
| 265 | |||
| 266 | mlkem_decap(private_key, ciphertext, ciphertext_len, s); | ||
| 267 | |||
| 268 | *out_shared_secret = s; | ||
| 269 | *out_shared_secret_len = MLKEM_SHARED_SECRET_LENGTH; | ||
| 270 | s = NULL; | ||
| 271 | |||
| 272 | ret = 1; | ||
| 273 | |||
| 274 | err: | ||
| 275 | freezero(s, MLKEM_SHARED_SECRET_LENGTH); | ||
| 276 | |||
| 277 | return ret; | ||
| 278 | } | ||
| 279 | LCRYPTO_ALIAS(MLKEM_decap); | ||
| 280 | |||
| 281 | int | ||
| 282 | MLKEM_marshal_public_key(const MLKEM_public_key *public_key, uint8_t **out, | ||
| 283 | size_t *out_len) | ||
| 284 | { | ||
| 285 | if (*out != NULL) | ||
| 286 | return 0; | ||
| 287 | |||
| 288 | if (!public_key_is_valid(public_key)) | ||
| 289 | return 0; | ||
| 290 | |||
| 291 | return mlkem_marshal_public_key(public_key, out, out_len); | ||
| 292 | } | ||
| 293 | LCRYPTO_ALIAS(MLKEM_marshal_public_key); | ||
| 294 | |||
| 295 | /* | ||
| 296 | * Not exposed publicly, because the NIST private key format is gigantisch, and | ||
| 297 | * seeds should be used instead. Used for the NIST tests. | ||
| 298 | */ | ||
| 299 | int | ||
| 300 | MLKEM_marshal_private_key(const MLKEM_private_key *private_key, uint8_t **out, | ||
| 301 | size_t *out_len) | ||
| 302 | { | ||
| 303 | if (*out != NULL) | ||
| 304 | return 0; | ||
| 305 | |||
| 306 | if (!private_key_is_valid(private_key)) | ||
| 307 | return 0; | ||
| 308 | |||
| 309 | return mlkem_marshal_private_key(private_key, out, out_len); | ||
| 310 | } | ||
| 311 | LCRYPTO_ALIAS(MLKEM_marshal_private_key); | ||
| 312 | |||
| 313 | int | ||
| 314 | MLKEM_parse_public_key(MLKEM_public_key *public_key, const uint8_t *in, | ||
| 315 | size_t in_len) | ||
| 316 | { | ||
| 317 | if (!public_key_is_new(public_key)) | ||
| 318 | return 0; | ||
| 319 | |||
| 320 | if (in_len != MLKEM_public_key_encoded_length(public_key)) | ||
| 321 | return 0; | ||
| 322 | |||
| 323 | if (!mlkem_parse_public_key(in, in_len, public_key)) | ||
| 324 | return 0; | ||
| 325 | |||
| 326 | public_key->state = MLKEM_PUBLIC_KEY_INITIALIZED; | ||
| 327 | |||
| 328 | return 1; | ||
| 329 | } | ||
| 330 | LCRYPTO_ALIAS(MLKEM_parse_public_key); | ||
| 331 | |||
| 332 | int | ||
| 333 | MLKEM_parse_private_key(MLKEM_private_key *private_key, const uint8_t *in, | ||
| 334 | size_t in_len) | ||
| 335 | { | ||
| 336 | if (!private_key_is_new(private_key)) | ||
| 337 | return 0; | ||
| 338 | |||
| 339 | if (in_len != MLKEM_private_key_encoded_length(private_key)) | ||
| 340 | return 0; | ||
| 341 | |||
| 342 | if (!mlkem_parse_private_key(in, in_len, private_key)) | ||
| 343 | return 0; | ||
| 344 | |||
| 345 | private_key->state = MLKEM_PRIVATE_KEY_INITIALIZED; | ||
| 346 | |||
| 347 | return 1; | ||
| 348 | } | ||
| 349 | LCRYPTO_ALIAS(MLKEM_parse_private_key); | ||
diff --git a/src/lib/libcrypto/mlkem/mlkem.h b/src/lib/libcrypto/mlkem/mlkem.h index 055d92290e..39572e459d 100644 --- a/src/lib/libcrypto/mlkem/mlkem.h +++ b/src/lib/libcrypto/mlkem/mlkem.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* $OpenBSD: mlkem.h,v 1.5 2025/03/28 12:17:16 tb Exp $ */ | 1 | /* $OpenBSD: mlkem.h,v 1.10 2026/01/16 18:28:04 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024, Google Inc. | 3 | * Copyright (c) 2025 Bob Beck <beck@obtuse.com> |
| 4 | * | 4 | * |
| 5 | * Permission to use, copy, modify, and/or distribute this software for any | 5 | * Permission to use, copy, modify, and/or distribute this software for any |
| 6 | * purpose with or without fee is hereby granted, provided that the above | 6 | * purpose with or without fee is hereby granted, provided that the above |
| @@ -25,258 +25,209 @@ | |||
| 25 | extern "C" { | 25 | extern "C" { |
| 26 | #endif | 26 | #endif |
| 27 | 27 | ||
| 28 | /* Hack for now */ | ||
| 29 | struct cbs_st; | ||
| 30 | struct cbb_st; | ||
| 31 | |||
| 32 | /* | 28 | /* |
| 33 | * ML-KEM-768 | 29 | * ML-KEM constants |
| 34 | * | ||
| 35 | * This implements the Module-Lattice-Based Key-Encapsulation Mechanism from | ||
| 36 | * https://csrc.nist.gov/pubs/fips/204/final | ||
| 37 | */ | 30 | */ |
| 38 | 31 | ||
| 39 | /* | 32 | #define MLKEM768_RANK 3 |
| 40 | * MLKEM768_public_key contains a ML-KEM-768 public key. The contents of this | 33 | #define MLKEM1024_RANK 4 |
| 41 | * object should never leave the address space since the format is unstable. | ||
| 42 | */ | ||
| 43 | struct MLKEM768_public_key { | ||
| 44 | union { | ||
| 45 | uint8_t bytes[512 * (3 + 9) + 32 + 32]; | ||
| 46 | uint16_t alignment; | ||
| 47 | } opaque; | ||
| 48 | }; | ||
| 49 | 34 | ||
| 50 | /* | 35 | /* |
| 51 | * MLKEM768_private_key contains a ML-KEM-768 private key. The contents of this | 36 | * ML-KEM keys |
| 52 | * object should never leave the address space since the format is unstable. | ||
| 53 | */ | 37 | */ |
| 54 | struct MLKEM768_private_key { | ||
| 55 | union { | ||
| 56 | uint8_t bytes[512 * (3 + 3 + 9) + 32 + 32 + 32]; | ||
| 57 | uint16_t alignment; | ||
| 58 | } opaque; | ||
| 59 | }; | ||
| 60 | 38 | ||
| 61 | /* | 39 | typedef struct MLKEM_private_key_st MLKEM_private_key; |
| 62 | * MLKEM768_PUBLIC_KEY_BYTES is the number of bytes in an encoded ML-KEM768 public | 40 | typedef struct MLKEM_public_key_st MLKEM_public_key; |
| 63 | * key. | ||
| 64 | */ | ||
| 65 | #define MLKEM768_PUBLIC_KEY_BYTES 1184 | ||
| 66 | |||
| 67 | /* MLKEM_SEED_BYTES is the number of bytes in an ML-KEM seed. */ | ||
| 68 | #define MLKEM_SEED_BYTES 64 | ||
| 69 | 41 | ||
| 70 | /* | 42 | /* |
| 71 | * MLKEM_SHARED_SECRET_BYTES is the number of bytes in the ML-KEM768 shared | 43 | * MLKEM_private_key_new allocates a new uninitialized ML-KEM private key for |
| 72 | * secret. Although the round-3 specification has a variable-length output, the | 44 | * |rank|, which must be MLKEM768_RANK or MLKEM1024_RANK. It returns a pointer |
| 73 | * final ML-KEM construction is expected to use a fixed 32-byte output. To | 45 | * to an allocated structure suitable for holding a generated private key of the |
| 74 | * simplify the future transition, we apply the same restriction. | 46 | * corresponding rank on success, NULL is returned on failure. The caller is |
| 47 | * responsible for deallocating the resulting key with |MLKEM_private_key_free|. | ||
| 75 | */ | 48 | */ |
| 76 | #define MLKEM_SHARED_SECRET_BYTES 32 | 49 | MLKEM_private_key *MLKEM_private_key_new(int rank); |
| 77 | 50 | ||
| 78 | /* | 51 | /* |
| 79 | * MLKEM_generate_key generates a random public/private key pair, writes the | 52 | * MLKEM_private_key_free zeroes and frees all memory for |key| if |key| is |
| 80 | * encoded public key to |out_encoded_public_key| and sets |out_private_key| to | 53 | * non NULL. If |key| is NULL it does nothing and returns. |
| 81 | * the private key. If |optional_out_seed| is not NULL then the seed used to | ||
| 82 | * generate the private key is written to it. | ||
| 83 | */ | 54 | */ |
| 84 | void MLKEM768_generate_key( | 55 | void MLKEM_private_key_free(MLKEM_private_key *key); |
| 85 | uint8_t out_encoded_public_key[MLKEM768_PUBLIC_KEY_BYTES], | ||
| 86 | uint8_t optional_out_seed[MLKEM_SEED_BYTES], | ||
| 87 | struct MLKEM768_private_key *out_private_key); | ||
| 88 | 56 | ||
| 89 | /* | 57 | /* |
| 90 | * MLKEM768_private_key_from_seed derives a private key from a seed that was | 58 | * MLKEM_private_key_encoded_length the number of bytes used by the encoded form |
| 91 | * generated by |MLKEM768_generate_key|. It fails and returns 0 if |seed_len| is | 59 | * of |key|. This corresponds to the length of the buffer allocated for the |
| 92 | * incorrect, otherwise it writes |*out_private_key| and returns 1. | 60 | * encoded_public_key from |MLKEM_marshal_private_key|. Zero is returned if |
| 61 | * |key| is NULL or has an invalid rank. | ||
| 93 | */ | 62 | */ |
| 94 | int MLKEM768_private_key_from_seed(struct MLKEM768_private_key *out_private_key, | 63 | size_t MLKEM_private_key_encoded_length(const MLKEM_private_key *key); |
| 95 | const uint8_t *seed, size_t seed_len); | ||
| 96 | 64 | ||
| 97 | /* | 65 | /* |
| 98 | * MLKEM_public_from_private sets |*out_public_key| to the public key that | 66 | * MLKEM_private_key_ciphertext_length returns the number of bytes of ciphertext |
| 99 | * corresponds to |private_key|. (This is faster than parsing the output of | 67 | * required to decrypt a shared secret with |key| using |MLKEM_decap|. Zero is |
| 100 | * |MLKEM_generate_key| if, for some reason, you need to encapsulate to a key | 68 | * returned if |key| is NULL or has an invalid rank. |
| 101 | * that was just generated.) | ||
| 102 | */ | 69 | */ |
| 103 | void MLKEM768_public_from_private(struct MLKEM768_public_key *out_public_key, | 70 | size_t MLKEM_private_key_ciphertext_length(const MLKEM_private_key *key); |
| 104 | const struct MLKEM768_private_key *private_key); | ||
| 105 | |||
| 106 | /* MLKEM768_CIPHERTEXT_BYTES is number of bytes in the ML-KEM768 ciphertext. */ | ||
| 107 | #define MLKEM768_CIPHERTEXT_BYTES 1088 | ||
| 108 | 71 | ||
| 109 | /* | 72 | /* |
| 110 | * MLKEM768_encap encrypts a random shared secret for |public_key|, writes the | 73 | * MLKEM_public_key_new allocates a new uninitialized ML-KEM public key for |
| 111 | * ciphertext to |out_ciphertext|, and writes the random shared secret to | 74 | * |rank|, which must be MLKEM768_RANK or MLKEM1024_RANK. It returns a pointer |
| 112 | * |out_shared_secret|. | 75 | * to an allocated structure suitable for holding a generated public key of the |
| 76 | * corresponding rank on success, NULL is returned on failure. The caller is | ||
| 77 | * responsible for deallocating the resulting key with |MLKEM_public_key_free|. | ||
| 113 | */ | 78 | */ |
| 114 | void MLKEM768_encap(uint8_t out_ciphertext[MLKEM768_CIPHERTEXT_BYTES], | 79 | MLKEM_public_key *MLKEM_public_key_new(int rank); |
| 115 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], | ||
| 116 | const struct MLKEM768_public_key *public_key); | ||
| 117 | 80 | ||
| 118 | /* | 81 | /* |
| 119 | * MLKEM768_decap decrypts a shared secret from |ciphertext| using |private_key| | 82 | * MLKEM_public_key_free zeros and deallocates all memory for |key| if |key| is |
| 120 | * and writes it to |out_shared_secret|. If |ciphertext_len| is incorrect it | 83 | * non NULL. If |key| is NULL it does nothing and returns. |
| 121 | * returns 0, otherwise it rreturns 1. If |ciphertext| is invalid, | ||
| 122 | * |out_shared_secret| is filled with a key that will always be the same for the | ||
| 123 | * same |ciphertext| and |private_key|, but which appears to be random unless | ||
| 124 | * one has access to |private_key|. These alternatives occur in constant time. | ||
| 125 | * Any subsequent symmetric encryption using |out_shared_secret| must use an | ||
| 126 | * authenticated encryption scheme in order to discover the decapsulation | ||
| 127 | * failure. | ||
| 128 | */ | 84 | */ |
| 129 | int MLKEM768_decap(uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], | 85 | void MLKEM_public_key_free(MLKEM_public_key *key); |
| 130 | const uint8_t *ciphertext, size_t ciphertext_len, | ||
| 131 | const struct MLKEM768_private_key *private_key); | ||
| 132 | |||
| 133 | /* Serialisation of keys. */ | ||
| 134 | 86 | ||
| 135 | /* | 87 | /* |
| 136 | * MLKEM768_marshal_public_key serializes |public_key| to |out| in the standard | 88 | * MLKEM_public_key_encoded_length the number of bytes used by the encoded form |
| 137 | * format for ML-KEM public keys. It returns one on success or zero on allocation | 89 | * of |key|. This corresponds to the length of the buffer allocated for the |
| 138 | * error. | 90 | * encoded_public_key from |MLKEM_generate_key| or |MLKEM_marshal_public_key|. |
| 91 | * Zero is returned if |key| is NULL or has an invalid rank. | ||
| 139 | */ | 92 | */ |
| 140 | int MLKEM768_marshal_public_key(struct cbb_st *out, | 93 | size_t MLKEM_public_key_encoded_length(const MLKEM_public_key *key); |
| 141 | const struct MLKEM768_public_key *public_key); | ||
| 142 | 94 | ||
| 143 | /* | 95 | /* |
| 144 | * MLKEM768_parse_public_key parses a public key, in the format generated by | 96 | * MLKEM_public_key_cipertext_length returns the number of bytes produced as the |
| 145 | * |MLKEM_marshal_public_key|, from |in| and writes the result to | 97 | * ciphertext when encrypting a shared secret with |key| using |MLKEM_encap|. |
| 146 | * |out_public_key|. It returns one on success or zero on parse error or if | 98 | * Zero is returned if |key| is NULL or has an invalid rank. |
| 147 | * there are trailing bytes in |in|. | ||
| 148 | */ | 99 | */ |
| 149 | int MLKEM768_parse_public_key(struct MLKEM768_public_key *out_public_key, | 100 | size_t MLKEM_public_key_ciphertext_length(const MLKEM_public_key *key); |
| 150 | struct cbs_st *in); | ||
| 151 | 101 | ||
| 152 | /* | 102 | /* |
| 153 | * MLKEM_parse_private_key parses a private key, in the format generated by | 103 | * ML-KEM operations |
| 154 | * |MLKEM_marshal_private_key|, from |in| and writes the result to | ||
| 155 | * |out_private_key|. It returns one on success or zero on parse error or if | ||
| 156 | * there are trailing bytes in |in|. This formate is verbose and should be avoided. | ||
| 157 | * Private keys should be stored as seeds and parsed using |MLKEM768_private_key_from_seed|. | ||
| 158 | */ | 104 | */ |
| 159 | int MLKEM768_parse_private_key(struct MLKEM768_private_key *out_private_key, | ||
| 160 | struct cbs_st *in); | ||
| 161 | 105 | ||
| 162 | /* | 106 | /* |
| 163 | * ML-KEM-1024 | 107 | * MLKEM_generate_key generates a random private/public key pair, initializing |
| 108 | * |private_key|. It returns one on success, and zero on failure or error. | ||
| 109 | * |private_key| must be a new uninitialized key. |*out_encoded_public_key| and | ||
| 110 | * |*out_optional_seed|, if provided, must have the value of NULL. On success, a | ||
| 111 | * pointer to the encoded public key of the correct size for |key| is returned | ||
| 112 | * in |out_encoded_public_key|, and the length in bytes of | ||
| 113 | * |*out_encoded_public_key| is returned in |out_encoded_public_key_len|. If | ||
| 114 | * |out_optional_seed| is not NULL, a pointer to the seed used to generate the | ||
| 115 | * private key is returned in |*out_optional_seed| and the length in bytes of | ||
| 116 | * the seed is returned in |*out_optional_seed_len|. The caller is responsible | ||
| 117 | * for freeing the values returned in |out_encoded_public_key|, and | ||
| 118 | * |out_optional_seed|. | ||
| 164 | * | 119 | * |
| 165 | * ML-KEM-1024 also exists. You should prefer ML-KEM-768 where possible. | 120 | * In the event a private key needs to be saved, The normal best practice is to |
| 166 | */ | 121 | * save |out_optional_seed| as the private key, along with the ML-KEM rank value. |
| 167 | 122 | * An MLKEM_private_key of the correct rank can then be constructed using | |
| 168 | /* | 123 | * |MLKEM_private_key_from_seed|. |
| 169 | * MLKEM1024_public_key contains an ML-KEM-1024 public key. The contents of this | ||
| 170 | * object should never leave the address space since the format is unstable. | ||
| 171 | */ | 124 | */ |
| 172 | struct MLKEM1024_public_key { | 125 | int MLKEM_generate_key(MLKEM_private_key *private_key, |
| 173 | union { | 126 | uint8_t **out_encoded_public_key, size_t *out_encoded_public_key_len, |
| 174 | uint8_t bytes[512 * (4 + 16) + 32 + 32]; | 127 | uint8_t **out_optional_seed, size_t *out_optional_seed_len); |
| 175 | uint16_t alignment; | ||
| 176 | } opaque; | ||
| 177 | }; | ||
| 178 | 128 | ||
| 179 | /* | 129 | /* |
| 180 | * MLKEM1024_private_key contains a ML-KEM-1024 private key. The contents of | 130 | * MLKEM_private_key_from_seed derives a private key from a seed that was |
| 181 | * this object should never leave the address space since the format is | 131 | * generated by |MLKEM_generate_key| initializing |private_key|. It returns one |
| 182 | * unstable. | 132 | * on success, and zero on failure or error. |private_key| must be a new |
| 183 | */ | 133 | * uninitialized key. |seed_len| must be MLKEM_SEED_LENGTH. |
| 184 | struct MLKEM1024_private_key { | 134 | * |
| 185 | union { | 135 | * For |private_key| to match the key generated by |MLKEM_generate_key|, |
| 186 | uint8_t bytes[512 * (4 + 4 + 16) + 32 + 32 + 32]; | 136 | * |private_key| must have been created with the same rank as used when generating |
| 187 | uint16_t alignment; | 137 | * the key. |
| 188 | } opaque; | ||
| 189 | }; | ||
| 190 | |||
| 191 | /* | ||
| 192 | * MLKEM1024_PUBLIC_KEY_BYTES is the number of bytes in an encoded ML-KEM-1024 | ||
| 193 | * public key. | ||
| 194 | */ | 138 | */ |
| 195 | #define MLKEM1024_PUBLIC_KEY_BYTES 1568 | 139 | int MLKEM_private_key_from_seed(MLKEM_private_key *private_key, |
| 140 | const uint8_t *seed, size_t seed_len); | ||
| 196 | 141 | ||
| 197 | /* | 142 | /* |
| 198 | * MLKEM1024_generate_key generates a random public/private key pair, writes the | 143 | * MLKEM_public_from_private initializes |public_key| with the public key that |
| 199 | * encoded public key to |out_encoded_public_key| and sets |out_private_key| to | 144 | * corresponds to |private_key|. It returns one on success and zero on |
| 200 | * the private key. If |optional_out_seed| is not NULL then the seed used to | 145 | * error. This is faster than parsing the output of |MLKEM_generate_key| if, for |
| 201 | * generate the private key is written to it. | 146 | * some reason, you need to encapsulate to a key that was just |
| 147 | * generated. |private key| must be a new uninitialized key, of the same rank as | ||
| 148 | * |public_key|. | ||
| 202 | */ | 149 | */ |
| 203 | void MLKEM1024_generate_key( | 150 | int MLKEM_public_from_private(const MLKEM_private_key *private_key, |
| 204 | uint8_t out_encoded_public_key[MLKEM1024_PUBLIC_KEY_BYTES], | 151 | MLKEM_public_key *public_key); |
| 205 | uint8_t optional_out_seed[MLKEM_SEED_BYTES], | ||
| 206 | struct MLKEM1024_private_key *out_private_key); | ||
| 207 | 152 | ||
| 208 | /* | 153 | /* |
| 209 | * MLKEM1024_private_key_from_seed derives a private key from a seed that was | 154 | * MLKEM_encap encrypts a random shared secret for an initialized |
| 210 | * generated by |MLKEM1024_generate_key|. It fails and returns 0 if |seed_len| | 155 | * |public_key|. It returns one on success, and zero on failure or error. |*out |
| 211 | * is incorrect, otherwise it writes |*out_private_key| and returns 1. | 156 | * ciphertext| and |*out_shared_secret| must have the value NULL. On success, a |
| 157 | * pointer to the ciphertext of the correct size for |key| is returned in | ||
| 158 | * |out_ciphertext|, the length in bytes of |*out_ciphertext| is returned in | ||
| 159 | * |*out_ciphertext_len|, a pointer to the random shared secret is returned in | ||
| 160 | * |out_shared_secret|, and the length in bytes of |*out_shared_secret| is | ||
| 161 | * returned in |*out_ciphtertext_len|. The caller is responsible for zeroing and | ||
| 162 | * freeing the values returned in |out_ciphertext| and |out_shared_secret| | ||
| 212 | */ | 163 | */ |
| 213 | int MLKEM1024_private_key_from_seed( | 164 | int MLKEM_encap(const MLKEM_public_key *public_key, |
| 214 | struct MLKEM1024_private_key *out_private_key, const uint8_t *seed, | 165 | uint8_t **out_ciphertext, size_t *out_ciphertext_len, |
| 215 | size_t seed_len); | 166 | uint8_t **out_shared_secret, size_t *out_shared_secret_len); |
| 216 | 167 | ||
| 217 | /* | 168 | /* |
| 218 | * MLKEM1024_public_from_private sets |*out_public_key| to the public key that | 169 | * MLKEM_decap decrypts a shared secret from |ciphertext| using an initialized |
| 219 | * corresponds to |private_key|. (This is faster than parsing the output of | 170 | * |private_key|. It returns a pointer to the shared secret|out_shared_secret| |
| 220 | * |MLKEM1024_generate_key| if, for some reason, you need to encapsulate to a | 171 | * and the length in bytes of |*out_shared_secret| in |*out_shared_secret_len|. |
| 221 | * key that was just generated.) | 172 | * |
| 173 | * If |ciphertext_len| is incorrect for |private_key|, |*out_shared_secret| is | ||
| 174 | * not NULL, or memory can not be allocated, it returns zero, otherwise it | ||
| 175 | * returns one. If |ciphertext| is invalid, a pointer is returned in | ||
| 176 | * |out_shared_secret| pointing to a key that will always be the same for the | ||
| 177 | * same |ciphertext| and |private_key|, but which appears to be random unless | ||
| 178 | * one has access to |private_key|. These alternatives occur in constant time. | ||
| 179 | * Any subsequent symmetric encryption using |out_shared_secret| must use an | ||
| 180 | * authenticated encryption scheme in order to discover the decapsulation | ||
| 181 | * failure. The caller is responsible for zeroing and freeing the value returned | ||
| 182 | * in |out_shared_secret|. | ||
| 222 | */ | 183 | */ |
| 223 | void MLKEM1024_public_from_private(struct MLKEM1024_public_key *out_public_key, | 184 | int MLKEM_decap(const MLKEM_private_key *private_key, |
| 224 | const struct MLKEM1024_private_key *private_key); | 185 | const uint8_t *ciphertext, size_t ciphertext_len, |
| 186 | uint8_t **out_shared_secret, size_t *out_shared_secret_len); | ||
| 225 | 187 | ||
| 226 | /* MLKEM1024_CIPHERTEXT_BYTES is number of bytes in the ML-KEM-1024 ciphertext. */ | 188 | /* Serialization of ML-KEM keys. */ |
| 227 | #define MLKEM1024_CIPHERTEXT_BYTES 1568 | ||
| 228 | 189 | ||
| 229 | /* | 190 | /* |
| 230 | * MLKEM1024_encap encrypts a random shared secret for |public_key|, writes the | 191 | * MLKEM_marshal_public_key serializes an initialized |public_key| in the |
| 231 | * ciphertext to |out_ciphertext|, and writes the random shared secret to | 192 | * standard format for ML-KEM public keys. It returns one on success or zero on |
| 232 | * |out_shared_secret|. | 193 | * allocation error or failure. |*out| must have the value NULL. On success a |
| 194 | * pointer is returned in |out| to the encoded public key matching |public_key|, | ||
| 195 | * and a pointer to the length in bytes of the encoded public key is stored in | ||
| 196 | * |out_len|. The caller is responsible for freeing the values returned in | ||
| 197 | * |out|. | ||
| 233 | */ | 198 | */ |
| 234 | void MLKEM1024_encap(uint8_t out_ciphertext[MLKEM1024_CIPHERTEXT_BYTES], | 199 | int MLKEM_marshal_public_key(const MLKEM_public_key *public_key, uint8_t **out, |
| 235 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], | 200 | size_t *out_len); |
| 236 | const struct MLKEM1024_public_key *public_key); | ||
| 237 | 201 | ||
| 238 | /* | 202 | /* |
| 239 | * MLKEM1024_decap decrypts a shared secret from |ciphertext| using | 203 | * MLKEM_parse_public_key parses a public key, in the format generated by |
| 240 | * |private_key| and writes it to |out_shared_secret|. If |ciphertext_len| is | 204 | * |MLKEM_marshal_public_key|, from |in|. It returns one on success or zero on |
| 241 | * incorrect it returns 0, otherwise it returns 1. If |ciphertext| is invalid | 205 | * error or failure. |public_key| must be a new uninitialized key. |in_len| must |
| 242 | * (but of the correct length), |out_shared_secret| is filled with a key that | 206 | * be the correct length for the encoded format of |public_key. On success |
| 243 | * will always be the same for the same |ciphertext| and |private_key|, but | 207 | * |public_key| is initialized to the value parsed from |in|. |
| 244 | * which appears to be random unless one has access to |private_key|. These | ||
| 245 | * alternatives occur in constant time. Any subsequent symmetric encryption | ||
| 246 | * using |out_shared_secret| must use an authenticated encryption scheme in | ||
| 247 | * order to discover the decapsulation failure. | ||
| 248 | */ | 208 | */ |
| 249 | int MLKEM1024_decap(uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], | 209 | int MLKEM_parse_public_key(MLKEM_public_key *public_key, const uint8_t *in, |
| 250 | const uint8_t *ciphertext, size_t ciphertext_len, | 210 | size_t in_len); |
| 251 | const struct MLKEM1024_private_key *private_key); | ||
| 252 | 211 | ||
| 253 | /* | 212 | /* |
| 254 | * Serialisation of ML-KEM-1024 keys. | 213 | * Marshals a private key to encoded format, used for NIST tests. |
| 255 | * MLKEM1024_marshal_public_key serializes |public_key| to |out| in the standard | ||
| 256 | * format for ML-KEM-1024 public keys. It returns one on success or zero on | ||
| 257 | * allocation error. | ||
| 258 | */ | 214 | */ |
| 259 | int MLKEM1024_marshal_public_key(struct cbb_st *out, | 215 | int MLKEM_marshal_private_key(const MLKEM_private_key *private_key, |
| 260 | const struct MLKEM1024_public_key *public_key); | 216 | uint8_t **out, size_t *out_len); |
| 261 | 217 | ||
| 262 | /* | 218 | /* |
| 263 | * MLKEM1024_parse_public_key parses a public key, in the format generated by | 219 | * MLKEM_parse_private_key parses a private key, in the format generated by |
| 264 | * |MLKEM1024_marshal_public_key|, from |in| and writes the result to | 220 | * |MLKEM_marshal_private_key|, from |in|. It returns one on success or zero on |
| 265 | * |out_public_key|. It returns one on success or zero on parse error or if | 221 | * error or failure. |private_key| must be a new uninitialized key. |in_len| |
| 266 | * there are trailing bytes in |in|. | 222 | * must be the correct length for the encoded format of |private_key. On success |
| 267 | */ | 223 | * |private_key| is initialized to the value parsed from |in|. |
| 268 | int MLKEM1024_parse_public_key(struct MLKEM1024_public_key *out_public_key, | 224 | * |
| 269 | struct cbs_st *in); | 225 | * This format is wastefully verbose and should be avoided. Private keys should |
| 270 | 226 | * be stored as seeds from |MLKEM_generate_key|, and then parsed using | |
| 271 | /* | 227 | * |MLKEM_private_key_from_seed|. |
| 272 | * MLKEM1024_parse_private_key parses a private key, in NIST's format for | ||
| 273 | * private keys, from |in| and writes the result to |out_private_key|. It | ||
| 274 | * returns one on success or zero on parse error or if there are trailing bytes | ||
| 275 | * in |in|. This format is verbose and should be avoided. Private keys should be | ||
| 276 | * stored as seeds and parsed using |MLKEM1024_private_key_from_seed|. | ||
| 277 | */ | 228 | */ |
| 278 | int MLKEM1024_parse_private_key(struct MLKEM1024_private_key *out_private_key, | 229 | int MLKEM_parse_private_key(MLKEM_private_key *private_key, const uint8_t *in, |
| 279 | struct cbs_st *in); | 230 | size_t in_len); |
| 280 | 231 | ||
| 281 | #if defined(__cplusplus) | 232 | #if defined(__cplusplus) |
| 282 | } | 233 | } |
diff --git a/src/lib/libcrypto/mlkem/mlkem768.c b/src/lib/libcrypto/mlkem/mlkem768.c deleted file mode 100644 index bacde0c0b7..0000000000 --- a/src/lib/libcrypto/mlkem/mlkem768.c +++ /dev/null | |||
| @@ -1,1138 +0,0 @@ | |||
| 1 | /* $OpenBSD: mlkem768.c,v 1.7 2025/01/03 08:19:24 tb Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2024, Google Inc. | ||
| 4 | * Copyright (c) 2024, Bob Beck <beck@obtuse.com> | ||
| 5 | * | ||
| 6 | * Permission to use, copy, modify, and/or distribute this software for any | ||
| 7 | * purpose with or without fee is hereby granted, provided that the above | ||
| 8 | * copyright notice and this permission notice appear in all copies. | ||
| 9 | * | ||
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | ||
| 13 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | ||
| 15 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | ||
| 16 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <assert.h> | ||
| 20 | #include <stdlib.h> | ||
| 21 | #include <string.h> | ||
| 22 | |||
| 23 | #include "bytestring.h" | ||
| 24 | #include "mlkem.h" | ||
| 25 | |||
| 26 | #include "sha3_internal.h" | ||
| 27 | #include "mlkem_internal.h" | ||
| 28 | #include "constant_time.h" | ||
| 29 | #include "crypto_internal.h" | ||
| 30 | |||
| 31 | /* Remove later */ | ||
| 32 | #undef LCRYPTO_ALIAS | ||
| 33 | #define LCRYPTO_ALIAS(A) | ||
| 34 | |||
| 35 | /* | ||
| 36 | * See | ||
| 37 | * https://csrc.nist.gov/pubs/fips/203/final | ||
| 38 | */ | ||
| 39 | |||
| 40 | static void | ||
| 41 | prf(uint8_t *out, size_t out_len, const uint8_t in[33]) | ||
| 42 | { | ||
| 43 | sha3_ctx ctx; | ||
| 44 | shake256_init(&ctx); | ||
| 45 | shake_update(&ctx, in, 33); | ||
| 46 | shake_xof(&ctx); | ||
| 47 | shake_out(&ctx, out, out_len); | ||
| 48 | } | ||
| 49 | |||
| 50 | /* Section 4.1 */ | ||
| 51 | static void | ||
| 52 | hash_h(uint8_t out[32], const uint8_t *in, size_t len) | ||
| 53 | { | ||
| 54 | sha3_ctx ctx; | ||
| 55 | sha3_init(&ctx, 32); | ||
| 56 | sha3_update(&ctx, in, len); | ||
| 57 | sha3_final(out, &ctx); | ||
| 58 | } | ||
| 59 | |||
| 60 | static void | ||
| 61 | hash_g(uint8_t out[64], const uint8_t *in, size_t len) | ||
| 62 | { | ||
| 63 | sha3_ctx ctx; | ||
| 64 | sha3_init(&ctx, 64); | ||
| 65 | sha3_update(&ctx, in, len); | ||
| 66 | sha3_final(out, &ctx); | ||
| 67 | } | ||
| 68 | |||
| 69 | /* this is called 'J' in the spec */ | ||
| 70 | static void | ||
| 71 | kdf(uint8_t out[MLKEM_SHARED_SECRET_BYTES], const uint8_t failure_secret[32], | ||
| 72 | const uint8_t *in, size_t len) | ||
| 73 | { | ||
| 74 | sha3_ctx ctx; | ||
| 75 | shake256_init(&ctx); | ||
| 76 | shake_update(&ctx, failure_secret, 32); | ||
| 77 | shake_update(&ctx, in, len); | ||
| 78 | shake_xof(&ctx); | ||
| 79 | shake_out(&ctx, out, MLKEM_SHARED_SECRET_BYTES); | ||
| 80 | } | ||
| 81 | |||
| 82 | #define DEGREE 256 | ||
| 83 | #define RANK768 3 | ||
| 84 | |||
| 85 | static const size_t kBarrettMultiplier = 5039; | ||
| 86 | static const unsigned kBarrettShift = 24; | ||
| 87 | static const uint16_t kPrime = 3329; | ||
| 88 | static const int kLog2Prime = 12; | ||
| 89 | static const uint16_t kHalfPrime = (/*kPrime=*/3329 - 1) / 2; | ||
| 90 | static const int kDU768 = 10; | ||
| 91 | static const int kDV768 = 4; | ||
| 92 | /* | ||
| 93 | * kInverseDegree is 128^-1 mod 3329; 128 because kPrime does not have a 512th | ||
| 94 | * root of unity. | ||
| 95 | */ | ||
| 96 | static const uint16_t kInverseDegree = 3303; | ||
| 97 | static const size_t kEncodedVectorSize = | ||
| 98 | (/*kLog2Prime=*/12 * DEGREE / 8) * RANK768; | ||
| 99 | static const size_t kCompressedVectorSize = /*kDU768=*/ 10 * RANK768 * DEGREE / | ||
| 100 | 8; | ||
| 101 | |||
| 102 | typedef struct scalar { | ||
| 103 | /* On every function entry and exit, 0 <= c < kPrime. */ | ||
| 104 | uint16_t c[DEGREE]; | ||
| 105 | } scalar; | ||
| 106 | |||
| 107 | typedef struct vector { | ||
| 108 | scalar v[RANK768]; | ||
| 109 | } vector; | ||
| 110 | |||
| 111 | typedef struct matrix { | ||
| 112 | scalar v[RANK768][RANK768]; | ||
| 113 | } matrix; | ||
| 114 | |||
| 115 | /* | ||
| 116 | * This bit of Python will be referenced in some of the following comments: | ||
| 117 | * | ||
| 118 | * p = 3329 | ||
| 119 | * | ||
| 120 | * def bitreverse(i): | ||
| 121 | * ret = 0 | ||
| 122 | * for n in range(7): | ||
| 123 | * bit = i & 1 | ||
| 124 | * ret <<= 1 | ||
| 125 | * ret |= bit | ||
| 126 | * i >>= 1 | ||
| 127 | * return ret | ||
| 128 | */ | ||
| 129 | |||
| 130 | /* kNTTRoots = [pow(17, bitreverse(i), p) for i in range(128)] */ | ||
| 131 | static const uint16_t kNTTRoots[128] = { | ||
| 132 | 1, 1729, 2580, 3289, 2642, 630, 1897, 848, 1062, 1919, 193, 797, | ||
| 133 | 2786, 3260, 569, 1746, 296, 2447, 1339, 1476, 3046, 56, 2240, 1333, | ||
| 134 | 1426, 2094, 535, 2882, 2393, 2879, 1974, 821, 289, 331, 3253, 1756, | ||
| 135 | 1197, 2304, 2277, 2055, 650, 1977, 2513, 632, 2865, 33, 1320, 1915, | ||
| 136 | 2319, 1435, 807, 452, 1438, 2868, 1534, 2402, 2647, 2617, 1481, 648, | ||
| 137 | 2474, 3110, 1227, 910, 17, 2761, 583, 2649, 1637, 723, 2288, 1100, | ||
| 138 | 1409, 2662, 3281, 233, 756, 2156, 3015, 3050, 1703, 1651, 2789, 1789, | ||
| 139 | 1847, 952, 1461, 2687, 939, 2308, 2437, 2388, 733, 2337, 268, 641, | ||
| 140 | 1584, 2298, 2037, 3220, 375, 2549, 2090, 1645, 1063, 319, 2773, 757, | ||
| 141 | 2099, 561, 2466, 2594, 2804, 1092, 403, 1026, 1143, 2150, 2775, 886, | ||
| 142 | 1722, 1212, 1874, 1029, 2110, 2935, 885, 2154, | ||
| 143 | }; | ||
| 144 | |||
| 145 | /* kInverseNTTRoots = [pow(17, -bitreverse(i), p) for i in range(128)] */ | ||
| 146 | static const uint16_t kInverseNTTRoots[128] = { | ||
| 147 | 1, 1600, 40, 749, 2481, 1432, 2699, 687, 1583, 2760, 69, 543, | ||
| 148 | 2532, 3136, 1410, 2267, 2508, 1355, 450, 936, 447, 2794, 1235, 1903, | ||
| 149 | 1996, 1089, 3273, 283, 1853, 1990, 882, 3033, 2419, 2102, 219, 855, | ||
| 150 | 2681, 1848, 712, 682, 927, 1795, 461, 1891, 2877, 2522, 1894, 1010, | ||
| 151 | 1414, 2009, 3296, 464, 2697, 816, 1352, 2679, 1274, 1052, 1025, 2132, | ||
| 152 | 1573, 76, 2998, 3040, 1175, 2444, 394, 1219, 2300, 1455, 2117, 1607, | ||
| 153 | 2443, 554, 1179, 2186, 2303, 2926, 2237, 525, 735, 863, 2768, 1230, | ||
| 154 | 2572, 556, 3010, 2266, 1684, 1239, 780, 2954, 109, 1292, 1031, 1745, | ||
| 155 | 2688, 3061, 992, 2596, 941, 892, 1021, 2390, 642, 1868, 2377, 1482, | ||
| 156 | 1540, 540, 1678, 1626, 279, 314, 1173, 2573, 3096, 48, 667, 1920, | ||
| 157 | 2229, 1041, 2606, 1692, 680, 2746, 568, 3312, | ||
| 158 | }; | ||
| 159 | |||
| 160 | /* kModRoots = [pow(17, 2*bitreverse(i) + 1, p) for i in range(128)] */ | ||
| 161 | static const uint16_t kModRoots[128] = { | ||
| 162 | 17, 3312, 2761, 568, 583, 2746, 2649, 680, 1637, 1692, 723, 2606, | ||
| 163 | 2288, 1041, 1100, 2229, 1409, 1920, 2662, 667, 3281, 48, 233, 3096, | ||
| 164 | 756, 2573, 2156, 1173, 3015, 314, 3050, 279, 1703, 1626, 1651, 1678, | ||
| 165 | 2789, 540, 1789, 1540, 1847, 1482, 952, 2377, 1461, 1868, 2687, 642, | ||
| 166 | 939, 2390, 2308, 1021, 2437, 892, 2388, 941, 733, 2596, 2337, 992, | ||
| 167 | 268, 3061, 641, 2688, 1584, 1745, 2298, 1031, 2037, 1292, 3220, 109, | ||
| 168 | 375, 2954, 2549, 780, 2090, 1239, 1645, 1684, 1063, 2266, 319, 3010, | ||
| 169 | 2773, 556, 757, 2572, 2099, 1230, 561, 2768, 2466, 863, 2594, 735, | ||
| 170 | 2804, 525, 1092, 2237, 403, 2926, 1026, 2303, 1143, 2186, 2150, 1179, | ||
| 171 | 2775, 554, 886, 2443, 1722, 1607, 1212, 2117, 1874, 1455, 1029, 2300, | ||
| 172 | 2110, 1219, 2935, 394, 885, 2444, 2154, 1175, | ||
| 173 | }; | ||
| 174 | |||
| 175 | /* reduce_once reduces 0 <= x < 2*kPrime, mod kPrime. */ | ||
| 176 | static uint16_t | ||
| 177 | reduce_once(uint16_t x) | ||
| 178 | { | ||
| 179 | assert(x < 2 * kPrime); | ||
| 180 | const uint16_t subtracted = x - kPrime; | ||
| 181 | uint16_t mask = 0u - (subtracted >> 15); | ||
| 182 | |||
| 183 | /* | ||
| 184 | * Although this is a constant-time select, we omit a value barrier here. | ||
| 185 | * Value barriers impede auto-vectorization (likely because it forces the | ||
| 186 | * value to transit through a general-purpose register). On AArch64, this | ||
| 187 | * is a difference of 2x. | ||
| 188 | * | ||
| 189 | * We usually add value barriers to selects because Clang turns | ||
| 190 | * consecutive selects with the same condition into a branch instead of | ||
| 191 | * CMOV/CSEL. This condition does not occur in ML-KEM, so omitting it | ||
| 192 | * seems to be safe so far but see | ||
| 193 | * |scalar_centered_binomial_distribution_eta_2_with_prf|. | ||
| 194 | */ | ||
| 195 | return (mask & x) | (~mask & subtracted); | ||
| 196 | } | ||
| 197 | |||
| 198 | /* | ||
| 199 | * constant time reduce x mod kPrime using Barrett reduction. x must be less | ||
| 200 | * than kPrime + 2×kPrime². | ||
| 201 | */ | ||
| 202 | static uint16_t | ||
| 203 | reduce(uint32_t x) | ||
| 204 | { | ||
| 205 | uint64_t product = (uint64_t)x * kBarrettMultiplier; | ||
| 206 | uint32_t quotient = (uint32_t)(product >> kBarrettShift); | ||
| 207 | uint32_t remainder = x - quotient * kPrime; | ||
| 208 | |||
| 209 | assert(x < kPrime + 2u * kPrime * kPrime); | ||
| 210 | return reduce_once(remainder); | ||
| 211 | } | ||
| 212 | |||
| 213 | static void | ||
| 214 | scalar_zero(scalar *out) | ||
| 215 | { | ||
| 216 | memset(out, 0, sizeof(*out)); | ||
| 217 | } | ||
| 218 | |||
| 219 | static void | ||
| 220 | vector_zero(vector *out) | ||
| 221 | { | ||
| 222 | memset(out, 0, sizeof(*out)); | ||
| 223 | } | ||
| 224 | |||
| 225 | /* | ||
| 226 | * In place number theoretic transform of a given scalar. | ||
| 227 | * Note that MLKEM's kPrime 3329 does not have a 512th root of unity, so this | ||
| 228 | * transform leaves off the last iteration of the usual FFT code, with the 128 | ||
| 229 | * relevant roots of unity being stored in |kNTTRoots|. This means the output | ||
| 230 | * should be seen as 128 elements in GF(3329^2), with the coefficients of the | ||
| 231 | * elements being consecutive entries in |s->c|. | ||
| 232 | */ | ||
| 233 | static void | ||
| 234 | scalar_ntt(scalar *s) | ||
| 235 | { | ||
| 236 | int offset = DEGREE; | ||
| 237 | int step; | ||
| 238 | /* | ||
| 239 | * `int` is used here because using `size_t` throughout caused a ~5% slowdown | ||
| 240 | * with Clang 14 on Aarch64. | ||
| 241 | */ | ||
| 242 | for (step = 1; step < DEGREE / 2; step <<= 1) { | ||
| 243 | int i, j, k = 0; | ||
| 244 | |||
| 245 | offset >>= 1; | ||
| 246 | for (i = 0; i < step; i++) { | ||
| 247 | const uint32_t step_root = kNTTRoots[i + step]; | ||
| 248 | |||
| 249 | for (j = k; j < k + offset; j++) { | ||
| 250 | uint16_t odd, even; | ||
| 251 | |||
| 252 | odd = reduce(step_root * s->c[j + offset]); | ||
| 253 | even = s->c[j]; | ||
| 254 | s->c[j] = reduce_once(odd + even); | ||
| 255 | s->c[j + offset] = reduce_once(even - odd + | ||
| 256 | kPrime); | ||
| 257 | } | ||
| 258 | k += 2 * offset; | ||
| 259 | } | ||
| 260 | } | ||
| 261 | } | ||
| 262 | |||
| 263 | static void | ||
| 264 | vector_ntt(vector *a) | ||
| 265 | { | ||
| 266 | int i; | ||
| 267 | |||
| 268 | for (i = 0; i < RANK768; i++) { | ||
| 269 | scalar_ntt(&a->v[i]); | ||
| 270 | } | ||
| 271 | } | ||
| 272 | |||
| 273 | /* | ||
| 274 | * In place inverse number theoretic transform of a given scalar, with pairs of | ||
| 275 | * entries of s->v being interpreted as elements of GF(3329^2). Just as with the | ||
| 276 | * number theoretic transform, this leaves off the first step of the normal iFFT | ||
| 277 | * to account for the fact that 3329 does not have a 512th root of unity, using | ||
| 278 | * the precomputed 128 roots of unity stored in |kInverseNTTRoots|. | ||
| 279 | */ | ||
| 280 | static void | ||
| 281 | scalar_inverse_ntt(scalar *s) | ||
| 282 | { | ||
| 283 | int i, j, k, offset, step = DEGREE / 2; | ||
| 284 | |||
| 285 | /* | ||
| 286 | * `int` is used here because using `size_t` throughout caused a ~5% slowdown | ||
| 287 | * with Clang 14 on Aarch64. | ||
| 288 | */ | ||
| 289 | for (offset = 2; offset < DEGREE; offset <<= 1) { | ||
| 290 | step >>= 1; | ||
| 291 | k = 0; | ||
| 292 | for (i = 0; i < step; i++) { | ||
| 293 | uint32_t step_root = kInverseNTTRoots[i + step]; | ||
| 294 | for (j = k; j < k + offset; j++) { | ||
| 295 | uint16_t odd, even; | ||
| 296 | odd = s->c[j + offset]; | ||
| 297 | even = s->c[j]; | ||
| 298 | s->c[j] = reduce_once(odd + even); | ||
| 299 | s->c[j + offset] = reduce(step_root * | ||
| 300 | (even - odd + kPrime)); | ||
| 301 | } | ||
| 302 | k += 2 * offset; | ||
| 303 | } | ||
| 304 | } | ||
| 305 | for (i = 0; i < DEGREE; i++) { | ||
| 306 | s->c[i] = reduce(s->c[i] * kInverseDegree); | ||
| 307 | } | ||
| 308 | } | ||
| 309 | |||
| 310 | static void | ||
| 311 | vector_inverse_ntt(vector *a) | ||
| 312 | { | ||
| 313 | int i; | ||
| 314 | |||
| 315 | for (i = 0; i < RANK768; i++) { | ||
| 316 | scalar_inverse_ntt(&a->v[i]); | ||
| 317 | } | ||
| 318 | } | ||
| 319 | |||
| 320 | static void | ||
| 321 | scalar_add(scalar *lhs, const scalar *rhs) | ||
| 322 | { | ||
| 323 | int i; | ||
| 324 | |||
| 325 | for (i = 0; i < DEGREE; i++) { | ||
| 326 | lhs->c[i] = reduce_once(lhs->c[i] + rhs->c[i]); | ||
| 327 | } | ||
| 328 | } | ||
| 329 | |||
| 330 | static void | ||
| 331 | scalar_sub(scalar *lhs, const scalar *rhs) | ||
| 332 | { | ||
| 333 | int i; | ||
| 334 | |||
| 335 | for (i = 0; i < DEGREE; i++) { | ||
| 336 | lhs->c[i] = reduce_once(lhs->c[i] - rhs->c[i] + kPrime); | ||
| 337 | } | ||
| 338 | } | ||
| 339 | |||
| 340 | /* | ||
| 341 | * Multiplying two scalars in the number theoretically transformed state. | ||
| 342 | * Since 3329 does not have a 512th root of unity, this means we have to | ||
| 343 | * interpret the 2*ith and (2*i+1)th entries of the scalar as elements of | ||
| 344 | * GF(3329)[X]/(X^2 - 17^(2*bitreverse(i)+1)). | ||
| 345 | * The value of 17^(2*bitreverse(i)+1) mod 3329 is stored in the precomputed | ||
| 346 | * |kModRoots| table. Our Barrett transform only allows us to multiply two | ||
| 347 | * reduced numbers together, so we need some intermediate reduction steps, | ||
| 348 | * even if an uint64_t could hold 3 multiplied numbers. | ||
| 349 | */ | ||
| 350 | static void | ||
| 351 | scalar_mult(scalar *out, const scalar *lhs, const scalar *rhs) | ||
| 352 | { | ||
| 353 | int i; | ||
| 354 | |||
| 355 | for (i = 0; i < DEGREE / 2; i++) { | ||
| 356 | uint32_t real_real = (uint32_t)lhs->c[2 * i] * rhs->c[2 * i]; | ||
| 357 | uint32_t img_img = (uint32_t)lhs->c[2 * i + 1] * | ||
| 358 | rhs->c[2 * i + 1]; | ||
| 359 | uint32_t real_img = (uint32_t)lhs->c[2 * i] * rhs->c[2 * i + 1]; | ||
| 360 | uint32_t img_real = (uint32_t)lhs->c[2 * i + 1] * rhs->c[2 * i]; | ||
| 361 | |||
| 362 | out->c[2 * i] = | ||
| 363 | reduce(real_real + | ||
| 364 | (uint32_t)reduce(img_img) * kModRoots[i]); | ||
| 365 | out->c[2 * i + 1] = reduce(img_real + real_img); | ||
| 366 | } | ||
| 367 | } | ||
| 368 | |||
| 369 | static void | ||
| 370 | vector_add(vector *lhs, const vector *rhs) | ||
| 371 | { | ||
| 372 | int i; | ||
| 373 | |||
| 374 | for (i = 0; i < RANK768; i++) { | ||
| 375 | scalar_add(&lhs->v[i], &rhs->v[i]); | ||
| 376 | } | ||
| 377 | } | ||
| 378 | |||
| 379 | static void | ||
| 380 | matrix_mult(vector *out, const matrix *m, const vector *a) | ||
| 381 | { | ||
| 382 | int i, j; | ||
| 383 | |||
| 384 | vector_zero(out); | ||
| 385 | for (i = 0; i < RANK768; i++) { | ||
| 386 | for (j = 0; j < RANK768; j++) { | ||
| 387 | scalar product; | ||
| 388 | |||
| 389 | scalar_mult(&product, &m->v[i][j], &a->v[j]); | ||
| 390 | scalar_add(&out->v[i], &product); | ||
| 391 | } | ||
| 392 | } | ||
| 393 | } | ||
| 394 | |||
| 395 | static void | ||
| 396 | matrix_mult_transpose(vector *out, const matrix *m, | ||
| 397 | const vector *a) | ||
| 398 | { | ||
| 399 | int i, j; | ||
| 400 | |||
| 401 | vector_zero(out); | ||
| 402 | for (i = 0; i < RANK768; i++) { | ||
| 403 | for (j = 0; j < RANK768; j++) { | ||
| 404 | scalar product; | ||
| 405 | |||
| 406 | scalar_mult(&product, &m->v[j][i], &a->v[j]); | ||
| 407 | scalar_add(&out->v[i], &product); | ||
| 408 | } | ||
| 409 | } | ||
| 410 | } | ||
| 411 | |||
| 412 | static void | ||
| 413 | scalar_inner_product(scalar *out, const vector *lhs, | ||
| 414 | const vector *rhs) | ||
| 415 | { | ||
| 416 | int i; | ||
| 417 | scalar_zero(out); | ||
| 418 | for (i = 0; i < RANK768; i++) { | ||
| 419 | scalar product; | ||
| 420 | |||
| 421 | scalar_mult(&product, &lhs->v[i], &rhs->v[i]); | ||
| 422 | scalar_add(out, &product); | ||
| 423 | } | ||
| 424 | } | ||
| 425 | |||
| 426 | /* | ||
| 427 | * Algorithm 6 of spec. Rejection samples a Keccak stream to get uniformly | ||
| 428 | * distributed elements. This is used for matrix expansion and only operates on | ||
| 429 | * public inputs. | ||
| 430 | */ | ||
| 431 | static void | ||
| 432 | scalar_from_keccak_vartime(scalar *out, sha3_ctx *keccak_ctx) | ||
| 433 | { | ||
| 434 | int i, done = 0; | ||
| 435 | |||
| 436 | while (done < DEGREE) { | ||
| 437 | uint8_t block[168]; | ||
| 438 | |||
| 439 | shake_out(keccak_ctx, block, sizeof(block)); | ||
| 440 | for (i = 0; i < sizeof(block) && done < DEGREE; i += 3) { | ||
| 441 | uint16_t d1 = block[i] + 256 * (block[i + 1] % 16); | ||
| 442 | uint16_t d2 = block[i + 1] / 16 + 16 * block[i + 2]; | ||
| 443 | |||
| 444 | if (d1 < kPrime) { | ||
| 445 | out->c[done++] = d1; | ||
| 446 | } | ||
| 447 | if (d2 < kPrime && done < DEGREE) { | ||
| 448 | out->c[done++] = d2; | ||
| 449 | } | ||
| 450 | } | ||
| 451 | } | ||
| 452 | } | ||
| 453 | |||
| 454 | /* | ||
| 455 | * Algorithm 7 of the spec, with eta fixed to two and the PRF call | ||
| 456 | * included. Creates binominally distributed elements by sampling 2*|eta| bits, | ||
| 457 | * and setting the coefficient to the count of the first bits minus the count of | ||
| 458 | * the second bits, resulting in a centered binomial distribution. Since eta is | ||
| 459 | * two this gives -2/2 with a probability of 1/16, -1/1 with probability 1/4, | ||
| 460 | * and 0 with probability 3/8. | ||
| 461 | */ | ||
| 462 | static void | ||
| 463 | scalar_centered_binomial_distribution_eta_2_with_prf(scalar *out, | ||
| 464 | const uint8_t input[33]) | ||
| 465 | { | ||
| 466 | uint8_t entropy[128]; | ||
| 467 | int i; | ||
| 468 | |||
| 469 | CTASSERT(sizeof(entropy) == 2 * /*kEta=*/ 2 * DEGREE / 8); | ||
| 470 | prf(entropy, sizeof(entropy), input); | ||
| 471 | |||
| 472 | for (i = 0; i < DEGREE; i += 2) { | ||
| 473 | uint8_t byte = entropy[i / 2]; | ||
| 474 | uint16_t mask; | ||
| 475 | uint16_t value = (byte & 1) + ((byte >> 1) & 1); | ||
| 476 | |||
| 477 | value -= ((byte >> 2) & 1) + ((byte >> 3) & 1); | ||
| 478 | |||
| 479 | /* | ||
| 480 | * Add |kPrime| if |value| underflowed. See |reduce_once| for a | ||
| 481 | * discussion on why the value barrier is omitted. While this | ||
| 482 | * could have been written reduce_once(value + kPrime), this is | ||
| 483 | * one extra addition and small range of |value| tempts some | ||
| 484 | * versions of Clang to emit a branch. | ||
| 485 | */ | ||
| 486 | mask = 0u - (value >> 15); | ||
| 487 | out->c[i] = ((value + kPrime) & mask) | (value & ~mask); | ||
| 488 | |||
| 489 | byte >>= 4; | ||
| 490 | value = (byte & 1) + ((byte >> 1) & 1); | ||
| 491 | value -= ((byte >> 2) & 1) + ((byte >> 3) & 1); | ||
| 492 | /* See above. */ | ||
| 493 | mask = 0u - (value >> 15); | ||
| 494 | out->c[i + 1] = ((value + kPrime) & mask) | (value & ~mask); | ||
| 495 | } | ||
| 496 | } | ||
| 497 | |||
| 498 | /* | ||
| 499 | * Generates a secret vector by using | ||
| 500 | * |scalar_centered_binomial_distribution_eta_2_with_prf|, using the given seed | ||
| 501 | * appending and incrementing |counter| for entry of the vector. | ||
| 502 | */ | ||
| 503 | static void | ||
| 504 | vector_generate_secret_eta_2(vector *out, uint8_t *counter, | ||
| 505 | const uint8_t seed[32]) | ||
| 506 | { | ||
| 507 | uint8_t input[33]; | ||
| 508 | int i; | ||
| 509 | |||
| 510 | memcpy(input, seed, 32); | ||
| 511 | for (i = 0; i < RANK768; i++) { | ||
| 512 | input[32] = (*counter)++; | ||
| 513 | scalar_centered_binomial_distribution_eta_2_with_prf(&out->v[i], | ||
| 514 | input); | ||
| 515 | } | ||
| 516 | } | ||
| 517 | |||
| 518 | /* Expands the matrix of a seed for key generation and for encaps-CPA. */ | ||
| 519 | static void | ||
| 520 | matrix_expand(matrix *out, const uint8_t rho[32]) | ||
| 521 | { | ||
| 522 | uint8_t input[34]; | ||
| 523 | int i, j; | ||
| 524 | |||
| 525 | memcpy(input, rho, 32); | ||
| 526 | for (i = 0; i < RANK768; i++) { | ||
| 527 | for (j = 0; j < RANK768; j++) { | ||
| 528 | sha3_ctx keccak_ctx; | ||
| 529 | |||
| 530 | input[32] = i; | ||
| 531 | input[33] = j; | ||
| 532 | shake128_init(&keccak_ctx); | ||
| 533 | shake_update(&keccak_ctx, input, sizeof(input)); | ||
| 534 | shake_xof(&keccak_ctx); | ||
| 535 | scalar_from_keccak_vartime(&out->v[i][j], &keccak_ctx); | ||
| 536 | } | ||
| 537 | } | ||
| 538 | } | ||
| 539 | |||
| 540 | static const uint8_t kMasks[8] = {0x01, 0x03, 0x07, 0x0f, | ||
| 541 | 0x1f, 0x3f, 0x7f, 0xff}; | ||
| 542 | |||
| 543 | static void | ||
| 544 | scalar_encode(uint8_t *out, const scalar *s, int bits) | ||
| 545 | { | ||
| 546 | uint8_t out_byte = 0; | ||
| 547 | int i, out_byte_bits = 0; | ||
| 548 | |||
| 549 | assert(bits <= (int)sizeof(*s->c) * 8 && bits != 1); | ||
| 550 | for (i = 0; i < DEGREE; i++) { | ||
| 551 | uint16_t element = s->c[i]; | ||
| 552 | int element_bits_done = 0; | ||
| 553 | |||
| 554 | while (element_bits_done < bits) { | ||
| 555 | int chunk_bits = bits - element_bits_done; | ||
| 556 | int out_bits_remaining = 8 - out_byte_bits; | ||
| 557 | |||
| 558 | if (chunk_bits >= out_bits_remaining) { | ||
| 559 | chunk_bits = out_bits_remaining; | ||
| 560 | out_byte |= (element & | ||
| 561 | kMasks[chunk_bits - 1]) << out_byte_bits; | ||
| 562 | *out = out_byte; | ||
| 563 | out++; | ||
| 564 | out_byte_bits = 0; | ||
| 565 | out_byte = 0; | ||
| 566 | } else { | ||
| 567 | out_byte |= (element & | ||
| 568 | kMasks[chunk_bits - 1]) << out_byte_bits; | ||
| 569 | out_byte_bits += chunk_bits; | ||
| 570 | } | ||
| 571 | |||
| 572 | element_bits_done += chunk_bits; | ||
| 573 | element >>= chunk_bits; | ||
| 574 | } | ||
| 575 | } | ||
| 576 | |||
| 577 | if (out_byte_bits > 0) { | ||
| 578 | *out = out_byte; | ||
| 579 | } | ||
| 580 | } | ||
| 581 | |||
| 582 | /* scalar_encode_1 is |scalar_encode| specialised for |bits| == 1. */ | ||
| 583 | static void | ||
| 584 | scalar_encode_1(uint8_t out[32], const scalar *s) | ||
| 585 | { | ||
| 586 | int i, j; | ||
| 587 | |||
| 588 | for (i = 0; i < DEGREE; i += 8) { | ||
| 589 | uint8_t out_byte = 0; | ||
| 590 | |||
| 591 | for (j = 0; j < 8; j++) { | ||
| 592 | out_byte |= (s->c[i + j] & 1) << j; | ||
| 593 | } | ||
| 594 | *out = out_byte; | ||
| 595 | out++; | ||
| 596 | } | ||
| 597 | } | ||
| 598 | |||
| 599 | /* | ||
| 600 | * Encodes an entire vector into 32*|RANK768|*|bits| bytes. Note that since 256 | ||
| 601 | * (DEGREE) is divisible by 8, the individual vector entries will always fill a | ||
| 602 | * whole number of bytes, so we do not need to worry about bit packing here. | ||
| 603 | */ | ||
| 604 | static void | ||
| 605 | vector_encode(uint8_t *out, const vector *a, int bits) | ||
| 606 | { | ||
| 607 | int i; | ||
| 608 | |||
| 609 | for (i = 0; i < RANK768; i++) { | ||
| 610 | scalar_encode(out + i * bits * DEGREE / 8, &a->v[i], bits); | ||
| 611 | } | ||
| 612 | } | ||
| 613 | |||
| 614 | /* | ||
| 615 | * scalar_decode parses |DEGREE * bits| bits from |in| into |DEGREE| values in | ||
| 616 | * |out|. It returns one on success and zero if any parsed value is >= | ||
| 617 | * |kPrime|. | ||
| 618 | */ | ||
| 619 | static int | ||
| 620 | scalar_decode(scalar *out, const uint8_t *in, int bits) | ||
| 621 | { | ||
| 622 | uint8_t in_byte = 0; | ||
| 623 | int i, in_byte_bits_left = 0; | ||
| 624 | |||
| 625 | assert(bits <= (int)sizeof(*out->c) * 8 && bits != 1); | ||
| 626 | |||
| 627 | for (i = 0; i < DEGREE; i++) { | ||
| 628 | uint16_t element = 0; | ||
| 629 | int element_bits_done = 0; | ||
| 630 | |||
| 631 | while (element_bits_done < bits) { | ||
| 632 | int chunk_bits = bits - element_bits_done; | ||
| 633 | |||
| 634 | if (in_byte_bits_left == 0) { | ||
| 635 | in_byte = *in; | ||
| 636 | in++; | ||
| 637 | in_byte_bits_left = 8; | ||
| 638 | } | ||
| 639 | |||
| 640 | if (chunk_bits > in_byte_bits_left) { | ||
| 641 | chunk_bits = in_byte_bits_left; | ||
| 642 | } | ||
| 643 | |||
| 644 | element |= (in_byte & kMasks[chunk_bits - 1]) << | ||
| 645 | element_bits_done; | ||
| 646 | in_byte_bits_left -= chunk_bits; | ||
| 647 | in_byte >>= chunk_bits; | ||
| 648 | |||
| 649 | element_bits_done += chunk_bits; | ||
| 650 | } | ||
| 651 | |||
| 652 | if (element >= kPrime) { | ||
| 653 | return 0; | ||
| 654 | } | ||
| 655 | out->c[i] = element; | ||
| 656 | } | ||
| 657 | |||
| 658 | return 1; | ||
| 659 | } | ||
| 660 | |||
| 661 | /* scalar_decode_1 is |scalar_decode| specialised for |bits| == 1. */ | ||
| 662 | static void | ||
| 663 | scalar_decode_1(scalar *out, const uint8_t in[32]) | ||
| 664 | { | ||
| 665 | int i, j; | ||
| 666 | |||
| 667 | for (i = 0; i < DEGREE; i += 8) { | ||
| 668 | uint8_t in_byte = *in; | ||
| 669 | |||
| 670 | in++; | ||
| 671 | for (j = 0; j < 8; j++) { | ||
| 672 | out->c[i + j] = in_byte & 1; | ||
| 673 | in_byte >>= 1; | ||
| 674 | } | ||
| 675 | } | ||
| 676 | } | ||
| 677 | |||
| 678 | /* | ||
| 679 | * Decodes 32*|RANK768|*|bits| bytes from |in| into |out|. It returns one on | ||
| 680 | * success or zero if any parsed value is >= |kPrime|. | ||
| 681 | */ | ||
| 682 | static int | ||
| 683 | vector_decode(vector *out, const uint8_t *in, int bits) | ||
| 684 | { | ||
| 685 | int i; | ||
| 686 | |||
| 687 | for (i = 0; i < RANK768; i++) { | ||
| 688 | if (!scalar_decode(&out->v[i], in + i * bits * DEGREE / 8, | ||
| 689 | bits)) { | ||
| 690 | return 0; | ||
| 691 | } | ||
| 692 | } | ||
| 693 | return 1; | ||
| 694 | } | ||
| 695 | |||
| 696 | /* | ||
| 697 | * Compresses (lossily) an input |x| mod 3329 into |bits| many bits by grouping | ||
| 698 | * numbers close to each other together. The formula used is | ||
| 699 | * round(2^|bits|/kPrime*x) mod 2^|bits|. | ||
| 700 | * Uses Barrett reduction to achieve constant time. Since we need both the | ||
| 701 | * remainder (for rounding) and the quotient (as the result), we cannot use | ||
| 702 | * |reduce| here, but need to do the Barrett reduction directly. | ||
| 703 | */ | ||
| 704 | static uint16_t | ||
| 705 | compress(uint16_t x, int bits) | ||
| 706 | { | ||
| 707 | uint32_t shifted = (uint32_t)x << bits; | ||
| 708 | uint64_t product = (uint64_t)shifted * kBarrettMultiplier; | ||
| 709 | uint32_t quotient = (uint32_t)(product >> kBarrettShift); | ||
| 710 | uint32_t remainder = shifted - quotient * kPrime; | ||
| 711 | |||
| 712 | /* | ||
| 713 | * Adjust the quotient to round correctly: | ||
| 714 | * 0 <= remainder <= kHalfPrime round to 0 | ||
| 715 | * kHalfPrime < remainder <= kPrime + kHalfPrime round to 1 | ||
| 716 | * kPrime + kHalfPrime < remainder < 2 * kPrime round to 2 | ||
| 717 | */ | ||
| 718 | assert(remainder < 2u * kPrime); | ||
| 719 | quotient += 1 & constant_time_lt(kHalfPrime, remainder); | ||
| 720 | quotient += 1 & constant_time_lt(kPrime + kHalfPrime, remainder); | ||
| 721 | return quotient & ((1 << bits) - 1); | ||
| 722 | } | ||
| 723 | |||
| 724 | /* | ||
| 725 | * Decompresses |x| by using an equi-distant representative. The formula is | ||
| 726 | * round(kPrime/2^|bits|*x). Note that 2^|bits| being the divisor allows us to | ||
| 727 | * implement this logic using only bit operations. | ||
| 728 | */ | ||
| 729 | static uint16_t | ||
| 730 | decompress(uint16_t x, int bits) | ||
| 731 | { | ||
| 732 | uint32_t product = (uint32_t)x * kPrime; | ||
| 733 | uint32_t power = 1 << bits; | ||
| 734 | /* This is |product| % power, since |power| is a power of 2. */ | ||
| 735 | uint32_t remainder = product & (power - 1); | ||
| 736 | /* This is |product| / power, since |power| is a power of 2. */ | ||
| 737 | uint32_t lower = product >> bits; | ||
| 738 | |||
| 739 | /* | ||
| 740 | * The rounding logic works since the first half of numbers mod |power| have a | ||
| 741 | * 0 as first bit, and the second half has a 1 as first bit, since |power| is | ||
| 742 | * a power of 2. As a 12 bit number, |remainder| is always positive, so we | ||
| 743 | * will shift in 0s for a right shift. | ||
| 744 | */ | ||
| 745 | return lower + (remainder >> (bits - 1)); | ||
| 746 | } | ||
| 747 | |||
| 748 | static void | ||
| 749 | scalar_compress(scalar *s, int bits) | ||
| 750 | { | ||
| 751 | int i; | ||
| 752 | |||
| 753 | for (i = 0; i < DEGREE; i++) { | ||
| 754 | s->c[i] = compress(s->c[i], bits); | ||
| 755 | } | ||
| 756 | } | ||
| 757 | |||
| 758 | static void | ||
| 759 | scalar_decompress(scalar *s, int bits) | ||
| 760 | { | ||
| 761 | int i; | ||
| 762 | |||
| 763 | for (i = 0; i < DEGREE; i++) { | ||
| 764 | s->c[i] = decompress(s->c[i], bits); | ||
| 765 | } | ||
| 766 | } | ||
| 767 | |||
| 768 | static void | ||
| 769 | vector_compress(vector *a, int bits) | ||
| 770 | { | ||
| 771 | int i; | ||
| 772 | |||
| 773 | for (i = 0; i < RANK768; i++) { | ||
| 774 | scalar_compress(&a->v[i], bits); | ||
| 775 | } | ||
| 776 | } | ||
| 777 | |||
| 778 | static void | ||
| 779 | vector_decompress(vector *a, int bits) | ||
| 780 | { | ||
| 781 | int i; | ||
| 782 | |||
| 783 | for (i = 0; i < RANK768; i++) { | ||
| 784 | scalar_decompress(&a->v[i], bits); | ||
| 785 | } | ||
| 786 | } | ||
| 787 | |||
| 788 | struct public_key { | ||
| 789 | vector t; | ||
| 790 | uint8_t rho[32]; | ||
| 791 | uint8_t public_key_hash[32]; | ||
| 792 | matrix m; | ||
| 793 | }; | ||
| 794 | |||
| 795 | static struct public_key * | ||
| 796 | public_key_768_from_external(const struct MLKEM768_public_key *external) | ||
| 797 | { | ||
| 798 | return (struct public_key *)external; | ||
| 799 | } | ||
| 800 | |||
| 801 | struct private_key { | ||
| 802 | struct public_key pub; | ||
| 803 | vector s; | ||
| 804 | uint8_t fo_failure_secret[32]; | ||
| 805 | }; | ||
| 806 | |||
| 807 | static struct private_key * | ||
| 808 | private_key_768_from_external(const struct MLKEM768_private_key *external) | ||
| 809 | { | ||
| 810 | return (struct private_key *)external; | ||
| 811 | } | ||
| 812 | |||
| 813 | /* | ||
| 814 | * Calls |MLKEM768_generate_key_external_entropy| with random bytes from | ||
| 815 | * |RAND_bytes|. | ||
| 816 | */ | ||
| 817 | void | ||
| 818 | MLKEM768_generate_key(uint8_t out_encoded_public_key[MLKEM768_PUBLIC_KEY_BYTES], | ||
| 819 | uint8_t optional_out_seed[MLKEM_SEED_BYTES], | ||
| 820 | struct MLKEM768_private_key *out_private_key) | ||
| 821 | { | ||
| 822 | uint8_t entropy_buf[MLKEM_SEED_BYTES]; | ||
| 823 | uint8_t *entropy = optional_out_seed != NULL ? optional_out_seed : | ||
| 824 | entropy_buf; | ||
| 825 | |||
| 826 | arc4random_buf(entropy, MLKEM_SEED_BYTES); | ||
| 827 | MLKEM768_generate_key_external_entropy(out_encoded_public_key, | ||
| 828 | out_private_key, entropy); | ||
| 829 | } | ||
| 830 | LCRYPTO_ALIAS(MLKEM768_generate_key); | ||
| 831 | |||
| 832 | int | ||
| 833 | MLKEM768_private_key_from_seed(struct MLKEM768_private_key *out_private_key, | ||
| 834 | const uint8_t *seed, size_t seed_len) | ||
| 835 | { | ||
| 836 | uint8_t public_key_bytes[MLKEM768_PUBLIC_KEY_BYTES]; | ||
| 837 | |||
| 838 | if (seed_len != MLKEM_SEED_BYTES) { | ||
| 839 | return 0; | ||
| 840 | } | ||
| 841 | MLKEM768_generate_key_external_entropy(public_key_bytes, | ||
| 842 | out_private_key, seed); | ||
| 843 | |||
| 844 | return 1; | ||
| 845 | } | ||
| 846 | LCRYPTO_ALIAS(MLKEM768_private_key_from_seed); | ||
| 847 | |||
| 848 | static int | ||
| 849 | mlkem_marshal_public_key(CBB *out, const struct public_key *pub) | ||
| 850 | { | ||
| 851 | uint8_t *vector_output; | ||
| 852 | |||
| 853 | if (!CBB_add_space(out, &vector_output, kEncodedVectorSize)) { | ||
| 854 | return 0; | ||
| 855 | } | ||
| 856 | vector_encode(vector_output, &pub->t, kLog2Prime); | ||
| 857 | if (!CBB_add_bytes(out, pub->rho, sizeof(pub->rho))) { | ||
| 858 | return 0; | ||
| 859 | } | ||
| 860 | return 1; | ||
| 861 | } | ||
| 862 | |||
| 863 | void | ||
| 864 | MLKEM768_generate_key_external_entropy( | ||
| 865 | uint8_t out_encoded_public_key[MLKEM768_PUBLIC_KEY_BYTES], | ||
| 866 | struct MLKEM768_private_key *out_private_key, | ||
| 867 | const uint8_t entropy[MLKEM_SEED_BYTES]) | ||
| 868 | { | ||
| 869 | struct private_key *priv = private_key_768_from_external( | ||
| 870 | out_private_key); | ||
| 871 | uint8_t augmented_seed[33]; | ||
| 872 | uint8_t *rho, *sigma; | ||
| 873 | uint8_t counter = 0; | ||
| 874 | uint8_t hashed[64]; | ||
| 875 | vector error; | ||
| 876 | CBB cbb; | ||
| 877 | |||
| 878 | memcpy(augmented_seed, entropy, 32); | ||
| 879 | augmented_seed[32] = RANK768; | ||
| 880 | hash_g(hashed, augmented_seed, 33); | ||
| 881 | rho = hashed; | ||
| 882 | sigma = hashed + 32; | ||
| 883 | memcpy(priv->pub.rho, hashed, sizeof(priv->pub.rho)); | ||
| 884 | matrix_expand(&priv->pub.m, rho); | ||
| 885 | vector_generate_secret_eta_2(&priv->s, &counter, sigma); | ||
| 886 | vector_ntt(&priv->s); | ||
| 887 | vector_generate_secret_eta_2(&error, &counter, sigma); | ||
| 888 | vector_ntt(&error); | ||
| 889 | matrix_mult_transpose(&priv->pub.t, &priv->pub.m, &priv->s); | ||
| 890 | vector_add(&priv->pub.t, &error); | ||
| 891 | |||
| 892 | /* XXX - error checking */ | ||
| 893 | CBB_init_fixed(&cbb, out_encoded_public_key, MLKEM768_PUBLIC_KEY_BYTES); | ||
| 894 | if (!mlkem_marshal_public_key(&cbb, &priv->pub)) { | ||
| 895 | abort(); | ||
| 896 | } | ||
| 897 | CBB_cleanup(&cbb); | ||
| 898 | |||
| 899 | hash_h(priv->pub.public_key_hash, out_encoded_public_key, | ||
| 900 | MLKEM768_PUBLIC_KEY_BYTES); | ||
| 901 | memcpy(priv->fo_failure_secret, entropy + 32, 32); | ||
| 902 | } | ||
| 903 | |||
| 904 | void | ||
| 905 | MLKEM768_public_from_private(struct MLKEM768_public_key *out_public_key, | ||
| 906 | const struct MLKEM768_private_key *private_key) | ||
| 907 | { | ||
| 908 | struct public_key *const pub = public_key_768_from_external( | ||
| 909 | out_public_key); | ||
| 910 | const struct private_key *const priv = private_key_768_from_external( | ||
| 911 | private_key); | ||
| 912 | |||
| 913 | *pub = priv->pub; | ||
| 914 | } | ||
| 915 | LCRYPTO_ALIAS(MLKEM768_public_from_private); | ||
| 916 | |||
| 917 | /* | ||
| 918 | * Encrypts a message with given randomness to the ciphertext in |out|. Without | ||
| 919 | * applying the Fujisaki-Okamoto transform this would not result in a CCA secure | ||
| 920 | * scheme, since lattice schemes are vulnerable to decryption failure oracles. | ||
| 921 | */ | ||
| 922 | static void | ||
| 923 | encrypt_cpa(uint8_t out[MLKEM768_CIPHERTEXT_BYTES], | ||
| 924 | const struct public_key *pub, const uint8_t message[32], | ||
| 925 | const uint8_t randomness[32]) | ||
| 926 | { | ||
| 927 | scalar expanded_message, scalar_error; | ||
| 928 | vector secret, error, u; | ||
| 929 | uint8_t counter = 0; | ||
| 930 | uint8_t input[33]; | ||
| 931 | scalar v; | ||
| 932 | |||
| 933 | vector_generate_secret_eta_2(&secret, &counter, randomness); | ||
| 934 | vector_ntt(&secret); | ||
| 935 | vector_generate_secret_eta_2(&error, &counter, randomness); | ||
| 936 | memcpy(input, randomness, 32); | ||
| 937 | input[32] = counter; | ||
| 938 | scalar_centered_binomial_distribution_eta_2_with_prf(&scalar_error, | ||
| 939 | input); | ||
| 940 | matrix_mult(&u, &pub->m, &secret); | ||
| 941 | vector_inverse_ntt(&u); | ||
| 942 | vector_add(&u, &error); | ||
| 943 | scalar_inner_product(&v, &pub->t, &secret); | ||
| 944 | scalar_inverse_ntt(&v); | ||
| 945 | scalar_add(&v, &scalar_error); | ||
| 946 | scalar_decode_1(&expanded_message, message); | ||
| 947 | scalar_decompress(&expanded_message, 1); | ||
| 948 | scalar_add(&v, &expanded_message); | ||
| 949 | vector_compress(&u, kDU768); | ||
| 950 | vector_encode(out, &u, kDU768); | ||
| 951 | scalar_compress(&v, kDV768); | ||
| 952 | scalar_encode(out + kCompressedVectorSize, &v, kDV768); | ||
| 953 | } | ||
| 954 | |||
| 955 | /* Calls MLKEM768_encap_external_entropy| with random bytes */ | ||
| 956 | void | ||
| 957 | MLKEM768_encap(uint8_t out_ciphertext[MLKEM768_CIPHERTEXT_BYTES], | ||
| 958 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], | ||
| 959 | const struct MLKEM768_public_key *public_key) | ||
| 960 | { | ||
| 961 | uint8_t entropy[MLKEM_ENCAP_ENTROPY]; | ||
| 962 | |||
| 963 | arc4random_buf(entropy, MLKEM_ENCAP_ENTROPY); | ||
| 964 | MLKEM768_encap_external_entropy(out_ciphertext, out_shared_secret, | ||
| 965 | public_key, entropy); | ||
| 966 | } | ||
| 967 | LCRYPTO_ALIAS(MLKEM768_encap); | ||
| 968 | |||
| 969 | /* See section 6.2 of the spec. */ | ||
| 970 | void | ||
| 971 | MLKEM768_encap_external_entropy( | ||
| 972 | uint8_t out_ciphertext[MLKEM768_CIPHERTEXT_BYTES], | ||
| 973 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], | ||
| 974 | const struct MLKEM768_public_key *public_key, | ||
| 975 | const uint8_t entropy[MLKEM_ENCAP_ENTROPY]) | ||
| 976 | { | ||
| 977 | const struct public_key *pub = public_key_768_from_external(public_key); | ||
| 978 | uint8_t key_and_randomness[64]; | ||
| 979 | uint8_t input[64]; | ||
| 980 | |||
| 981 | memcpy(input, entropy, MLKEM_ENCAP_ENTROPY); | ||
| 982 | memcpy(input + MLKEM_ENCAP_ENTROPY, pub->public_key_hash, | ||
| 983 | sizeof(input) - MLKEM_ENCAP_ENTROPY); | ||
| 984 | hash_g(key_and_randomness, input, sizeof(input)); | ||
| 985 | encrypt_cpa(out_ciphertext, pub, entropy, key_and_randomness + 32); | ||
| 986 | memcpy(out_shared_secret, key_and_randomness, 32); | ||
| 987 | } | ||
| 988 | |||
| 989 | static void | ||
| 990 | decrypt_cpa(uint8_t out[32], const struct private_key *priv, | ||
| 991 | const uint8_t ciphertext[MLKEM768_CIPHERTEXT_BYTES]) | ||
| 992 | { | ||
| 993 | scalar mask, v; | ||
| 994 | vector u; | ||
| 995 | |||
| 996 | vector_decode(&u, ciphertext, kDU768); | ||
| 997 | vector_decompress(&u, kDU768); | ||
| 998 | vector_ntt(&u); | ||
| 999 | scalar_decode(&v, ciphertext + kCompressedVectorSize, kDV768); | ||
| 1000 | scalar_decompress(&v, kDV768); | ||
| 1001 | scalar_inner_product(&mask, &priv->s, &u); | ||
| 1002 | scalar_inverse_ntt(&mask); | ||
| 1003 | scalar_sub(&v, &mask); | ||
| 1004 | scalar_compress(&v, 1); | ||
| 1005 | scalar_encode_1(out, &v); | ||
| 1006 | } | ||
| 1007 | |||
| 1008 | /* See section 6.3 */ | ||
| 1009 | int | ||
| 1010 | MLKEM768_decap(uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], | ||
| 1011 | const uint8_t *ciphertext, size_t ciphertext_len, | ||
| 1012 | const struct MLKEM768_private_key *private_key) | ||
| 1013 | { | ||
| 1014 | const struct private_key *priv = private_key_768_from_external( | ||
| 1015 | private_key); | ||
| 1016 | uint8_t expected_ciphertext[MLKEM768_CIPHERTEXT_BYTES]; | ||
| 1017 | uint8_t key_and_randomness[64]; | ||
| 1018 | uint8_t failure_key[32]; | ||
| 1019 | uint8_t decrypted[64]; | ||
| 1020 | uint8_t mask; | ||
| 1021 | int i; | ||
| 1022 | |||
| 1023 | if (ciphertext_len != MLKEM768_CIPHERTEXT_BYTES) { | ||
| 1024 | arc4random_buf(out_shared_secret, MLKEM_SHARED_SECRET_BYTES); | ||
| 1025 | return 0; | ||
| 1026 | } | ||
| 1027 | |||
| 1028 | decrypt_cpa(decrypted, priv, ciphertext); | ||
| 1029 | memcpy(decrypted + 32, priv->pub.public_key_hash, | ||
| 1030 | sizeof(decrypted) - 32); | ||
| 1031 | hash_g(key_and_randomness, decrypted, sizeof(decrypted)); | ||
| 1032 | encrypt_cpa(expected_ciphertext, &priv->pub, decrypted, | ||
| 1033 | key_and_randomness + 32); | ||
| 1034 | kdf(failure_key, priv->fo_failure_secret, ciphertext, ciphertext_len); | ||
| 1035 | mask = constant_time_eq_int_8(memcmp(ciphertext, expected_ciphertext, | ||
| 1036 | sizeof(expected_ciphertext)), 0); | ||
| 1037 | for (i = 0; i < MLKEM_SHARED_SECRET_BYTES; i++) { | ||
| 1038 | out_shared_secret[i] = constant_time_select_8(mask, | ||
| 1039 | key_and_randomness[i], failure_key[i]); | ||
| 1040 | } | ||
| 1041 | |||
| 1042 | return 1; | ||
| 1043 | } | ||
| 1044 | LCRYPTO_ALIAS(MLKEM768_decap); | ||
| 1045 | |||
| 1046 | int | ||
| 1047 | MLKEM768_marshal_public_key(CBB *out, | ||
| 1048 | const struct MLKEM768_public_key *public_key) | ||
| 1049 | { | ||
| 1050 | return mlkem_marshal_public_key(out, | ||
| 1051 | public_key_768_from_external(public_key)); | ||
| 1052 | } | ||
| 1053 | LCRYPTO_ALIAS(MLKEM768_marshal_public_key); | ||
| 1054 | |||
| 1055 | /* | ||
| 1056 | * mlkem_parse_public_key_no_hash parses |in| into |pub| but doesn't calculate | ||
| 1057 | * the value of |pub->public_key_hash|. | ||
| 1058 | */ | ||
| 1059 | static int | ||
| 1060 | mlkem_parse_public_key_no_hash(struct public_key *pub, CBS *in) | ||
| 1061 | { | ||
| 1062 | CBS t_bytes; | ||
| 1063 | |||
| 1064 | if (!CBS_get_bytes(in, &t_bytes, kEncodedVectorSize) || | ||
| 1065 | !vector_decode(&pub->t, CBS_data(&t_bytes), kLog2Prime)) { | ||
| 1066 | return 0; | ||
| 1067 | } | ||
| 1068 | memcpy(pub->rho, CBS_data(in), sizeof(pub->rho)); | ||
| 1069 | if (!CBS_skip(in, sizeof(pub->rho))) | ||
| 1070 | return 0; | ||
| 1071 | matrix_expand(&pub->m, pub->rho); | ||
| 1072 | return 1; | ||
| 1073 | } | ||
| 1074 | |||
| 1075 | int | ||
| 1076 | MLKEM768_parse_public_key(struct MLKEM768_public_key *public_key, CBS *in) | ||
| 1077 | { | ||
| 1078 | struct public_key *pub = public_key_768_from_external(public_key); | ||
| 1079 | CBS orig_in = *in; | ||
| 1080 | |||
| 1081 | if (!mlkem_parse_public_key_no_hash(pub, in) || | ||
| 1082 | CBS_len(in) != 0) { | ||
| 1083 | return 0; | ||
| 1084 | } | ||
| 1085 | hash_h(pub->public_key_hash, CBS_data(&orig_in), CBS_len(&orig_in)); | ||
| 1086 | return 1; | ||
| 1087 | } | ||
| 1088 | LCRYPTO_ALIAS(MLKEM768_parse_public_key); | ||
| 1089 | |||
| 1090 | int | ||
| 1091 | MLKEM768_marshal_private_key(CBB *out, | ||
| 1092 | const struct MLKEM768_private_key *private_key) | ||
| 1093 | { | ||
| 1094 | const struct private_key *const priv = private_key_768_from_external( | ||
| 1095 | private_key); | ||
| 1096 | uint8_t *s_output; | ||
| 1097 | |||
| 1098 | if (!CBB_add_space(out, &s_output, kEncodedVectorSize)) { | ||
| 1099 | return 0; | ||
| 1100 | } | ||
| 1101 | vector_encode(s_output, &priv->s, kLog2Prime); | ||
| 1102 | if (!mlkem_marshal_public_key(out, &priv->pub) || | ||
| 1103 | !CBB_add_bytes(out, priv->pub.public_key_hash, | ||
| 1104 | sizeof(priv->pub.public_key_hash)) || | ||
| 1105 | !CBB_add_bytes(out, priv->fo_failure_secret, | ||
| 1106 | sizeof(priv->fo_failure_secret))) { | ||
| 1107 | return 0; | ||
| 1108 | } | ||
| 1109 | return 1; | ||
| 1110 | } | ||
| 1111 | |||
| 1112 | int | ||
| 1113 | MLKEM768_parse_private_key(struct MLKEM768_private_key *out_private_key, | ||
| 1114 | CBS *in) | ||
| 1115 | { | ||
| 1116 | struct private_key *const priv = private_key_768_from_external( | ||
| 1117 | out_private_key); | ||
| 1118 | CBS s_bytes; | ||
| 1119 | |||
| 1120 | if (!CBS_get_bytes(in, &s_bytes, kEncodedVectorSize) || | ||
| 1121 | !vector_decode(&priv->s, CBS_data(&s_bytes), kLog2Prime) || | ||
| 1122 | !mlkem_parse_public_key_no_hash(&priv->pub, in)) { | ||
| 1123 | return 0; | ||
| 1124 | } | ||
| 1125 | memcpy(priv->pub.public_key_hash, CBS_data(in), | ||
| 1126 | sizeof(priv->pub.public_key_hash)); | ||
| 1127 | if (!CBS_skip(in, sizeof(priv->pub.public_key_hash))) | ||
| 1128 | return 0; | ||
| 1129 | memcpy(priv->fo_failure_secret, CBS_data(in), | ||
| 1130 | sizeof(priv->fo_failure_secret)); | ||
| 1131 | if (!CBS_skip(in, sizeof(priv->fo_failure_secret))) | ||
| 1132 | return 0; | ||
| 1133 | if (CBS_len(in) != 0) | ||
| 1134 | return 0; | ||
| 1135 | |||
| 1136 | return 1; | ||
| 1137 | } | ||
| 1138 | LCRYPTO_ALIAS(MLKEM768_parse_private_key); | ||
diff --git a/src/lib/libcrypto/mlkem/mlkem1024.c b/src/lib/libcrypto/mlkem/mlkem_internal.c index f6fccdf6a8..048b147806 100644 --- a/src/lib/libcrypto/mlkem/mlkem1024.c +++ b/src/lib/libcrypto/mlkem/mlkem_internal.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* $OpenBSD: mlkem1024.c,v 1.6 2025/01/03 08:19:24 tb Exp $ */ | 1 | /* $OpenBSD: mlkem_internal.c,v 1.6 2026/01/18 08:49:42 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024, Google Inc. | 3 | * Copyright (c) 2024, Google Inc. |
| 4 | * Copyright (c) 2024, Bob Beck <beck@obtuse.com> | 4 | * Copyright (c) 2024, 2025 Bob Beck <beck@obtuse.com> |
| 5 | * | 5 | * |
| 6 | * Permission to use, copy, modify, and/or distribute this software for any | 6 | * Permission to use, copy, modify, and/or distribute this software for any |
| 7 | * purpose with or without fee is hereby granted, provided that the above | 7 | * purpose with or without fee is hereby granted, provided that the above |
| @@ -19,19 +19,16 @@ | |||
| 19 | #include <assert.h> | 19 | #include <assert.h> |
| 20 | #include <stdlib.h> | 20 | #include <stdlib.h> |
| 21 | #include <string.h> | 21 | #include <string.h> |
| 22 | #include <stdio.h> | ||
| 22 | 23 | ||
| 23 | #include "bytestring.h" | 24 | #include <openssl/mlkem.h> |
| 24 | #include "mlkem.h" | ||
| 25 | 25 | ||
| 26 | #include "bytestring.h" | ||
| 26 | #include "sha3_internal.h" | 27 | #include "sha3_internal.h" |
| 27 | #include "mlkem_internal.h" | 28 | #include "mlkem_internal.h" |
| 28 | #include "constant_time.h" | 29 | #include "constant_time.h" |
| 29 | #include "crypto_internal.h" | 30 | #include "crypto_internal.h" |
| 30 | 31 | ||
| 31 | /* Remove later */ | ||
| 32 | #undef LCRYPTO_ALIAS | ||
| 33 | #define LCRYPTO_ALIAS(A) | ||
| 34 | |||
| 35 | /* | 32 | /* |
| 36 | * See | 33 | * See |
| 37 | * https://csrc.nist.gov/pubs/fips/203/final | 34 | * https://csrc.nist.gov/pubs/fips/203/final |
| @@ -68,7 +65,7 @@ hash_g(uint8_t out[64], const uint8_t *in, size_t len) | |||
| 68 | 65 | ||
| 69 | /* this is called 'J' in the spec */ | 66 | /* this is called 'J' in the spec */ |
| 70 | static void | 67 | static void |
| 71 | kdf(uint8_t out[MLKEM_SHARED_SECRET_BYTES], const uint8_t failure_secret[32], | 68 | kdf(uint8_t out[MLKEM_SHARED_SECRET_LENGTH], const uint8_t failure_secret[32], |
| 72 | const uint8_t *in, size_t len) | 69 | const uint8_t *in, size_t len) |
| 73 | { | 70 | { |
| 74 | sha3_ctx ctx; | 71 | sha3_ctx ctx; |
| @@ -76,17 +73,18 @@ kdf(uint8_t out[MLKEM_SHARED_SECRET_BYTES], const uint8_t failure_secret[32], | |||
| 76 | shake_update(&ctx, failure_secret, 32); | 73 | shake_update(&ctx, failure_secret, 32); |
| 77 | shake_update(&ctx, in, len); | 74 | shake_update(&ctx, in, len); |
| 78 | shake_xof(&ctx); | 75 | shake_xof(&ctx); |
| 79 | shake_out(&ctx, out, MLKEM_SHARED_SECRET_BYTES); | 76 | shake_out(&ctx, out, MLKEM_SHARED_SECRET_LENGTH); |
| 80 | } | 77 | } |
| 81 | 78 | ||
| 82 | #define DEGREE 256 | 79 | #define DEGREE 256 |
| 83 | #define RANK1024 4 | ||
| 84 | 80 | ||
| 85 | static const size_t kBarrettMultiplier = 5039; | 81 | static const size_t kBarrettMultiplier = 5039; |
| 86 | static const unsigned kBarrettShift = 24; | 82 | static const unsigned kBarrettShift = 24; |
| 87 | static const uint16_t kPrime = 3329; | 83 | static const uint16_t kPrime = 3329; |
| 88 | static const int kLog2Prime = 12; | 84 | static const int kLog2Prime = 12; |
| 89 | static const uint16_t kHalfPrime = (/*kPrime=*/3329 - 1) / 2; | 85 | static const uint16_t kHalfPrime = (/*kPrime=*/3329 - 1) / 2; |
| 86 | static const int kDU768 = 10; | ||
| 87 | static const int kDV768 = 4; | ||
| 90 | static const int kDU1024 = 11; | 88 | static const int kDU1024 = 11; |
| 91 | static const int kDV1024 = 5; | 89 | static const int kDV1024 = 5; |
| 92 | 90 | ||
| @@ -95,23 +93,41 @@ static const int kDV1024 = 5; | |||
| 95 | * root of unity. | 93 | * root of unity. |
| 96 | */ | 94 | */ |
| 97 | static const uint16_t kInverseDegree = 3303; | 95 | static const uint16_t kInverseDegree = 3303; |
| 98 | static const size_t kEncodedVectorSize = | 96 | |
| 99 | (/*kLog2Prime=*/12 * DEGREE / 8) * RANK1024; | 97 | static inline size_t |
| 100 | static const size_t kCompressedVectorSize = /*kDU1024=*/ 11 * RANK1024 * DEGREE / | 98 | encoded_vector_size(uint16_t rank) |
| 101 | 8; | 99 | { |
| 100 | return (kLog2Prime * DEGREE / 8) * rank; | ||
| 101 | } | ||
| 102 | |||
| 103 | static inline size_t | ||
| 104 | compressed_vector_size(uint16_t rank) | ||
| 105 | { | ||
| 106 | return ((rank == MLKEM768_RANK) ? kDU768 : kDU1024) * rank * DEGREE / 8; | ||
| 107 | } | ||
| 102 | 108 | ||
| 103 | typedef struct scalar { | 109 | typedef struct scalar { |
| 104 | /* On every function entry and exit, 0 <= c < kPrime. */ | 110 | /* On every function entry and exit, 0 <= c < kPrime. */ |
| 105 | uint16_t c[DEGREE]; | 111 | uint16_t c[DEGREE]; |
| 106 | } scalar; | 112 | } scalar; |
| 107 | 113 | ||
| 108 | typedef struct vector { | 114 | /* |
| 109 | scalar v[RANK1024]; | 115 | * Retrieve a const scalar from const matrix of |rank| at position [row][col] |
| 110 | } vector; | 116 | */ |
| 117 | static inline const scalar * | ||
| 118 | const_m2s(const scalar *v, size_t row, size_t col, uint16_t rank) | ||
| 119 | { | ||
| 120 | return ((scalar *)v) + row * rank + col; | ||
| 121 | } | ||
| 111 | 122 | ||
| 112 | typedef struct matrix { | 123 | /* |
| 113 | scalar v[RANK1024][RANK1024]; | 124 | * Retrieve a scalar from matrix of |rank| at position [row][col] |
| 114 | } matrix; | 125 | */ |
| 126 | static inline scalar * | ||
| 127 | m2s(scalar *v, size_t row, size_t col, uint16_t rank) | ||
| 128 | { | ||
| 129 | return ((scalar *)v) + row * rank + col; | ||
| 130 | } | ||
| 115 | 131 | ||
| 116 | /* | 132 | /* |
| 117 | * This bit of Python will be referenced in some of the following comments: | 133 | * This bit of Python will be referenced in some of the following comments: |
| @@ -188,10 +204,10 @@ reduce_once(uint16_t x) | |||
| 188 | * is a difference of 2x. | 204 | * is a difference of 2x. |
| 189 | * | 205 | * |
| 190 | * We usually add value barriers to selects because Clang turns | 206 | * We usually add value barriers to selects because Clang turns |
| 191 | * consecutive selects with the same condition into a branch instead of | 207 | * consecutive selects with the same condition into a branch instead of |
| 192 | * CMOV/CSEL. This condition does not occur in ML-KEM, so omitting it | 208 | * CMOV/CSEL. This condition does not occur in ML-KEM, so omitting it |
| 193 | * seems to be safe so far but see | 209 | * seems to be safe so far but see |
| 194 | * |scalar_centered_binomial_distribution_eta_2_with_prf|. | 210 | * |scalar_centered_binomial_distribution_eta_2_with_prf|. |
| 195 | */ | 211 | */ |
| 196 | return (mask & x) | (~mask & subtracted); | 212 | return (mask & x) | (~mask & subtracted); |
| 197 | } | 213 | } |
| @@ -218,9 +234,9 @@ scalar_zero(scalar *out) | |||
| 218 | } | 234 | } |
| 219 | 235 | ||
| 220 | static void | 236 | static void |
| 221 | vector_zero(vector *out) | 237 | vector_zero(scalar *out, size_t rank) |
| 222 | { | 238 | { |
| 223 | memset(out, 0, sizeof(*out)); | 239 | memset(out, 0, sizeof(*out) * rank); |
| 224 | } | 240 | } |
| 225 | 241 | ||
| 226 | /* | 242 | /* |
| @@ -262,12 +278,12 @@ scalar_ntt(scalar *s) | |||
| 262 | } | 278 | } |
| 263 | 279 | ||
| 264 | static void | 280 | static void |
| 265 | vector_ntt(vector *a) | 281 | vector_ntt(scalar *v, size_t rank) |
| 266 | { | 282 | { |
| 267 | int i; | 283 | size_t i; |
| 268 | 284 | ||
| 269 | for (i = 0; i < RANK1024; i++) { | 285 | for (i = 0; i < rank; i++) { |
| 270 | scalar_ntt(&a->v[i]); | 286 | scalar_ntt(&v[i]); |
| 271 | } | 287 | } |
| 272 | } | 288 | } |
| 273 | 289 | ||
| @@ -309,12 +325,12 @@ scalar_inverse_ntt(scalar *s) | |||
| 309 | } | 325 | } |
| 310 | 326 | ||
| 311 | static void | 327 | static void |
| 312 | vector_inverse_ntt(vector *a) | 328 | vector_inverse_ntt(scalar *v, size_t rank) |
| 313 | { | 329 | { |
| 314 | int i; | 330 | size_t i; |
| 315 | 331 | ||
| 316 | for (i = 0; i < RANK1024; i++) { | 332 | for (i = 0; i < rank; i++) { |
| 317 | scalar_inverse_ntt(&a->v[i]); | 333 | scalar_inverse_ntt(&v[i]); |
| 318 | } | 334 | } |
| 319 | } | 335 | } |
| 320 | 336 | ||
| @@ -368,58 +384,58 @@ scalar_mult(scalar *out, const scalar *lhs, const scalar *rhs) | |||
| 368 | } | 384 | } |
| 369 | 385 | ||
| 370 | static void | 386 | static void |
| 371 | vector_add(vector *lhs, const vector *rhs) | 387 | vector_add(scalar *lhs, const scalar *rhs, size_t rank) |
| 372 | { | 388 | { |
| 373 | int i; | 389 | size_t i; |
| 374 | 390 | ||
| 375 | for (i = 0; i < RANK1024; i++) { | 391 | for (i = 0; i < rank; i++) { |
| 376 | scalar_add(&lhs->v[i], &rhs->v[i]); | 392 | scalar_add(&lhs[i], &rhs[i]); |
| 377 | } | 393 | } |
| 378 | } | 394 | } |
| 379 | 395 | ||
| 380 | static void | 396 | static void |
| 381 | matrix_mult(vector *out, const matrix *m, const vector *a) | 397 | matrix_mult(scalar *out, const void *m, const scalar *a, size_t rank) |
| 382 | { | 398 | { |
| 383 | int i, j; | 399 | size_t i, j; |
| 384 | 400 | ||
| 385 | vector_zero(out); | 401 | vector_zero(&out[0], rank); |
| 386 | for (i = 0; i < RANK1024; i++) { | 402 | for (i = 0; i < rank; i++) { |
| 387 | for (j = 0; j < RANK1024; j++) { | 403 | for (j = 0; j < rank; j++) { |
| 388 | scalar product; | 404 | scalar product; |
| 389 | 405 | ||
| 390 | scalar_mult(&product, &m->v[i][j], &a->v[j]); | 406 | scalar_mult(&product, const_m2s(m, i, j, rank), &a[j]); |
| 391 | scalar_add(&out->v[i], &product); | 407 | scalar_add(&out[i], &product); |
| 392 | } | 408 | } |
| 393 | } | 409 | } |
| 394 | } | 410 | } |
| 395 | 411 | ||
| 396 | static void | 412 | static void |
| 397 | matrix_mult_transpose(vector *out, const matrix *m, | 413 | matrix_mult_transpose(scalar *out, const void *m, const scalar *a, size_t rank) |
| 398 | const vector *a) | ||
| 399 | { | 414 | { |
| 400 | int i, j; | 415 | int i, j; |
| 401 | 416 | ||
| 402 | vector_zero(out); | 417 | vector_zero(&out[0], rank); |
| 403 | for (i = 0; i < RANK1024; i++) { | 418 | for (i = 0; i < rank; i++) { |
| 404 | for (j = 0; j < RANK1024; j++) { | 419 | for (j = 0; j < rank; j++) { |
| 405 | scalar product; | 420 | scalar product; |
| 406 | 421 | ||
| 407 | scalar_mult(&product, &m->v[j][i], &a->v[j]); | 422 | scalar_mult(&product, const_m2s(m, j, i, rank), &a[j]); |
| 408 | scalar_add(&out->v[i], &product); | 423 | scalar_add(&out[i], &product); |
| 409 | } | 424 | } |
| 410 | } | 425 | } |
| 411 | } | 426 | } |
| 412 | 427 | ||
| 413 | static void | 428 | static void |
| 414 | scalar_inner_product(scalar *out, const vector *lhs, | 429 | scalar_inner_product(scalar *out, const scalar *lhs, |
| 415 | const vector *rhs) | 430 | const scalar *rhs, size_t rank) |
| 416 | { | 431 | { |
| 417 | int i; | 432 | size_t i; |
| 433 | |||
| 418 | scalar_zero(out); | 434 | scalar_zero(out); |
| 419 | for (i = 0; i < RANK1024; i++) { | 435 | for (i = 0; i < rank; i++) { |
| 420 | scalar product; | 436 | scalar product; |
| 421 | 437 | ||
| 422 | scalar_mult(&product, &lhs->v[i], &rhs->v[i]); | 438 | scalar_mult(&product, &lhs[i], &rhs[i]); |
| 423 | scalar_add(out, &product); | 439 | scalar_add(out, &product); |
| 424 | } | 440 | } |
| 425 | } | 441 | } |
| @@ -502,30 +518,30 @@ scalar_centered_binomial_distribution_eta_2_with_prf(scalar *out, | |||
| 502 | * appending and incrementing |counter| for entry of the vector. | 518 | * appending and incrementing |counter| for entry of the vector. |
| 503 | */ | 519 | */ |
| 504 | static void | 520 | static void |
| 505 | vector_generate_secret_eta_2(vector *out, uint8_t *counter, | 521 | vector_generate_secret_eta_2(scalar *out, uint8_t *counter, |
| 506 | const uint8_t seed[32]) | 522 | const uint8_t seed[32], size_t rank) |
| 507 | { | 523 | { |
| 508 | uint8_t input[33]; | 524 | uint8_t input[33]; |
| 509 | int i; | 525 | size_t i; |
| 510 | 526 | ||
| 511 | memcpy(input, seed, 32); | 527 | memcpy(input, seed, 32); |
| 512 | for (i = 0; i < RANK1024; i++) { | 528 | for (i = 0; i < rank; i++) { |
| 513 | input[32] = (*counter)++; | 529 | input[32] = (*counter)++; |
| 514 | scalar_centered_binomial_distribution_eta_2_with_prf(&out->v[i], | 530 | scalar_centered_binomial_distribution_eta_2_with_prf(&out[i], |
| 515 | input); | 531 | input); |
| 516 | } | 532 | } |
| 517 | } | 533 | } |
| 518 | 534 | ||
| 519 | /* Expands the matrix of a seed for key generation and for encaps-CPA. */ | 535 | /* Expands the matrix of a seed for key generation and for encaps-CPA. */ |
| 520 | static void | 536 | static void |
| 521 | matrix_expand(matrix *out, const uint8_t rho[32]) | 537 | matrix_expand(void *out, const uint8_t rho[32], size_t rank) |
| 522 | { | 538 | { |
| 523 | uint8_t input[34]; | 539 | uint8_t input[34]; |
| 524 | int i, j; | 540 | size_t i, j; |
| 525 | 541 | ||
| 526 | memcpy(input, rho, 32); | 542 | memcpy(input, rho, 32); |
| 527 | for (i = 0; i < RANK1024; i++) { | 543 | for (i = 0; i < rank; i++) { |
| 528 | for (j = 0; j < RANK1024; j++) { | 544 | for (j = 0; j < rank; j++) { |
| 529 | sha3_ctx keccak_ctx; | 545 | sha3_ctx keccak_ctx; |
| 530 | 546 | ||
| 531 | input[32] = i; | 547 | input[32] = i; |
| @@ -533,7 +549,8 @@ matrix_expand(matrix *out, const uint8_t rho[32]) | |||
| 533 | shake128_init(&keccak_ctx); | 549 | shake128_init(&keccak_ctx); |
| 534 | shake_update(&keccak_ctx, input, sizeof(input)); | 550 | shake_update(&keccak_ctx, input, sizeof(input)); |
| 535 | shake_xof(&keccak_ctx); | 551 | shake_xof(&keccak_ctx); |
| 536 | scalar_from_keccak_vartime(&out->v[i][j], &keccak_ctx); | 552 | scalar_from_keccak_vartime(m2s(out, i, j, rank), |
| 553 | &keccak_ctx); | ||
| 537 | } | 554 | } |
| 538 | } | 555 | } |
| 539 | } | 556 | } |
| @@ -598,20 +615,33 @@ scalar_encode_1(uint8_t out[32], const scalar *s) | |||
| 598 | } | 615 | } |
| 599 | 616 | ||
| 600 | /* | 617 | /* |
| 601 | * Encodes an entire vector into 32*|RANK1024|*|bits| bytes. Note that since 256 | 618 | * Encodes an entire vector into 32*|MLKEM768_RANK|*|bits| bytes. Since 256 |
| 602 | * (DEGREE) is divisible by 8, the individual vector entries will always fill a | 619 | * (DEGREE) is divisible by 8, the individual vector entries will always fill a |
| 603 | * whole number of bytes, so we do not need to worry about bit packing here. | 620 | * whole number of bytes, so we do not need to worry about bit packing here. |
| 604 | */ | 621 | */ |
| 605 | static void | 622 | static void |
| 606 | vector_encode(uint8_t *out, const vector *a, int bits) | 623 | vector_encode(uint8_t *out, const scalar *a, int bits, size_t rank) |
| 607 | { | 624 | { |
| 608 | int i; | 625 | int i; |
| 609 | 626 | ||
| 610 | for (i = 0; i < RANK1024; i++) { | 627 | for (i = 0; i < rank; i++) { |
| 611 | scalar_encode(out + i * bits * DEGREE / 8, &a->v[i], bits); | 628 | scalar_encode(out + i * bits * DEGREE / 8, &a[i], bits); |
| 612 | } | 629 | } |
| 613 | } | 630 | } |
| 614 | 631 | ||
| 632 | /* Encodes an entire vector as above, but adding it to a CBB */ | ||
| 633 | static int | ||
| 634 | vector_encode_cbb(CBB *cbb, const scalar *a, int bits, size_t rank) | ||
| 635 | { | ||
| 636 | uint8_t *encoded_vector; | ||
| 637 | |||
| 638 | if (!CBB_add_space(cbb, &encoded_vector, encoded_vector_size(rank))) | ||
| 639 | return 0; | ||
| 640 | vector_encode(encoded_vector, a, bits, rank); | ||
| 641 | |||
| 642 | return 1; | ||
| 643 | } | ||
| 644 | |||
| 615 | /* | 645 | /* |
| 616 | * scalar_decode parses |DEGREE * bits| bits from |in| into |DEGREE| values in | 646 | * scalar_decode parses |DEGREE * bits| bits from |in| into |DEGREE| values in |
| 617 | * |out|. It returns one on success and zero if any parsed value is >= | 647 | * |out|. It returns one on success and zero if any parsed value is >= |
| @@ -677,16 +707,16 @@ scalar_decode_1(scalar *out, const uint8_t in[32]) | |||
| 677 | } | 707 | } |
| 678 | 708 | ||
| 679 | /* | 709 | /* |
| 680 | * Decodes 32*|RANK1024|*|bits| bytes from |in| into |out|. It returns one on | 710 | * Decodes 32*|MLKEM768_RANK|*|bits| bytes from |in| into |out|. It returns one on |
| 681 | * success or zero if any parsed value is >= |kPrime|. | 711 | * success or zero if any parsed value is >= |kPrime|. |
| 682 | */ | 712 | */ |
| 683 | static int | 713 | static int |
| 684 | vector_decode(vector *out, const uint8_t *in, int bits) | 714 | vector_decode(scalar *out, const uint8_t *in, int bits, size_t rank) |
| 685 | { | 715 | { |
| 686 | int i; | 716 | size_t i; |
| 687 | 717 | ||
| 688 | for (i = 0; i < RANK1024; i++) { | 718 | for (i = 0; i < rank; i++) { |
| 689 | if (!scalar_decode(&out->v[i], in + i * bits * DEGREE / 8, | 719 | if (!scalar_decode(&out[i], in + i * bits * DEGREE / 8, |
| 690 | bits)) { | 720 | bits)) { |
| 691 | return 0; | 721 | return 0; |
| 692 | } | 722 | } |
| @@ -767,153 +797,194 @@ scalar_decompress(scalar *s, int bits) | |||
| 767 | } | 797 | } |
| 768 | 798 | ||
| 769 | static void | 799 | static void |
| 770 | vector_compress(vector *a, int bits) | 800 | vector_compress(scalar *v, int bits, size_t rank) |
| 771 | { | 801 | { |
| 772 | int i; | 802 | size_t i; |
| 773 | 803 | ||
| 774 | for (i = 0; i < RANK1024; i++) { | 804 | for (i = 0; i < rank; i++) { |
| 775 | scalar_compress(&a->v[i], bits); | 805 | scalar_compress(&v[i], bits); |
| 776 | } | 806 | } |
| 777 | } | 807 | } |
| 778 | 808 | ||
| 779 | static void | 809 | static void |
| 780 | vector_decompress(vector *a, int bits) | 810 | vector_decompress(scalar *v, int bits, size_t rank) |
| 781 | { | 811 | { |
| 782 | int i; | 812 | int i; |
| 783 | 813 | ||
| 784 | for (i = 0; i < RANK1024; i++) { | 814 | for (i = 0; i < rank; i++) { |
| 785 | scalar_decompress(&a->v[i], bits); | 815 | scalar_decompress(&v[i], bits); |
| 786 | } | 816 | } |
| 787 | } | 817 | } |
| 788 | 818 | ||
| 789 | struct public_key { | 819 | struct public_key { |
| 790 | vector t; | 820 | scalar *t; |
| 791 | uint8_t rho[32]; | 821 | uint8_t *rho; |
| 792 | uint8_t public_key_hash[32]; | 822 | uint8_t *public_key_hash; |
| 793 | matrix m; | 823 | scalar *m; |
| 794 | }; | 824 | }; |
| 795 | 825 | ||
| 796 | static struct public_key * | 826 | static void |
| 797 | public_key_1024_from_external(const struct MLKEM1024_public_key *external) | 827 | public_key_from_external(const MLKEM_public_key *external, |
| 828 | struct public_key *pub) | ||
| 798 | { | 829 | { |
| 799 | return (struct public_key *)external; | 830 | size_t vector_size = external->rank * sizeof(scalar); |
| 831 | uint8_t *bytes = external->key_768->bytes; | ||
| 832 | size_t offset = 0; | ||
| 833 | |||
| 834 | if (external->rank == MLKEM1024_RANK) | ||
| 835 | bytes = external->key_1024->bytes; | ||
| 836 | |||
| 837 | pub->t = (struct scalar *)bytes + offset; | ||
| 838 | offset += vector_size; | ||
| 839 | pub->rho = bytes + offset; | ||
| 840 | offset += 32; | ||
| 841 | pub->public_key_hash = bytes + offset; | ||
| 842 | offset += 32; | ||
| 843 | pub->m = (void *)(bytes + offset); | ||
| 844 | offset += vector_size * external->rank; | ||
| 800 | } | 845 | } |
| 801 | 846 | ||
| 802 | struct private_key { | 847 | struct private_key { |
| 803 | struct public_key pub; | 848 | struct public_key pub; |
| 804 | vector s; | 849 | scalar *s; |
| 805 | uint8_t fo_failure_secret[32]; | 850 | uint8_t *fo_failure_secret; |
| 806 | }; | 851 | }; |
| 807 | 852 | ||
| 808 | static struct private_key * | 853 | static void |
| 809 | private_key_1024_from_external(const struct MLKEM1024_private_key *external) | 854 | private_key_from_external(const MLKEM_private_key *external, |
| 855 | struct private_key *priv) | ||
| 810 | { | 856 | { |
| 811 | return (struct private_key *)external; | 857 | size_t vector_size = external->rank * sizeof(scalar); |
| 858 | size_t offset = 0; | ||
| 859 | uint8_t *bytes = external->key_768->bytes; | ||
| 860 | |||
| 861 | if (external->rank == MLKEM1024_RANK) | ||
| 862 | bytes = external->key_1024->bytes; | ||
| 863 | |||
| 864 | priv->pub.t = (struct scalar *)(bytes + offset); | ||
| 865 | offset += vector_size; | ||
| 866 | priv->pub.rho = bytes + offset; | ||
| 867 | offset += 32; | ||
| 868 | priv->pub.public_key_hash = bytes + offset; | ||
| 869 | offset += 32; | ||
| 870 | priv->pub.m = (void *)(bytes + offset); | ||
| 871 | offset += vector_size * external->rank; | ||
| 872 | priv->s = (void *)(bytes + offset); | ||
| 873 | offset += vector_size; | ||
| 874 | priv->fo_failure_secret = bytes + offset; | ||
| 875 | offset += 32; | ||
| 812 | } | 876 | } |
| 813 | 877 | ||
| 814 | /* | ||
| 815 | * Calls |MLKEM1024_generate_key_external_entropy| with random bytes from | ||
| 816 | * |RAND_bytes|. | ||
| 817 | */ | ||
| 818 | void | ||
| 819 | MLKEM1024_generate_key(uint8_t out_encoded_public_key[MLKEM1024_PUBLIC_KEY_BYTES], | ||
| 820 | uint8_t optional_out_seed[MLKEM_SEED_BYTES], | ||
| 821 | struct MLKEM1024_private_key *out_private_key) | ||
| 822 | { | ||
| 823 | uint8_t entropy_buf[MLKEM_SEED_BYTES]; | ||
| 824 | uint8_t *entropy = optional_out_seed != NULL ? optional_out_seed : | ||
| 825 | entropy_buf; | ||
| 826 | |||
| 827 | arc4random_buf(entropy, MLKEM_SEED_BYTES); | ||
| 828 | MLKEM1024_generate_key_external_entropy(out_encoded_public_key, | ||
| 829 | out_private_key, entropy); | ||
| 830 | } | ||
| 831 | LCRYPTO_ALIAS(MLKEM1024_generate_key); | ||
| 832 | |||
| 833 | int | 878 | int |
| 834 | MLKEM1024_private_key_from_seed(struct MLKEM1024_private_key *out_private_key, | 879 | mlkem_private_key_from_seed(const uint8_t *seed, size_t seed_len, |
| 835 | const uint8_t *seed, size_t seed_len) | 880 | MLKEM_private_key *out_private_key) |
| 836 | { | 881 | { |
| 837 | uint8_t public_key_bytes[MLKEM1024_PUBLIC_KEY_BYTES]; | 882 | uint8_t *public_key_buf = NULL; |
| 883 | size_t public_key_buf_len = out_private_key->rank == MLKEM768_RANK ? | ||
| 884 | MLKEM768_PUBLIC_KEY_BYTES : MLKEM1024_PUBLIC_KEY_BYTES; | ||
| 885 | int ret = 0; | ||
| 838 | 886 | ||
| 839 | if (seed_len != MLKEM_SEED_BYTES) { | 887 | if (seed_len != MLKEM_SEED_LENGTH) { |
| 840 | return 0; | 888 | goto err; |
| 841 | } | 889 | } |
| 842 | MLKEM1024_generate_key_external_entropy(public_key_bytes, | 890 | |
| 891 | if ((public_key_buf = calloc(1, public_key_buf_len)) == NULL) | ||
| 892 | goto err; | ||
| 893 | |||
| 894 | ret = mlkem_generate_key_external_entropy(public_key_buf, | ||
| 843 | out_private_key, seed); | 895 | out_private_key, seed); |
| 844 | 896 | ||
| 845 | return 1; | 897 | err: |
| 898 | freezero(public_key_buf, public_key_buf_len); | ||
| 899 | |||
| 900 | return ret; | ||
| 846 | } | 901 | } |
| 847 | LCRYPTO_ALIAS(MLKEM1024_private_key_from_seed); | ||
| 848 | 902 | ||
| 849 | static int | 903 | static int |
| 850 | mlkem_marshal_public_key(CBB *out, const struct public_key *pub) | 904 | mlkem_marshal_public_key_internal(CBB *out, const struct public_key *pub, |
| 905 | size_t rank) | ||
| 851 | { | 906 | { |
| 852 | uint8_t *vector_output; | 907 | if (!vector_encode_cbb(out, &pub->t[0], kLog2Prime, rank)) |
| 853 | |||
| 854 | if (!CBB_add_space(out, &vector_output, kEncodedVectorSize)) { | ||
| 855 | return 0; | 908 | return 0; |
| 856 | } | 909 | return CBB_add_bytes(out, pub->rho, 32); |
| 857 | vector_encode(vector_output, &pub->t, kLog2Prime); | ||
| 858 | if (!CBB_add_bytes(out, pub->rho, sizeof(pub->rho))) { | ||
| 859 | return 0; | ||
| 860 | } | ||
| 861 | return 1; | ||
| 862 | } | 910 | } |
| 863 | 911 | ||
| 864 | void | 912 | int |
| 865 | MLKEM1024_generate_key_external_entropy( | 913 | mlkem_generate_key_external_entropy(uint8_t *out_encoded_public_key, |
| 866 | uint8_t out_encoded_public_key[MLKEM1024_PUBLIC_KEY_BYTES], | 914 | MLKEM_private_key *out_private_key, |
| 867 | struct MLKEM1024_private_key *out_private_key, | 915 | const uint8_t entropy[MLKEM_SEED_LENGTH]) |
| 868 | const uint8_t entropy[MLKEM_SEED_BYTES]) | ||
| 869 | { | 916 | { |
| 870 | struct private_key *priv = private_key_1024_from_external( | 917 | struct private_key priv; |
| 871 | out_private_key); | ||
| 872 | uint8_t augmented_seed[33]; | 918 | uint8_t augmented_seed[33]; |
| 873 | uint8_t *rho, *sigma; | 919 | uint8_t *rho, *sigma; |
| 874 | uint8_t counter = 0; | 920 | uint8_t counter = 0; |
| 875 | uint8_t hashed[64]; | 921 | uint8_t hashed[64]; |
| 876 | vector error; | 922 | scalar error[MLKEM1024_RANK]; |
| 877 | CBB cbb; | 923 | CBB cbb; |
| 924 | int ret = 0; | ||
| 878 | 925 | ||
| 926 | private_key_from_external(out_private_key, &priv); | ||
| 927 | memset(&cbb, 0, sizeof(cbb)); | ||
| 879 | memcpy(augmented_seed, entropy, 32); | 928 | memcpy(augmented_seed, entropy, 32); |
| 880 | augmented_seed[32] = RANK1024; | 929 | augmented_seed[32] = out_private_key->rank; |
| 881 | hash_g(hashed, augmented_seed, 33); | 930 | hash_g(hashed, augmented_seed, 33); |
| 882 | rho = hashed; | 931 | rho = hashed; |
| 883 | sigma = hashed + 32; | 932 | sigma = hashed + 32; |
| 884 | memcpy(priv->pub.rho, hashed, sizeof(priv->pub.rho)); | 933 | memcpy(priv.pub.rho, hashed, 32); |
| 885 | matrix_expand(&priv->pub.m, rho); | 934 | matrix_expand(priv.pub.m, rho, out_private_key->rank); |
| 886 | vector_generate_secret_eta_2(&priv->s, &counter, sigma); | 935 | vector_generate_secret_eta_2(priv.s, &counter, sigma, |
| 887 | vector_ntt(&priv->s); | 936 | out_private_key->rank); |
| 888 | vector_generate_secret_eta_2(&error, &counter, sigma); | 937 | vector_ntt(priv.s, out_private_key->rank); |
| 889 | vector_ntt(&error); | 938 | vector_generate_secret_eta_2(&error[0], &counter, sigma, |
| 890 | matrix_mult_transpose(&priv->pub.t, &priv->pub.m, &priv->s); | 939 | out_private_key->rank); |
| 891 | vector_add(&priv->pub.t, &error); | 940 | vector_ntt(&error[0], out_private_key->rank); |
| 892 | 941 | matrix_mult_transpose(priv.pub.t, priv.pub.m, priv.s, | |
| 893 | /* XXX - error checking. */ | 942 | out_private_key->rank); |
| 894 | CBB_init_fixed(&cbb, out_encoded_public_key, MLKEM1024_PUBLIC_KEY_BYTES); | 943 | vector_add(priv.pub.t, &error[0], out_private_key->rank); |
| 895 | if (!mlkem_marshal_public_key(&cbb, &priv->pub)) { | 944 | |
| 896 | abort(); | 945 | if (!CBB_init_fixed(&cbb, out_encoded_public_key, |
| 897 | } | 946 | out_private_key->rank == MLKEM768_RANK ? MLKEM768_PUBLIC_KEY_BYTES : |
| 947 | MLKEM1024_PUBLIC_KEY_BYTES)) | ||
| 948 | goto err; | ||
| 949 | |||
| 950 | if (!mlkem_marshal_public_key_internal(&cbb, &priv.pub, | ||
| 951 | out_private_key->rank)) | ||
| 952 | goto err; | ||
| 953 | |||
| 954 | hash_h(priv.pub.public_key_hash, out_encoded_public_key, | ||
| 955 | out_private_key->rank == MLKEM768_RANK ? MLKEM768_PUBLIC_KEY_BYTES : | ||
| 956 | MLKEM1024_PUBLIC_KEY_BYTES); | ||
| 957 | memcpy(priv.fo_failure_secret, entropy + 32, 32); | ||
| 958 | |||
| 959 | ret = 1; | ||
| 960 | |||
| 961 | err: | ||
| 898 | CBB_cleanup(&cbb); | 962 | CBB_cleanup(&cbb); |
| 963 | explicit_bzero(&priv, sizeof(priv)); | ||
| 964 | explicit_bzero(augmented_seed, sizeof(augmented_seed)); | ||
| 965 | explicit_bzero(error, sizeof(error)); | ||
| 966 | explicit_bzero(hashed, sizeof(hashed)); | ||
| 899 | 967 | ||
| 900 | hash_h(priv->pub.public_key_hash, out_encoded_public_key, | 968 | return ret; |
| 901 | MLKEM1024_PUBLIC_KEY_BYTES); | ||
| 902 | memcpy(priv->fo_failure_secret, entropy + 32, 32); | ||
| 903 | } | 969 | } |
| 904 | 970 | ||
| 905 | void | 971 | void |
| 906 | MLKEM1024_public_from_private(struct MLKEM1024_public_key *out_public_key, | 972 | mlkem_public_from_private(const MLKEM_private_key *private_key, |
| 907 | const struct MLKEM1024_private_key *private_key) | 973 | MLKEM_public_key *out_public_key) |
| 908 | { | 974 | { |
| 909 | struct public_key *const pub = public_key_1024_from_external( | 975 | switch (private_key->rank) { |
| 910 | out_public_key); | 976 | case MLKEM768_RANK: |
| 911 | const struct private_key *const priv = private_key_1024_from_external( | 977 | memcpy(out_public_key->key_768->bytes, |
| 912 | private_key); | 978 | private_key->key_768->bytes, |
| 913 | 979 | sizeof(out_public_key->key_768->bytes)); | |
| 914 | *pub = priv->pub; | 980 | break; |
| 981 | case MLKEM1024_RANK: | ||
| 982 | memcpy(out_public_key->key_1024->bytes, | ||
| 983 | private_key->key_1024->bytes, | ||
| 984 | sizeof(out_public_key->key_1024->bytes)); | ||
| 985 | break; | ||
| 986 | } | ||
| 915 | } | 987 | } |
| 916 | LCRYPTO_ALIAS(MLKEM1024_public_from_private); | ||
| 917 | 988 | ||
| 918 | /* | 989 | /* |
| 919 | * Encrypts a message with given randomness to the ciphertext in |out|. Without | 990 | * Encrypts a message with given randomness to the ciphertext in |out|. Without |
| @@ -921,219 +992,287 @@ LCRYPTO_ALIAS(MLKEM1024_public_from_private); | |||
| 921 | * scheme, since lattice schemes are vulnerable to decryption failure oracles. | 992 | * scheme, since lattice schemes are vulnerable to decryption failure oracles. |
| 922 | */ | 993 | */ |
| 923 | static void | 994 | static void |
| 924 | encrypt_cpa(uint8_t out[MLKEM1024_CIPHERTEXT_BYTES], | 995 | encrypt_cpa(uint8_t *out, const struct public_key *pub, |
| 925 | const struct public_key *pub, const uint8_t message[32], | 996 | const uint8_t message[32], const uint8_t randomness[32], |
| 926 | const uint8_t randomness[32]) | 997 | size_t rank) |
| 927 | { | 998 | { |
| 999 | scalar secret[MLKEM1024_RANK], error[MLKEM1024_RANK], u[MLKEM1024_RANK]; | ||
| 928 | scalar expanded_message, scalar_error; | 1000 | scalar expanded_message, scalar_error; |
| 929 | vector secret, error, u; | ||
| 930 | uint8_t counter = 0; | 1001 | uint8_t counter = 0; |
| 931 | uint8_t input[33]; | 1002 | uint8_t input[33]; |
| 932 | scalar v; | 1003 | scalar v; |
| 1004 | int u_bits = kDU768; | ||
| 1005 | int v_bits = kDV768; | ||
| 933 | 1006 | ||
| 934 | vector_generate_secret_eta_2(&secret, &counter, randomness); | 1007 | if (rank == MLKEM1024_RANK) { |
| 935 | vector_ntt(&secret); | 1008 | u_bits = kDU1024; |
| 936 | vector_generate_secret_eta_2(&error, &counter, randomness); | 1009 | v_bits = kDV1024; |
| 1010 | } | ||
| 1011 | vector_generate_secret_eta_2(&secret[0], &counter, randomness, rank); | ||
| 1012 | vector_ntt(&secret[0], rank); | ||
| 1013 | vector_generate_secret_eta_2(&error[0], &counter, randomness, rank); | ||
| 937 | memcpy(input, randomness, 32); | 1014 | memcpy(input, randomness, 32); |
| 938 | input[32] = counter; | 1015 | input[32] = counter; |
| 939 | scalar_centered_binomial_distribution_eta_2_with_prf(&scalar_error, | 1016 | scalar_centered_binomial_distribution_eta_2_with_prf(&scalar_error, |
| 940 | input); | 1017 | input); |
| 941 | matrix_mult(&u, &pub->m, &secret); | 1018 | matrix_mult(&u[0], pub->m, &secret[0], rank); |
| 942 | vector_inverse_ntt(&u); | 1019 | vector_inverse_ntt(&u[0], rank); |
| 943 | vector_add(&u, &error); | 1020 | vector_add(&u[0], &error[0], rank); |
| 944 | scalar_inner_product(&v, &pub->t, &secret); | 1021 | scalar_inner_product(&v, &pub->t[0], &secret[0], rank); |
| 945 | scalar_inverse_ntt(&v); | 1022 | scalar_inverse_ntt(&v); |
| 946 | scalar_add(&v, &scalar_error); | 1023 | scalar_add(&v, &scalar_error); |
| 947 | scalar_decode_1(&expanded_message, message); | 1024 | scalar_decode_1(&expanded_message, message); |
| 948 | scalar_decompress(&expanded_message, 1); | 1025 | scalar_decompress(&expanded_message, 1); |
| 949 | scalar_add(&v, &expanded_message); | 1026 | scalar_add(&v, &expanded_message); |
| 950 | vector_compress(&u, kDU1024); | 1027 | vector_compress(&u[0], u_bits, rank); |
| 951 | vector_encode(out, &u, kDU1024); | 1028 | vector_encode(out, &u[0], u_bits, rank); |
| 952 | scalar_compress(&v, kDV1024); | 1029 | scalar_compress(&v, v_bits); |
| 953 | scalar_encode(out + kCompressedVectorSize, &v, kDV1024); | 1030 | scalar_encode(out + compressed_vector_size(rank), &v, v_bits); |
| 1031 | |||
| 1032 | explicit_bzero(secret, sizeof(secret)); | ||
| 1033 | explicit_bzero(error, sizeof(error)); | ||
| 1034 | explicit_bzero(u, sizeof(u)); | ||
| 1035 | explicit_bzero(input, sizeof(input)); | ||
| 954 | } | 1036 | } |
| 955 | 1037 | ||
| 956 | /* Calls MLKEM1024_encap_external_entropy| with random bytes */ | ||
| 957 | void | ||
| 958 | MLKEM1024_encap(uint8_t out_ciphertext[MLKEM1024_CIPHERTEXT_BYTES], | ||
| 959 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], | ||
| 960 | const struct MLKEM1024_public_key *public_key) | ||
| 961 | { | ||
| 962 | uint8_t entropy[MLKEM_ENCAP_ENTROPY]; | ||
| 963 | |||
| 964 | arc4random_buf(entropy, MLKEM_ENCAP_ENTROPY); | ||
| 965 | MLKEM1024_encap_external_entropy(out_ciphertext, out_shared_secret, | ||
| 966 | public_key, entropy); | ||
| 967 | } | ||
| 968 | LCRYPTO_ALIAS(MLKEM1024_encap); | ||
| 969 | |||
| 970 | /* See section 6.2 of the spec. */ | 1038 | /* See section 6.2 of the spec. */ |
| 971 | void | 1039 | void |
| 972 | MLKEM1024_encap_external_entropy( | 1040 | mlkem_encap_external_entropy(uint8_t *out_ciphertext, |
| 973 | uint8_t out_ciphertext[MLKEM1024_CIPHERTEXT_BYTES], | 1041 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_LENGTH], |
| 974 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], | 1042 | const MLKEM_public_key *public_key, |
| 975 | const struct MLKEM1024_public_key *public_key, | ||
| 976 | const uint8_t entropy[MLKEM_ENCAP_ENTROPY]) | 1043 | const uint8_t entropy[MLKEM_ENCAP_ENTROPY]) |
| 977 | { | 1044 | { |
| 978 | const struct public_key *pub = public_key_1024_from_external(public_key); | 1045 | struct public_key pub; |
| 979 | uint8_t key_and_randomness[64]; | 1046 | uint8_t key_and_randomness[64]; |
| 980 | uint8_t input[64]; | 1047 | uint8_t input[64]; |
| 981 | 1048 | ||
| 1049 | public_key_from_external(public_key, &pub); | ||
| 982 | memcpy(input, entropy, MLKEM_ENCAP_ENTROPY); | 1050 | memcpy(input, entropy, MLKEM_ENCAP_ENTROPY); |
| 983 | memcpy(input + MLKEM_ENCAP_ENTROPY, pub->public_key_hash, | 1051 | memcpy(input + MLKEM_ENCAP_ENTROPY, pub.public_key_hash, |
| 984 | sizeof(input) - MLKEM_ENCAP_ENTROPY); | 1052 | sizeof(input) - MLKEM_ENCAP_ENTROPY); |
| 985 | hash_g(key_and_randomness, input, sizeof(input)); | 1053 | hash_g(key_and_randomness, input, sizeof(input)); |
| 986 | encrypt_cpa(out_ciphertext, pub, entropy, key_and_randomness + 32); | 1054 | encrypt_cpa(out_ciphertext, &pub, entropy, key_and_randomness + 32, |
| 1055 | public_key->rank); | ||
| 987 | memcpy(out_shared_secret, key_and_randomness, 32); | 1056 | memcpy(out_shared_secret, key_and_randomness, 32); |
| 1057 | |||
| 1058 | explicit_bzero(key_and_randomness, sizeof(key_and_randomness)); | ||
| 1059 | explicit_bzero(input, sizeof(input)); | ||
| 988 | } | 1060 | } |
| 989 | 1061 | ||
| 990 | static void | 1062 | static void |
| 991 | decrypt_cpa(uint8_t out[32], const struct private_key *priv, | 1063 | decrypt_cpa(uint8_t out[32], const struct private_key *priv, |
| 992 | const uint8_t ciphertext[MLKEM1024_CIPHERTEXT_BYTES]) | 1064 | const uint8_t *ciphertext, size_t rank) |
| 993 | { | 1065 | { |
| 1066 | scalar u[MLKEM1024_RANK]; | ||
| 994 | scalar mask, v; | 1067 | scalar mask, v; |
| 995 | vector u; | 1068 | int u_bits = kDU768; |
| 996 | 1069 | int v_bits = kDV768; | |
| 997 | vector_decode(&u, ciphertext, kDU1024); | 1070 | |
| 998 | vector_decompress(&u, kDU1024); | 1071 | if (rank == MLKEM1024_RANK) { |
| 999 | vector_ntt(&u); | 1072 | u_bits = kDU1024; |
| 1000 | scalar_decode(&v, ciphertext + kCompressedVectorSize, kDV1024); | 1073 | v_bits = kDV1024; |
| 1001 | scalar_decompress(&v, kDV1024); | 1074 | } |
| 1002 | scalar_inner_product(&mask, &priv->s, &u); | 1075 | vector_decode(&u[0], ciphertext, u_bits, rank); |
| 1076 | vector_decompress(&u[0], u_bits, rank); | ||
| 1077 | vector_ntt(&u[0], rank); | ||
| 1078 | scalar_decode(&v, ciphertext + compressed_vector_size(rank), v_bits); | ||
| 1079 | scalar_decompress(&v, v_bits); | ||
| 1080 | scalar_inner_product(&mask, &priv->s[0], &u[0], rank); | ||
| 1003 | scalar_inverse_ntt(&mask); | 1081 | scalar_inverse_ntt(&mask); |
| 1004 | scalar_sub(&v, &mask); | 1082 | scalar_sub(&v, &mask); |
| 1005 | scalar_compress(&v, 1); | 1083 | scalar_compress(&v, 1); |
| 1006 | scalar_encode_1(out, &v); | 1084 | scalar_encode_1(out, &v); |
| 1085 | |||
| 1086 | explicit_bzero(u, sizeof(u)); | ||
| 1007 | } | 1087 | } |
| 1008 | 1088 | ||
| 1009 | /* See section 6.3 */ | 1089 | /* See section 6.3 */ |
| 1010 | int | 1090 | int |
| 1011 | MLKEM1024_decap(uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], | 1091 | mlkem_decap(const MLKEM_private_key *private_key, const uint8_t *ciphertext, |
| 1012 | const uint8_t *ciphertext, size_t ciphertext_len, | 1092 | size_t ciphertext_len, uint8_t out_shared_secret[MLKEM_SHARED_SECRET_LENGTH]) |
| 1013 | const struct MLKEM1024_private_key *private_key) | ||
| 1014 | { | 1093 | { |
| 1015 | const struct private_key *priv = private_key_1024_from_external( | 1094 | struct private_key priv; |
| 1016 | private_key); | 1095 | size_t expected_ciphertext_length = private_key->rank == MLKEM768_RANK ? |
| 1017 | uint8_t expected_ciphertext[MLKEM1024_CIPHERTEXT_BYTES]; | 1096 | MLKEM768_CIPHERTEXT_BYTES : MLKEM1024_CIPHERTEXT_BYTES; |
| 1097 | uint8_t *expected_ciphertext = NULL; | ||
| 1018 | uint8_t key_and_randomness[64]; | 1098 | uint8_t key_and_randomness[64]; |
| 1019 | uint8_t failure_key[32]; | 1099 | uint8_t failure_key[32]; |
| 1020 | uint8_t decrypted[64]; | 1100 | uint8_t decrypted[64]; |
| 1021 | uint8_t mask; | 1101 | uint8_t mask; |
| 1022 | int i; | 1102 | int i; |
| 1103 | int ret = 0; | ||
| 1023 | 1104 | ||
| 1024 | if (ciphertext_len != MLKEM1024_CIPHERTEXT_BYTES) { | 1105 | if (ciphertext_len != expected_ciphertext_length) { |
| 1025 | arc4random_buf(out_shared_secret, MLKEM_SHARED_SECRET_BYTES); | 1106 | arc4random_buf(out_shared_secret, MLKEM_SHARED_SECRET_LENGTH); |
| 1026 | return 0; | 1107 | goto err; |
| 1027 | } | 1108 | } |
| 1028 | 1109 | ||
| 1029 | decrypt_cpa(decrypted, priv, ciphertext); | 1110 | if ((expected_ciphertext = calloc(1, expected_ciphertext_length)) == |
| 1030 | memcpy(decrypted + 32, priv->pub.public_key_hash, | 1111 | NULL) { |
| 1112 | arc4random_buf(out_shared_secret, MLKEM_SHARED_SECRET_LENGTH); | ||
| 1113 | goto err; | ||
| 1114 | } | ||
| 1115 | |||
| 1116 | private_key_from_external(private_key, &priv); | ||
| 1117 | decrypt_cpa(decrypted, &priv, ciphertext, private_key->rank); | ||
| 1118 | memcpy(decrypted + 32, priv.pub.public_key_hash, | ||
| 1031 | sizeof(decrypted) - 32); | 1119 | sizeof(decrypted) - 32); |
| 1032 | hash_g(key_and_randomness, decrypted, sizeof(decrypted)); | 1120 | hash_g(key_and_randomness, decrypted, sizeof(decrypted)); |
| 1033 | encrypt_cpa(expected_ciphertext, &priv->pub, decrypted, | 1121 | encrypt_cpa(expected_ciphertext, &priv.pub, decrypted, |
| 1034 | key_and_randomness + 32); | 1122 | key_and_randomness + 32, private_key->rank); |
| 1035 | kdf(failure_key, priv->fo_failure_secret, ciphertext, ciphertext_len); | 1123 | kdf(failure_key, priv.fo_failure_secret, ciphertext, ciphertext_len); |
| 1036 | mask = constant_time_eq_int_8(memcmp(ciphertext, expected_ciphertext, | 1124 | mask = constant_time_eq_int_8(memcmp(ciphertext, expected_ciphertext, |
| 1037 | sizeof(expected_ciphertext)), 0); | 1125 | expected_ciphertext_length), 0); |
| 1038 | for (i = 0; i < MLKEM_SHARED_SECRET_BYTES; i++) { | 1126 | for (i = 0; i < MLKEM_SHARED_SECRET_LENGTH; i++) { |
| 1039 | out_shared_secret[i] = constant_time_select_8(mask, | 1127 | out_shared_secret[i] = constant_time_select_8(mask, |
| 1040 | key_and_randomness[i], failure_key[i]); | 1128 | key_and_randomness[i], failure_key[i]); |
| 1041 | } | 1129 | } |
| 1042 | 1130 | ||
| 1043 | return 1; | 1131 | ret = 1; |
| 1132 | |||
| 1133 | err: | ||
| 1134 | freezero(expected_ciphertext, expected_ciphertext_length); | ||
| 1135 | explicit_bzero(key_and_randomness, sizeof(key_and_randomness)); | ||
| 1136 | explicit_bzero(decrypted, sizeof(decrypted)); | ||
| 1137 | |||
| 1138 | return ret; | ||
| 1044 | } | 1139 | } |
| 1045 | LCRYPTO_ALIAS(MLKEM1024_decap); | ||
| 1046 | 1140 | ||
| 1047 | int | 1141 | int |
| 1048 | MLKEM1024_marshal_public_key(CBB *out, | 1142 | mlkem_marshal_public_key(const MLKEM_public_key *public_key, |
| 1049 | const struct MLKEM1024_public_key *public_key) | 1143 | uint8_t **output, size_t *output_len) |
| 1050 | { | 1144 | { |
| 1051 | return mlkem_marshal_public_key(out, | 1145 | struct public_key pub; |
| 1052 | public_key_1024_from_external(public_key)); | 1146 | int ret = 0; |
| 1147 | CBB cbb; | ||
| 1148 | |||
| 1149 | if (!CBB_init(&cbb, public_key->rank == MLKEM768_RANK ? | ||
| 1150 | MLKEM768_PUBLIC_KEY_BYTES : MLKEM1024_PUBLIC_KEY_BYTES)) | ||
| 1151 | goto err; | ||
| 1152 | public_key_from_external(public_key, &pub); | ||
| 1153 | if (!mlkem_marshal_public_key_internal(&cbb, &pub, public_key->rank)) | ||
| 1154 | goto err; | ||
| 1155 | if (!CBB_finish(&cbb, output, output_len)) | ||
| 1156 | goto err; | ||
| 1157 | |||
| 1158 | ret = 1; | ||
| 1159 | |||
| 1160 | err: | ||
| 1161 | CBB_cleanup(&cbb); | ||
| 1162 | |||
| 1163 | return ret; | ||
| 1053 | } | 1164 | } |
| 1054 | LCRYPTO_ALIAS(MLKEM1024_marshal_public_key); | ||
| 1055 | 1165 | ||
| 1056 | /* | 1166 | /* |
| 1057 | * mlkem_parse_public_key_no_hash parses |in| into |pub| but doesn't calculate | 1167 | * mlkem_parse_public_key_no_hash parses |in| into |pub| but doesn't calculate |
| 1058 | * the value of |pub->public_key_hash|. | 1168 | * the value of |pub->public_key_hash|. |
| 1059 | */ | 1169 | */ |
| 1060 | static int | 1170 | static int |
| 1061 | mlkem_parse_public_key_no_hash(struct public_key *pub, CBS *in) | 1171 | mlkem_parse_public_key_no_hash(struct public_key *pub, CBS *in, size_t rank) |
| 1062 | { | 1172 | { |
| 1063 | CBS t_bytes; | 1173 | CBS t_bytes; |
| 1064 | 1174 | ||
| 1065 | if (!CBS_get_bytes(in, &t_bytes, kEncodedVectorSize) || | 1175 | if (!CBS_get_bytes(in, &t_bytes, encoded_vector_size(rank))) |
| 1066 | !vector_decode(&pub->t, CBS_data(&t_bytes), kLog2Prime)) { | ||
| 1067 | return 0; | 1176 | return 0; |
| 1068 | } | 1177 | if (!vector_decode(&pub->t[0], CBS_data(&t_bytes), kLog2Prime, rank)) |
| 1069 | memcpy(pub->rho, CBS_data(in), sizeof(pub->rho)); | ||
| 1070 | if (!CBS_skip(in, sizeof(pub->rho))) | ||
| 1071 | return 0; | 1178 | return 0; |
| 1072 | matrix_expand(&pub->m, pub->rho); | ||
| 1073 | return 1; | ||
| 1074 | } | ||
| 1075 | 1179 | ||
| 1076 | int | 1180 | memcpy(pub->rho, CBS_data(in), 32); |
| 1077 | MLKEM1024_parse_public_key(struct MLKEM1024_public_key *public_key, CBS *in) | 1181 | if (!CBS_skip(in, 32)) |
| 1078 | { | ||
| 1079 | struct public_key *pub = public_key_1024_from_external(public_key); | ||
| 1080 | CBS orig_in = *in; | ||
| 1081 | |||
| 1082 | if (!mlkem_parse_public_key_no_hash(pub, in) || | ||
| 1083 | CBS_len(in) != 0) { | ||
| 1084 | return 0; | 1182 | return 0; |
| 1085 | } | 1183 | matrix_expand(pub->m, pub->rho, rank); |
| 1086 | hash_h(pub->public_key_hash, CBS_data(&orig_in), CBS_len(&orig_in)); | ||
| 1087 | return 1; | 1184 | return 1; |
| 1088 | } | 1185 | } |
| 1089 | LCRYPTO_ALIAS(MLKEM1024_parse_public_key); | ||
| 1090 | 1186 | ||
| 1091 | int | 1187 | int |
| 1092 | MLKEM1024_marshal_private_key(CBB *out, | 1188 | mlkem_parse_public_key(const uint8_t *input, size_t input_len, |
| 1093 | const struct MLKEM1024_private_key *private_key) | 1189 | MLKEM_public_key *public_key) |
| 1094 | { | 1190 | { |
| 1095 | const struct private_key *const priv = private_key_1024_from_external( | 1191 | struct public_key pub; |
| 1096 | private_key); | 1192 | CBS cbs; |
| 1097 | uint8_t *s_output; | ||
| 1098 | 1193 | ||
| 1099 | if (!CBB_add_space(out, &s_output, kEncodedVectorSize)) { | 1194 | public_key_from_external(public_key, &pub); |
| 1195 | CBS_init(&cbs, input, input_len); | ||
| 1196 | if (!mlkem_parse_public_key_no_hash(&pub, &cbs, public_key->rank)) | ||
| 1100 | return 0; | 1197 | return 0; |
| 1101 | } | 1198 | if (CBS_len(&cbs) != 0) |
| 1102 | vector_encode(s_output, &priv->s, kLog2Prime); | ||
| 1103 | if (!mlkem_marshal_public_key(out, &priv->pub) || | ||
| 1104 | !CBB_add_bytes(out, priv->pub.public_key_hash, | ||
| 1105 | sizeof(priv->pub.public_key_hash)) || | ||
| 1106 | !CBB_add_bytes(out, priv->fo_failure_secret, | ||
| 1107 | sizeof(priv->fo_failure_secret))) { | ||
| 1108 | return 0; | 1199 | return 0; |
| 1109 | } | 1200 | |
| 1201 | hash_h(pub.public_key_hash, input, input_len); | ||
| 1202 | |||
| 1110 | return 1; | 1203 | return 1; |
| 1111 | } | 1204 | } |
| 1112 | 1205 | ||
| 1113 | int | 1206 | int |
| 1114 | MLKEM1024_parse_private_key(struct MLKEM1024_private_key *out_private_key, | 1207 | mlkem_marshal_private_key(const MLKEM_private_key *private_key, |
| 1115 | CBS *in) | 1208 | uint8_t **out_private_key, size_t *out_private_key_len) |
| 1116 | { | 1209 | { |
| 1117 | struct private_key *const priv = private_key_1024_from_external( | 1210 | struct private_key priv; |
| 1118 | out_private_key); | 1211 | size_t key_length = private_key->rank == MLKEM768_RANK ? |
| 1119 | CBS s_bytes; | 1212 | MLKEM768_PRIVATE_KEY_BYTES : MLKEM1024_PRIVATE_KEY_BYTES; |
| 1213 | CBB cbb; | ||
| 1214 | int ret = 0; | ||
| 1120 | 1215 | ||
| 1121 | if (!CBS_get_bytes(in, &s_bytes, kEncodedVectorSize) || | 1216 | private_key_from_external(private_key, &priv); |
| 1122 | !vector_decode(&priv->s, CBS_data(&s_bytes), kLog2Prime) || | 1217 | if (!CBB_init(&cbb, key_length)) |
| 1123 | !mlkem_parse_public_key_no_hash(&priv->pub, in)) { | 1218 | goto err; |
| 1124 | return 0; | ||
| 1125 | } | ||
| 1126 | memcpy(priv->pub.public_key_hash, CBS_data(in), | ||
| 1127 | sizeof(priv->pub.public_key_hash)); | ||
| 1128 | if (!CBS_skip(in, sizeof(priv->pub.public_key_hash))) | ||
| 1129 | return 0; | ||
| 1130 | memcpy(priv->fo_failure_secret, CBS_data(in), | ||
| 1131 | sizeof(priv->fo_failure_secret)); | ||
| 1132 | if (!CBS_skip(in, sizeof(priv->fo_failure_secret))) | ||
| 1133 | return 0; | ||
| 1134 | if (CBS_len(in) != 0) | ||
| 1135 | return 0; | ||
| 1136 | 1219 | ||
| 1137 | return 1; | 1220 | if (!vector_encode_cbb(&cbb, priv.s, kLog2Prime, private_key->rank)) |
| 1221 | goto err; | ||
| 1222 | if (!mlkem_marshal_public_key_internal(&cbb, &priv.pub, | ||
| 1223 | private_key->rank)) | ||
| 1224 | goto err; | ||
| 1225 | if (!CBB_add_bytes(&cbb, priv.pub.public_key_hash, 32)) | ||
| 1226 | goto err; | ||
| 1227 | if (!CBB_add_bytes(&cbb, priv.fo_failure_secret, 32)) | ||
| 1228 | goto err; | ||
| 1229 | |||
| 1230 | if (!CBB_finish(&cbb, out_private_key, out_private_key_len)) | ||
| 1231 | goto err; | ||
| 1232 | |||
| 1233 | ret = 1; | ||
| 1234 | |||
| 1235 | err: | ||
| 1236 | CBB_cleanup(&cbb); | ||
| 1237 | explicit_bzero(&priv, sizeof(priv)); | ||
| 1238 | |||
| 1239 | return ret; | ||
| 1240 | } | ||
| 1241 | |||
| 1242 | int | ||
| 1243 | mlkem_parse_private_key(const uint8_t *input, size_t input_len, | ||
| 1244 | MLKEM_private_key *out_private_key) | ||
| 1245 | { | ||
| 1246 | struct private_key priv; | ||
| 1247 | CBS cbs, s_bytes; | ||
| 1248 | int ret = 0; | ||
| 1249 | |||
| 1250 | private_key_from_external(out_private_key, &priv); | ||
| 1251 | CBS_init(&cbs, input, input_len); | ||
| 1252 | |||
| 1253 | if (!CBS_get_bytes(&cbs, &s_bytes, | ||
| 1254 | encoded_vector_size(out_private_key->rank))) | ||
| 1255 | goto err; | ||
| 1256 | if (!vector_decode(priv.s, CBS_data(&s_bytes), kLog2Prime, | ||
| 1257 | out_private_key->rank)) | ||
| 1258 | goto err; | ||
| 1259 | if (!mlkem_parse_public_key_no_hash(&priv.pub, &cbs, | ||
| 1260 | out_private_key->rank)) | ||
| 1261 | goto err; | ||
| 1262 | |||
| 1263 | memcpy(priv.pub.public_key_hash, CBS_data(&cbs), 32); | ||
| 1264 | if (!CBS_skip(&cbs, 32)) | ||
| 1265 | goto err; | ||
| 1266 | memcpy(priv.fo_failure_secret, CBS_data(&cbs), 32); | ||
| 1267 | if (!CBS_skip(&cbs, 32)) | ||
| 1268 | goto err; | ||
| 1269 | if (CBS_len(&cbs) != 0) | ||
| 1270 | goto err; | ||
| 1271 | |||
| 1272 | ret = 1; | ||
| 1273 | |||
| 1274 | err: | ||
| 1275 | explicit_bzero(&priv, sizeof(priv)); | ||
| 1276 | |||
| 1277 | return ret; | ||
| 1138 | } | 1278 | } |
| 1139 | LCRYPTO_ALIAS(MLKEM1024_parse_private_key); | ||
diff --git a/src/lib/libcrypto/mlkem/mlkem_internal.h b/src/lib/libcrypto/mlkem/mlkem_internal.h index d3f325932f..42b5ba03b8 100644 --- a/src/lib/libcrypto/mlkem/mlkem_internal.h +++ b/src/lib/libcrypto/mlkem/mlkem_internal.h | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* $OpenBSD: mlkem_internal.h,v 1.4 2024/12/19 23:52:26 tb Exp $ */ | 1 | /* $OpenBSD: mlkem_internal.h,v 1.14 2026/01/18 08:58:31 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023, Google Inc. | 3 | * Copyright (c) 2023, Google Inc. |
| 4 | * Copyright (c) 2025, Bob Beck <beck@obtuse.com> | ||
| 4 | * | 5 | * |
| 5 | * Permission to use, copy, modify, and/or distribute this software for any | 6 | * Permission to use, copy, modify, and/or distribute this software for any |
| 6 | * purpose with or without fee is hereby granted, provided that the above | 7 | * purpose with or without fee is hereby granted, provided that the above |
| @@ -27,6 +28,101 @@ extern "C" { | |||
| 27 | 28 | ||
| 28 | __BEGIN_HIDDEN_DECLS | 29 | __BEGIN_HIDDEN_DECLS |
| 29 | 30 | ||
| 31 | /* Public opaque ML-KEM key structures. */ | ||
| 32 | |||
| 33 | #define MLKEM_PUBLIC_KEY_UNINITIALIZED 1 | ||
| 34 | #define MLKEM_PUBLIC_KEY_INITIALIZED 2 | ||
| 35 | #define MLKEM_PRIVATE_KEY_UNINITIALIZED 3 | ||
| 36 | #define MLKEM_PRIVATE_KEY_INITIALIZED 4 | ||
| 37 | |||
| 38 | struct MLKEM_public_key_st { | ||
| 39 | uint16_t rank; | ||
| 40 | int state; | ||
| 41 | struct MLKEM768_public_key *key_768; | ||
| 42 | struct MLKEM1024_public_key *key_1024; | ||
| 43 | }; | ||
| 44 | |||
| 45 | struct MLKEM_private_key_st { | ||
| 46 | uint16_t rank; | ||
| 47 | int state; | ||
| 48 | struct MLKEM768_private_key *key_768; | ||
| 49 | struct MLKEM1024_private_key *key_1024; | ||
| 50 | }; | ||
| 51 | |||
| 52 | /* | ||
| 53 | * ML-KEM-768 and ML-KEM-1024 | ||
| 54 | * | ||
| 55 | * This implements the Module-Lattice-Based Key-Encapsulation Mechanism from | ||
| 56 | * https://csrc.nist.gov/pubs/fips/204/final | ||
| 57 | * | ||
| 58 | * You should prefer ML-KEM-768 where possible. ML-KEM-1024 is larger and exists | ||
| 59 | * for people who are obsessed with more 'bits of crypto', and who are also | ||
| 60 | * lacking the knowledge to realize that anything that can count to 256 bits | ||
| 61 | * must likely use an equivalent amount of energy to that of an entire star to | ||
| 62 | * do so. | ||
| 63 | * | ||
| 64 | * ML-KEM-768 is adequate to protect against a future cryptographically relevant | ||
| 65 | * quantum computer, VIC 20, abacus, or carefully calibrated reference dog. I | ||
| 66 | * for one plan on welcoming our new Kardashev-II civilization overlords with | ||
| 67 | * open arms. In the meantime will not waste bytes on the wire by to adding | ||
| 68 | * the fear of the possible future existence of a cryptographically relevant | ||
| 69 | * Dyson sphere to the aforementioned list of fear-inducing future | ||
| 70 | * cryptographically relevant hypotheticals. | ||
| 71 | * | ||
| 72 | * If your carefully calibrated reference dog notices the sun starting to dim, | ||
| 73 | * you might need ML-KEM-1024, but you probably have bigger concerns than | ||
| 74 | * the decryption of your stored past TLS sessions at that point. | ||
| 75 | */ | ||
| 76 | |||
| 77 | /* | ||
| 78 | * MLKEM1024_public_key contains an ML-KEM-1024 public key. The contents of this | ||
| 79 | * object should never leave the address space since the format is unstable. | ||
| 80 | */ | ||
| 81 | struct MLKEM1024_public_key { | ||
| 82 | uint8_t bytes[512 * (4 + 16) + 32 + 32]; | ||
| 83 | uint16_t alignment; | ||
| 84 | }; | ||
| 85 | |||
| 86 | /* | ||
| 87 | * MLKEM1024_private_key contains a ML-KEM-1024 private key. The contents of | ||
| 88 | * this object should never leave the address space since the format is | ||
| 89 | * unstable. | ||
| 90 | */ | ||
| 91 | struct MLKEM1024_private_key { | ||
| 92 | uint8_t bytes[512 * (4 + 4 + 16) + 32 + 32 + 32]; | ||
| 93 | uint16_t alignment; | ||
| 94 | }; | ||
| 95 | |||
| 96 | /* | ||
| 97 | * MLKEM768_public_key contains a ML-KEM-768 public key. The contents of this | ||
| 98 | * object should never leave the address space since the format is unstable. | ||
| 99 | */ | ||
| 100 | struct MLKEM768_public_key { | ||
| 101 | uint8_t bytes[512 * (3 + 9) + 32 + 32]; | ||
| 102 | uint16_t alignment; | ||
| 103 | }; | ||
| 104 | |||
| 105 | /* | ||
| 106 | * MLKEM768_private_key contains a ML-KEM-768 private key. The contents of this | ||
| 107 | * object should never leave the address space since the format is unstable. | ||
| 108 | */ | ||
| 109 | struct MLKEM768_private_key { | ||
| 110 | uint8_t bytes[512 * (3 + 3 + 9) + 32 + 32 + 32]; | ||
| 111 | uint16_t alignment; | ||
| 112 | }; | ||
| 113 | |||
| 114 | /* | ||
| 115 | * MLKEM_SEED_LENGTH is the number of bytes in an ML-KEM seed. An ML-KEM | ||
| 116 | * seed is normally used to represent a private key. | ||
| 117 | */ | ||
| 118 | #define MLKEM_SEED_LENGTH 64 | ||
| 119 | |||
| 120 | /* | ||
| 121 | * MLKEM_SHARED_SECRET_LENGTH is the number of bytes in an ML-KEM shared | ||
| 122 | * secret. | ||
| 123 | */ | ||
| 124 | #define MLKEM_SHARED_SECRET_LENGTH 32 | ||
| 125 | |||
| 30 | /* | 126 | /* |
| 31 | * MLKEM_ENCAP_ENTROPY is the number of bytes of uniformly random entropy | 127 | * MLKEM_ENCAP_ENTROPY is the number of bytes of uniformly random entropy |
| 32 | * necessary to encapsulate a secret. The entropy will be leaked to the | 128 | * necessary to encapsulate a secret. The entropy will be leaked to the |
| @@ -34,84 +130,171 @@ __BEGIN_HIDDEN_DECLS | |||
| 34 | */ | 130 | */ |
| 35 | #define MLKEM_ENCAP_ENTROPY 32 | 131 | #define MLKEM_ENCAP_ENTROPY 32 |
| 36 | 132 | ||
| 133 | /* MLKEM1024_CIPHERTEXT_BYTES is number of bytes in the ML-KEM-1024 ciphertext. */ | ||
| 134 | #define MLKEM1024_CIPHERTEXT_BYTES 1568 | ||
| 135 | |||
| 136 | /* MLKEM768_CIPHERTEXT_BYTES is number of bytes in the ML-KEM768 ciphertext. */ | ||
| 137 | #define MLKEM768_CIPHERTEXT_BYTES 1088 | ||
| 138 | |||
| 37 | /* | 139 | /* |
| 38 | * MLKEM768_generate_key_external_entropy is a deterministic function to create a | 140 | * MLKEM768_PUBLIC_KEY_BYTES is the number of bytes in an encoded ML-KEM768 public |
| 39 | * pair of ML-KEM 768 keys, using the supplied entropy. The entropy needs to be | 141 | * key. |
| 40 | * uniformly random generated. This function is should only be used for tests, | 142 | */ |
| 41 | * regular callers should use the non-deterministic |MLKEM_generate_key| | 143 | #define MLKEM768_PUBLIC_KEY_BYTES 1184 |
| 42 | * directly. | 144 | |
| 145 | /* | ||
| 146 | * MLKEM1024_PUBLIC_KEY_BYTES is the number of bytes in an encoded ML-KEM-1024 | ||
| 147 | * public key. | ||
| 43 | */ | 148 | */ |
| 44 | void MLKEM768_generate_key_external_entropy( | 149 | #define MLKEM1024_PUBLIC_KEY_BYTES 1568 |
| 45 | uint8_t out_encoded_public_key[MLKEM768_PUBLIC_KEY_BYTES], | ||
| 46 | struct MLKEM768_private_key *out_private_key, | ||
| 47 | const uint8_t entropy[MLKEM_SEED_BYTES]); | ||
| 48 | 150 | ||
| 49 | /* | 151 | /* |
| 50 | * MLKEM768_PRIVATE_KEY_BYTES is the length of the data produced by | 152 | * MLKEM768_PRIVATE_KEY_BYTES is the length of the data produced by |
| 51 | * |MLKEM768_marshal_private_key|. | 153 | * |marshal_private_key| for a RANK768 MLKEM_private_key. |
| 52 | */ | 154 | */ |
| 53 | #define MLKEM768_PRIVATE_KEY_BYTES 2400 | 155 | #define MLKEM768_PRIVATE_KEY_BYTES 2400 |
| 54 | 156 | ||
| 55 | /* | 157 | /* |
| 56 | * MLKEM768_marshal_private_key serializes |private_key| to |out| in the standard | 158 | * MLKEM1024_PRIVATE_KEY_BYTES is the length of the data produced by |
| 57 | * format for ML-KEM private keys. It returns one on success or zero on | 159 | * |marshal_private_key| for a RANK1024 MLKEM_private_key. |
| 58 | * allocation error. | ||
| 59 | */ | 160 | */ |
| 60 | int MLKEM768_marshal_private_key(CBB *out, | 161 | #define MLKEM1024_PRIVATE_KEY_BYTES 3168 |
| 61 | const struct MLKEM768_private_key *private_key); | ||
| 62 | 162 | ||
| 63 | /* | 163 | /* |
| 64 | * MLKEM_encap_external_entropy behaves like |MLKEM_encap|, but uses | 164 | * Internal MLKEM 768 and MLKEM 1024 functions come largely from BoringSSL, but |
| 65 | * |MLKEM_ENCAP_ENTROPY| bytes of |entropy| for randomization. The decapsulating | 165 | * converted to C from templated C++. Due to this history, most internal |
| 66 | * side will be able to recover |entropy| in full. This function should only be | 166 | * functions do not allocate, and are expected to be handed memory allocated by |
| 67 | * used for tests, regular callers should use the non-deterministic | 167 | * the caller. The caller is generally expected to know what sizes to allocate |
| 68 | * |MLKEM_encap| directly. | 168 | * based upon the rank of the key (either public or private) that they are |
| 169 | * starting with. This avoids the need to handle memory allocation failures | ||
| 170 | * (which boring in C++ just crashes by choice) deep in the implementation, as | ||
| 171 | * what is needed is allocated up front in the public facing functions, and | ||
| 172 | * failure is handled there. | ||
| 69 | */ | 173 | */ |
| 70 | void MLKEM768_encap_external_entropy( | 174 | |
| 71 | uint8_t out_ciphertext[MLKEM768_CIPHERTEXT_BYTES], | 175 | /* Key generation. */ |
| 72 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], | ||
| 73 | const struct MLKEM768_public_key *public_key, | ||
| 74 | const uint8_t entropy[MLKEM_ENCAP_ENTROPY]); | ||
| 75 | 176 | ||
| 76 | /* | 177 | /* |
| 77 | * MLKEM1024_generate_key_external_entropy is a deterministic function to create a | 178 | * mlkem_private_key_from_seed modifies |out_private_key| to contain a key of |
| 78 | * pair of ML-KEM 1024 keys, using the supplied entropy. The entropy needs to be | 179 | * the rank of |*out_private_key| from a seed that was generated by |
| 79 | * uniformly random generated. This function is should only be used for tests, | 180 | * |MLKEM_generate_key|. It fails and returns 0 if |seed_len| is incorrect, or |
| 80 | * regular callers should use the non-deterministic |MLKEM_generate_key| | 181 | * if |*out_private_key| has not been initialized. otherwise it writes to |
| 81 | * directly. | 182 | * |*out_private_key| and returns 1. |
| 82 | */ | 183 | */ |
| 83 | void MLKEM1024_generate_key_external_entropy( | 184 | int mlkem_private_key_from_seed(const uint8_t *seed, size_t seed_len, |
| 84 | uint8_t out_encoded_public_key[MLKEM1024_PUBLIC_KEY_BYTES], | 185 | MLKEM_private_key *out_private_key); |
| 85 | struct MLKEM1024_private_key *out_private_key, | ||
| 86 | const uint8_t entropy[MLKEM_SEED_BYTES]); | ||
| 87 | 186 | ||
| 88 | /* | 187 | /* |
| 89 | * MLKEM1024_PRIVATE_KEY_BYTES is the length of the data produced by | 188 | * mlkem_public_from_private sets |*out_public_key| to the public key that |
| 90 | * |MLKEM1024_marshal_private_key|. | 189 | * corresponds to |*private_key|. (This is faster than parsing the output of |
| 190 | * |MLKEM_generate_key| if, for some reason, you need to encapsulate to a key | ||
| 191 | * that was just generated.) | ||
| 91 | */ | 192 | */ |
| 92 | #define MLKEM1024_PRIVATE_KEY_BYTES 3168 | 193 | void mlkem_public_from_private(const MLKEM_private_key *private_key, |
| 194 | MLKEM_public_key *out_public_key); | ||
| 195 | |||
| 196 | |||
| 197 | /* Encapsulation and decapsulation of secrets. */ | ||
| 198 | |||
| 199 | /* | ||
| 200 | * mlkem_decap decrypts a shared secret from |ciphertext| using |private_key| | ||
| 201 | * and writes it to |out_shared_secret|. If |ciphertext_len| is incorrect it | ||
| 202 | * returns 0, otherwise it returns 1. If |ciphertext| is invalid, | ||
| 203 | * |out_shared_secret| is filled with a key that will always be the same for the | ||
| 204 | * same |ciphertext| and |private_key|, but which appears to be random unless | ||
| 205 | * one has access to |private_key|. These alternatives occur in constant time. | ||
| 206 | * Any subsequent symmetric encryption using |out_shared_secret| must use an | ||
| 207 | * authenticated encryption scheme in order to discover the decapsulation | ||
| 208 | * failure. | ||
| 209 | */ | ||
| 210 | int mlkem_decap(const MLKEM_private_key *private_key, | ||
| 211 | const uint8_t *ciphertext, size_t ciphertext_len, | ||
| 212 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_LENGTH]); | ||
| 213 | |||
| 214 | |||
| 215 | /* Serialisation of keys. */ | ||
| 216 | |||
| 217 | /* | ||
| 218 | * mlkem_marshal_public_key serializes |public_key| to |output| in the standard | ||
| 219 | * format for ML-KEM public keys. It returns one on success or zero on allocation | ||
| 220 | * error. | ||
| 221 | */ | ||
| 222 | int mlkem_marshal_public_key(const MLKEM_public_key *public_key, | ||
| 223 | uint8_t **output, size_t *output_len); | ||
| 224 | |||
| 225 | /* | ||
| 226 | * mlkem_parse_public_key parses a public key, in the format generated by | ||
| 227 | * |MLKEM_marshal_public_key|, from |input| and writes the result to | ||
| 228 | * |out_public_key|. It returns one on success or zero on parse error or if | ||
| 229 | * there are trailing bytes in |input|. | ||
| 230 | */ | ||
| 231 | int mlkem_parse_public_key(const uint8_t *input, size_t input_len, | ||
| 232 | MLKEM_public_key *out_public_key); | ||
| 233 | |||
| 234 | /* | ||
| 235 | * mlkem_parse_private_key parses a private key, in the format generated by | ||
| 236 | * |MLKEM_marshal_private_key|, from |input| and writes the result to | ||
| 237 | * |out_private_key|. It returns one on success or zero on parse error or if | ||
| 238 | * there are trailing bytes in |input|. This format is verbose and should be avoided. | ||
| 239 | * Private keys should be stored as seeds and parsed using |mlkem_private_key_from_seed|. | ||
| 240 | */ | ||
| 241 | int mlkem_parse_private_key(const uint8_t *input, size_t input_len, | ||
| 242 | MLKEM_private_key *out_private_key); | ||
| 243 | |||
| 244 | |||
| 245 | /* Functions that are only used for test purposes. */ | ||
| 246 | |||
| 247 | /* | ||
| 248 | * mlkem_generate_key_external_entropy is a deterministic function to create a | ||
| 249 | * pair of ML-KEM keys, using the supplied entropy. The entropy needs to be | ||
| 250 | * uniformly random generated. This function should only be used for tests, | ||
| 251 | * regular callers should use the non-deterministic |MLKEM_generate_key| | ||
| 252 | * directly. | ||
| 253 | */ | ||
| 254 | int mlkem_generate_key_external_entropy(uint8_t *out_encoded_public_key, | ||
| 255 | MLKEM_private_key *out_private_key, | ||
| 256 | const uint8_t entropy[MLKEM_SEED_LENGTH]); | ||
| 93 | 257 | ||
| 94 | /* | 258 | /* |
| 95 | * MLKEM1024_marshal_private_key serializes |private_key| to |out| in the | 259 | * mlkem_marshal_private_key serializes |private_key| to |out_private_key| in the standard |
| 96 | * standard format for ML-KEM private keys. It returns one on success or zero on | 260 | * format for ML-KEM private keys. It returns one on success or zero on |
| 97 | * allocation error. | 261 | * allocation error. |
| 98 | */ | 262 | */ |
| 99 | int MLKEM1024_marshal_private_key(CBB *out, | 263 | int mlkem_marshal_private_key(const MLKEM_private_key *private_key, |
| 100 | const struct MLKEM1024_private_key *private_key); | 264 | uint8_t **out_private_key, size_t *out_private_key_len); |
| 101 | 265 | ||
| 102 | /* | 266 | /* |
| 103 | * MLKEM_encap_external_entropy behaves like |MLKEM_encap|, but uses | 267 | * mlkem_encap_external_entropy behaves like |MLKEM_encap|, but uses |
| 104 | * |MLKEM_ENCAP_ENTROPY| bytes of |entropy| for randomization. The decapsulating | 268 | * |MLKEM_ENCAP_ENTROPY| bytes of |entropy| for randomization. The decapsulating |
| 105 | * side will be able to recover |entropy| in full. This function should only be | 269 | * side will be able to recover |entropy| in full. This function should only be |
| 106 | * used for tests, regular callers should use the non-deterministic | 270 | * used for tests, regular callers should use the non-deterministic |
| 107 | * |MLKEM_encap| directly. | 271 | * |MLKEM_encap| directly. |
| 108 | */ | 272 | */ |
| 109 | void MLKEM1024_encap_external_entropy( | 273 | void mlkem_encap_external_entropy(uint8_t *out_ciphertext, |
| 110 | uint8_t out_ciphertext[MLKEM1024_CIPHERTEXT_BYTES], | 274 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_LENGTH], |
| 111 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], | 275 | const MLKEM_public_key *public_key, |
| 112 | const struct MLKEM1024_public_key *public_key, | ||
| 113 | const uint8_t entropy[MLKEM_ENCAP_ENTROPY]); | 276 | const uint8_t entropy[MLKEM_ENCAP_ENTROPY]); |
| 114 | 277 | ||
| 278 | /* | ||
| 279 | * |MLKEM_encap_external_entropy| behaves exactly like the public |MLKEM_encap| | ||
| 280 | * with the entropy provided by the caller. It is directly called internally | ||
| 281 | * and by tests. | ||
| 282 | */ | ||
| 283 | int MLKEM_encap_external_entropy(const MLKEM_public_key *public_key, | ||
| 284 | const uint8_t *entropy, uint8_t **out_ciphertext, | ||
| 285 | size_t *out_ciphertext_len, uint8_t **out_shared_secret, | ||
| 286 | size_t *out_shared_secret_len); | ||
| 287 | |||
| 288 | /* | ||
| 289 | * |MLKEM_generate_key_external_entropy| behaves exactly like the public | ||
| 290 | * |MLKEM_generate_key| with the entropy provided by the caller. | ||
| 291 | * It is directly called internally and by tests. | ||
| 292 | */ | ||
| 293 | int MLKEM_generate_key_external_entropy(MLKEM_private_key *private_key, | ||
| 294 | uint8_t **out_encoded_public_key, size_t *out_encoded_public_key_len, | ||
| 295 | const uint8_t *entropy); | ||
| 296 | |||
| 297 | |||
| 115 | __END_HIDDEN_DECLS | 298 | __END_HIDDEN_DECLS |
| 116 | 299 | ||
| 117 | #if defined(__cplusplus) | 300 | #if defined(__cplusplus) |
diff --git a/src/lib/libcrypto/mlkem/mlkem_key.c b/src/lib/libcrypto/mlkem/mlkem_key.c new file mode 100644 index 0000000000..d4e3d69d88 --- /dev/null +++ b/src/lib/libcrypto/mlkem/mlkem_key.c | |||
| @@ -0,0 +1,188 @@ | |||
| 1 | /* $OpenBSD: mlkem_key.c,v 1.5 2026/01/01 12:47:52 tb Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2025 Bob Beck <beck@obtuse.com> | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <stdlib.h> | ||
| 19 | #include <string.h> | ||
| 20 | |||
| 21 | #include <openssl/mlkem.h> | ||
| 22 | |||
| 23 | #include "mlkem_internal.h" | ||
| 24 | |||
| 25 | MLKEM_private_key * | ||
| 26 | MLKEM_private_key_new(int rank) | ||
| 27 | { | ||
| 28 | MLKEM_private_key *key = NULL; | ||
| 29 | MLKEM_private_key *ret = NULL; | ||
| 30 | |||
| 31 | if ((key = calloc(1, sizeof(*key))) == NULL) | ||
| 32 | goto err; | ||
| 33 | |||
| 34 | switch (rank) { | ||
| 35 | case MLKEM768_RANK: | ||
| 36 | if ((key->key_768 = calloc(1, sizeof(*key->key_768))) == NULL) | ||
| 37 | goto err; | ||
| 38 | break; | ||
| 39 | case MLKEM1024_RANK: | ||
| 40 | if ((key->key_1024 = calloc(1, sizeof(*key->key_1024))) == NULL) | ||
| 41 | goto err; | ||
| 42 | break; | ||
| 43 | default: | ||
| 44 | goto err; | ||
| 45 | } | ||
| 46 | key->rank = rank; | ||
| 47 | key->state = MLKEM_PRIVATE_KEY_UNINITIALIZED; | ||
| 48 | |||
| 49 | ret = key; | ||
| 50 | key = NULL; | ||
| 51 | |||
| 52 | err: | ||
| 53 | MLKEM_private_key_free(key); | ||
| 54 | |||
| 55 | return ret; | ||
| 56 | } | ||
| 57 | LCRYPTO_ALIAS(MLKEM_private_key_new); | ||
| 58 | |||
| 59 | void | ||
| 60 | MLKEM_private_key_free(MLKEM_private_key *key) | ||
| 61 | { | ||
| 62 | if (key == NULL) | ||
| 63 | return; | ||
| 64 | |||
| 65 | freezero(key->key_768, sizeof(*key->key_768)); | ||
| 66 | freezero(key->key_1024, sizeof(*key->key_1024)); | ||
| 67 | freezero(key, sizeof(*key)); | ||
| 68 | } | ||
| 69 | LCRYPTO_ALIAS(MLKEM_private_key_free); | ||
| 70 | |||
| 71 | size_t | ||
| 72 | MLKEM_private_key_encoded_length(const MLKEM_private_key *key) | ||
| 73 | { | ||
| 74 | if (key == NULL) | ||
| 75 | return 0; | ||
| 76 | |||
| 77 | switch (key->rank) { | ||
| 78 | case MLKEM768_RANK: | ||
| 79 | return MLKEM768_PRIVATE_KEY_BYTES; | ||
| 80 | case MLKEM1024_RANK: | ||
| 81 | return MLKEM1024_PRIVATE_KEY_BYTES; | ||
| 82 | default: | ||
| 83 | return 0; | ||
| 84 | } | ||
| 85 | return 0; | ||
| 86 | } | ||
| 87 | LCRYPTO_ALIAS(MLKEM_private_key_encoded_length); | ||
| 88 | |||
| 89 | size_t | ||
| 90 | MLKEM_private_key_ciphertext_length(const MLKEM_private_key *key) | ||
| 91 | { | ||
| 92 | if (key == NULL) | ||
| 93 | return 0; | ||
| 94 | |||
| 95 | switch (key->rank) { | ||
| 96 | case MLKEM768_RANK: | ||
| 97 | return MLKEM768_CIPHERTEXT_BYTES; | ||
| 98 | case MLKEM1024_RANK: | ||
| 99 | return MLKEM1024_CIPHERTEXT_BYTES; | ||
| 100 | default: | ||
| 101 | return 0; | ||
| 102 | } | ||
| 103 | return 0; | ||
| 104 | } | ||
| 105 | LCRYPTO_ALIAS(MLKEM_private_key_ciphertext_length); | ||
| 106 | |||
| 107 | MLKEM_public_key * | ||
| 108 | MLKEM_public_key_new(int rank) | ||
| 109 | { | ||
| 110 | MLKEM_public_key *key = NULL; | ||
| 111 | MLKEM_public_key *ret = NULL; | ||
| 112 | |||
| 113 | if ((key = calloc(1, sizeof(*key))) == NULL) | ||
| 114 | goto err; | ||
| 115 | |||
| 116 | switch (rank) { | ||
| 117 | case MLKEM768_RANK: | ||
| 118 | if ((key->key_768 = calloc(1, sizeof(*key->key_768))) == NULL) | ||
| 119 | goto err; | ||
| 120 | break; | ||
| 121 | case MLKEM1024_RANK: | ||
| 122 | if ((key->key_1024 = calloc(1, sizeof(*key->key_1024))) == NULL) | ||
| 123 | goto err; | ||
| 124 | break; | ||
| 125 | default: | ||
| 126 | goto err; | ||
| 127 | } | ||
| 128 | |||
| 129 | key->rank = rank; | ||
| 130 | key->state = MLKEM_PUBLIC_KEY_UNINITIALIZED; | ||
| 131 | |||
| 132 | ret = key; | ||
| 133 | key = NULL; | ||
| 134 | |||
| 135 | err: | ||
| 136 | MLKEM_public_key_free(key); | ||
| 137 | |||
| 138 | return ret; | ||
| 139 | } | ||
| 140 | LCRYPTO_ALIAS(MLKEM_public_key_new); | ||
| 141 | |||
| 142 | void | ||
| 143 | MLKEM_public_key_free(MLKEM_public_key *key) | ||
| 144 | { | ||
| 145 | if (key == NULL) | ||
| 146 | return; | ||
| 147 | |||
| 148 | freezero(key->key_768, sizeof(*key->key_768)); | ||
| 149 | freezero(key->key_1024, sizeof(*key->key_1024)); | ||
| 150 | freezero(key, sizeof(*key)); | ||
| 151 | } | ||
| 152 | LCRYPTO_ALIAS(MLKEM_public_key_free); | ||
| 153 | |||
| 154 | size_t | ||
| 155 | MLKEM_public_key_encoded_length(const MLKEM_public_key *key) | ||
| 156 | { | ||
| 157 | if (key == NULL) | ||
| 158 | return 0; | ||
| 159 | |||
| 160 | switch (key->rank) { | ||
| 161 | case MLKEM768_RANK: | ||
| 162 | return MLKEM768_PUBLIC_KEY_BYTES; | ||
| 163 | case MLKEM1024_RANK: | ||
| 164 | return MLKEM1024_PUBLIC_KEY_BYTES; | ||
| 165 | default: | ||
| 166 | return 0; | ||
| 167 | } | ||
| 168 | return 0; | ||
| 169 | } | ||
| 170 | LCRYPTO_ALIAS(MLKEM_public_key_encoded_length); | ||
| 171 | |||
| 172 | size_t | ||
| 173 | MLKEM_public_key_ciphertext_length(const MLKEM_public_key *key) | ||
| 174 | { | ||
| 175 | if (key == NULL) | ||
| 176 | return 0; | ||
| 177 | |||
| 178 | switch (key->rank) { | ||
| 179 | case MLKEM768_RANK: | ||
| 180 | return MLKEM768_CIPHERTEXT_BYTES; | ||
| 181 | case MLKEM1024_RANK: | ||
| 182 | return MLKEM1024_CIPHERTEXT_BYTES; | ||
| 183 | default: | ||
| 184 | return 0; | ||
| 185 | } | ||
| 186 | return 0; | ||
| 187 | } | ||
| 188 | LCRYPTO_ALIAS(MLKEM_public_key_ciphertext_length); | ||
diff --git a/src/lib/libcrypto/modes/asm/ghash-x86.pl b/src/lib/libcrypto/modes/asm/ghash-x86.pl index 47833582b6..395c680cc5 100644 --- a/src/lib/libcrypto/modes/asm/ghash-x86.pl +++ b/src/lib/libcrypto/modes/asm/ghash-x86.pl | |||
| @@ -119,8 +119,7 @@ require "x86asm.pl"; | |||
| 119 | 119 | ||
| 120 | &asm_init($ARGV[0],"ghash-x86.pl",$x86only = $ARGV[$#ARGV] eq "386"); | 120 | &asm_init($ARGV[0],"ghash-x86.pl",$x86only = $ARGV[$#ARGV] eq "386"); |
| 121 | 121 | ||
| 122 | $sse2=0; | 122 | $sse2=1; |
| 123 | for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } | ||
| 124 | 123 | ||
| 125 | ($Zhh,$Zhl,$Zlh,$Zll) = ("ebp","edx","ecx","ebx"); | 124 | ($Zhh,$Zhl,$Zlh,$Zll) = ("ebp","edx","ecx","ebx"); |
| 126 | $inp = "edi"; | 125 | $inp = "edi"; |
diff --git a/src/lib/libcrypto/modes/cbc128.c b/src/lib/libcrypto/modes/cbc128.c index f8ebf79a87..1b6858ee25 100644 --- a/src/lib/libcrypto/modes/cbc128.c +++ b/src/lib/libcrypto/modes/cbc128.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cbc128.c,v 1.8 2023/07/08 14:56:54 beck Exp $ */ | 1 | /* $OpenBSD: cbc128.c,v 1.11 2025/04/23 10:09:08 jsing Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 2008 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2008 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -49,15 +49,11 @@ | |||
| 49 | * | 49 | * |
| 50 | */ | 50 | */ |
| 51 | 51 | ||
| 52 | #include <openssl/crypto.h> | ||
| 53 | #include "modes_local.h" | ||
| 54 | #include <string.h> | 52 | #include <string.h> |
| 55 | 53 | ||
| 56 | #ifndef MODES_DEBUG | 54 | #include <openssl/crypto.h> |
| 57 | # ifndef NDEBUG | 55 | |
| 58 | # define NDEBUG | 56 | #include "modes_local.h" |
| 59 | # endif | ||
| 60 | #endif | ||
| 61 | 57 | ||
| 62 | #undef STRICT_ALIGNMENT | 58 | #undef STRICT_ALIGNMENT |
| 63 | #ifdef __STRICT_ALIGNMENT | 59 | #ifdef __STRICT_ALIGNMENT |
| @@ -74,7 +70,6 @@ CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, | |||
| 74 | size_t n; | 70 | size_t n; |
| 75 | const unsigned char *iv = ivec; | 71 | const unsigned char *iv = ivec; |
| 76 | 72 | ||
| 77 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | ||
| 78 | if (STRICT_ALIGNMENT && | 73 | if (STRICT_ALIGNMENT && |
| 79 | ((size_t)in|(size_t)out|(size_t)ivec) % sizeof(size_t) != 0) { | 74 | ((size_t)in|(size_t)out|(size_t)ivec) % sizeof(size_t) != 0) { |
| 80 | while (len >= 16) { | 75 | while (len >= 16) { |
| @@ -98,7 +93,6 @@ CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, | |||
| 98 | out += 16; | 93 | out += 16; |
| 99 | } | 94 | } |
| 100 | } | 95 | } |
| 101 | #endif | ||
| 102 | while (len) { | 96 | while (len) { |
| 103 | for (n = 0; n < 16 && n < len; ++n) | 97 | for (n = 0; n < 16 && n < len; ++n) |
| 104 | out[n] = in[n] ^ iv[n]; | 98 | out[n] = in[n] ^ iv[n]; |
| @@ -127,7 +121,6 @@ CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, | |||
| 127 | unsigned char c[16]; | 121 | unsigned char c[16]; |
| 128 | } tmp; | 122 | } tmp; |
| 129 | 123 | ||
| 130 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | ||
| 131 | if (in != out) { | 124 | if (in != out) { |
| 132 | const unsigned char *iv = ivec; | 125 | const unsigned char *iv = ivec; |
| 133 | 126 | ||
| @@ -192,7 +185,6 @@ CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, | |||
| 192 | } | 185 | } |
| 193 | } | 186 | } |
| 194 | } | 187 | } |
| 195 | #endif | ||
| 196 | while (len) { | 188 | while (len) { |
| 197 | unsigned char c; | 189 | unsigned char c; |
| 198 | (*block)(in, tmp.c, key); | 190 | (*block)(in, tmp.c, key); |
diff --git a/src/lib/libcrypto/modes/ccm128.c b/src/lib/libcrypto/modes/ccm128.c index 68c5cce5da..e27681ee62 100644 --- a/src/lib/libcrypto/modes/ccm128.c +++ b/src/lib/libcrypto/modes/ccm128.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ccm128.c,v 1.8 2023/07/08 14:56:54 beck Exp $ */ | 1 | /* $OpenBSD: ccm128.c,v 1.12 2025/05/18 09:21:29 bcook Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2011 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -48,15 +48,11 @@ | |||
| 48 | * ==================================================================== | 48 | * ==================================================================== |
| 49 | */ | 49 | */ |
| 50 | 50 | ||
| 51 | #include <openssl/crypto.h> | ||
| 52 | #include "modes_local.h" | ||
| 53 | #include <string.h> | 51 | #include <string.h> |
| 54 | 52 | ||
| 55 | #ifndef MODES_DEBUG | 53 | #include <openssl/crypto.h> |
| 56 | # ifndef NDEBUG | 54 | |
| 57 | # define NDEBUG | 55 | #include "modes_local.h" |
| 58 | # endif | ||
| 59 | #endif | ||
| 60 | 56 | ||
| 61 | /* First you setup M and L parameters and pass the key schedule. | 57 | /* First you setup M and L parameters and pass the key schedule. |
| 62 | * This is called once per session setup... */ | 58 | * This is called once per session setup... */ |
| @@ -65,7 +61,7 @@ CRYPTO_ccm128_init(CCM128_CONTEXT *ctx, | |||
| 65 | unsigned int M, unsigned int L, void *key, block128_f block) | 61 | unsigned int M, unsigned int L, void *key, block128_f block) |
| 66 | { | 62 | { |
| 67 | memset(ctx->nonce.c, 0, sizeof(ctx->nonce.c)); | 63 | memset(ctx->nonce.c, 0, sizeof(ctx->nonce.c)); |
| 68 | ctx->nonce.c[0] = ((u8)(L - 1) & 7) | (u8)(((M - 2)/2) & 7) << 3; | 64 | ctx->nonce.c[0] = ((uint8_t)(L - 1) & 7) | (uint8_t)(((M - 2)/2) & 7) << 3; |
| 69 | ctx->blocks = 0; | 65 | ctx->blocks = 0; |
| 70 | ctx->block = block; | 66 | ctx->block = block; |
| 71 | ctx->key = key; | 67 | ctx->key = key; |
| @@ -85,17 +81,17 @@ CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx, | |||
| 85 | return -1; /* nonce is too short */ | 81 | return -1; /* nonce is too short */ |
| 86 | 82 | ||
| 87 | if (sizeof(mlen) == 8 && L >= 3) { | 83 | if (sizeof(mlen) == 8 && L >= 3) { |
| 88 | ctx->nonce.c[8] = (u8)(mlen >> (56 % (sizeof(mlen)*8))); | 84 | ctx->nonce.c[8] = (uint8_t)(mlen >> (56 % (sizeof(mlen)*8))); |
| 89 | ctx->nonce.c[9] = (u8)(mlen >> (48 % (sizeof(mlen)*8))); | 85 | ctx->nonce.c[9] = (uint8_t)(mlen >> (48 % (sizeof(mlen)*8))); |
| 90 | ctx->nonce.c[10] = (u8)(mlen >> (40 % (sizeof(mlen)*8))); | 86 | ctx->nonce.c[10] = (uint8_t)(mlen >> (40 % (sizeof(mlen)*8))); |
| 91 | ctx->nonce.c[11] = (u8)(mlen >> (32 % (sizeof(mlen)*8))); | 87 | ctx->nonce.c[11] = (uint8_t)(mlen >> (32 % (sizeof(mlen)*8))); |
| 92 | } else | 88 | } else |
| 93 | ctx->nonce.u[1] = 0; | 89 | ctx->nonce.u[1] = 0; |
| 94 | 90 | ||
| 95 | ctx->nonce.c[12] = (u8)(mlen >> 24); | 91 | ctx->nonce.c[12] = (uint8_t)(mlen >> 24); |
| 96 | ctx->nonce.c[13] = (u8)(mlen >> 16); | 92 | ctx->nonce.c[13] = (uint8_t)(mlen >> 16); |
| 97 | ctx->nonce.c[14] = (u8)(mlen >> 8); | 93 | ctx->nonce.c[14] = (uint8_t)(mlen >> 8); |
| 98 | ctx->nonce.c[15] = (u8)mlen; | 94 | ctx->nonce.c[15] = (uint8_t)mlen; |
| 99 | 95 | ||
| 100 | ctx->nonce.c[0] &= ~0x40; /* clear Adata flag */ | 96 | ctx->nonce.c[0] &= ~0x40; /* clear Adata flag */ |
| 101 | memcpy(&ctx->nonce.c[1], nonce, 14 - L); | 97 | memcpy(&ctx->nonce.c[1], nonce, 14 - L); |
| @@ -120,29 +116,29 @@ CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx, | |||
| 120 | ctx->blocks++; | 116 | ctx->blocks++; |
| 121 | 117 | ||
| 122 | if (alen < (0x10000 - 0x100)) { | 118 | if (alen < (0x10000 - 0x100)) { |
| 123 | ctx->cmac.c[0] ^= (u8)(alen >> 8); | 119 | ctx->cmac.c[0] ^= (uint8_t)(alen >> 8); |
| 124 | ctx->cmac.c[1] ^= (u8)alen; | 120 | ctx->cmac.c[1] ^= (uint8_t)alen; |
| 125 | i = 2; | 121 | i = 2; |
| 126 | } else if (sizeof(alen) == 8 && | 122 | } else if (sizeof(alen) == 8 && |
| 127 | alen >= (size_t)1 << (32 % (sizeof(alen)*8))) { | 123 | alen >= (size_t)1 << (32 % (sizeof(alen)*8))) { |
| 128 | ctx->cmac.c[0] ^= 0xFF; | 124 | ctx->cmac.c[0] ^= 0xFF; |
| 129 | ctx->cmac.c[1] ^= 0xFF; | 125 | ctx->cmac.c[1] ^= 0xFF; |
| 130 | ctx->cmac.c[2] ^= (u8)(alen >> (56 % (sizeof(alen)*8))); | 126 | ctx->cmac.c[2] ^= (uint8_t)(alen >> (56 % (sizeof(alen)*8))); |
| 131 | ctx->cmac.c[3] ^= (u8)(alen >> (48 % (sizeof(alen)*8))); | 127 | ctx->cmac.c[3] ^= (uint8_t)(alen >> (48 % (sizeof(alen)*8))); |
| 132 | ctx->cmac.c[4] ^= (u8)(alen >> (40 % (sizeof(alen)*8))); | 128 | ctx->cmac.c[4] ^= (uint8_t)(alen >> (40 % (sizeof(alen)*8))); |
| 133 | ctx->cmac.c[5] ^= (u8)(alen >> (32 % (sizeof(alen)*8))); | 129 | ctx->cmac.c[5] ^= (uint8_t)(alen >> (32 % (sizeof(alen)*8))); |
| 134 | ctx->cmac.c[6] ^= (u8)(alen >> 24); | 130 | ctx->cmac.c[6] ^= (uint8_t)(alen >> 24); |
| 135 | ctx->cmac.c[7] ^= (u8)(alen >> 16); | 131 | ctx->cmac.c[7] ^= (uint8_t)(alen >> 16); |
| 136 | ctx->cmac.c[8] ^= (u8)(alen >> 8); | 132 | ctx->cmac.c[8] ^= (uint8_t)(alen >> 8); |
| 137 | ctx->cmac.c[9] ^= (u8)alen; | 133 | ctx->cmac.c[9] ^= (uint8_t)alen; |
| 138 | i = 10; | 134 | i = 10; |
| 139 | } else { | 135 | } else { |
| 140 | ctx->cmac.c[0] ^= 0xFF; | 136 | ctx->cmac.c[0] ^= 0xFF; |
| 141 | ctx->cmac.c[1] ^= 0xFE; | 137 | ctx->cmac.c[1] ^= 0xFE; |
| 142 | ctx->cmac.c[2] ^= (u8)(alen >> 24); | 138 | ctx->cmac.c[2] ^= (uint8_t)(alen >> 24); |
| 143 | ctx->cmac.c[3] ^= (u8)(alen >> 16); | 139 | ctx->cmac.c[3] ^= (uint8_t)(alen >> 16); |
| 144 | ctx->cmac.c[4] ^= (u8)(alen >> 8); | 140 | ctx->cmac.c[4] ^= (uint8_t)(alen >> 8); |
| 145 | ctx->cmac.c[5] ^= (u8)alen; | 141 | ctx->cmac.c[5] ^= (uint8_t)alen; |
| 146 | i = 6; | 142 | i = 6; |
| 147 | } | 143 | } |
| 148 | 144 | ||
| @@ -164,7 +160,7 @@ static void | |||
| 164 | ctr64_inc(unsigned char *counter) | 160 | ctr64_inc(unsigned char *counter) |
| 165 | { | 161 | { |
| 166 | unsigned int n = 8; | 162 | unsigned int n = 8; |
| 167 | u8 c; | 163 | uint8_t c; |
| 168 | 164 | ||
| 169 | counter += 8; | 165 | counter += 8; |
| 170 | do { | 166 | do { |
| @@ -188,8 +184,8 @@ CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, | |||
| 188 | block128_f block = ctx->block; | 184 | block128_f block = ctx->block; |
| 189 | void *key = ctx->key; | 185 | void *key = ctx->key; |
| 190 | union { | 186 | union { |
| 191 | u64 u[2]; | 187 | uint64_t u[2]; |
| 192 | u8 c[16]; | 188 | uint8_t c[16]; |
| 193 | } scratch; | 189 | } scratch; |
| 194 | 190 | ||
| 195 | if (!(flags0 & 0x40)) | 191 | if (!(flags0 & 0x40)) |
| @@ -215,16 +211,16 @@ CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, | |||
| 215 | while (len >= 16) { | 211 | while (len >= 16) { |
| 216 | #ifdef __STRICT_ALIGNMENT | 212 | #ifdef __STRICT_ALIGNMENT |
| 217 | union { | 213 | union { |
| 218 | u64 u[2]; | 214 | uint64_t u[2]; |
| 219 | u8 c[16]; | 215 | uint8_t c[16]; |
| 220 | } temp; | 216 | } temp; |
| 221 | 217 | ||
| 222 | memcpy(temp.c, inp, 16); | 218 | memcpy(temp.c, inp, 16); |
| 223 | ctx->cmac.u[0] ^= temp.u[0]; | 219 | ctx->cmac.u[0] ^= temp.u[0]; |
| 224 | ctx->cmac.u[1] ^= temp.u[1]; | 220 | ctx->cmac.u[1] ^= temp.u[1]; |
| 225 | #else | 221 | #else |
| 226 | ctx->cmac.u[0] ^= ((u64 *)inp)[0]; | 222 | ctx->cmac.u[0] ^= ((uint64_t *)inp)[0]; |
| 227 | ctx->cmac.u[1] ^= ((u64 *)inp)[1]; | 223 | ctx->cmac.u[1] ^= ((uint64_t *)inp)[1]; |
| 228 | #endif | 224 | #endif |
| 229 | (*block)(ctx->cmac.c, ctx->cmac.c, key); | 225 | (*block)(ctx->cmac.c, ctx->cmac.c, key); |
| 230 | (*block)(ctx->nonce.c, scratch.c, key); | 226 | (*block)(ctx->nonce.c, scratch.c, key); |
| @@ -234,8 +230,8 @@ CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, | |||
| 234 | temp.u[1] ^= scratch.u[1]; | 230 | temp.u[1] ^= scratch.u[1]; |
| 235 | memcpy(out, temp.c, 16); | 231 | memcpy(out, temp.c, 16); |
| 236 | #else | 232 | #else |
| 237 | ((u64 *)out)[0] = scratch.u[0] ^ ((u64 *)inp)[0]; | 233 | ((uint64_t *)out)[0] = scratch.u[0] ^ ((uint64_t *)inp)[0]; |
| 238 | ((u64 *)out)[1] = scratch.u[1] ^ ((u64 *)inp)[1]; | 234 | ((uint64_t *)out)[1] = scratch.u[1] ^ ((uint64_t *)inp)[1]; |
| 239 | #endif | 235 | #endif |
| 240 | inp += 16; | 236 | inp += 16; |
| 241 | out += 16; | 237 | out += 16; |
| @@ -275,8 +271,8 @@ CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, | |||
| 275 | block128_f block = ctx->block; | 271 | block128_f block = ctx->block; |
| 276 | void *key = ctx->key; | 272 | void *key = ctx->key; |
| 277 | union { | 273 | union { |
| 278 | u64 u[2]; | 274 | uint64_t u[2]; |
| 279 | u8 c[16]; | 275 | uint8_t c[16]; |
| 280 | } scratch; | 276 | } scratch; |
| 281 | 277 | ||
| 282 | if (!(flags0 & 0x40)) | 278 | if (!(flags0 & 0x40)) |
| @@ -297,8 +293,8 @@ CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, | |||
| 297 | while (len >= 16) { | 293 | while (len >= 16) { |
| 298 | #ifdef __STRICT_ALIGNMENT | 294 | #ifdef __STRICT_ALIGNMENT |
| 299 | union { | 295 | union { |
| 300 | u64 u[2]; | 296 | uint64_t u[2]; |
| 301 | u8 c[16]; | 297 | uint8_t c[16]; |
| 302 | } temp; | 298 | } temp; |
| 303 | #endif | 299 | #endif |
| 304 | (*block)(ctx->nonce.c, scratch.c, key); | 300 | (*block)(ctx->nonce.c, scratch.c, key); |
| @@ -309,10 +305,10 @@ CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, | |||
| 309 | ctx->cmac.u[1] ^= (scratch.u[1] ^= temp.u[1]); | 305 | ctx->cmac.u[1] ^= (scratch.u[1] ^= temp.u[1]); |
| 310 | memcpy(out, scratch.c, 16); | 306 | memcpy(out, scratch.c, 16); |
| 311 | #else | 307 | #else |
| 312 | ctx->cmac.u[0] ^= (((u64 *)out)[0] = scratch.u[0] ^ | 308 | ctx->cmac.u[0] ^= (((uint64_t *)out)[0] = scratch.u[0] ^ |
| 313 | ((u64 *)inp)[0]); | 309 | ((uint64_t *)inp)[0]); |
| 314 | ctx->cmac.u[1] ^= (((u64 *)out)[1] = scratch.u[1] ^ | 310 | ctx->cmac.u[1] ^= (((uint64_t *)out)[1] = scratch.u[1] ^ |
| 315 | ((u64 *)inp)[1]); | 311 | ((uint64_t *)inp)[1]); |
| 316 | #endif | 312 | #endif |
| 317 | (*block)(ctx->cmac.c, ctx->cmac.c, key); | 313 | (*block)(ctx->cmac.c, ctx->cmac.c, key); |
| 318 | 314 | ||
| @@ -367,8 +363,8 @@ CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx, | |||
| 367 | block128_f block = ctx->block; | 363 | block128_f block = ctx->block; |
| 368 | void *key = ctx->key; | 364 | void *key = ctx->key; |
| 369 | union { | 365 | union { |
| 370 | u64 u[2]; | 366 | uint64_t u[2]; |
| 371 | u8 c[16]; | 367 | uint8_t c[16]; |
| 372 | } scratch; | 368 | } scratch; |
| 373 | 369 | ||
| 374 | if (!(flags0 & 0x40)) | 370 | if (!(flags0 & 0x40)) |
| @@ -434,8 +430,8 @@ CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, | |||
| 434 | block128_f block = ctx->block; | 430 | block128_f block = ctx->block; |
| 435 | void *key = ctx->key; | 431 | void *key = ctx->key; |
| 436 | union { | 432 | union { |
| 437 | u64 u[2]; | 433 | uint64_t u[2]; |
| 438 | u8 c[16]; | 434 | uint8_t c[16]; |
| 439 | } scratch; | 435 | } scratch; |
| 440 | 436 | ||
| 441 | if (!(flags0 & 0x40)) | 437 | if (!(flags0 & 0x40)) |
diff --git a/src/lib/libcrypto/modes/cfb128.c b/src/lib/libcrypto/modes/cfb128.c index 931353a620..9a63a46724 100644 --- a/src/lib/libcrypto/modes/cfb128.c +++ b/src/lib/libcrypto/modes/cfb128.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cfb128.c,v 1.7 2023/07/08 14:56:54 beck Exp $ */ | 1 | /* $OpenBSD: cfb128.c,v 1.10 2025/04/23 10:09:08 jsing Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 2008 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2008 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -49,15 +49,11 @@ | |||
| 49 | * | 49 | * |
| 50 | */ | 50 | */ |
| 51 | 51 | ||
| 52 | #include <openssl/crypto.h> | ||
| 53 | #include "modes_local.h" | ||
| 54 | #include <string.h> | 52 | #include <string.h> |
| 55 | 53 | ||
| 56 | #ifndef MODES_DEBUG | 54 | #include <openssl/crypto.h> |
| 57 | # ifndef NDEBUG | 55 | |
| 58 | # define NDEBUG | 56 | #include "modes_local.h" |
| 59 | # endif | ||
| 60 | #endif | ||
| 61 | 57 | ||
| 62 | /* The input and output encrypted as though 128bit cfb mode is being | 58 | /* The input and output encrypted as though 128bit cfb mode is being |
| 63 | * used. The extra state information to record how much of the | 59 | * used. The extra state information to record how much of the |
| @@ -75,7 +71,6 @@ CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, | |||
| 75 | n = *num; | 71 | n = *num; |
| 76 | 72 | ||
| 77 | if (enc) { | 73 | if (enc) { |
| 78 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | ||
| 79 | if (16 % sizeof(size_t) == 0) | 74 | if (16 % sizeof(size_t) == 0) |
| 80 | do { /* always true actually */ | 75 | do { /* always true actually */ |
| 81 | while (n && len) { | 76 | while (n && len) { |
| @@ -111,7 +106,6 @@ CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, | |||
| 111 | return; | 106 | return; |
| 112 | } while (0); | 107 | } while (0); |
| 113 | /* the rest would be commonly eliminated by x86* compiler */ | 108 | /* the rest would be commonly eliminated by x86* compiler */ |
| 114 | #endif | ||
| 115 | while (l < len) { | 109 | while (l < len) { |
| 116 | if (n == 0) { | 110 | if (n == 0) { |
| 117 | (*block)(ivec, ivec, key); | 111 | (*block)(ivec, ivec, key); |
| @@ -122,7 +116,6 @@ CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, | |||
| 122 | } | 116 | } |
| 123 | *num = n; | 117 | *num = n; |
| 124 | } else { | 118 | } else { |
| 125 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | ||
| 126 | if (16 % sizeof(size_t) == 0) | 119 | if (16 % sizeof(size_t) == 0) |
| 127 | do { /* always true actually */ | 120 | do { /* always true actually */ |
| 128 | while (n && len) { | 121 | while (n && len) { |
| @@ -163,7 +156,6 @@ CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, | |||
| 163 | return; | 156 | return; |
| 164 | } while (0); | 157 | } while (0); |
| 165 | /* the rest would be commonly eliminated by x86* compiler */ | 158 | /* the rest would be commonly eliminated by x86* compiler */ |
| 166 | #endif | ||
| 167 | while (l < len) { | 159 | while (l < len) { |
| 168 | unsigned char c; | 160 | unsigned char c; |
| 169 | if (n == 0) { | 161 | if (n == 0) { |
diff --git a/src/lib/libcrypto/modes/ctr128.c b/src/lib/libcrypto/modes/ctr128.c index 6d507dfc3a..87d9abb355 100644 --- a/src/lib/libcrypto/modes/ctr128.c +++ b/src/lib/libcrypto/modes/ctr128.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ctr128.c,v 1.11 2023/07/08 14:56:54 beck Exp $ */ | 1 | /* $OpenBSD: ctr128.c,v 1.18 2025/05/18 09:05:59 jsing Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 2008 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2008 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -49,16 +49,12 @@ | |||
| 49 | * | 49 | * |
| 50 | */ | 50 | */ |
| 51 | 51 | ||
| 52 | #include <openssl/crypto.h> | ||
| 53 | #include "modes_local.h" | ||
| 54 | #include <string.h> | 52 | #include <string.h> |
| 55 | 53 | ||
| 56 | #ifndef MODES_DEBUG | 54 | #include <openssl/crypto.h> |
| 57 | # ifndef NDEBUG | 55 | |
| 58 | # define NDEBUG | 56 | #include "crypto_internal.h" |
| 59 | # endif | 57 | #include "modes_local.h" |
| 60 | #endif | ||
| 61 | #include <assert.h> | ||
| 62 | 58 | ||
| 63 | /* NOTE: the IV/counter CTR mode is big-endian. The code itself | 59 | /* NOTE: the IV/counter CTR mode is big-endian. The code itself |
| 64 | * is endian-neutral. */ | 60 | * is endian-neutral. */ |
| @@ -67,8 +63,8 @@ | |||
| 67 | static void | 63 | static void |
| 68 | ctr128_inc(unsigned char *counter) | 64 | ctr128_inc(unsigned char *counter) |
| 69 | { | 65 | { |
| 70 | u32 n = 16; | 66 | uint32_t n = 16; |
| 71 | u8 c; | 67 | uint8_t c; |
| 72 | 68 | ||
| 73 | do { | 69 | do { |
| 74 | --n; | 70 | --n; |
| @@ -80,7 +76,6 @@ ctr128_inc(unsigned char *counter) | |||
| 80 | } while (n); | 76 | } while (n); |
| 81 | } | 77 | } |
| 82 | 78 | ||
| 83 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | ||
| 84 | static void | 79 | static void |
| 85 | ctr128_inc_aligned(unsigned char *counter) | 80 | ctr128_inc_aligned(unsigned char *counter) |
| 86 | { | 81 | { |
| @@ -100,7 +95,6 @@ ctr128_inc_aligned(unsigned char *counter) | |||
| 100 | } while (n); | 95 | } while (n); |
| 101 | #endif | 96 | #endif |
| 102 | } | 97 | } |
| 103 | #endif | ||
| 104 | 98 | ||
| 105 | /* The input encrypted as though 128bit counter mode is being | 99 | /* The input encrypted as though 128bit counter mode is being |
| 106 | * used. The extra state information to record how much of the | 100 | * used. The extra state information to record how much of the |
| @@ -121,14 +115,11 @@ CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, | |||
| 121 | unsigned char ivec[16], unsigned char ecount_buf[16], | 115 | unsigned char ivec[16], unsigned char ecount_buf[16], |
| 122 | unsigned int *num, block128_f block) | 116 | unsigned int *num, block128_f block) |
| 123 | { | 117 | { |
| 124 | unsigned int n; | 118 | unsigned int n = *num; |
| 125 | size_t l = 0; | 119 | size_t l = 0; |
| 126 | 120 | ||
| 127 | assert(*num < 16); | 121 | OPENSSL_assert(n < 16); |
| 128 | |||
| 129 | n = *num; | ||
| 130 | 122 | ||
| 131 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | ||
| 132 | if (16 % sizeof(size_t) == 0) | 123 | if (16 % sizeof(size_t) == 0) |
| 133 | do { /* always true actually */ | 124 | do { /* always true actually */ |
| 134 | while (n && len) { | 125 | while (n && len) { |
| @@ -166,7 +157,6 @@ CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, | |||
| 166 | return; | 157 | return; |
| 167 | } while (0); | 158 | } while (0); |
| 168 | /* the rest would be commonly eliminated by x86* compiler */ | 159 | /* the rest would be commonly eliminated by x86* compiler */ |
| 169 | #endif | ||
| 170 | while (l < len) { | 160 | while (l < len) { |
| 171 | if (n == 0) { | 161 | if (n == 0) { |
| 172 | (*block)(ivec, ecount_buf, key); | 162 | (*block)(ivec, ecount_buf, key); |
| @@ -185,8 +175,8 @@ LCRYPTO_ALIAS(CRYPTO_ctr128_encrypt); | |||
| 185 | static void | 175 | static void |
| 186 | ctr96_inc(unsigned char *counter) | 176 | ctr96_inc(unsigned char *counter) |
| 187 | { | 177 | { |
| 188 | u32 n = 12; | 178 | uint32_t n = 12; |
| 189 | u8 c; | 179 | uint8_t c; |
| 190 | 180 | ||
| 191 | do { | 181 | do { |
| 192 | --n; | 182 | --n; |
| @@ -204,11 +194,10 @@ CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out, | |||
| 204 | unsigned char ivec[16], unsigned char ecount_buf[16], | 194 | unsigned char ivec[16], unsigned char ecount_buf[16], |
| 205 | unsigned int *num, ctr128_f func) | 195 | unsigned int *num, ctr128_f func) |
| 206 | { | 196 | { |
| 207 | unsigned int n, ctr32; | 197 | unsigned int n = *num; |
| 198 | unsigned int ctr32; | ||
| 208 | 199 | ||
| 209 | assert(*num < 16); | 200 | OPENSSL_assert(n < 16); |
| 210 | |||
| 211 | n = *num; | ||
| 212 | 201 | ||
| 213 | while (n && len) { | 202 | while (n && len) { |
| 214 | *(out++) = *(in++) ^ ecount_buf[n]; | 203 | *(out++) = *(in++) ^ ecount_buf[n]; |
| @@ -216,7 +205,8 @@ CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out, | |||
| 216 | n = (n + 1) % 16; | 205 | n = (n + 1) % 16; |
| 217 | } | 206 | } |
| 218 | 207 | ||
| 219 | ctr32 = GETU32(ivec + 12); | 208 | ctr32 = crypto_load_be32toh(&ivec[12]); |
| 209 | |||
| 220 | while (len >= 16) { | 210 | while (len >= 16) { |
| 221 | size_t blocks = len/16; | 211 | size_t blocks = len/16; |
| 222 | /* | 212 | /* |
| @@ -233,14 +223,14 @@ CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out, | |||
| 233 | * overflow, which is then handled by limiting the | 223 | * overflow, which is then handled by limiting the |
| 234 | * amount of blocks to the exact overflow point... | 224 | * amount of blocks to the exact overflow point... |
| 235 | */ | 225 | */ |
| 236 | ctr32 += (u32)blocks; | 226 | ctr32 += (uint32_t)blocks; |
| 237 | if (ctr32 < blocks) { | 227 | if (ctr32 < blocks) { |
| 238 | blocks -= ctr32; | 228 | blocks -= ctr32; |
| 239 | ctr32 = 0; | 229 | ctr32 = 0; |
| 240 | } | 230 | } |
| 241 | (*func)(in, out, blocks, key, ivec); | 231 | (*func)(in, out, blocks, key, ivec); |
| 242 | /* (*ctr) does not update ivec, caller does: */ | 232 | /* (*ctr) does not update ivec, caller does: */ |
| 243 | PUTU32(ivec + 12, ctr32); | 233 | crypto_store_htobe32(&ivec[12], ctr32); |
| 244 | /* ... overflow was detected, propagate carry. */ | 234 | /* ... overflow was detected, propagate carry. */ |
| 245 | if (ctr32 == 0) | 235 | if (ctr32 == 0) |
| 246 | ctr96_inc(ivec); | 236 | ctr96_inc(ivec); |
| @@ -253,7 +243,7 @@ CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out, | |||
| 253 | memset(ecount_buf, 0, 16); | 243 | memset(ecount_buf, 0, 16); |
| 254 | (*func)(ecount_buf, ecount_buf, 1, key, ivec); | 244 | (*func)(ecount_buf, ecount_buf, 1, key, ivec); |
| 255 | ++ctr32; | 245 | ++ctr32; |
| 256 | PUTU32(ivec + 12, ctr32); | 246 | crypto_store_htobe32(&ivec[12], ctr32); |
| 257 | if (ctr32 == 0) | 247 | if (ctr32 == 0) |
| 258 | ctr96_inc(ivec); | 248 | ctr96_inc(ivec); |
| 259 | while (len--) { | 249 | while (len--) { |
diff --git a/src/lib/libcrypto/modes/gcm128.c b/src/lib/libcrypto/modes/gcm128.c index 6c89bd44b7..a88f589b00 100644 --- a/src/lib/libcrypto/modes/gcm128.c +++ b/src/lib/libcrypto/modes/gcm128.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: gcm128.c,v 1.27 2024/09/06 09:57:32 tb Exp $ */ | 1 | /* $OpenBSD: gcm128.c,v 1.55 2026/01/17 14:30:37 jsing Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 2010 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2010 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -48,293 +48,62 @@ | |||
| 48 | * ==================================================================== | 48 | * ==================================================================== |
| 49 | */ | 49 | */ |
| 50 | 50 | ||
| 51 | #define OPENSSL_FIPSAPI | ||
| 52 | |||
| 53 | #include <string.h> | 51 | #include <string.h> |
| 54 | 52 | ||
| 55 | #include <openssl/crypto.h> | 53 | #include <openssl/crypto.h> |
| 56 | 54 | ||
| 55 | #include "crypto_arch.h" | ||
| 57 | #include "crypto_internal.h" | 56 | #include "crypto_internal.h" |
| 58 | #include "modes_local.h" | 57 | #include "modes_local.h" |
| 59 | 58 | ||
| 60 | #ifndef MODES_DEBUG | 59 | void |
| 61 | # ifndef NDEBUG | 60 | gcm_init_4bit(u128 Htable[16], uint64_t H[2]) |
| 62 | # define NDEBUG | ||
| 63 | # endif | ||
| 64 | #endif | ||
| 65 | |||
| 66 | #if defined(BSWAP4) && defined(__STRICT_ALIGNMENT) | ||
| 67 | /* redefine, because alignment is ensured */ | ||
| 68 | #undef GETU32 | ||
| 69 | #define GETU32(p) BSWAP4(*(const u32 *)(p)) | ||
| 70 | #endif | ||
| 71 | |||
| 72 | #define PACK(s) ((size_t)(s)<<(sizeof(size_t)*8-16)) | ||
| 73 | #define REDUCE1BIT(V) \ | ||
| 74 | do { \ | ||
| 75 | if (sizeof(size_t)==8) { \ | ||
| 76 | u64 T = U64(0xe100000000000000) & (0-(V.lo&1)); \ | ||
| 77 | V.lo = (V.hi<<63)|(V.lo>>1); \ | ||
| 78 | V.hi = (V.hi>>1 )^T; \ | ||
| 79 | } else { \ | ||
| 80 | u32 T = 0xe1000000U & (0-(u32)(V.lo&1)); \ | ||
| 81 | V.lo = (V.hi<<63)|(V.lo>>1); \ | ||
| 82 | V.hi = (V.hi>>1 )^((u64)T<<32); \ | ||
| 83 | } \ | ||
| 84 | } while(0) | ||
| 85 | |||
| 86 | /* | ||
| 87 | * Even though permitted values for TABLE_BITS are 8, 4 and 1, it should | ||
| 88 | * never be set to 8. 8 is effectively reserved for testing purposes. | ||
| 89 | * TABLE_BITS>1 are lookup-table-driven implementations referred to as | ||
| 90 | * "Shoup's" in GCM specification. In other words OpenSSL does not cover | ||
| 91 | * whole spectrum of possible table driven implementations. Why? In | ||
| 92 | * non-"Shoup's" case memory access pattern is segmented in such manner, | ||
| 93 | * that it's trivial to see that cache timing information can reveal | ||
| 94 | * fair portion of intermediate hash value. Given that ciphertext is | ||
| 95 | * always available to attacker, it's possible for him to attempt to | ||
| 96 | * deduce secret parameter H and if successful, tamper with messages | ||
| 97 | * [which is nothing but trivial in CTR mode]. In "Shoup's" case it's | ||
| 98 | * not as trivial, but there is no reason to believe that it's resistant | ||
| 99 | * to cache-timing attack. And the thing about "8-bit" implementation is | ||
| 100 | * that it consumes 16 (sixteen) times more memory, 4KB per individual | ||
| 101 | * key + 1KB shared. Well, on pros side it should be twice as fast as | ||
| 102 | * "4-bit" version. And for gcc-generated x86[_64] code, "8-bit" version | ||
| 103 | * was observed to run ~75% faster, closer to 100% for commercial | ||
| 104 | * compilers... Yet "4-bit" procedure is preferred, because it's | ||
| 105 | * believed to provide better security-performance balance and adequate | ||
| 106 | * all-round performance. "All-round" refers to things like: | ||
| 107 | * | ||
| 108 | * - shorter setup time effectively improves overall timing for | ||
| 109 | * handling short messages; | ||
| 110 | * - larger table allocation can become unbearable because of VM | ||
| 111 | * subsystem penalties (for example on Windows large enough free | ||
| 112 | * results in VM working set trimming, meaning that consequent | ||
| 113 | * malloc would immediately incur working set expansion); | ||
| 114 | * - larger table has larger cache footprint, which can affect | ||
| 115 | * performance of other code paths (not necessarily even from same | ||
| 116 | * thread in Hyper-Threading world); | ||
| 117 | * | ||
| 118 | * Value of 1 is not appropriate for performance reasons. | ||
| 119 | */ | ||
| 120 | #if TABLE_BITS==8 | ||
| 121 | |||
| 122 | static void | ||
| 123 | gcm_init_8bit(u128 Htable[256], u64 H[2]) | ||
| 124 | { | ||
| 125 | int i, j; | ||
| 126 | u128 V; | ||
| 127 | |||
| 128 | Htable[0].hi = 0; | ||
| 129 | Htable[0].lo = 0; | ||
| 130 | V.hi = H[0]; | ||
| 131 | V.lo = H[1]; | ||
| 132 | |||
| 133 | for (Htable[128] = V, i = 64; i > 0; i >>= 1) { | ||
| 134 | REDUCE1BIT(V); | ||
| 135 | Htable[i] = V; | ||
| 136 | } | ||
| 137 | |||
| 138 | for (i = 2; i < 256; i <<= 1) { | ||
| 139 | u128 *Hi = Htable + i, H0 = *Hi; | ||
| 140 | for (j = 1; j < i; ++j) { | ||
| 141 | Hi[j].hi = H0.hi ^ Htable[j].hi; | ||
| 142 | Hi[j].lo = H0.lo ^ Htable[j].lo; | ||
| 143 | } | ||
| 144 | } | ||
| 145 | } | ||
| 146 | |||
| 147 | static void | ||
| 148 | gcm_gmult_8bit(u64 Xi[2], const u128 Htable[256]) | ||
| 149 | { | ||
| 150 | u128 Z = { 0, 0}; | ||
| 151 | const u8 *xi = (const u8 *)Xi + 15; | ||
| 152 | size_t rem, n = *xi; | ||
| 153 | static const size_t rem_8bit[256] = { | ||
| 154 | PACK(0x0000), PACK(0x01C2), PACK(0x0384), PACK(0x0246), | ||
| 155 | PACK(0x0708), PACK(0x06CA), PACK(0x048C), PACK(0x054E), | ||
| 156 | PACK(0x0E10), PACK(0x0FD2), PACK(0x0D94), PACK(0x0C56), | ||
| 157 | PACK(0x0918), PACK(0x08DA), PACK(0x0A9C), PACK(0x0B5E), | ||
| 158 | PACK(0x1C20), PACK(0x1DE2), PACK(0x1FA4), PACK(0x1E66), | ||
| 159 | PACK(0x1B28), PACK(0x1AEA), PACK(0x18AC), PACK(0x196E), | ||
| 160 | PACK(0x1230), PACK(0x13F2), PACK(0x11B4), PACK(0x1076), | ||
| 161 | PACK(0x1538), PACK(0x14FA), PACK(0x16BC), PACK(0x177E), | ||
| 162 | PACK(0x3840), PACK(0x3982), PACK(0x3BC4), PACK(0x3A06), | ||
| 163 | PACK(0x3F48), PACK(0x3E8A), PACK(0x3CCC), PACK(0x3D0E), | ||
| 164 | PACK(0x3650), PACK(0x3792), PACK(0x35D4), PACK(0x3416), | ||
| 165 | PACK(0x3158), PACK(0x309A), PACK(0x32DC), PACK(0x331E), | ||
| 166 | PACK(0x2460), PACK(0x25A2), PACK(0x27E4), PACK(0x2626), | ||
| 167 | PACK(0x2368), PACK(0x22AA), PACK(0x20EC), PACK(0x212E), | ||
| 168 | PACK(0x2A70), PACK(0x2BB2), PACK(0x29F4), PACK(0x2836), | ||
| 169 | PACK(0x2D78), PACK(0x2CBA), PACK(0x2EFC), PACK(0x2F3E), | ||
| 170 | PACK(0x7080), PACK(0x7142), PACK(0x7304), PACK(0x72C6), | ||
| 171 | PACK(0x7788), PACK(0x764A), PACK(0x740C), PACK(0x75CE), | ||
| 172 | PACK(0x7E90), PACK(0x7F52), PACK(0x7D14), PACK(0x7CD6), | ||
| 173 | PACK(0x7998), PACK(0x785A), PACK(0x7A1C), PACK(0x7BDE), | ||
| 174 | PACK(0x6CA0), PACK(0x6D62), PACK(0x6F24), PACK(0x6EE6), | ||
| 175 | PACK(0x6BA8), PACK(0x6A6A), PACK(0x682C), PACK(0x69EE), | ||
| 176 | PACK(0x62B0), PACK(0x6372), PACK(0x6134), PACK(0x60F6), | ||
| 177 | PACK(0x65B8), PACK(0x647A), PACK(0x663C), PACK(0x67FE), | ||
| 178 | PACK(0x48C0), PACK(0x4902), PACK(0x4B44), PACK(0x4A86), | ||
| 179 | PACK(0x4FC8), PACK(0x4E0A), PACK(0x4C4C), PACK(0x4D8E), | ||
| 180 | PACK(0x46D0), PACK(0x4712), PACK(0x4554), PACK(0x4496), | ||
| 181 | PACK(0x41D8), PACK(0x401A), PACK(0x425C), PACK(0x439E), | ||
| 182 | PACK(0x54E0), PACK(0x5522), PACK(0x5764), PACK(0x56A6), | ||
| 183 | PACK(0x53E8), PACK(0x522A), PACK(0x506C), PACK(0x51AE), | ||
| 184 | PACK(0x5AF0), PACK(0x5B32), PACK(0x5974), PACK(0x58B6), | ||
| 185 | PACK(0x5DF8), PACK(0x5C3A), PACK(0x5E7C), PACK(0x5FBE), | ||
| 186 | PACK(0xE100), PACK(0xE0C2), PACK(0xE284), PACK(0xE346), | ||
| 187 | PACK(0xE608), PACK(0xE7CA), PACK(0xE58C), PACK(0xE44E), | ||
| 188 | PACK(0xEF10), PACK(0xEED2), PACK(0xEC94), PACK(0xED56), | ||
| 189 | PACK(0xE818), PACK(0xE9DA), PACK(0xEB9C), PACK(0xEA5E), | ||
| 190 | PACK(0xFD20), PACK(0xFCE2), PACK(0xFEA4), PACK(0xFF66), | ||
| 191 | PACK(0xFA28), PACK(0xFBEA), PACK(0xF9AC), PACK(0xF86E), | ||
| 192 | PACK(0xF330), PACK(0xF2F2), PACK(0xF0B4), PACK(0xF176), | ||
| 193 | PACK(0xF438), PACK(0xF5FA), PACK(0xF7BC), PACK(0xF67E), | ||
| 194 | PACK(0xD940), PACK(0xD882), PACK(0xDAC4), PACK(0xDB06), | ||
| 195 | PACK(0xDE48), PACK(0xDF8A), PACK(0xDDCC), PACK(0xDC0E), | ||
| 196 | PACK(0xD750), PACK(0xD692), PACK(0xD4D4), PACK(0xD516), | ||
| 197 | PACK(0xD058), PACK(0xD19A), PACK(0xD3DC), PACK(0xD21E), | ||
| 198 | PACK(0xC560), PACK(0xC4A2), PACK(0xC6E4), PACK(0xC726), | ||
| 199 | PACK(0xC268), PACK(0xC3AA), PACK(0xC1EC), PACK(0xC02E), | ||
| 200 | PACK(0xCB70), PACK(0xCAB2), PACK(0xC8F4), PACK(0xC936), | ||
| 201 | PACK(0xCC78), PACK(0xCDBA), PACK(0xCFFC), PACK(0xCE3E), | ||
| 202 | PACK(0x9180), PACK(0x9042), PACK(0x9204), PACK(0x93C6), | ||
| 203 | PACK(0x9688), PACK(0x974A), PACK(0x950C), PACK(0x94CE), | ||
| 204 | PACK(0x9F90), PACK(0x9E52), PACK(0x9C14), PACK(0x9DD6), | ||
| 205 | PACK(0x9898), PACK(0x995A), PACK(0x9B1C), PACK(0x9ADE), | ||
| 206 | PACK(0x8DA0), PACK(0x8C62), PACK(0x8E24), PACK(0x8FE6), | ||
| 207 | PACK(0x8AA8), PACK(0x8B6A), PACK(0x892C), PACK(0x88EE), | ||
| 208 | PACK(0x83B0), PACK(0x8272), PACK(0x8034), PACK(0x81F6), | ||
| 209 | PACK(0x84B8), PACK(0x857A), PACK(0x873C), PACK(0x86FE), | ||
| 210 | PACK(0xA9C0), PACK(0xA802), PACK(0xAA44), PACK(0xAB86), | ||
| 211 | PACK(0xAEC8), PACK(0xAF0A), PACK(0xAD4C), PACK(0xAC8E), | ||
| 212 | PACK(0xA7D0), PACK(0xA612), PACK(0xA454), PACK(0xA596), | ||
| 213 | PACK(0xA0D8), PACK(0xA11A), PACK(0xA35C), PACK(0xA29E), | ||
| 214 | PACK(0xB5E0), PACK(0xB422), PACK(0xB664), PACK(0xB7A6), | ||
| 215 | PACK(0xB2E8), PACK(0xB32A), PACK(0xB16C), PACK(0xB0AE), | ||
| 216 | PACK(0xBBF0), PACK(0xBA32), PACK(0xB874), PACK(0xB9B6), | ||
| 217 | PACK(0xBCF8), PACK(0xBD3A), PACK(0xBF7C), PACK(0xBEBE) }; | ||
| 218 | |||
| 219 | while (1) { | ||
| 220 | Z.hi ^= Htable[n].hi; | ||
| 221 | Z.lo ^= Htable[n].lo; | ||
| 222 | |||
| 223 | if ((u8 *)Xi == xi) | ||
| 224 | break; | ||
| 225 | |||
| 226 | n = *(--xi); | ||
| 227 | |||
| 228 | rem = (size_t)Z.lo & 0xff; | ||
| 229 | Z.lo = (Z.hi << 56)|(Z.lo >> 8); | ||
| 230 | Z.hi = (Z.hi >> 8); | ||
| 231 | #if SIZE_MAX == 0xffffffffffffffff | ||
| 232 | Z.hi ^= rem_8bit[rem]; | ||
| 233 | #else | ||
| 234 | Z.hi ^= (u64)rem_8bit[rem] << 32; | ||
| 235 | #endif | ||
| 236 | } | ||
| 237 | |||
| 238 | Xi[0] = htobe64(Z.hi); | ||
| 239 | Xi[1] = htobe64(Z.lo); | ||
| 240 | } | ||
| 241 | #define GCM_MUL(ctx,Xi) gcm_gmult_8bit(ctx->Xi.u,ctx->Htable) | ||
| 242 | |||
| 243 | #elif TABLE_BITS==4 | ||
| 244 | |||
| 245 | static void | ||
| 246 | gcm_init_4bit(u128 Htable[16], u64 H[2]) | ||
| 247 | { | 61 | { |
| 248 | u128 V; | 62 | u128 V; |
| 249 | #if defined(OPENSSL_SMALL_FOOTPRINT) | 63 | uint64_t T; |
| 250 | int i; | 64 | int i; |
| 251 | #endif | ||
| 252 | 65 | ||
| 253 | Htable[0].hi = 0; | 66 | Htable[0].hi = 0; |
| 254 | Htable[0].lo = 0; | 67 | Htable[0].lo = 0; |
| 255 | V.hi = H[0]; | 68 | V.hi = H[0]; |
| 256 | V.lo = H[1]; | 69 | V.lo = H[1]; |
| 257 | 70 | ||
| 258 | #if defined(OPENSSL_SMALL_FOOTPRINT) | ||
| 259 | for (Htable[8] = V, i = 4; i > 0; i >>= 1) { | 71 | for (Htable[8] = V, i = 4; i > 0; i >>= 1) { |
| 260 | REDUCE1BIT(V); | 72 | T = U64(0xe100000000000000) & (0 - (V.lo & 1)); |
| 73 | V.lo = (V.hi << 63) | (V.lo >> 1); | ||
| 74 | V.hi = (V.hi >> 1 ) ^ T; | ||
| 261 | Htable[i] = V; | 75 | Htable[i] = V; |
| 262 | } | 76 | } |
| 263 | 77 | ||
| 264 | for (i = 2; i < 16; i <<= 1) { | 78 | for (i = 2; i < 16; i <<= 1) { |
| 265 | u128 *Hi = Htable + i; | 79 | u128 *Hi = Htable + i; |
| 266 | int j; | 80 | int j; |
| 267 | for (V = *Hi, j = 1; j < i; ++j) { | 81 | for (V = *Hi, j = 1; j < i; j++) { |
| 268 | Hi[j].hi = V.hi ^ Htable[j].hi; | 82 | Hi[j].hi = V.hi ^ Htable[j].hi; |
| 269 | Hi[j].lo = V.lo ^ Htable[j].lo; | 83 | Hi[j].lo = V.lo ^ Htable[j].lo; |
| 270 | } | 84 | } |
| 271 | } | 85 | } |
| 272 | #else | ||
| 273 | Htable[8] = V; | ||
| 274 | REDUCE1BIT(V); | ||
| 275 | Htable[4] = V; | ||
| 276 | REDUCE1BIT(V); | ||
| 277 | Htable[2] = V; | ||
| 278 | REDUCE1BIT(V); | ||
| 279 | Htable[1] = V; | ||
| 280 | Htable[3].hi = V.hi ^ Htable[2].hi, Htable[3].lo = V.lo ^ Htable[2].lo; | ||
| 281 | V = Htable[4]; | ||
| 282 | Htable[5].hi = V.hi ^ Htable[1].hi, Htable[5].lo = V.lo ^ Htable[1].lo; | ||
| 283 | Htable[6].hi = V.hi ^ Htable[2].hi, Htable[6].lo = V.lo ^ Htable[2].lo; | ||
| 284 | Htable[7].hi = V.hi ^ Htable[3].hi, Htable[7].lo = V.lo ^ Htable[3].lo; | ||
| 285 | V = Htable[8]; | ||
| 286 | Htable[9].hi = V.hi ^ Htable[1].hi, Htable[9].lo = V.lo ^ Htable[1].lo; | ||
| 287 | Htable[10].hi = V.hi ^ Htable[2].hi, | ||
| 288 | Htable[10].lo = V.lo ^ Htable[2].lo; | ||
| 289 | Htable[11].hi = V.hi ^ Htable[3].hi, | ||
| 290 | Htable[11].lo = V.lo ^ Htable[3].lo; | ||
| 291 | Htable[12].hi = V.hi ^ Htable[4].hi, | ||
| 292 | Htable[12].lo = V.lo ^ Htable[4].lo; | ||
| 293 | Htable[13].hi = V.hi ^ Htable[5].hi, | ||
| 294 | Htable[13].lo = V.lo ^ Htable[5].lo; | ||
| 295 | Htable[14].hi = V.hi ^ Htable[6].hi, | ||
| 296 | Htable[14].lo = V.lo ^ Htable[6].lo; | ||
| 297 | Htable[15].hi = V.hi ^ Htable[7].hi, | ||
| 298 | Htable[15].lo = V.lo ^ Htable[7].lo; | ||
| 299 | #endif | ||
| 300 | #if defined(GHASH_ASM) && (defined(__arm__) || defined(__arm)) | ||
| 301 | /* | ||
| 302 | * ARM assembler expects specific dword order in Htable. | ||
| 303 | */ | ||
| 304 | { | ||
| 305 | int j; | ||
| 306 | #if BYTE_ORDER == LITTLE_ENDIAN | ||
| 307 | for (j = 0; j < 16; ++j) { | ||
| 308 | V = Htable[j]; | ||
| 309 | Htable[j].hi = V.lo; | ||
| 310 | Htable[j].lo = V.hi; | ||
| 311 | } | ||
| 312 | #else /* BIG_ENDIAN */ | ||
| 313 | for (j = 0; j < 16; ++j) { | ||
| 314 | V = Htable[j]; | ||
| 315 | Htable[j].hi = V.lo << 32|V.lo >> 32; | ||
| 316 | Htable[j].lo = V.hi << 32|V.hi >> 32; | ||
| 317 | } | ||
| 318 | #endif | ||
| 319 | } | ||
| 320 | #endif | ||
| 321 | } | 86 | } |
| 322 | 87 | ||
| 323 | #ifndef GHASH_ASM | 88 | #if !defined(HAVE_GCM_GHASH_4BIT) && !defined(HAVE_GCM_GMULT_4BIT) |
| 324 | static const size_t rem_4bit[16] = { | 89 | static const uint16_t rem_4bit[16] = { |
| 325 | PACK(0x0000), PACK(0x1C20), PACK(0x3840), PACK(0x2460), | 90 | 0x0000, 0x1c20, 0x3840, 0x2460, 0x7080, 0x6ca0, 0x48c0, 0x54e0, |
| 326 | PACK(0x7080), PACK(0x6CA0), PACK(0x48C0), PACK(0x54E0), | 91 | 0xe100, 0xfd20, 0xd940, 0xc560, 0x9180, 0x8da0, 0xa9c0, 0xb5e0, |
| 327 | PACK(0xE100), PACK(0xFD20), PACK(0xD940), PACK(0xC560), | 92 | }; |
| 328 | PACK(0x9180), PACK(0x8DA0), PACK(0xA9C0), PACK(0xB5E0) }; | 93 | #endif |
| 94 | |||
| 95 | #ifdef HAVE_GCM_GMULT_4BIT | ||
| 96 | void gcm_gmult_4bit(uint64_t Xi[2], const u128 Htable[16]); | ||
| 329 | 97 | ||
| 98 | #else | ||
| 330 | static void | 99 | static void |
| 331 | gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16]) | 100 | gcm_gmult_4bit(uint64_t Xi[2], const u128 Htable[16]) |
| 332 | { | 101 | { |
| 333 | u128 Z; | 102 | u128 Z; |
| 334 | int cnt = 15; | 103 | int cnt = 15; |
| 335 | size_t rem, nlo, nhi; | 104 | size_t rem, nlo, nhi; |
| 336 | 105 | ||
| 337 | nlo = ((const u8 *)Xi)[15]; | 106 | nlo = ((const uint8_t *)Xi)[15]; |
| 338 | nhi = nlo >> 4; | 107 | nhi = nlo >> 4; |
| 339 | nlo &= 0xf; | 108 | nlo &= 0xf; |
| 340 | 109 | ||
| @@ -345,29 +114,21 @@ gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16]) | |||
| 345 | rem = (size_t)Z.lo & 0xf; | 114 | rem = (size_t)Z.lo & 0xf; |
| 346 | Z.lo = (Z.hi << 60)|(Z.lo >> 4); | 115 | Z.lo = (Z.hi << 60)|(Z.lo >> 4); |
| 347 | Z.hi = (Z.hi >> 4); | 116 | Z.hi = (Z.hi >> 4); |
| 348 | #if SIZE_MAX == 0xffffffffffffffff | 117 | Z.hi ^= (uint64_t)rem_4bit[rem] << 48; |
| 349 | Z.hi ^= rem_4bit[rem]; | ||
| 350 | #else | ||
| 351 | Z.hi ^= (u64)rem_4bit[rem] << 32; | ||
| 352 | #endif | ||
| 353 | Z.hi ^= Htable[nhi].hi; | 118 | Z.hi ^= Htable[nhi].hi; |
| 354 | Z.lo ^= Htable[nhi].lo; | 119 | Z.lo ^= Htable[nhi].lo; |
| 355 | 120 | ||
| 356 | if (--cnt < 0) | 121 | if (--cnt < 0) |
| 357 | break; | 122 | break; |
| 358 | 123 | ||
| 359 | nlo = ((const u8 *)Xi)[cnt]; | 124 | nlo = ((const uint8_t *)Xi)[cnt]; |
| 360 | nhi = nlo >> 4; | 125 | nhi = nlo >> 4; |
| 361 | nlo &= 0xf; | 126 | nlo &= 0xf; |
| 362 | 127 | ||
| 363 | rem = (size_t)Z.lo & 0xf; | 128 | rem = (size_t)Z.lo & 0xf; |
| 364 | Z.lo = (Z.hi << 60)|(Z.lo >> 4); | 129 | Z.lo = (Z.hi << 60)|(Z.lo >> 4); |
| 365 | Z.hi = (Z.hi >> 4); | 130 | Z.hi = (Z.hi >> 4); |
| 366 | #if SIZE_MAX == 0xffffffffffffffff | 131 | Z.hi ^= (uint64_t)rem_4bit[rem] << 48; |
| 367 | Z.hi ^= rem_4bit[rem]; | ||
| 368 | #else | ||
| 369 | Z.hi ^= (u64)rem_4bit[rem] << 32; | ||
| 370 | #endif | ||
| 371 | Z.hi ^= Htable[nlo].hi; | 132 | Z.hi ^= Htable[nlo].hi; |
| 372 | Z.lo ^= Htable[nlo].lo; | 133 | Z.lo ^= Htable[nlo].lo; |
| 373 | } | 134 | } |
| @@ -375,27 +136,24 @@ gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16]) | |||
| 375 | Xi[0] = htobe64(Z.hi); | 136 | Xi[0] = htobe64(Z.hi); |
| 376 | Xi[1] = htobe64(Z.lo); | 137 | Xi[1] = htobe64(Z.lo); |
| 377 | } | 138 | } |
| 139 | #endif | ||
| 378 | 140 | ||
| 379 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | 141 | #ifdef HAVE_GCM_GHASH_4BIT |
| 380 | /* | 142 | void gcm_ghash_4bit(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp, |
| 381 | * Streamed gcm_mult_4bit, see CRYPTO_gcm128_[en|de]crypt for | 143 | size_t len); |
| 382 | * details... Compiler-generated code doesn't seem to give any | 144 | |
| 383 | * performance improvement, at least not on x86[_64]. It's here | 145 | #else |
| 384 | * mostly as reference and a placeholder for possible future | ||
| 385 | * non-trivial optimization[s]... | ||
| 386 | */ | ||
| 387 | static void | 146 | static void |
| 388 | gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16], | 147 | gcm_ghash_4bit(uint64_t Xi[2], const u128 Htable[16], |
| 389 | const u8 *inp, size_t len) | 148 | const uint8_t *inp, size_t len) |
| 390 | { | 149 | { |
| 391 | u128 Z; | 150 | u128 Z; |
| 392 | int cnt; | 151 | int cnt; |
| 393 | size_t rem, nlo, nhi; | 152 | size_t rem, nlo, nhi; |
| 394 | 153 | ||
| 395 | #if 1 | ||
| 396 | do { | 154 | do { |
| 397 | cnt = 15; | 155 | cnt = 15; |
| 398 | nlo = ((const u8 *)Xi)[15]; | 156 | nlo = ((const uint8_t *)Xi)[15]; |
| 399 | nlo ^= inp[15]; | 157 | nlo ^= inp[15]; |
| 400 | nhi = nlo >> 4; | 158 | nhi = nlo >> 4; |
| 401 | nlo &= 0xf; | 159 | nlo &= 0xf; |
| @@ -407,18 +165,14 @@ gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16], | |||
| 407 | rem = (size_t)Z.lo & 0xf; | 165 | rem = (size_t)Z.lo & 0xf; |
| 408 | Z.lo = (Z.hi << 60)|(Z.lo >> 4); | 166 | Z.lo = (Z.hi << 60)|(Z.lo >> 4); |
| 409 | Z.hi = (Z.hi >> 4); | 167 | Z.hi = (Z.hi >> 4); |
| 410 | #if SIZE_MAX == 0xffffffffffffffff | 168 | Z.hi ^= (uint64_t)rem_4bit[rem] << 48; |
| 411 | Z.hi ^= rem_4bit[rem]; | ||
| 412 | #else | ||
| 413 | Z.hi ^= (u64)rem_4bit[rem] << 32; | ||
| 414 | #endif | ||
| 415 | Z.hi ^= Htable[nhi].hi; | 169 | Z.hi ^= Htable[nhi].hi; |
| 416 | Z.lo ^= Htable[nhi].lo; | 170 | Z.lo ^= Htable[nhi].lo; |
| 417 | 171 | ||
| 418 | if (--cnt < 0) | 172 | if (--cnt < 0) |
| 419 | break; | 173 | break; |
| 420 | 174 | ||
| 421 | nlo = ((const u8 *)Xi)[cnt]; | 175 | nlo = ((const uint8_t *)Xi)[cnt]; |
| 422 | nlo ^= inp[cnt]; | 176 | nlo ^= inp[cnt]; |
| 423 | nhi = nlo >> 4; | 177 | nhi = nlo >> 4; |
| 424 | nlo &= 0xf; | 178 | nlo &= 0xf; |
| @@ -426,222 +180,40 @@ gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16], | |||
| 426 | rem = (size_t)Z.lo & 0xf; | 180 | rem = (size_t)Z.lo & 0xf; |
| 427 | Z.lo = (Z.hi << 60)|(Z.lo >> 4); | 181 | Z.lo = (Z.hi << 60)|(Z.lo >> 4); |
| 428 | Z.hi = (Z.hi >> 4); | 182 | Z.hi = (Z.hi >> 4); |
| 429 | #if SIZE_MAX == 0xffffffffffffffff | 183 | Z.hi ^= (uint64_t)rem_4bit[rem] << 48; |
| 430 | Z.hi ^= rem_4bit[rem]; | ||
| 431 | #else | ||
| 432 | Z.hi ^= (u64)rem_4bit[rem] << 32; | ||
| 433 | #endif | ||
| 434 | Z.hi ^= Htable[nlo].hi; | 184 | Z.hi ^= Htable[nlo].hi; |
| 435 | Z.lo ^= Htable[nlo].lo; | 185 | Z.lo ^= Htable[nlo].lo; |
| 436 | } | 186 | } |
| 437 | #else | ||
| 438 | /* | ||
| 439 | * Extra 256+16 bytes per-key plus 512 bytes shared tables | ||
| 440 | * [should] give ~50% improvement... One could have PACK()-ed | ||
| 441 | * the rem_8bit even here, but the priority is to minimize | ||
| 442 | * cache footprint... | ||
| 443 | */ | ||
| 444 | u128 Hshr4[16]; /* Htable shifted right by 4 bits */ | ||
| 445 | u8 Hshl4[16]; /* Htable shifted left by 4 bits */ | ||
| 446 | static const unsigned short rem_8bit[256] = { | ||
| 447 | 0x0000, 0x01C2, 0x0384, 0x0246, 0x0708, 0x06CA, 0x048C, 0x054E, | ||
| 448 | 0x0E10, 0x0FD2, 0x0D94, 0x0C56, 0x0918, 0x08DA, 0x0A9C, 0x0B5E, | ||
| 449 | 0x1C20, 0x1DE2, 0x1FA4, 0x1E66, 0x1B28, 0x1AEA, 0x18AC, 0x196E, | ||
| 450 | 0x1230, 0x13F2, 0x11B4, 0x1076, 0x1538, 0x14FA, 0x16BC, 0x177E, | ||
| 451 | 0x3840, 0x3982, 0x3BC4, 0x3A06, 0x3F48, 0x3E8A, 0x3CCC, 0x3D0E, | ||
| 452 | 0x3650, 0x3792, 0x35D4, 0x3416, 0x3158, 0x309A, 0x32DC, 0x331E, | ||
| 453 | 0x2460, 0x25A2, 0x27E4, 0x2626, 0x2368, 0x22AA, 0x20EC, 0x212E, | ||
| 454 | 0x2A70, 0x2BB2, 0x29F4, 0x2836, 0x2D78, 0x2CBA, 0x2EFC, 0x2F3E, | ||
| 455 | 0x7080, 0x7142, 0x7304, 0x72C6, 0x7788, 0x764A, 0x740C, 0x75CE, | ||
| 456 | 0x7E90, 0x7F52, 0x7D14, 0x7CD6, 0x7998, 0x785A, 0x7A1C, 0x7BDE, | ||
| 457 | 0x6CA0, 0x6D62, 0x6F24, 0x6EE6, 0x6BA8, 0x6A6A, 0x682C, 0x69EE, | ||
| 458 | 0x62B0, 0x6372, 0x6134, 0x60F6, 0x65B8, 0x647A, 0x663C, 0x67FE, | ||
| 459 | 0x48C0, 0x4902, 0x4B44, 0x4A86, 0x4FC8, 0x4E0A, 0x4C4C, 0x4D8E, | ||
| 460 | 0x46D0, 0x4712, 0x4554, 0x4496, 0x41D8, 0x401A, 0x425C, 0x439E, | ||
| 461 | 0x54E0, 0x5522, 0x5764, 0x56A6, 0x53E8, 0x522A, 0x506C, 0x51AE, | ||
| 462 | 0x5AF0, 0x5B32, 0x5974, 0x58B6, 0x5DF8, 0x5C3A, 0x5E7C, 0x5FBE, | ||
| 463 | 0xE100, 0xE0C2, 0xE284, 0xE346, 0xE608, 0xE7CA, 0xE58C, 0xE44E, | ||
| 464 | 0xEF10, 0xEED2, 0xEC94, 0xED56, 0xE818, 0xE9DA, 0xEB9C, 0xEA5E, | ||
| 465 | 0xFD20, 0xFCE2, 0xFEA4, 0xFF66, 0xFA28, 0xFBEA, 0xF9AC, 0xF86E, | ||
| 466 | 0xF330, 0xF2F2, 0xF0B4, 0xF176, 0xF438, 0xF5FA, 0xF7BC, 0xF67E, | ||
| 467 | 0xD940, 0xD882, 0xDAC4, 0xDB06, 0xDE48, 0xDF8A, 0xDDCC, 0xDC0E, | ||
| 468 | 0xD750, 0xD692, 0xD4D4, 0xD516, 0xD058, 0xD19A, 0xD3DC, 0xD21E, | ||
| 469 | 0xC560, 0xC4A2, 0xC6E4, 0xC726, 0xC268, 0xC3AA, 0xC1EC, 0xC02E, | ||
| 470 | 0xCB70, 0xCAB2, 0xC8F4, 0xC936, 0xCC78, 0xCDBA, 0xCFFC, 0xCE3E, | ||
| 471 | 0x9180, 0x9042, 0x9204, 0x93C6, 0x9688, 0x974A, 0x950C, 0x94CE, | ||
| 472 | 0x9F90, 0x9E52, 0x9C14, 0x9DD6, 0x9898, 0x995A, 0x9B1C, 0x9ADE, | ||
| 473 | 0x8DA0, 0x8C62, 0x8E24, 0x8FE6, 0x8AA8, 0x8B6A, 0x892C, 0x88EE, | ||
| 474 | 0x83B0, 0x8272, 0x8034, 0x81F6, 0x84B8, 0x857A, 0x873C, 0x86FE, | ||
| 475 | 0xA9C0, 0xA802, 0xAA44, 0xAB86, 0xAEC8, 0xAF0A, 0xAD4C, 0xAC8E, | ||
| 476 | 0xA7D0, 0xA612, 0xA454, 0xA596, 0xA0D8, 0xA11A, 0xA35C, 0xA29E, | ||
| 477 | 0xB5E0, 0xB422, 0xB664, 0xB7A6, 0xB2E8, 0xB32A, 0xB16C, 0xB0AE, | ||
| 478 | 0xBBF0, 0xBA32, 0xB874, 0xB9B6, 0xBCF8, 0xBD3A, 0xBF7C, 0xBEBE }; | ||
| 479 | /* | ||
| 480 | * This pre-processing phase slows down procedure by approximately | ||
| 481 | * same time as it makes each loop spin faster. In other words | ||
| 482 | * single block performance is approximately same as straightforward | ||
| 483 | * "4-bit" implementation, and then it goes only faster... | ||
| 484 | */ | ||
| 485 | for (cnt = 0; cnt < 16; ++cnt) { | ||
| 486 | Z.hi = Htable[cnt].hi; | ||
| 487 | Z.lo = Htable[cnt].lo; | ||
| 488 | Hshr4[cnt].lo = (Z.hi << 60)|(Z.lo >> 4); | ||
| 489 | Hshr4[cnt].hi = (Z.hi >> 4); | ||
| 490 | Hshl4[cnt] = (u8)(Z.lo << 4); | ||
| 491 | } | ||
| 492 | |||
| 493 | do { | ||
| 494 | for (Z.lo = 0, Z.hi = 0, cnt = 15; cnt; --cnt) { | ||
| 495 | nlo = ((const u8 *)Xi)[cnt]; | ||
| 496 | nlo ^= inp[cnt]; | ||
| 497 | nhi = nlo >> 4; | ||
| 498 | nlo &= 0xf; | ||
| 499 | |||
| 500 | Z.hi ^= Htable[nlo].hi; | ||
| 501 | Z.lo ^= Htable[nlo].lo; | ||
| 502 | |||
| 503 | rem = (size_t)Z.lo & 0xff; | ||
| 504 | |||
| 505 | Z.lo = (Z.hi << 56)|(Z.lo >> 8); | ||
| 506 | Z.hi = (Z.hi >> 8); | ||
| 507 | |||
| 508 | Z.hi ^= Hshr4[nhi].hi; | ||
| 509 | Z.lo ^= Hshr4[nhi].lo; | ||
| 510 | Z.hi ^= (u64)rem_8bit[rem ^ Hshl4[nhi]] << 48; | ||
| 511 | } | ||
| 512 | |||
| 513 | nlo = ((const u8 *)Xi)[0]; | ||
| 514 | nlo ^= inp[0]; | ||
| 515 | nhi = nlo >> 4; | ||
| 516 | nlo &= 0xf; | ||
| 517 | |||
| 518 | Z.hi ^= Htable[nlo].hi; | ||
| 519 | Z.lo ^= Htable[nlo].lo; | ||
| 520 | |||
| 521 | rem = (size_t)Z.lo & 0xf; | ||
| 522 | |||
| 523 | Z.lo = (Z.hi << 60)|(Z.lo >> 4); | ||
| 524 | Z.hi = (Z.hi >> 4); | ||
| 525 | |||
| 526 | Z.hi ^= Htable[nhi].hi; | ||
| 527 | Z.lo ^= Htable[nhi].lo; | ||
| 528 | Z.hi ^= ((u64)rem_8bit[rem << 4]) << 48; | ||
| 529 | #endif | ||
| 530 | 187 | ||
| 531 | Xi[0] = htobe64(Z.hi); | 188 | Xi[0] = htobe64(Z.hi); |
| 532 | Xi[1] = htobe64(Z.lo); | 189 | Xi[1] = htobe64(Z.lo); |
| 533 | } while (inp += 16, len -= 16); | 190 | } while (inp += 16, len -= 16); |
| 534 | } | 191 | } |
| 535 | #endif | 192 | #endif |
| 536 | #else | ||
| 537 | void gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16]); | ||
| 538 | void gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16], const u8 *inp, | ||
| 539 | size_t len); | ||
| 540 | #endif | ||
| 541 | 193 | ||
| 542 | #define GCM_MUL(ctx,Xi) gcm_gmult_4bit(ctx->Xi.u,ctx->Htable) | 194 | static inline void |
| 543 | #if defined(GHASH_ASM) || !defined(OPENSSL_SMALL_FOOTPRINT) | 195 | gcm_mul(GCM128_CONTEXT *ctx, uint64_t u[2]) |
| 544 | #define GHASH(ctx,in,len) gcm_ghash_4bit((ctx)->Xi.u,(ctx)->Htable,in,len) | 196 | { |
| 545 | /* GHASH_CHUNK is "stride parameter" missioned to mitigate cache | 197 | ctx->gmult(u, ctx->Htable); |
| 546 | * trashing effect. In other words idea is to hash data while it's | 198 | } |
| 547 | * still in L1 cache after encryption pass... */ | ||
| 548 | #define GHASH_CHUNK (3*1024) | ||
| 549 | #endif | ||
| 550 | |||
| 551 | #else /* TABLE_BITS */ | ||
| 552 | 199 | ||
| 553 | static void | 200 | static inline void |
| 554 | gcm_gmult_1bit(u64 Xi[2], const u64 H[2]) | 201 | gcm_ghash(GCM128_CONTEXT *ctx, const uint8_t *in, size_t len) |
| 555 | { | 202 | { |
| 556 | u128 V, Z = { 0,0 }; | 203 | ctx->ghash(ctx->Xi.u, ctx->Htable, in, len); |
| 557 | long X; | 204 | } |
| 558 | int i, j; | ||
| 559 | const long *xi = (const long *)Xi; | ||
| 560 | 205 | ||
| 561 | V.hi = H[0]; /* H is in host byte order, no byte swapping */ | 206 | #ifdef HAVE_GCM128_INIT |
| 562 | V.lo = H[1]; | 207 | void gcm128_init(GCM128_CONTEXT *ctx); |
| 563 | 208 | ||
| 564 | for (j = 0; j < 16/sizeof(long); ++j) { | ||
| 565 | #if BYTE_ORDER == LITTLE_ENDIAN | ||
| 566 | #if SIZE_MAX == 0xffffffffffffffff | ||
| 567 | #ifdef BSWAP8 | ||
| 568 | X = (long)(BSWAP8(xi[j])); | ||
| 569 | #else | ||
| 570 | const u8 *p = (const u8 *)(xi + j); | ||
| 571 | X = (long)((u64)GETU32(p) << 32|GETU32(p + 4)); | ||
| 572 | #endif | ||
| 573 | #else | 209 | #else |
| 574 | const u8 *p = (const u8 *)(xi + j); | 210 | static void |
| 575 | X = (long)GETU32(p); | 211 | gcm128_init(GCM128_CONTEXT *ctx) |
| 576 | #endif | 212 | { |
| 577 | #else /* BIG_ENDIAN */ | 213 | gcm_init_4bit(ctx->Htable, ctx->H.u); |
| 578 | X = xi[j]; | 214 | ctx->gmult = gcm_gmult_4bit; |
| 579 | #endif | 215 | ctx->ghash = gcm_ghash_4bit; |
| 580 | |||
| 581 | for (i = 0; i < 8*sizeof(long); ++i, X <<= 1) { | ||
| 582 | u64 M = (u64)(X >> (8*sizeof(long) - 1)); | ||
| 583 | Z.hi ^= V.hi & M; | ||
| 584 | Z.lo ^= V.lo & M; | ||
| 585 | |||
| 586 | REDUCE1BIT(V); | ||
| 587 | } | ||
| 588 | } | ||
| 589 | |||
| 590 | Xi[0] = htobe64(Z.hi); | ||
| 591 | Xi[1] = htobe64(Z.lo); | ||
| 592 | } | 216 | } |
| 593 | #define GCM_MUL(ctx,Xi) gcm_gmult_1bit(ctx->Xi.u,ctx->H.u) | ||
| 594 | |||
| 595 | #endif | ||
| 596 | |||
| 597 | #if defined(GHASH_ASM) && \ | ||
| 598 | (defined(__i386) || defined(__i386__) || \ | ||
| 599 | defined(__x86_64) || defined(__x86_64__) || \ | ||
| 600 | defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64)) | ||
| 601 | #include "x86_arch.h" | ||
| 602 | #endif | ||
| 603 | |||
| 604 | #if TABLE_BITS==4 && defined(GHASH_ASM) | ||
| 605 | # if (defined(__i386) || defined(__i386__) || \ | ||
| 606 | defined(__x86_64) || defined(__x86_64__) || \ | ||
| 607 | defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64)) | ||
| 608 | # define GHASH_ASM_X86_OR_64 | ||
| 609 | # define GCM_FUNCREF_4BIT | ||
| 610 | |||
| 611 | void gcm_init_clmul(u128 Htable[16], const u64 Xi[2]); | ||
| 612 | void gcm_gmult_clmul(u64 Xi[2], const u128 Htable[16]); | ||
| 613 | void gcm_ghash_clmul(u64 Xi[2], const u128 Htable[16], const u8 *inp, | ||
| 614 | size_t len); | ||
| 615 | |||
| 616 | # if defined(__i386) || defined(__i386__) || defined(_M_IX86) | ||
| 617 | # define GHASH_ASM_X86 | ||
| 618 | void gcm_gmult_4bit_mmx(u64 Xi[2], const u128 Htable[16]); | ||
| 619 | void gcm_ghash_4bit_mmx(u64 Xi[2], const u128 Htable[16], const u8 *inp, | ||
| 620 | size_t len); | ||
| 621 | |||
| 622 | void gcm_gmult_4bit_x86(u64 Xi[2], const u128 Htable[16]); | ||
| 623 | void gcm_ghash_4bit_x86(u64 Xi[2], const u128 Htable[16], const u8 *inp, | ||
| 624 | size_t len); | ||
| 625 | # endif | ||
| 626 | # elif defined(__arm__) || defined(__arm) | ||
| 627 | # include "arm_arch.h" | ||
| 628 | # if __ARM_ARCH__>=7 && !defined(__STRICT_ALIGNMENT) | ||
| 629 | # define GHASH_ASM_ARM | ||
| 630 | # define GCM_FUNCREF_4BIT | ||
| 631 | void gcm_gmult_neon(u64 Xi[2], const u128 Htable[16]); | ||
| 632 | void gcm_ghash_neon(u64 Xi[2], const u128 Htable[16], const u8 *inp, | ||
| 633 | size_t len); | ||
| 634 | # endif | ||
| 635 | # endif | ||
| 636 | #endif | ||
| 637 | |||
| 638 | #ifdef GCM_FUNCREF_4BIT | ||
| 639 | # undef GCM_MUL | ||
| 640 | # define GCM_MUL(ctx,Xi) (*gcm_gmult_p)(ctx->Xi.u,ctx->Htable) | ||
| 641 | # ifdef GHASH | ||
| 642 | # undef GHASH | ||
| 643 | # define GHASH(ctx,in,len) (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,in,len) | ||
| 644 | # endif | ||
| 645 | #endif | 217 | #endif |
| 646 | 218 | ||
| 647 | void | 219 | void |
| @@ -657,60 +229,35 @@ CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block) | |||
| 657 | ctx->H.u[0] = be64toh(ctx->H.u[0]); | 229 | ctx->H.u[0] = be64toh(ctx->H.u[0]); |
| 658 | ctx->H.u[1] = be64toh(ctx->H.u[1]); | 230 | ctx->H.u[1] = be64toh(ctx->H.u[1]); |
| 659 | 231 | ||
| 660 | #if TABLE_BITS==8 | 232 | gcm128_init(ctx); |
| 661 | gcm_init_8bit(ctx->Htable, ctx->H.u); | ||
| 662 | #elif TABLE_BITS==4 | ||
| 663 | # if defined(GHASH_ASM_X86_OR_64) | ||
| 664 | # if !defined(GHASH_ASM_X86) || defined(OPENSSL_IA32_SSE2) | ||
| 665 | /* check FXSR and PCLMULQDQ bits */ | ||
| 666 | if ((crypto_cpu_caps_ia32() & (CPUCAP_MASK_FXSR | CPUCAP_MASK_PCLMUL)) == | ||
| 667 | (CPUCAP_MASK_FXSR | CPUCAP_MASK_PCLMUL)) { | ||
| 668 | gcm_init_clmul(ctx->Htable, ctx->H.u); | ||
| 669 | ctx->gmult = gcm_gmult_clmul; | ||
| 670 | ctx->ghash = gcm_ghash_clmul; | ||
| 671 | return; | ||
| 672 | } | ||
| 673 | # endif | ||
| 674 | gcm_init_4bit(ctx->Htable, ctx->H.u); | ||
| 675 | # if defined(GHASH_ASM_X86) /* x86 only */ | ||
| 676 | # if defined(OPENSSL_IA32_SSE2) | ||
| 677 | if (crypto_cpu_caps_ia32() & CPUCAP_MASK_SSE) { /* check SSE bit */ | ||
| 678 | # else | ||
| 679 | if (crypto_cpu_caps_ia32() & CPUCAP_MASK_MMX) { /* check MMX bit */ | ||
| 680 | # endif | ||
| 681 | ctx->gmult = gcm_gmult_4bit_mmx; | ||
| 682 | ctx->ghash = gcm_ghash_4bit_mmx; | ||
| 683 | } else { | ||
| 684 | ctx->gmult = gcm_gmult_4bit_x86; | ||
| 685 | ctx->ghash = gcm_ghash_4bit_x86; | ||
| 686 | } | ||
| 687 | # else | ||
| 688 | ctx->gmult = gcm_gmult_4bit; | ||
| 689 | ctx->ghash = gcm_ghash_4bit; | ||
| 690 | # endif | ||
| 691 | # elif defined(GHASH_ASM_ARM) | ||
| 692 | if (OPENSSL_armcap_P & ARMV7_NEON) { | ||
| 693 | ctx->gmult = gcm_gmult_neon; | ||
| 694 | ctx->ghash = gcm_ghash_neon; | ||
| 695 | } else { | ||
| 696 | gcm_init_4bit(ctx->Htable, ctx->H.u); | ||
| 697 | ctx->gmult = gcm_gmult_4bit; | ||
| 698 | ctx->ghash = gcm_ghash_4bit; | ||
| 699 | } | ||
| 700 | # else | ||
| 701 | gcm_init_4bit(ctx->Htable, ctx->H.u); | ||
| 702 | # endif | ||
| 703 | #endif | ||
| 704 | } | 233 | } |
| 705 | LCRYPTO_ALIAS(CRYPTO_gcm128_init); | 234 | LCRYPTO_ALIAS(CRYPTO_gcm128_init); |
| 706 | 235 | ||
| 236 | GCM128_CONTEXT * | ||
| 237 | CRYPTO_gcm128_new(void *key, block128_f block) | ||
| 238 | { | ||
| 239 | GCM128_CONTEXT *ctx; | ||
| 240 | |||
| 241 | if ((ctx = calloc(1, sizeof(*ctx))) == NULL) | ||
| 242 | return NULL; | ||
| 243 | |||
| 244 | CRYPTO_gcm128_init(ctx, key, block); | ||
| 245 | |||
| 246 | return ctx; | ||
| 247 | } | ||
| 248 | LCRYPTO_ALIAS(CRYPTO_gcm128_new); | ||
| 249 | |||
| 250 | void | ||
| 251 | CRYPTO_gcm128_release(GCM128_CONTEXT *ctx) | ||
| 252 | { | ||
| 253 | freezero(ctx, sizeof(*ctx)); | ||
| 254 | } | ||
| 255 | LCRYPTO_ALIAS(CRYPTO_gcm128_release); | ||
| 256 | |||
| 707 | void | 257 | void |
| 708 | CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, size_t len) | 258 | CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, size_t len) |
| 709 | { | 259 | { |
| 710 | unsigned int ctr; | 260 | unsigned int ctr; |
| 711 | #ifdef GCM_FUNCREF_4BIT | ||
| 712 | void (*gcm_gmult_p)(u64 Xi[2], const u128 Htable[16]) = ctx->gmult; | ||
| 713 | #endif | ||
| 714 | 261 | ||
| 715 | ctx->Yi.u[0] = 0; | 262 | ctx->Yi.u[0] = 0; |
| 716 | ctx->Yi.u[1] = 0; | 263 | ctx->Yi.u[1] = 0; |
| @@ -727,577 +274,277 @@ CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, size_t len) | |||
| 727 | ctr = 1; | 274 | ctr = 1; |
| 728 | } else { | 275 | } else { |
| 729 | size_t i; | 276 | size_t i; |
| 730 | u64 len0 = len; | 277 | uint64_t len0 = len; |
| 731 | 278 | ||
| 732 | while (len >= 16) { | 279 | while (len >= 16) { |
| 733 | for (i = 0; i < 16; ++i) | 280 | for (i = 0; i < 16; i++) |
| 734 | ctx->Yi.c[i] ^= iv[i]; | 281 | ctx->Yi.c[i] ^= iv[i]; |
| 735 | GCM_MUL(ctx, Yi); | 282 | gcm_mul(ctx, ctx->Yi.u); |
| 736 | iv += 16; | 283 | iv += 16; |
| 737 | len -= 16; | 284 | len -= 16; |
| 738 | } | 285 | } |
| 739 | if (len) { | 286 | if (len > 0) { |
| 740 | for (i = 0; i < len; ++i) | 287 | for (i = 0; i < len; i++) |
| 741 | ctx->Yi.c[i] ^= iv[i]; | 288 | ctx->Yi.c[i] ^= iv[i]; |
| 742 | GCM_MUL(ctx, Yi); | 289 | gcm_mul(ctx, ctx->Yi.u); |
| 743 | } | 290 | } |
| 744 | len0 <<= 3; | 291 | len0 <<= 3; |
| 745 | ctx->Yi.u[1] ^= htobe64(len0); | 292 | ctx->Yi.u[1] ^= htobe64(len0); |
| 746 | 293 | ||
| 747 | GCM_MUL(ctx, Yi); | 294 | gcm_mul(ctx, ctx->Yi.u); |
| 748 | 295 | ||
| 749 | ctr = be32toh(ctx->Yi.d[3]); | 296 | ctr = be32toh(ctx->Yi.d[3]); |
| 750 | } | 297 | } |
| 751 | 298 | ||
| 752 | (*ctx->block)(ctx->Yi.c, ctx->EK0.c, ctx->key); | 299 | (*ctx->block)(ctx->Yi.c, ctx->EK0.c, ctx->key); |
| 753 | ++ctr; | 300 | ctx->Yi.d[3] = htobe32(++ctr); |
| 754 | ctx->Yi.d[3] = htobe32(ctr); | ||
| 755 | } | 301 | } |
| 756 | LCRYPTO_ALIAS(CRYPTO_gcm128_setiv); | 302 | LCRYPTO_ALIAS(CRYPTO_gcm128_setiv); |
| 757 | 303 | ||
| 758 | int | 304 | int |
| 759 | CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad, size_t len) | 305 | CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad, size_t len) |
| 760 | { | 306 | { |
| 761 | size_t i; | ||
| 762 | unsigned int n; | 307 | unsigned int n; |
| 763 | u64 alen = ctx->len.u[0]; | 308 | uint64_t alen; |
| 764 | #ifdef GCM_FUNCREF_4BIT | 309 | size_t i; |
| 765 | void (*gcm_gmult_p)(u64 Xi[2], const u128 Htable[16]) = ctx->gmult; | ||
| 766 | # ifdef GHASH | ||
| 767 | void (*gcm_ghash_p)(u64 Xi[2], const u128 Htable[16], | ||
| 768 | const u8 *inp, size_t len) = ctx->ghash; | ||
| 769 | # endif | ||
| 770 | #endif | ||
| 771 | 310 | ||
| 772 | if (ctx->len.u[1]) | 311 | if (ctx->len.u[1] != 0) |
| 773 | return -2; | 312 | return -2; |
| 774 | 313 | ||
| 775 | alen += len; | 314 | alen = ctx->len.u[0] + len; |
| 776 | if (alen > (U64(1) << 61) || (sizeof(len) == 8 && alen < len)) | 315 | if (alen > (U64(1) << 61) || (sizeof(len) == 8 && alen < len)) |
| 777 | return -1; | 316 | return -1; |
| 778 | ctx->len.u[0] = alen; | 317 | ctx->len.u[0] = alen; |
| 779 | 318 | ||
| 780 | n = ctx->ares; | 319 | if ((n = ctx->ares) > 0) { |
| 781 | if (n) { | 320 | while (n > 0 && len > 0) { |
| 782 | while (n && len) { | ||
| 783 | ctx->Xi.c[n] ^= *(aad++); | 321 | ctx->Xi.c[n] ^= *(aad++); |
| 784 | --len; | ||
| 785 | n = (n + 1) % 16; | 322 | n = (n + 1) % 16; |
| 323 | len--; | ||
| 786 | } | 324 | } |
| 787 | if (n == 0) | 325 | if (n > 0) { |
| 788 | GCM_MUL(ctx, Xi); | ||
| 789 | else { | ||
| 790 | ctx->ares = n; | 326 | ctx->ares = n; |
| 791 | return 0; | 327 | return 0; |
| 792 | } | 328 | } |
| 329 | gcm_mul(ctx, ctx->Xi.u); | ||
| 793 | } | 330 | } |
| 794 | 331 | ||
| 795 | #ifdef GHASH | 332 | if ((i = (len & (size_t)-16)) > 0) { |
| 796 | if ((i = (len & (size_t)-16))) { | 333 | gcm_ghash(ctx, aad, i); |
| 797 | GHASH(ctx, aad, i); | ||
| 798 | aad += i; | 334 | aad += i; |
| 799 | len -= i; | 335 | len -= i; |
| 800 | } | 336 | } |
| 801 | #else | 337 | if (len > 0) { |
| 802 | while (len >= 16) { | ||
| 803 | for (i = 0; i < 16; ++i) | ||
| 804 | ctx->Xi.c[i] ^= aad[i]; | ||
| 805 | GCM_MUL(ctx, Xi); | ||
| 806 | aad += 16; | ||
| 807 | len -= 16; | ||
| 808 | } | ||
| 809 | #endif | ||
| 810 | if (len) { | ||
| 811 | n = (unsigned int)len; | 338 | n = (unsigned int)len; |
| 812 | for (i = 0; i < len; ++i) | 339 | for (i = 0; i < len; i++) |
| 813 | ctx->Xi.c[i] ^= aad[i]; | 340 | ctx->Xi.c[i] ^= aad[i]; |
| 814 | } | 341 | } |
| 815 | |||
| 816 | ctx->ares = n; | 342 | ctx->ares = n; |
| 343 | |||
| 817 | return 0; | 344 | return 0; |
| 818 | } | 345 | } |
| 819 | LCRYPTO_ALIAS(CRYPTO_gcm128_aad); | 346 | LCRYPTO_ALIAS(CRYPTO_gcm128_aad); |
| 820 | 347 | ||
| 821 | int | 348 | int |
| 822 | CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, | 349 | CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, const unsigned char *in, |
| 823 | const unsigned char *in, unsigned char *out, | 350 | unsigned char *out, size_t len) |
| 824 | size_t len) | ||
| 825 | { | 351 | { |
| 826 | unsigned int n, ctr; | 352 | unsigned int n, ctr; |
| 353 | uint64_t mlen; | ||
| 827 | size_t i; | 354 | size_t i; |
| 828 | u64 mlen = ctx->len.u[1]; | ||
| 829 | block128_f block = ctx->block; | ||
| 830 | void *key = ctx->key; | ||
| 831 | #ifdef GCM_FUNCREF_4BIT | ||
| 832 | void (*gcm_gmult_p)(u64 Xi[2], const u128 Htable[16]) = ctx->gmult; | ||
| 833 | # ifdef GHASH | ||
| 834 | void (*gcm_ghash_p)(u64 Xi[2], const u128 Htable[16], | ||
| 835 | const u8 *inp, size_t len) = ctx->ghash; | ||
| 836 | # endif | ||
| 837 | #endif | ||
| 838 | 355 | ||
| 839 | mlen += len; | 356 | mlen = ctx->len.u[1] + len; |
| 840 | if (mlen > ((U64(1) << 36) - 32) || (sizeof(len) == 8 && mlen < len)) | 357 | if (mlen > ((U64(1) << 36) - 32) || (sizeof(len) == 8 && mlen < len)) |
| 841 | return -1; | 358 | return -1; |
| 842 | ctx->len.u[1] = mlen; | 359 | ctx->len.u[1] = mlen; |
| 843 | 360 | ||
| 844 | if (ctx->ares) { | 361 | if (ctx->ares > 0) { |
| 845 | /* First call to encrypt finalizes GHASH(AAD) */ | 362 | /* First call to encrypt finalizes GHASH(AAD) */ |
| 846 | GCM_MUL(ctx, Xi); | 363 | gcm_mul(ctx, ctx->Xi.u); |
| 847 | ctx->ares = 0; | 364 | ctx->ares = 0; |
| 848 | } | 365 | } |
| 849 | 366 | ||
| 850 | ctr = be32toh(ctx->Yi.d[3]); | 367 | ctr = be32toh(ctx->Yi.d[3]); |
| 851 | 368 | ||
| 852 | n = ctx->mres; | 369 | n = ctx->mres; |
| 853 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | ||
| 854 | if (16 % sizeof(size_t) == 0) | ||
| 855 | do { /* always true actually */ | ||
| 856 | if (n) { | ||
| 857 | while (n && len) { | ||
| 858 | ctx->Xi.c[n] ^= *(out++) = *(in++) ^ | ||
| 859 | ctx->EKi.c[n]; | ||
| 860 | --len; | ||
| 861 | n = (n + 1) % 16; | ||
| 862 | } | ||
| 863 | if (n == 0) | ||
| 864 | GCM_MUL(ctx, Xi); | ||
| 865 | else { | ||
| 866 | ctx->mres = n; | ||
| 867 | return 0; | ||
| 868 | } | ||
| 869 | } | ||
| 870 | #ifdef __STRICT_ALIGNMENT | ||
| 871 | if (((size_t)in|(size_t)out) % sizeof(size_t) != 0) | ||
| 872 | break; | ||
| 873 | #endif | ||
| 874 | #if defined(GHASH) && defined(GHASH_CHUNK) | ||
| 875 | while (len >= GHASH_CHUNK) { | ||
| 876 | size_t j = GHASH_CHUNK; | ||
| 877 | |||
| 878 | while (j) { | ||
| 879 | size_t *out_t = (size_t *)out; | ||
| 880 | const size_t *in_t = (const size_t *)in; | ||
| 881 | |||
| 882 | (*block)(ctx->Yi.c, ctx->EKi.c, key); | ||
| 883 | ++ctr; | ||
| 884 | ctx->Yi.d[3] = htobe32(ctr); | ||
| 885 | |||
| 886 | for (i = 0; i < 16/sizeof(size_t); ++i) | ||
| 887 | out_t[i] = in_t[i] ^ | ||
| 888 | ctx->EKi.t[i]; | ||
| 889 | out += 16; | ||
| 890 | in += 16; | ||
| 891 | j -= 16; | ||
| 892 | } | ||
| 893 | GHASH(ctx, out - GHASH_CHUNK, GHASH_CHUNK); | ||
| 894 | len -= GHASH_CHUNK; | ||
| 895 | } | ||
| 896 | if ((i = (len & (size_t)-16))) { | ||
| 897 | size_t j = i; | ||
| 898 | |||
| 899 | while (len >= 16) { | ||
| 900 | size_t *out_t = (size_t *)out; | ||
| 901 | const size_t *in_t = (const size_t *)in; | ||
| 902 | |||
| 903 | (*block)(ctx->Yi.c, ctx->EKi.c, key); | ||
| 904 | ++ctr; | ||
| 905 | ctx->Yi.d[3] = htobe32(ctr); | ||
| 906 | |||
| 907 | for (i = 0; i < 16/sizeof(size_t); ++i) | ||
| 908 | out_t[i] = in_t[i] ^ | ||
| 909 | ctx->EKi.t[i]; | ||
| 910 | out += 16; | ||
| 911 | in += 16; | ||
| 912 | len -= 16; | ||
| 913 | } | ||
| 914 | GHASH(ctx, out - j, j); | ||
| 915 | } | ||
| 916 | #else | ||
| 917 | while (len >= 16) { | ||
| 918 | size_t *out_t = (size_t *)out; | ||
| 919 | const size_t *in_t = (const size_t *)in; | ||
| 920 | |||
| 921 | (*block)(ctx->Yi.c, ctx->EKi.c, key); | ||
| 922 | ++ctr; | ||
| 923 | ctx->Yi.d[3] = htobe32(ctr); | ||
| 924 | |||
| 925 | for (i = 0; i < 16/sizeof(size_t); ++i) | ||
| 926 | ctx->Xi.t[i] ^= | ||
| 927 | out_t[i] = in_t[i] ^ ctx->EKi.t[i]; | ||
| 928 | GCM_MUL(ctx, Xi); | ||
| 929 | out += 16; | ||
| 930 | in += 16; | ||
| 931 | len -= 16; | ||
| 932 | } | ||
| 933 | #endif | ||
| 934 | if (len) { | ||
| 935 | (*block)(ctx->Yi.c, ctx->EKi.c, key); | ||
| 936 | ++ctr; | ||
| 937 | ctx->Yi.d[3] = htobe32(ctr); | ||
| 938 | |||
| 939 | while (len--) { | ||
| 940 | ctx->Xi.c[n] ^= out[n] = in[n] ^ | ||
| 941 | ctx->EKi.c[n]; | ||
| 942 | ++n; | ||
| 943 | } | ||
| 944 | } | ||
| 945 | 370 | ||
| 946 | ctx->mres = n; | 371 | for (i = 0; i < len; i++) { |
| 947 | return 0; | ||
| 948 | } while (0); | ||
| 949 | #endif | ||
| 950 | for (i = 0; i < len; ++i) { | ||
| 951 | if (n == 0) { | 372 | if (n == 0) { |
| 952 | (*block)(ctx->Yi.c, ctx->EKi.c, key); | 373 | ctx->block(ctx->Yi.c, ctx->EKi.c, ctx->key); |
| 953 | ++ctr; | 374 | ctx->Yi.d[3] = htobe32(++ctr); |
| 954 | ctx->Yi.d[3] = htobe32(ctr); | ||
| 955 | } | 375 | } |
| 956 | ctx->Xi.c[n] ^= out[i] = in[i] ^ ctx->EKi.c[n]; | 376 | ctx->Xi.c[n] ^= out[i] = in[i] ^ ctx->EKi.c[n]; |
| 957 | n = (n + 1) % 16; | 377 | n = (n + 1) % 16; |
| 958 | if (n == 0) | 378 | if (n == 0) |
| 959 | GCM_MUL(ctx, Xi); | 379 | gcm_mul(ctx, ctx->Xi.u); |
| 960 | } | 380 | } |
| 961 | 381 | ||
| 962 | ctx->mres = n; | 382 | ctx->mres = n; |
| 383 | |||
| 963 | return 0; | 384 | return 0; |
| 964 | } | 385 | } |
| 965 | LCRYPTO_ALIAS(CRYPTO_gcm128_encrypt); | 386 | LCRYPTO_ALIAS(CRYPTO_gcm128_encrypt); |
| 966 | 387 | ||
| 967 | int | 388 | int |
| 968 | CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, | 389 | CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, const unsigned char *in, |
| 969 | const unsigned char *in, unsigned char *out, | 390 | unsigned char *out, size_t len) |
| 970 | size_t len) | ||
| 971 | { | 391 | { |
| 972 | unsigned int n, ctr; | 392 | unsigned int n, ctr; |
| 393 | uint64_t mlen; | ||
| 394 | uint8_t c; | ||
| 973 | size_t i; | 395 | size_t i; |
| 974 | u64 mlen = ctx->len.u[1]; | ||
| 975 | block128_f block = ctx->block; | ||
| 976 | void *key = ctx->key; | ||
| 977 | #ifdef GCM_FUNCREF_4BIT | ||
| 978 | void (*gcm_gmult_p)(u64 Xi[2], const u128 Htable[16]) = ctx->gmult; | ||
| 979 | # ifdef GHASH | ||
| 980 | void (*gcm_ghash_p)(u64 Xi[2], const u128 Htable[16], | ||
| 981 | const u8 *inp, size_t len) = ctx->ghash; | ||
| 982 | # endif | ||
| 983 | #endif | ||
| 984 | 396 | ||
| 985 | mlen += len; | 397 | mlen = ctx->len.u[1] + len; |
| 986 | if (mlen > ((U64(1) << 36) - 32) || (sizeof(len) == 8 && mlen < len)) | 398 | if (mlen > ((U64(1) << 36) - 32) || (sizeof(len) == 8 && mlen < len)) |
| 987 | return -1; | 399 | return -1; |
| 988 | ctx->len.u[1] = mlen; | 400 | ctx->len.u[1] = mlen; |
| 989 | 401 | ||
| 990 | if (ctx->ares) { | 402 | if (ctx->ares) { |
| 991 | /* First call to decrypt finalizes GHASH(AAD) */ | 403 | /* First call to decrypt finalizes GHASH(AAD) */ |
| 992 | GCM_MUL(ctx, Xi); | 404 | gcm_mul(ctx, ctx->Xi.u); |
| 993 | ctx->ares = 0; | 405 | ctx->ares = 0; |
| 994 | } | 406 | } |
| 995 | 407 | ||
| 996 | ctr = be32toh(ctx->Yi.d[3]); | 408 | ctr = be32toh(ctx->Yi.d[3]); |
| 997 | 409 | ||
| 998 | n = ctx->mres; | 410 | n = ctx->mres; |
| 999 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | ||
| 1000 | if (16 % sizeof(size_t) == 0) | ||
| 1001 | do { /* always true actually */ | ||
| 1002 | if (n) { | ||
| 1003 | while (n && len) { | ||
| 1004 | u8 c = *(in++); | ||
| 1005 | *(out++) = c ^ ctx->EKi.c[n]; | ||
| 1006 | ctx->Xi.c[n] ^= c; | ||
| 1007 | --len; | ||
| 1008 | n = (n + 1) % 16; | ||
| 1009 | } | ||
| 1010 | if (n == 0) | ||
| 1011 | GCM_MUL(ctx, Xi); | ||
| 1012 | else { | ||
| 1013 | ctx->mres = n; | ||
| 1014 | return 0; | ||
| 1015 | } | ||
| 1016 | } | ||
| 1017 | #ifdef __STRICT_ALIGNMENT | ||
| 1018 | if (((size_t)in|(size_t)out) % sizeof(size_t) != 0) | ||
| 1019 | break; | ||
| 1020 | #endif | ||
| 1021 | #if defined(GHASH) && defined(GHASH_CHUNK) | ||
| 1022 | while (len >= GHASH_CHUNK) { | ||
| 1023 | size_t j = GHASH_CHUNK; | ||
| 1024 | |||
| 1025 | GHASH(ctx, in, GHASH_CHUNK); | ||
| 1026 | while (j) { | ||
| 1027 | size_t *out_t = (size_t *)out; | ||
| 1028 | const size_t *in_t = (const size_t *)in; | ||
| 1029 | |||
| 1030 | (*block)(ctx->Yi.c, ctx->EKi.c, key); | ||
| 1031 | ++ctr; | ||
| 1032 | ctx->Yi.d[3] = htobe32(ctr); | ||
| 1033 | |||
| 1034 | for (i = 0; i < 16/sizeof(size_t); ++i) | ||
| 1035 | out_t[i] = in_t[i] ^ | ||
| 1036 | ctx->EKi.t[i]; | ||
| 1037 | out += 16; | ||
| 1038 | in += 16; | ||
| 1039 | j -= 16; | ||
| 1040 | } | ||
| 1041 | len -= GHASH_CHUNK; | ||
| 1042 | } | ||
| 1043 | if ((i = (len & (size_t)-16))) { | ||
| 1044 | GHASH(ctx, in, i); | ||
| 1045 | while (len >= 16) { | ||
| 1046 | size_t *out_t = (size_t *)out; | ||
| 1047 | const size_t *in_t = (const size_t *)in; | ||
| 1048 | |||
| 1049 | (*block)(ctx->Yi.c, ctx->EKi.c, key); | ||
| 1050 | ++ctr; | ||
| 1051 | ctx->Yi.d[3] = htobe32(ctr); | ||
| 1052 | |||
| 1053 | for (i = 0; i < 16/sizeof(size_t); ++i) | ||
| 1054 | out_t[i] = in_t[i] ^ | ||
| 1055 | ctx->EKi.t[i]; | ||
| 1056 | out += 16; | ||
| 1057 | in += 16; | ||
| 1058 | len -= 16; | ||
| 1059 | } | ||
| 1060 | } | ||
| 1061 | #else | ||
| 1062 | while (len >= 16) { | ||
| 1063 | size_t *out_t = (size_t *)out; | ||
| 1064 | const size_t *in_t = (const size_t *)in; | ||
| 1065 | |||
| 1066 | (*block)(ctx->Yi.c, ctx->EKi.c, key); | ||
| 1067 | ++ctr; | ||
| 1068 | ctx->Yi.d[3] = htobe32(ctr); | ||
| 1069 | |||
| 1070 | for (i = 0; i < 16/sizeof(size_t); ++i) { | ||
| 1071 | size_t c = in[i]; | ||
| 1072 | out[i] = c ^ ctx->EKi.t[i]; | ||
| 1073 | ctx->Xi.t[i] ^= c; | ||
| 1074 | } | ||
| 1075 | GCM_MUL(ctx, Xi); | ||
| 1076 | out += 16; | ||
| 1077 | in += 16; | ||
| 1078 | len -= 16; | ||
| 1079 | } | ||
| 1080 | #endif | ||
| 1081 | if (len) { | ||
| 1082 | (*block)(ctx->Yi.c, ctx->EKi.c, key); | ||
| 1083 | ++ctr; | ||
| 1084 | ctx->Yi.d[3] = htobe32(ctr); | ||
| 1085 | |||
| 1086 | while (len--) { | ||
| 1087 | u8 c = in[n]; | ||
| 1088 | ctx->Xi.c[n] ^= c; | ||
| 1089 | out[n] = c ^ ctx->EKi.c[n]; | ||
| 1090 | ++n; | ||
| 1091 | } | ||
| 1092 | } | ||
| 1093 | 411 | ||
| 1094 | ctx->mres = n; | 412 | for (i = 0; i < len; i++) { |
| 1095 | return 0; | ||
| 1096 | } while (0); | ||
| 1097 | #endif | ||
| 1098 | for (i = 0; i < len; ++i) { | ||
| 1099 | u8 c; | ||
| 1100 | if (n == 0) { | 413 | if (n == 0) { |
| 1101 | (*block)(ctx->Yi.c, ctx->EKi.c, key); | 414 | ctx->block(ctx->Yi.c, ctx->EKi.c, ctx->key); |
| 1102 | ++ctr; | 415 | ctx->Yi.d[3] = htobe32(++ctr); |
| 1103 | ctx->Yi.d[3] = htobe32(ctr); | ||
| 1104 | } | 416 | } |
| 1105 | c = in[i]; | 417 | c = in[i]; |
| 1106 | out[i] = c ^ ctx->EKi.c[n]; | 418 | out[i] = c ^ ctx->EKi.c[n]; |
| 1107 | ctx->Xi.c[n] ^= c; | 419 | ctx->Xi.c[n] ^= c; |
| 1108 | n = (n + 1) % 16; | 420 | n = (n + 1) % 16; |
| 1109 | if (n == 0) | 421 | if (n == 0) |
| 1110 | GCM_MUL(ctx, Xi); | 422 | gcm_mul(ctx, ctx->Xi.u); |
| 1111 | } | 423 | } |
| 1112 | 424 | ||
| 1113 | ctx->mres = n; | 425 | ctx->mres = n; |
| 426 | |||
| 1114 | return 0; | 427 | return 0; |
| 1115 | } | 428 | } |
| 1116 | LCRYPTO_ALIAS(CRYPTO_gcm128_decrypt); | 429 | LCRYPTO_ALIAS(CRYPTO_gcm128_decrypt); |
| 1117 | 430 | ||
| 1118 | int | 431 | int |
| 1119 | CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, | 432 | CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, const unsigned char *in, |
| 1120 | const unsigned char *in, unsigned char *out, | 433 | unsigned char *out, size_t len, ctr128_f stream) |
| 1121 | size_t len, ctr128_f stream) | ||
| 1122 | { | 434 | { |
| 1123 | unsigned int n, ctr; | 435 | unsigned int n, ctr; |
| 1124 | size_t i; | 436 | uint64_t mlen; |
| 1125 | u64 mlen = ctx->len.u[1]; | 437 | size_t i, j; |
| 1126 | void *key = ctx->key; | ||
| 1127 | #ifdef GCM_FUNCREF_4BIT | ||
| 1128 | void (*gcm_gmult_p)(u64 Xi[2], const u128 Htable[16]) = ctx->gmult; | ||
| 1129 | # ifdef GHASH | ||
| 1130 | void (*gcm_ghash_p)(u64 Xi[2], const u128 Htable[16], | ||
| 1131 | const u8 *inp, size_t len) = ctx->ghash; | ||
| 1132 | # endif | ||
| 1133 | #endif | ||
| 1134 | 438 | ||
| 1135 | mlen += len; | 439 | mlen = ctx->len.u[1] + len; |
| 1136 | if (mlen > ((U64(1) << 36) - 32) || (sizeof(len) == 8 && mlen < len)) | 440 | if (mlen > ((U64(1) << 36) - 32) || (sizeof(len) == 8 && mlen < len)) |
| 1137 | return -1; | 441 | return -1; |
| 1138 | ctx->len.u[1] = mlen; | 442 | ctx->len.u[1] = mlen; |
| 1139 | 443 | ||
| 1140 | if (ctx->ares) { | 444 | if (ctx->ares > 0) { |
| 1141 | /* First call to encrypt finalizes GHASH(AAD) */ | 445 | /* First call to encrypt finalizes GHASH(AAD) */ |
| 1142 | GCM_MUL(ctx, Xi); | 446 | gcm_mul(ctx, ctx->Xi.u); |
| 1143 | ctx->ares = 0; | 447 | ctx->ares = 0; |
| 1144 | } | 448 | } |
| 1145 | 449 | ||
| 1146 | ctr = be32toh(ctx->Yi.d[3]); | 450 | ctr = be32toh(ctx->Yi.d[3]); |
| 1147 | 451 | ||
| 1148 | n = ctx->mres; | 452 | if ((n = ctx->mres) > 0) { |
| 1149 | if (n) { | 453 | while (n > 0 && len > 0) { |
| 1150 | while (n && len) { | ||
| 1151 | ctx->Xi.c[n] ^= *(out++) = *(in++) ^ ctx->EKi.c[n]; | 454 | ctx->Xi.c[n] ^= *(out++) = *(in++) ^ ctx->EKi.c[n]; |
| 1152 | --len; | ||
| 1153 | n = (n + 1) % 16; | 455 | n = (n + 1) % 16; |
| 456 | len--; | ||
| 1154 | } | 457 | } |
| 1155 | if (n == 0) | 458 | if (n > 0) { |
| 1156 | GCM_MUL(ctx, Xi); | ||
| 1157 | else { | ||
| 1158 | ctx->mres = n; | 459 | ctx->mres = n; |
| 1159 | return 0; | 460 | return 0; |
| 1160 | } | 461 | } |
| 462 | gcm_mul(ctx, ctx->Xi.u); | ||
| 1161 | } | 463 | } |
| 1162 | #if defined(GHASH) && !defined(OPENSSL_SMALL_FOOTPRINT) | 464 | if ((i = (len & (size_t)-16)) > 0) { |
| 1163 | while (len >= GHASH_CHUNK) { | 465 | j = i / 16; |
| 1164 | (*stream)(in, out, GHASH_CHUNK/16, key, ctx->Yi.c); | 466 | stream(in, out, j, ctx->key, ctx->Yi.c); |
| 1165 | ctr += GHASH_CHUNK/16; | ||
| 1166 | ctx->Yi.d[3] = htobe32(ctr); | ||
| 1167 | GHASH(ctx, out, GHASH_CHUNK); | ||
| 1168 | out += GHASH_CHUNK; | ||
| 1169 | in += GHASH_CHUNK; | ||
| 1170 | len -= GHASH_CHUNK; | ||
| 1171 | } | ||
| 1172 | #endif | ||
| 1173 | if ((i = (len & (size_t)-16))) { | ||
| 1174 | size_t j = i/16; | ||
| 1175 | |||
| 1176 | (*stream)(in, out, j, key, ctx->Yi.c); | ||
| 1177 | ctr += (unsigned int)j; | 467 | ctr += (unsigned int)j; |
| 1178 | ctx->Yi.d[3] = htobe32(ctr); | 468 | ctx->Yi.d[3] = htobe32(ctr); |
| 469 | gcm_ghash(ctx, out, i); | ||
| 1179 | in += i; | 470 | in += i; |
| 1180 | len -= i; | ||
| 1181 | #if defined(GHASH) | ||
| 1182 | GHASH(ctx, out, i); | ||
| 1183 | out += i; | 471 | out += i; |
| 1184 | #else | 472 | len -= i; |
| 1185 | while (j--) { | ||
| 1186 | for (i = 0; i < 16; ++i) | ||
| 1187 | ctx->Xi.c[i] ^= out[i]; | ||
| 1188 | GCM_MUL(ctx, Xi); | ||
| 1189 | out += 16; | ||
| 1190 | } | ||
| 1191 | #endif | ||
| 1192 | } | 473 | } |
| 1193 | if (len) { | 474 | if (len > 0) { |
| 1194 | (*ctx->block)(ctx->Yi.c, ctx->EKi.c, key); | 475 | ctx->block(ctx->Yi.c, ctx->EKi.c, ctx->key); |
| 1195 | ++ctr; | 476 | ctx->Yi.d[3] = htobe32(++ctr); |
| 1196 | ctx->Yi.d[3] = htobe32(ctr); | 477 | while (len-- > 0) { |
| 1197 | while (len--) { | ||
| 1198 | ctx->Xi.c[n] ^= out[n] = in[n] ^ ctx->EKi.c[n]; | 478 | ctx->Xi.c[n] ^= out[n] = in[n] ^ ctx->EKi.c[n]; |
| 1199 | ++n; | 479 | n++; |
| 1200 | } | 480 | } |
| 1201 | } | 481 | } |
| 1202 | 482 | ||
| 1203 | ctx->mres = n; | 483 | ctx->mres = n; |
| 484 | |||
| 1204 | return 0; | 485 | return 0; |
| 1205 | } | 486 | } |
| 1206 | LCRYPTO_ALIAS(CRYPTO_gcm128_encrypt_ctr32); | 487 | LCRYPTO_ALIAS(CRYPTO_gcm128_encrypt_ctr32); |
| 1207 | 488 | ||
| 1208 | int | 489 | int |
| 1209 | CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, | 490 | CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, const unsigned char *in, |
| 1210 | const unsigned char *in, unsigned char *out, | 491 | unsigned char *out, size_t len, ctr128_f stream) |
| 1211 | size_t len, ctr128_f stream) | ||
| 1212 | { | 492 | { |
| 1213 | unsigned int n, ctr; | 493 | unsigned int n, ctr; |
| 1214 | size_t i; | 494 | uint64_t mlen; |
| 1215 | u64 mlen = ctx->len.u[1]; | 495 | size_t i, j; |
| 1216 | void *key = ctx->key; | 496 | uint8_t c; |
| 1217 | #ifdef GCM_FUNCREF_4BIT | ||
| 1218 | void (*gcm_gmult_p)(u64 Xi[2], const u128 Htable[16]) = ctx->gmult; | ||
| 1219 | # ifdef GHASH | ||
| 1220 | void (*gcm_ghash_p)(u64 Xi[2], const u128 Htable[16], | ||
| 1221 | const u8 *inp, size_t len) = ctx->ghash; | ||
| 1222 | # endif | ||
| 1223 | #endif | ||
| 1224 | 497 | ||
| 1225 | mlen += len; | 498 | mlen = ctx->len.u[1] + len; |
| 1226 | if (mlen > ((U64(1) << 36) - 32) || (sizeof(len) == 8 && mlen < len)) | 499 | if (mlen > ((U64(1) << 36) - 32) || (sizeof(len) == 8 && mlen < len)) |
| 1227 | return -1; | 500 | return -1; |
| 1228 | ctx->len.u[1] = mlen; | 501 | ctx->len.u[1] = mlen; |
| 1229 | 502 | ||
| 1230 | if (ctx->ares) { | 503 | if (ctx->ares > 0) { |
| 1231 | /* First call to decrypt finalizes GHASH(AAD) */ | 504 | /* First call to decrypt finalizes GHASH(AAD) */ |
| 1232 | GCM_MUL(ctx, Xi); | 505 | gcm_mul(ctx, ctx->Xi.u); |
| 1233 | ctx->ares = 0; | 506 | ctx->ares = 0; |
| 1234 | } | 507 | } |
| 1235 | 508 | ||
| 1236 | ctr = be32toh(ctx->Yi.d[3]); | 509 | ctr = be32toh(ctx->Yi.d[3]); |
| 1237 | 510 | ||
| 1238 | n = ctx->mres; | 511 | if ((n = ctx->mres) > 0) { |
| 1239 | if (n) { | 512 | while (n > 0 && len > 0) { |
| 1240 | while (n && len) { | 513 | c = *(in++); |
| 1241 | u8 c = *(in++); | ||
| 1242 | *(out++) = c ^ ctx->EKi.c[n]; | 514 | *(out++) = c ^ ctx->EKi.c[n]; |
| 1243 | ctx->Xi.c[n] ^= c; | 515 | ctx->Xi.c[n] ^= c; |
| 1244 | --len; | ||
| 1245 | n = (n + 1) % 16; | 516 | n = (n + 1) % 16; |
| 517 | len--; | ||
| 1246 | } | 518 | } |
| 1247 | if (n == 0) | 519 | if (n > 0) { |
| 1248 | GCM_MUL(ctx, Xi); | ||
| 1249 | else { | ||
| 1250 | ctx->mres = n; | 520 | ctx->mres = n; |
| 1251 | return 0; | 521 | return 0; |
| 1252 | } | 522 | } |
| 523 | gcm_mul(ctx, ctx->Xi.u); | ||
| 1253 | } | 524 | } |
| 1254 | #if defined(GHASH) && !defined(OPENSSL_SMALL_FOOTPRINT) | 525 | if ((i = (len & (size_t)-16)) > 0) { |
| 1255 | while (len >= GHASH_CHUNK) { | 526 | j = i / 16; |
| 1256 | GHASH(ctx, in, GHASH_CHUNK); | 527 | gcm_ghash(ctx, in, i); |
| 1257 | (*stream)(in, out, GHASH_CHUNK/16, key, ctx->Yi.c); | 528 | stream(in, out, j, ctx->key, ctx->Yi.c); |
| 1258 | ctr += GHASH_CHUNK/16; | ||
| 1259 | ctx->Yi.d[3] = htobe32(ctr); | ||
| 1260 | out += GHASH_CHUNK; | ||
| 1261 | in += GHASH_CHUNK; | ||
| 1262 | len -= GHASH_CHUNK; | ||
| 1263 | } | ||
| 1264 | #endif | ||
| 1265 | if ((i = (len & (size_t)-16))) { | ||
| 1266 | size_t j = i/16; | ||
| 1267 | |||
| 1268 | #if defined(GHASH) | ||
| 1269 | GHASH(ctx, in, i); | ||
| 1270 | #else | ||
| 1271 | while (j--) { | ||
| 1272 | size_t k; | ||
| 1273 | for (k = 0; k < 16; ++k) | ||
| 1274 | ctx->Xi.c[k] ^= in[k]; | ||
| 1275 | GCM_MUL(ctx, Xi); | ||
| 1276 | in += 16; | ||
| 1277 | } | ||
| 1278 | j = i/16; | ||
| 1279 | in -= i; | ||
| 1280 | #endif | ||
| 1281 | (*stream)(in, out, j, key, ctx->Yi.c); | ||
| 1282 | ctr += (unsigned int)j; | 529 | ctr += (unsigned int)j; |
| 1283 | ctx->Yi.d[3] = htobe32(ctr); | 530 | ctx->Yi.d[3] = htobe32(ctr); |
| 1284 | out += i; | ||
| 1285 | in += i; | 531 | in += i; |
| 532 | out += i; | ||
| 1286 | len -= i; | 533 | len -= i; |
| 1287 | } | 534 | } |
| 1288 | if (len) { | 535 | if (len > 0) { |
| 1289 | (*ctx->block)(ctx->Yi.c, ctx->EKi.c, key); | 536 | ctx->block(ctx->Yi.c, ctx->EKi.c, ctx->key); |
| 1290 | ++ctr; | 537 | ctx->Yi.d[3] = htobe32(++ctr); |
| 1291 | ctx->Yi.d[3] = htobe32(ctr); | 538 | while (len-- > 0) { |
| 1292 | while (len--) { | 539 | c = in[n]; |
| 1293 | u8 c = in[n]; | ||
| 1294 | ctx->Xi.c[n] ^= c; | 540 | ctx->Xi.c[n] ^= c; |
| 1295 | out[n] = c ^ ctx->EKi.c[n]; | 541 | out[n] = c ^ ctx->EKi.c[n]; |
| 1296 | ++n; | 542 | n++; |
| 1297 | } | 543 | } |
| 1298 | } | 544 | } |
| 1299 | 545 | ||
| 1300 | ctx->mres = n; | 546 | ctx->mres = n; |
| 547 | |||
| 1301 | return 0; | 548 | return 0; |
| 1302 | } | 549 | } |
| 1303 | LCRYPTO_ALIAS(CRYPTO_gcm128_decrypt_ctr32); | 550 | LCRYPTO_ALIAS(CRYPTO_gcm128_decrypt_ctr32); |
| @@ -1306,26 +553,25 @@ int | |||
| 1306 | CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag, | 553 | CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag, |
| 1307 | size_t len) | 554 | size_t len) |
| 1308 | { | 555 | { |
| 1309 | u64 alen = ctx->len.u[0] << 3; | 556 | uint64_t alen, clen; |
| 1310 | u64 clen = ctx->len.u[1] << 3; | 557 | |
| 1311 | #ifdef GCM_FUNCREF_4BIT | 558 | alen = ctx->len.u[0] << 3; |
| 1312 | void (*gcm_gmult_p)(u64 Xi[2], const u128 Htable[16]) = ctx->gmult; | 559 | clen = ctx->len.u[1] << 3; |
| 1313 | #endif | ||
| 1314 | 560 | ||
| 1315 | if (ctx->mres || ctx->ares) | 561 | if (ctx->ares > 0 || ctx->mres > 0) |
| 1316 | GCM_MUL(ctx, Xi); | 562 | gcm_mul(ctx, ctx->Xi.u); |
| 1317 | 563 | ||
| 1318 | ctx->Xi.u[0] ^= htobe64(alen); | 564 | ctx->Xi.u[0] ^= htobe64(alen); |
| 1319 | ctx->Xi.u[1] ^= htobe64(clen); | 565 | ctx->Xi.u[1] ^= htobe64(clen); |
| 1320 | GCM_MUL(ctx, Xi); | 566 | gcm_mul(ctx, ctx->Xi.u); |
| 1321 | 567 | ||
| 1322 | ctx->Xi.u[0] ^= ctx->EK0.u[0]; | 568 | ctx->Xi.u[0] ^= ctx->EK0.u[0]; |
| 1323 | ctx->Xi.u[1] ^= ctx->EK0.u[1]; | 569 | ctx->Xi.u[1] ^= ctx->EK0.u[1]; |
| 1324 | 570 | ||
| 1325 | if (tag && len <= sizeof(ctx->Xi)) | 571 | if (tag == NULL || len > sizeof(ctx->Xi)) |
| 1326 | return memcmp(ctx->Xi.c, tag, len); | ||
| 1327 | else | ||
| 1328 | return -1; | 572 | return -1; |
| 573 | |||
| 574 | return timingsafe_memcmp(ctx->Xi.c, tag, len); | ||
| 1329 | } | 575 | } |
| 1330 | LCRYPTO_ALIAS(CRYPTO_gcm128_finish); | 576 | LCRYPTO_ALIAS(CRYPTO_gcm128_finish); |
| 1331 | 577 | ||
| @@ -1333,26 +579,10 @@ void | |||
| 1333 | CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len) | 579 | CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len) |
| 1334 | { | 580 | { |
| 1335 | CRYPTO_gcm128_finish(ctx, NULL, 0); | 581 | CRYPTO_gcm128_finish(ctx, NULL, 0); |
| 1336 | memcpy(tag, ctx->Xi.c, | ||
| 1337 | len <= sizeof(ctx->Xi.c) ? len : sizeof(ctx->Xi.c)); | ||
| 1338 | } | ||
| 1339 | LCRYPTO_ALIAS(CRYPTO_gcm128_tag); | ||
| 1340 | |||
| 1341 | GCM128_CONTEXT * | ||
| 1342 | CRYPTO_gcm128_new(void *key, block128_f block) | ||
| 1343 | { | ||
| 1344 | GCM128_CONTEXT *ret; | ||
| 1345 | 582 | ||
| 1346 | if ((ret = malloc(sizeof(GCM128_CONTEXT)))) | 583 | if (len > sizeof(ctx->Xi.c)) |
| 1347 | CRYPTO_gcm128_init(ret, key, block); | 584 | len = sizeof(ctx->Xi.c); |
| 1348 | 585 | ||
| 1349 | return ret; | 586 | memcpy(tag, ctx->Xi.c, len); |
| 1350 | } | 587 | } |
| 1351 | LCRYPTO_ALIAS(CRYPTO_gcm128_new); | 588 | LCRYPTO_ALIAS(CRYPTO_gcm128_tag); |
| 1352 | |||
| 1353 | void | ||
| 1354 | CRYPTO_gcm128_release(GCM128_CONTEXT *ctx) | ||
| 1355 | { | ||
| 1356 | freezero(ctx, sizeof(*ctx)); | ||
| 1357 | } | ||
| 1358 | LCRYPTO_ALIAS(CRYPTO_gcm128_release); | ||
diff --git a/src/lib/libcrypto/modes/gcm128_amd64.c b/src/lib/libcrypto/modes/gcm128_amd64.c new file mode 100644 index 0000000000..eaa66fb32f --- /dev/null +++ b/src/lib/libcrypto/modes/gcm128_amd64.c | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | /* $OpenBSD: gcm128_amd64.c,v 1.1 2025/06/28 12:39:10 jsing Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2025 Joel Sing <jsing@openbsd.org> | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include "crypto_arch.h" | ||
| 19 | #include "modes_local.h" | ||
| 20 | |||
| 21 | void gcm_init_4bit(u128 Htable[16], uint64_t H[2]); | ||
| 22 | void gcm_gmult_4bit(uint64_t Xi[2], const u128 Htable[16]); | ||
| 23 | void gcm_ghash_4bit(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp, | ||
| 24 | size_t len); | ||
| 25 | |||
| 26 | void gcm_init_clmul(u128 Htable[16], const uint64_t Xi[2]); | ||
| 27 | void gcm_gmult_clmul(uint64_t Xi[2], const u128 Htable[16]); | ||
| 28 | void gcm_ghash_clmul(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp, | ||
| 29 | size_t len); | ||
| 30 | |||
| 31 | void | ||
| 32 | gcm128_init(GCM128_CONTEXT *ctx) | ||
| 33 | { | ||
| 34 | if ((crypto_cpu_caps_amd64 & CRYPTO_CPU_CAPS_AMD64_CLMUL) != 0) { | ||
| 35 | gcm_init_clmul(ctx->Htable, ctx->H.u); | ||
| 36 | ctx->gmult = gcm_gmult_clmul; | ||
| 37 | ctx->ghash = gcm_ghash_clmul; | ||
| 38 | return; | ||
| 39 | } | ||
| 40 | |||
| 41 | gcm_init_4bit(ctx->Htable, ctx->H.u); | ||
| 42 | ctx->gmult = gcm_gmult_4bit; | ||
| 43 | ctx->ghash = gcm_ghash_4bit; | ||
| 44 | } | ||
diff --git a/src/lib/libcrypto/modes/gcm128_i386.c b/src/lib/libcrypto/modes/gcm128_i386.c new file mode 100644 index 0000000000..14b0b9ce64 --- /dev/null +++ b/src/lib/libcrypto/modes/gcm128_i386.c | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | /* $OpenBSD: gcm128_i386.c,v 1.2 2025/12/31 10:16:24 jsing Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2025 Joel Sing <jsing@openbsd.org> | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include "crypto_arch.h" | ||
| 19 | #include "modes_local.h" | ||
| 20 | |||
| 21 | void gcm_init_4bit(u128 Htable[16], uint64_t H[2]); | ||
| 22 | |||
| 23 | void gcm_gmult_4bit_mmx(uint64_t Xi[2], const u128 Htable[16]); | ||
| 24 | void gcm_ghash_4bit_mmx(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp, | ||
| 25 | size_t len); | ||
| 26 | |||
| 27 | void gcm_gmult_4bit_x86(uint64_t Xi[2], const u128 Htable[16]); | ||
| 28 | void gcm_ghash_4bit_x86(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp, | ||
| 29 | size_t len); | ||
| 30 | |||
| 31 | void gcm_init_clmul(u128 Htable[16], const uint64_t Xi[2]); | ||
| 32 | void gcm_gmult_clmul(uint64_t Xi[2], const u128 Htable[16]); | ||
| 33 | void gcm_ghash_clmul(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp, | ||
| 34 | size_t len); | ||
| 35 | |||
| 36 | void | ||
| 37 | gcm128_init(GCM128_CONTEXT *ctx) | ||
| 38 | { | ||
| 39 | if ((crypto_cpu_caps_i386 & CRYPTO_CPU_CAPS_I386_CLMUL) != 0) { | ||
| 40 | gcm_init_clmul(ctx->Htable, ctx->H.u); | ||
| 41 | ctx->gmult = gcm_gmult_clmul; | ||
| 42 | ctx->ghash = gcm_ghash_clmul; | ||
| 43 | return; | ||
| 44 | } | ||
| 45 | |||
| 46 | if ((crypto_cpu_caps_i386 & CRYPTO_CPU_CAPS_I386_SSE) != 0) { | ||
| 47 | gcm_init_4bit(ctx->Htable, ctx->H.u); | ||
| 48 | ctx->gmult = gcm_gmult_4bit_mmx; | ||
| 49 | ctx->ghash = gcm_ghash_4bit_mmx; | ||
| 50 | return; | ||
| 51 | } | ||
| 52 | |||
| 53 | gcm_init_4bit(ctx->Htable, ctx->H.u); | ||
| 54 | ctx->gmult = gcm_gmult_4bit_x86; | ||
| 55 | ctx->ghash = gcm_ghash_4bit_x86; | ||
| 56 | } | ||
diff --git a/src/lib/libcrypto/modes/modes_local.h b/src/lib/libcrypto/modes/modes_local.h index 511855f2e0..df699d3e4c 100644 --- a/src/lib/libcrypto/modes/modes_local.h +++ b/src/lib/libcrypto/modes/modes_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: modes_local.h,v 1.2 2023/07/08 14:55:36 beck Exp $ */ | 1 | /* $OpenBSD: modes_local.h,v 1.8 2025/11/26 10:19:57 tb Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 2010 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2010 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -6,6 +6,9 @@ | |||
| 6 | * ==================================================================== | 6 | * ==================================================================== |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #ifndef HEADER_MODES_LOCAL_H | ||
| 10 | #define HEADER_MODES_LOCAL_H | ||
| 11 | |||
| 9 | #include <endian.h> | 12 | #include <endian.h> |
| 10 | 13 | ||
| 11 | #include <openssl/opensslconf.h> | 14 | #include <openssl/opensslconf.h> |
| @@ -15,107 +18,51 @@ | |||
| 15 | __BEGIN_HIDDEN_DECLS | 18 | __BEGIN_HIDDEN_DECLS |
| 16 | 19 | ||
| 17 | #if defined(_LP64) | 20 | #if defined(_LP64) |
| 18 | typedef long i64; | ||
| 19 | typedef unsigned long u64; | ||
| 20 | #define U64(C) C##UL | 21 | #define U64(C) C##UL |
| 21 | #else | 22 | #else |
| 22 | typedef long long i64; | ||
| 23 | typedef unsigned long long u64; | ||
| 24 | #define U64(C) C##ULL | 23 | #define U64(C) C##ULL |
| 25 | #endif | 24 | #endif |
| 26 | 25 | ||
| 27 | typedef unsigned int u32; | ||
| 28 | typedef unsigned char u8; | ||
| 29 | |||
| 30 | #if !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) | ||
| 31 | #if defined(__GNUC__) && __GNUC__>=2 | ||
| 32 | # if defined(__x86_64) || defined(__x86_64__) | ||
| 33 | # define BSWAP8(x) ({ u64 ret=(x); \ | ||
| 34 | asm ("bswapq %0" \ | ||
| 35 | : "+r"(ret)); ret; }) | ||
| 36 | # define BSWAP4(x) ({ u32 ret=(x); \ | ||
| 37 | asm ("bswapl %0" \ | ||
| 38 | : "+r"(ret)); ret; }) | ||
| 39 | # elif (defined(__i386) || defined(__i386__)) | ||
| 40 | # define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \ | ||
| 41 | asm ("bswapl %0; bswapl %1" \ | ||
| 42 | : "+r"(hi),"+r"(lo)); \ | ||
| 43 | (u64)hi<<32|lo; }) | ||
| 44 | # define BSWAP4(x) ({ u32 ret=(x); \ | ||
| 45 | asm ("bswapl %0" \ | ||
| 46 | : "+r"(ret)); ret; }) | ||
| 47 | # elif (defined(__arm__) || defined(__arm)) && !defined(__STRICT_ALIGNMENT) | ||
| 48 | # define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \ | ||
| 49 | asm ("rev %0,%0; rev %1,%1" \ | ||
| 50 | : "+r"(hi),"+r"(lo)); \ | ||
| 51 | (u64)hi<<32|lo; }) | ||
| 52 | # define BSWAP4(x) ({ u32 ret; \ | ||
| 53 | asm ("rev %0,%1" \ | ||
| 54 | : "=r"(ret) : "r"((u32)(x))); \ | ||
| 55 | ret; }) | ||
| 56 | # endif | ||
| 57 | #endif | ||
| 58 | #endif | ||
| 59 | |||
| 60 | #if defined(BSWAP4) && !defined(__STRICT_ALIGNMENT) | ||
| 61 | #define GETU32(p) BSWAP4(*(const u32 *)(p)) | ||
| 62 | #define PUTU32(p,v) *(u32 *)(p) = BSWAP4(v) | ||
| 63 | #else | ||
| 64 | #define GETU32(p) ((u32)(p)[0]<<24|(u32)(p)[1]<<16|(u32)(p)[2]<<8|(u32)(p)[3]) | ||
| 65 | #define PUTU32(p,v) ((p)[0]=(u8)((v)>>24),(p)[1]=(u8)((v)>>16),(p)[2]=(u8)((v)>>8),(p)[3]=(u8)(v)) | ||
| 66 | #endif | ||
| 67 | |||
| 68 | /* GCM definitions */ | 26 | /* GCM definitions */ |
| 69 | 27 | ||
| 70 | typedef struct { | 28 | typedef struct { |
| 71 | u64 hi, lo; | 29 | uint64_t hi, lo; |
| 72 | } u128; | 30 | } u128; |
| 73 | 31 | ||
| 74 | #ifdef TABLE_BITS | ||
| 75 | #undef TABLE_BITS | ||
| 76 | #endif | ||
| 77 | /* | ||
| 78 | * Even though permitted values for TABLE_BITS are 8, 4 and 1, it should | ||
| 79 | * never be set to 8 [or 1]. For further information see gcm128.c. | ||
| 80 | */ | ||
| 81 | #define TABLE_BITS 4 | ||
| 82 | |||
| 83 | struct gcm128_context { | 32 | struct gcm128_context { |
| 84 | /* Following 6 names follow names in GCM specification */ | 33 | /* Following 6 names follow names in GCM specification */ |
| 85 | union { | 34 | union { |
| 86 | u64 u[2]; | 35 | uint64_t u[2]; |
| 87 | u32 d[4]; | 36 | uint32_t d[4]; |
| 88 | u8 c[16]; | 37 | uint8_t c[16]; |
| 89 | size_t t[16/sizeof(size_t)]; | 38 | size_t t[16/sizeof(size_t)]; |
| 90 | } Yi, EKi, EK0, len, Xi, H; | 39 | } Yi, EKi, EK0, len, Xi, H; |
| 91 | /* Relative position of Xi, H and pre-computed Htable is used | 40 | /* Relative position of Xi, H and pre-computed Htable is used |
| 92 | * in some assembler modules, i.e. don't change the order! */ | 41 | * in some assembler modules, i.e. don't change the order! */ |
| 93 | #if TABLE_BITS==8 | ||
| 94 | u128 Htable[256]; | ||
| 95 | #else | ||
| 96 | u128 Htable[16]; | 42 | u128 Htable[16]; |
| 97 | void (*gmult)(u64 Xi[2], const u128 Htable[16]); | 43 | void (*gmult)(uint64_t Xi[2], const u128 Htable[16]); |
| 98 | void (*ghash)(u64 Xi[2], const u128 Htable[16], const u8 *inp, | 44 | void (*ghash)(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp, |
| 99 | size_t len); | 45 | size_t len); |
| 100 | #endif | ||
| 101 | unsigned int mres, ares; | 46 | unsigned int mres, ares; |
| 102 | block128_f block; | 47 | block128_f block; |
| 103 | void *key; | 48 | void *key; |
| 104 | }; | 49 | }; |
| 105 | 50 | ||
| 106 | struct xts128_context { | 51 | struct xts128_context { |
| 107 | void *key1, *key2; | 52 | const void *key1, *key2; |
| 108 | block128_f block1, block2; | 53 | block128_f block1, block2; |
| 109 | }; | 54 | }; |
| 110 | 55 | ||
| 111 | struct ccm128_context { | 56 | struct ccm128_context { |
| 112 | union { | 57 | union { |
| 113 | u64 u[2]; | 58 | uint64_t u[2]; |
| 114 | u8 c[16]; | 59 | uint8_t c[16]; |
| 115 | } nonce, cmac; | 60 | } nonce, cmac; |
| 116 | u64 blocks; | 61 | uint64_t blocks; |
| 117 | block128_f block; | 62 | block128_f block; |
| 118 | void *key; | 63 | void *key; |
| 119 | }; | 64 | }; |
| 120 | 65 | ||
| 121 | __END_HIDDEN_DECLS | 66 | __END_HIDDEN_DECLS |
| 67 | |||
| 68 | #endif /* HEADER_MODES_LOCAL_H */ | ||
diff --git a/src/lib/libcrypto/modes/ofb128.c b/src/lib/libcrypto/modes/ofb128.c index 42afd29d58..8440e7f583 100644 --- a/src/lib/libcrypto/modes/ofb128.c +++ b/src/lib/libcrypto/modes/ofb128.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ofb128.c,v 1.7 2023/07/08 14:56:54 beck Exp $ */ | 1 | /* $OpenBSD: ofb128.c,v 1.10 2025/04/23 10:09:08 jsing Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 2008 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2008 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -49,15 +49,11 @@ | |||
| 49 | * | 49 | * |
| 50 | */ | 50 | */ |
| 51 | 51 | ||
| 52 | #include <openssl/crypto.h> | ||
| 53 | #include "modes_local.h" | ||
| 54 | #include <string.h> | 52 | #include <string.h> |
| 55 | 53 | ||
| 56 | #ifndef MODES_DEBUG | 54 | #include <openssl/crypto.h> |
| 57 | # ifndef NDEBUG | 55 | |
| 58 | # define NDEBUG | 56 | #include "modes_local.h" |
| 59 | # endif | ||
| 60 | #endif | ||
| 61 | 57 | ||
| 62 | /* The input and output encrypted as though 128bit ofb mode is being | 58 | /* The input and output encrypted as though 128bit ofb mode is being |
| 63 | * used. The extra state information to record how much of the | 59 | * used. The extra state information to record how much of the |
| @@ -74,7 +70,6 @@ CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, | |||
| 74 | 70 | ||
| 75 | n = *num; | 71 | n = *num; |
| 76 | 72 | ||
| 77 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | ||
| 78 | if (16 % sizeof(size_t) == 0) | 73 | if (16 % sizeof(size_t) == 0) |
| 79 | do { /* always true actually */ | 74 | do { /* always true actually */ |
| 80 | while (n && len) { | 75 | while (n && len) { |
| @@ -109,7 +104,6 @@ CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, | |||
| 109 | return; | 104 | return; |
| 110 | } while (0); | 105 | } while (0); |
| 111 | /* the rest would be commonly eliminated by x86* compiler */ | 106 | /* the rest would be commonly eliminated by x86* compiler */ |
| 112 | #endif | ||
| 113 | while (l < len) { | 107 | while (l < len) { |
| 114 | if (n == 0) { | 108 | if (n == 0) { |
| 115 | (*block)(ivec, ivec, key); | 109 | (*block)(ivec, ivec, key); |
diff --git a/src/lib/libcrypto/modes/xts128.c b/src/lib/libcrypto/modes/xts128.c index 7516acf850..9c863e73d6 100644 --- a/src/lib/libcrypto/modes/xts128.c +++ b/src/lib/libcrypto/modes/xts128.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: xts128.c,v 1.12 2023/07/08 14:56:54 beck Exp $ */ | 1 | /* $OpenBSD: xts128.c,v 1.15 2025/05/18 09:05:59 jsing Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2011 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -48,17 +48,12 @@ | |||
| 48 | * ==================================================================== | 48 | * ==================================================================== |
| 49 | */ | 49 | */ |
| 50 | 50 | ||
| 51 | #include <openssl/crypto.h> | ||
| 52 | #include "modes_local.h" | ||
| 53 | |||
| 54 | #include <endian.h> | 51 | #include <endian.h> |
| 55 | #include <string.h> | 52 | #include <string.h> |
| 56 | 53 | ||
| 57 | #ifndef MODES_DEBUG | 54 | #include <openssl/crypto.h> |
| 58 | # ifndef NDEBUG | 55 | |
| 59 | # define NDEBUG | 56 | #include "modes_local.h" |
| 60 | # endif | ||
| 61 | #endif | ||
| 62 | 57 | ||
| 63 | int | 58 | int |
| 64 | CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], | 59 | CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], |
| @@ -66,9 +61,9 @@ CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], | |||
| 66 | size_t len, int enc) | 61 | size_t len, int enc) |
| 67 | { | 62 | { |
| 68 | union { | 63 | union { |
| 69 | u64 u[2]; | 64 | uint64_t u[2]; |
| 70 | u32 d[4]; | 65 | uint32_t d[4]; |
| 71 | u8 c[16]; | 66 | uint8_t c[16]; |
| 72 | } tweak, scratch; | 67 | } tweak, scratch; |
| 73 | unsigned int i; | 68 | unsigned int i; |
| 74 | 69 | ||
| @@ -88,8 +83,8 @@ CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], | |||
| 88 | scratch.u[0] ^= tweak.u[0]; | 83 | scratch.u[0] ^= tweak.u[0]; |
| 89 | scratch.u[1] ^= tweak.u[1]; | 84 | scratch.u[1] ^= tweak.u[1]; |
| 90 | #else | 85 | #else |
| 91 | scratch.u[0] = ((u64 *)inp)[0] ^ tweak.u[0]; | 86 | scratch.u[0] = ((uint64_t *)inp)[0] ^ tweak.u[0]; |
| 92 | scratch.u[1] = ((u64 *)inp)[1] ^ tweak.u[1]; | 87 | scratch.u[1] = ((uint64_t *)inp)[1] ^ tweak.u[1]; |
| 93 | #endif | 88 | #endif |
| 94 | (*ctx->block1)(scratch.c, scratch.c, ctx->key1); | 89 | (*ctx->block1)(scratch.c, scratch.c, ctx->key1); |
| 95 | #ifdef __STRICT_ALIGNMENT | 90 | #ifdef __STRICT_ALIGNMENT |
| @@ -97,8 +92,8 @@ CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], | |||
| 97 | scratch.u[1] ^= tweak.u[1]; | 92 | scratch.u[1] ^= tweak.u[1]; |
| 98 | memcpy(out, scratch.c, 16); | 93 | memcpy(out, scratch.c, 16); |
| 99 | #else | 94 | #else |
| 100 | ((u64 *)out)[0] = scratch.u[0] ^= tweak.u[0]; | 95 | ((uint64_t *)out)[0] = scratch.u[0] ^= tweak.u[0]; |
| 101 | ((u64 *)out)[1] = scratch.u[1] ^= tweak.u[1]; | 96 | ((uint64_t *)out)[1] = scratch.u[1] ^= tweak.u[1]; |
| 102 | #endif | 97 | #endif |
| 103 | inp += 16; | 98 | inp += 16; |
| 104 | out += 16; | 99 | out += 16; |
| @@ -120,15 +115,15 @@ CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], | |||
| 120 | for (c = 0, i = 0; i < 16; ++i) { | 115 | for (c = 0, i = 0; i < 16; ++i) { |
| 121 | /*+ substitutes for |, because c is 1 bit */ | 116 | /*+ substitutes for |, because c is 1 bit */ |
| 122 | c += ((size_t)tweak.c[i]) << 1; | 117 | c += ((size_t)tweak.c[i]) << 1; |
| 123 | tweak.c[i] = (u8)c; | 118 | tweak.c[i] = (uint8_t)c; |
| 124 | c = c >> 8; | 119 | c = c >> 8; |
| 125 | } | 120 | } |
| 126 | tweak.c[0] ^= (u8)(0x87 & (0 - c)); | 121 | tweak.c[0] ^= (uint8_t)(0x87 & (0 - c)); |
| 127 | #endif | 122 | #endif |
| 128 | } | 123 | } |
| 129 | if (enc) { | 124 | if (enc) { |
| 130 | for (i = 0; i < len; ++i) { | 125 | for (i = 0; i < len; ++i) { |
| 131 | u8 ch = inp[i]; | 126 | uint8_t ch = inp[i]; |
| 132 | out[i] = scratch.c[i]; | 127 | out[i] = scratch.c[i]; |
| 133 | scratch.c[i] = ch; | 128 | scratch.c[i] = ch; |
| 134 | } | 129 | } |
| @@ -140,8 +135,8 @@ CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], | |||
| 140 | memcpy(out - 16, scratch.c, 16); | 135 | memcpy(out - 16, scratch.c, 16); |
| 141 | } else { | 136 | } else { |
| 142 | union { | 137 | union { |
| 143 | u64 u[2]; | 138 | uint64_t u[2]; |
| 144 | u8 c[16]; | 139 | uint8_t c[16]; |
| 145 | } tweak1; | 140 | } tweak1; |
| 146 | 141 | ||
| 147 | #if BYTE_ORDER == LITTLE_ENDIAN | 142 | #if BYTE_ORDER == LITTLE_ENDIAN |
| @@ -157,25 +152,25 @@ CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], | |||
| 157 | for (c = 0, i = 0; i < 16; ++i) { | 152 | for (c = 0, i = 0; i < 16; ++i) { |
| 158 | /*+ substitutes for |, because c is 1 bit */ | 153 | /*+ substitutes for |, because c is 1 bit */ |
| 159 | c += ((size_t)tweak.c[i]) << 1; | 154 | c += ((size_t)tweak.c[i]) << 1; |
| 160 | tweak1.c[i] = (u8)c; | 155 | tweak1.c[i] = (uint8_t)c; |
| 161 | c = c >> 8; | 156 | c = c >> 8; |
| 162 | } | 157 | } |
| 163 | tweak1.c[0] ^= (u8)(0x87 & (0 - c)); | 158 | tweak1.c[0] ^= (uint8_t)(0x87 & (0 - c)); |
| 164 | #endif | 159 | #endif |
| 165 | #ifdef __STRICT_ALIGNMENT | 160 | #ifdef __STRICT_ALIGNMENT |
| 166 | memcpy(scratch.c, inp, 16); | 161 | memcpy(scratch.c, inp, 16); |
| 167 | scratch.u[0] ^= tweak1.u[0]; | 162 | scratch.u[0] ^= tweak1.u[0]; |
| 168 | scratch.u[1] ^= tweak1.u[1]; | 163 | scratch.u[1] ^= tweak1.u[1]; |
| 169 | #else | 164 | #else |
| 170 | scratch.u[0] = ((u64 *)inp)[0] ^ tweak1.u[0]; | 165 | scratch.u[0] = ((uint64_t *)inp)[0] ^ tweak1.u[0]; |
| 171 | scratch.u[1] = ((u64 *)inp)[1] ^ tweak1.u[1]; | 166 | scratch.u[1] = ((uint64_t *)inp)[1] ^ tweak1.u[1]; |
| 172 | #endif | 167 | #endif |
| 173 | (*ctx->block1)(scratch.c, scratch.c, ctx->key1); | 168 | (*ctx->block1)(scratch.c, scratch.c, ctx->key1); |
| 174 | scratch.u[0] ^= tweak1.u[0]; | 169 | scratch.u[0] ^= tweak1.u[0]; |
| 175 | scratch.u[1] ^= tweak1.u[1]; | 170 | scratch.u[1] ^= tweak1.u[1]; |
| 176 | 171 | ||
| 177 | for (i = 0; i < len; ++i) { | 172 | for (i = 0; i < len; ++i) { |
| 178 | u8 ch = inp[16 + i]; | 173 | uint8_t ch = inp[16 + i]; |
| 179 | out[16 + i] = scratch.c[i]; | 174 | out[16 + i] = scratch.c[i]; |
| 180 | scratch.c[i] = ch; | 175 | scratch.c[i] = ch; |
| 181 | } | 176 | } |
| @@ -187,8 +182,8 @@ CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], | |||
| 187 | scratch.u[1] ^= tweak.u[1]; | 182 | scratch.u[1] ^= tweak.u[1]; |
| 188 | memcpy(out, scratch.c, 16); | 183 | memcpy(out, scratch.c, 16); |
| 189 | #else | 184 | #else |
| 190 | ((u64 *)out)[0] = scratch.u[0] ^ tweak.u[0]; | 185 | ((uint64_t *)out)[0] = scratch.u[0] ^ tweak.u[0]; |
| 191 | ((u64 *)out)[1] = scratch.u[1] ^ tweak.u[1]; | 186 | ((uint64_t *)out)[1] = scratch.u[1] ^ tweak.u[1]; |
| 192 | #endif | 187 | #endif |
| 193 | } | 188 | } |
| 194 | 189 | ||
diff --git a/src/lib/libcrypto/objects/obj_dat.c b/src/lib/libcrypto/objects/obj_dat.c index 2f4012fe15..d4da6be52c 100644 --- a/src/lib/libcrypto/objects/obj_dat.c +++ b/src/lib/libcrypto/objects/obj_dat.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: obj_dat.c,v 1.94 2025/02/26 10:48:25 tb Exp $ */ | 1 | /* $OpenBSD: obj_dat.c,v 1.95 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -66,11 +66,11 @@ | |||
| 66 | 66 | ||
| 67 | #include <openssl/asn1.h> | 67 | #include <openssl/asn1.h> |
| 68 | #include <openssl/bn.h> | 68 | #include <openssl/bn.h> |
| 69 | #include <openssl/err.h> | ||
| 70 | #include <openssl/lhash.h> | 69 | #include <openssl/lhash.h> |
| 71 | #include <openssl/objects.h> | 70 | #include <openssl/objects.h> |
| 72 | 71 | ||
| 73 | #include "asn1_local.h" | 72 | #include "asn1_local.h" |
| 73 | #include "err_local.h" | ||
| 74 | 74 | ||
| 75 | /* obj_dat.h is generated from objects.h by obj_dat.pl */ | 75 | /* obj_dat.h is generated from objects.h by obj_dat.pl */ |
| 76 | #include "obj_dat.h" | 76 | #include "obj_dat.h" |
diff --git a/src/lib/libcrypto/objects/obj_lib.c b/src/lib/libcrypto/objects/obj_lib.c index 45062dbd4c..56b0b10423 100644 --- a/src/lib/libcrypto/objects/obj_lib.c +++ b/src/lib/libcrypto/objects/obj_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: obj_lib.c,v 1.19 2023/08/17 09:13:01 tb Exp $ */ | 1 | /* $OpenBSD: obj_lib.c,v 1.20 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -59,12 +59,12 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <string.h> | 60 | #include <string.h> |
| 61 | 61 | ||
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/buffer.h> | 62 | #include <openssl/buffer.h> |
| 64 | #include <openssl/lhash.h> | 63 | #include <openssl/lhash.h> |
| 65 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
| 66 | 65 | ||
| 67 | #include "asn1_local.h" | 66 | #include "asn1_local.h" |
| 67 | #include "err_local.h" | ||
| 68 | 68 | ||
| 69 | ASN1_OBJECT * | 69 | ASN1_OBJECT * |
| 70 | OBJ_dup(const ASN1_OBJECT *o) | 70 | OBJ_dup(const ASN1_OBJECT *o) |
diff --git a/src/lib/libcrypto/objects/obj_mac.num b/src/lib/libcrypto/objects/obj_mac.num index 728bf02400..2f93e12b82 100644 --- a/src/lib/libcrypto/objects/obj_mac.num +++ b/src/lib/libcrypto/objects/obj_mac.num | |||
| @@ -1053,3 +1053,4 @@ RSA_SHA3_512 1052 | |||
| 1053 | acmeIdentifier 1053 | 1053 | acmeIdentifier 1053 |
| 1054 | id_ct_rpkiSignedPrefixList 1054 | 1054 | id_ct_rpkiSignedPrefixList 1054 |
| 1055 | tls1_prf 1055 | 1055 | tls1_prf 1055 |
| 1056 | X25519MLKEM768 1056 | ||
diff --git a/src/lib/libcrypto/objects/objects.txt b/src/lib/libcrypto/objects/objects.txt index 4d5a52efcf..933fa51f71 100644 --- a/src/lib/libcrypto/objects/objects.txt +++ b/src/lib/libcrypto/objects/objects.txt | |||
| @@ -1477,3 +1477,8 @@ tc26 1 3 3 : id-tc26-signwithdigest-gost3410-2012-512 : GOST R 34.11-2012 with | |||
| 1477 | : AuthECDSA : auth-ecdsa | 1477 | : AuthECDSA : auth-ecdsa |
| 1478 | : AuthGOST01 : auth-gost01 | 1478 | : AuthGOST01 : auth-gost01 |
| 1479 | : AuthNULL : auth-null | 1479 | : AuthNULL : auth-null |
| 1480 | |||
| 1481 | # MLKEM/X25519 hybrid for TLS - no OID assigned | ||
| 1482 | # see https://datatracker.ietf.org/doc/draft-ietf-tls-ecdhe-mlkem/ | ||
| 1483 | # section 7.1 | ||
| 1484 | : X25519MLKEM768 | ||
diff --git a/src/lib/libcrypto/ocsp/ocsp_cl.c b/src/lib/libcrypto/ocsp/ocsp_cl.c index d8ee33c391..460c1bce5e 100644 --- a/src/lib/libcrypto/ocsp/ocsp_cl.c +++ b/src/lib/libcrypto/ocsp/ocsp_cl.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ocsp_cl.c,v 1.25 2024/03/24 11:30:12 beck Exp $ */ | 1 | /* $OpenBSD: ocsp_cl.c,v 1.26 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL | 2 | /* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL |
| 3 | * project. */ | 3 | * project. */ |
| 4 | 4 | ||
| @@ -64,7 +64,6 @@ | |||
| 64 | #include <stdio.h> | 64 | #include <stdio.h> |
| 65 | #include <time.h> | 65 | #include <time.h> |
| 66 | 66 | ||
| 67 | #include <openssl/err.h> | ||
| 68 | #include <openssl/ocsp.h> | 67 | #include <openssl/ocsp.h> |
| 69 | #include <openssl/objects.h> | 68 | #include <openssl/objects.h> |
| 70 | #include <openssl/pem.h> | 69 | #include <openssl/pem.h> |
| @@ -73,6 +72,7 @@ | |||
| 73 | #include <openssl/x509v3.h> | 72 | #include <openssl/x509v3.h> |
| 74 | 73 | ||
| 75 | #include "asn1_local.h" | 74 | #include "asn1_local.h" |
| 75 | #include "err_local.h" | ||
| 76 | #include "ocsp_local.h" | 76 | #include "ocsp_local.h" |
| 77 | 77 | ||
| 78 | /* Utility functions related to sending OCSP requests and extracting | 78 | /* Utility functions related to sending OCSP requests and extracting |
diff --git a/src/lib/libcrypto/ocsp/ocsp_ht.c b/src/lib/libcrypto/ocsp/ocsp_ht.c index 69723c2154..db83b35518 100644 --- a/src/lib/libcrypto/ocsp/ocsp_ht.c +++ b/src/lib/libcrypto/ocsp/ocsp_ht.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ocsp_ht.c,v 1.27 2023/11/28 09:29:20 jsg Exp $ */ | 1 | /* $OpenBSD: ocsp_ht.c,v 1.28 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -60,11 +60,13 @@ | |||
| 60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
| 61 | #include <ctype.h> | 61 | #include <ctype.h> |
| 62 | #include <string.h> | 62 | #include <string.h> |
| 63 | |||
| 63 | #include <openssl/asn1.h> | 64 | #include <openssl/asn1.h> |
| 64 | #include <openssl/ocsp.h> | 65 | #include <openssl/ocsp.h> |
| 65 | #include <openssl/err.h> | ||
| 66 | #include <openssl/buffer.h> | 66 | #include <openssl/buffer.h> |
| 67 | 67 | ||
| 68 | #include "err_local.h" | ||
| 69 | |||
| 68 | /* Stateful OCSP request code, supporting non-blocking I/O */ | 70 | /* Stateful OCSP request code, supporting non-blocking I/O */ |
| 69 | 71 | ||
| 70 | /* Opaque OCSP request status structure */ | 72 | /* Opaque OCSP request status structure */ |
diff --git a/src/lib/libcrypto/ocsp/ocsp_lib.c b/src/lib/libcrypto/ocsp/ocsp_lib.c index 521fb67aed..dfa002a594 100644 --- a/src/lib/libcrypto/ocsp/ocsp_lib.c +++ b/src/lib/libcrypto/ocsp/ocsp_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ocsp_lib.c,v 1.28 2024/08/28 06:27:19 tb Exp $ */ | 1 | /* $OpenBSD: ocsp_lib.c,v 1.29 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL | 2 | /* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL |
| 3 | * project. */ | 3 | * project. */ |
| 4 | 4 | ||
| @@ -67,13 +67,13 @@ | |||
| 67 | #include <openssl/opensslconf.h> | 67 | #include <openssl/opensslconf.h> |
| 68 | 68 | ||
| 69 | #include <openssl/asn1t.h> | 69 | #include <openssl/asn1t.h> |
| 70 | #include <openssl/err.h> | ||
| 71 | #include <openssl/objects.h> | 70 | #include <openssl/objects.h> |
| 72 | #include <openssl/ocsp.h> | 71 | #include <openssl/ocsp.h> |
| 73 | #include <openssl/pem.h> | 72 | #include <openssl/pem.h> |
| 74 | #include <openssl/x509.h> | 73 | #include <openssl/x509.h> |
| 75 | #include <openssl/x509v3.h> | 74 | #include <openssl/x509v3.h> |
| 76 | 75 | ||
| 76 | #include "err_local.h" | ||
| 77 | #include "ocsp_local.h" | 77 | #include "ocsp_local.h" |
| 78 | #include "x509_local.h" | 78 | #include "x509_local.h" |
| 79 | 79 | ||
diff --git a/src/lib/libcrypto/ocsp/ocsp_prn.c b/src/lib/libcrypto/ocsp/ocsp_prn.c index fb7b9651d9..537d5e3d20 100644 --- a/src/lib/libcrypto/ocsp/ocsp_prn.c +++ b/src/lib/libcrypto/ocsp/ocsp_prn.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ocsp_prn.c,v 1.11 2024/08/28 06:18:44 tb Exp $ */ | 1 | /* $OpenBSD: ocsp_prn.c,v 1.12 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL | 2 | /* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL |
| 3 | * project. */ | 3 | * project. */ |
| 4 | 4 | ||
| @@ -62,7 +62,6 @@ | |||
| 62 | */ | 62 | */ |
| 63 | 63 | ||
| 64 | #include <openssl/bio.h> | 64 | #include <openssl/bio.h> |
| 65 | #include <openssl/err.h> | ||
| 66 | #include <openssl/ocsp.h> | 65 | #include <openssl/ocsp.h> |
| 67 | #include <openssl/pem.h> | 66 | #include <openssl/pem.h> |
| 68 | #include <openssl/x509.h> | 67 | #include <openssl/x509.h> |
diff --git a/src/lib/libcrypto/ocsp/ocsp_srv.c b/src/lib/libcrypto/ocsp/ocsp_srv.c index 77c5e2e0fd..4b1d73d7ac 100644 --- a/src/lib/libcrypto/ocsp/ocsp_srv.c +++ b/src/lib/libcrypto/ocsp/ocsp_srv.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ocsp_srv.c,v 1.13 2023/07/08 10:44:00 beck Exp $ */ | 1 | /* $OpenBSD: ocsp_srv.c,v 1.14 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2001. | 3 | * project 2001. |
| 4 | */ | 4 | */ |
| @@ -58,13 +58,13 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | 60 | ||
| 61 | #include <openssl/err.h> | ||
| 62 | #include <openssl/objects.h> | 61 | #include <openssl/objects.h> |
| 63 | #include <openssl/ocsp.h> | 62 | #include <openssl/ocsp.h> |
| 64 | #include <openssl/pem.h> | 63 | #include <openssl/pem.h> |
| 65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
| 66 | #include <openssl/x509v3.h> | 65 | #include <openssl/x509v3.h> |
| 67 | 66 | ||
| 67 | #include "err_local.h" | ||
| 68 | #include "ocsp_local.h" | 68 | #include "ocsp_local.h" |
| 69 | 69 | ||
| 70 | /* Utility functions related to sending OCSP responses and extracting | 70 | /* Utility functions related to sending OCSP responses and extracting |
diff --git a/src/lib/libcrypto/ocsp/ocsp_vfy.c b/src/lib/libcrypto/ocsp/ocsp_vfy.c index 27d2283ea7..185839f465 100644 --- a/src/lib/libcrypto/ocsp/ocsp_vfy.c +++ b/src/lib/libcrypto/ocsp/ocsp_vfy.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ocsp_vfy.c,v 1.24 2024/07/12 18:15:10 beck Exp $ */ | 1 | /* $OpenBSD: ocsp_vfy.c,v 1.25 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -57,9 +57,9 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <openssl/ocsp.h> | 59 | #include <openssl/ocsp.h> |
| 60 | #include <openssl/err.h> | ||
| 61 | #include <string.h> | 60 | #include <string.h> |
| 62 | 61 | ||
| 62 | #include "err_local.h" | ||
| 63 | #include "ocsp_local.h" | 63 | #include "ocsp_local.h" |
| 64 | #include "x509_local.h" | 64 | #include "x509_local.h" |
| 65 | 65 | ||
diff --git a/src/lib/libcrypto/opensslconf.h b/src/lib/libcrypto/opensslconf.h new file mode 100644 index 0000000000..c5b30fbfcb --- /dev/null +++ b/src/lib/libcrypto/opensslconf.h | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | /* $OpenBSD: opensslconf.h,v 1.4 2025/08/29 18:29:42 tb Exp $ */ | ||
| 2 | /* | ||
| 3 | * Public domain. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include <openssl/opensslfeatures.h> | ||
| 7 | |||
| 8 | #ifndef OPENSSL_FILE | ||
| 9 | #ifdef OPENSSL_NO_FILENAMES | ||
| 10 | #define OPENSSL_FILE "" | ||
| 11 | #define OPENSSL_LINE 0 | ||
| 12 | #else | ||
| 13 | #define OPENSSL_FILE __FILE__ | ||
| 14 | #define OPENSSL_LINE __LINE__ | ||
| 15 | #endif | ||
| 16 | #endif | ||
diff --git a/src/lib/libcrypto/opensslv.h b/src/lib/libcrypto/opensslv.h index bf06db8bce..e191a0dec1 100644 --- a/src/lib/libcrypto/opensslv.h +++ b/src/lib/libcrypto/opensslv.h | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | /* $OpenBSD: opensslv.h,v 1.80 2025/03/09 15:49:18 tb Exp $ */ | 1 | /* $OpenBSD: opensslv.h,v 1.81 2025/09/28 14:17:52 tb Exp $ */ |
| 2 | #ifndef HEADER_OPENSSLV_H | 2 | #ifndef HEADER_OPENSSLV_H |
| 3 | #define HEADER_OPENSSLV_H | 3 | #define HEADER_OPENSSLV_H |
| 4 | 4 | ||
| 5 | /* These will change with each release of LibreSSL-portable */ | 5 | /* These will change with each release of LibreSSL-portable */ |
| 6 | #define LIBRESSL_VERSION_NUMBER 0x4010000fL | 6 | #define LIBRESSL_VERSION_NUMBER 0x4020000fL |
| 7 | /* ^ Patch starts here */ | 7 | /* ^ Patch starts here */ |
| 8 | #define LIBRESSL_VERSION_TEXT "LibreSSL 4.1.0" | 8 | #define LIBRESSL_VERSION_TEXT "LibreSSL 4.2.0" |
| 9 | 9 | ||
| 10 | /* These will never change */ | 10 | /* These will never change */ |
| 11 | #define OPENSSL_VERSION_NUMBER 0x20000000L | 11 | #define OPENSSL_VERSION_NUMBER 0x20000000L |
diff --git a/src/lib/libcrypto/pem/pem.h b/src/lib/libcrypto/pem/pem.h index 4fdab48bb2..709e17308b 100644 --- a/src/lib/libcrypto/pem/pem.h +++ b/src/lib/libcrypto/pem/pem.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pem.h,v 1.28 2024/05/11 05:41:28 tb Exp $ */ | 1 | /* $OpenBSD: pem.h,v 1.29 2025/07/16 15:59:26 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -338,8 +338,6 @@ int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, void *x, | |||
| 338 | 338 | ||
| 339 | STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp, | 339 | STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp, |
| 340 | STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u); | 340 | STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u); |
| 341 | int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc, | ||
| 342 | unsigned char *kstr, int klen, pem_password_cb *cd, void *u); | ||
| 343 | #endif | 341 | #endif |
| 344 | 342 | ||
| 345 | int PEM_read(FILE *fp, char **name, char **header, | 343 | int PEM_read(FILE *fp, char **name, char **header, |
| @@ -351,8 +349,6 @@ void * PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, | |||
| 351 | int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, | 349 | int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, |
| 352 | void *x, const EVP_CIPHER *enc, unsigned char *kstr, | 350 | void *x, const EVP_CIPHER *enc, unsigned char *kstr, |
| 353 | int klen, pem_password_cb *callback, void *u); | 351 | int klen, pem_password_cb *callback, void *u); |
| 354 | STACK_OF(X509_INFO) * PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, | ||
| 355 | pem_password_cb *cb, void *u); | ||
| 356 | 352 | ||
| 357 | int PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type); | 353 | int PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type); |
| 358 | int PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *d, unsigned int cnt); | 354 | int PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *d, unsigned int cnt); |
diff --git a/src/lib/libcrypto/pem/pem_info.c b/src/lib/libcrypto/pem/pem_info.c index b979c79b33..26061f6f08 100644 --- a/src/lib/libcrypto/pem/pem_info.c +++ b/src/lib/libcrypto/pem/pem_info.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pem_info.c,v 1.27 2023/07/07 13:40:44 beck Exp $ */ | 1 | /* $OpenBSD: pem_info.c,v 1.33 2025/07/16 15:59:26 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -57,43 +57,81 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <stdlib.h> | ||
| 60 | #include <string.h> | 61 | #include <string.h> |
| 61 | 62 | ||
| 62 | #include <openssl/opensslconf.h> | 63 | #include <openssl/opensslconf.h> |
| 63 | 64 | ||
| 64 | #include <openssl/buffer.h> | 65 | #include <openssl/asn1.h> |
| 66 | #include <openssl/bio.h> | ||
| 67 | #include <openssl/crypto.h> | ||
| 68 | #include <openssl/dsa.h> | ||
| 69 | #include <openssl/ec.h> | ||
| 65 | #include <openssl/err.h> | 70 | #include <openssl/err.h> |
| 66 | #include <openssl/evp.h> | 71 | #include <openssl/evp.h> |
| 67 | #include <openssl/objects.h> | 72 | #include <openssl/objects.h> |
| 68 | #include <openssl/pem.h> | 73 | #include <openssl/pem.h> |
| 69 | #include <openssl/x509.h> | ||
| 70 | |||
| 71 | #ifndef OPENSSL_NO_DSA | ||
| 72 | #include <openssl/dsa.h> | ||
| 73 | #endif | ||
| 74 | #ifndef OPENSSL_NO_RSA | ||
| 75 | #include <openssl/rsa.h> | 74 | #include <openssl/rsa.h> |
| 76 | #endif | 75 | #include <openssl/x509.h> |
| 77 | 76 | ||
| 77 | #include "err_local.h" | ||
| 78 | #include "evp_local.h" | 78 | #include "evp_local.h" |
| 79 | 79 | ||
| 80 | STACK_OF(X509_INFO) * | 80 | X509_PKEY * |
| 81 | PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, | 81 | X509_PKEY_new(void) |
| 82 | void *u) | 82 | { |
| 83 | X509_PKEY *x_pkey; | ||
| 84 | |||
| 85 | if ((x_pkey = calloc(1, sizeof(*x_pkey))) == NULL) { | ||
| 86 | ASN1error(ERR_R_MALLOC_FAILURE); | ||
| 87 | return NULL; | ||
| 88 | } | ||
| 89 | |||
| 90 | return x_pkey; | ||
| 91 | } | ||
| 92 | |||
| 93 | void | ||
| 94 | X509_PKEY_free(X509_PKEY *x_pkey) | ||
| 95 | { | ||
| 96 | if (x_pkey == NULL) | ||
| 97 | return; | ||
| 98 | |||
| 99 | EVP_PKEY_free(x_pkey->dec_pkey); | ||
| 100 | free(x_pkey); | ||
| 101 | } | ||
| 102 | |||
| 103 | X509_INFO * | ||
| 104 | X509_INFO_new(void) | ||
| 83 | { | 105 | { |
| 84 | BIO *b; | 106 | X509_INFO *ret; |
| 85 | STACK_OF(X509_INFO) *ret; | ||
| 86 | 107 | ||
| 87 | if ((b = BIO_new(BIO_s_file())) == NULL) { | 108 | if ((ret = calloc(1, sizeof(X509_INFO))) == NULL) { |
| 88 | PEMerror(ERR_R_BUF_LIB); | 109 | ASN1error(ERR_R_MALLOC_FAILURE); |
| 89 | return (0); | 110 | return NULL; |
| 90 | } | 111 | } |
| 91 | BIO_set_fp(b, fp, BIO_NOCLOSE); | 112 | ret->references = 1; |
| 92 | ret = PEM_X509_INFO_read_bio(b, sk, cb, u); | 113 | |
| 93 | BIO_free(b); | 114 | return ret; |
| 94 | return (ret); | 115 | } |
| 116 | LCRYPTO_ALIAS(X509_INFO_new); | ||
| 117 | |||
| 118 | void | ||
| 119 | X509_INFO_free(X509_INFO *x) | ||
| 120 | { | ||
| 121 | if (x == NULL) | ||
| 122 | return; | ||
| 123 | |||
| 124 | if (CRYPTO_add(&x->references, -1, CRYPTO_LOCK_X509_INFO) > 0) | ||
| 125 | return; | ||
| 126 | |||
| 127 | X509_free(x->x509); | ||
| 128 | X509_CRL_free(x->crl); | ||
| 129 | X509_PKEY_free(x->x_pkey); | ||
| 130 | free(x->enc_data); | ||
| 131 | |||
| 132 | free(x); | ||
| 95 | } | 133 | } |
| 96 | LCRYPTO_ALIAS(PEM_X509_INFO_read); | 134 | LCRYPTO_ALIAS(X509_INFO_free); |
| 97 | 135 | ||
| 98 | STACK_OF(X509_INFO) * | 136 | STACK_OF(X509_INFO) * |
| 99 | PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, | 137 | PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, |
| @@ -290,98 +328,3 @@ err: | |||
| 290 | return ret; | 328 | return ret; |
| 291 | } | 329 | } |
| 292 | LCRYPTO_ALIAS(PEM_X509_INFO_read_bio); | 330 | LCRYPTO_ALIAS(PEM_X509_INFO_read_bio); |
| 293 | |||
| 294 | |||
| 295 | /* A TJH addition */ | ||
| 296 | int | ||
| 297 | PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc, | ||
| 298 | unsigned char *kstr, int klen, pem_password_cb *cb, void *u) | ||
| 299 | { | ||
| 300 | EVP_CIPHER_CTX ctx; | ||
| 301 | int i, ret = 0; | ||
| 302 | unsigned char *data = NULL; | ||
| 303 | const char *objstr = NULL; | ||
| 304 | char buf[PEM_BUFSIZE]; | ||
| 305 | unsigned char *iv = NULL; | ||
| 306 | |||
| 307 | if (enc != NULL) { | ||
| 308 | objstr = OBJ_nid2sn(EVP_CIPHER_nid(enc)); | ||
| 309 | if (objstr == NULL) { | ||
| 310 | PEMerror(PEM_R_UNSUPPORTED_CIPHER); | ||
| 311 | goto err; | ||
| 312 | } | ||
| 313 | } | ||
| 314 | |||
| 315 | /* now for the fun part ... if we have a private key then | ||
| 316 | * we have to be able to handle a not-yet-decrypted key | ||
| 317 | * being written out correctly ... if it is decrypted or | ||
| 318 | * it is non-encrypted then we use the base code | ||
| 319 | */ | ||
| 320 | if (xi->x_pkey != NULL) { | ||
| 321 | if ((xi->enc_data != NULL) && (xi->enc_len > 0) ) { | ||
| 322 | if (enc == NULL) { | ||
| 323 | PEMerror(PEM_R_CIPHER_IS_NULL); | ||
| 324 | goto err; | ||
| 325 | } | ||
| 326 | |||
| 327 | /* copy from weirdo names into more normal things */ | ||
| 328 | iv = xi->enc_cipher.iv; | ||
| 329 | data = (unsigned char *)xi->enc_data; | ||
| 330 | i = xi->enc_len; | ||
| 331 | |||
| 332 | /* we take the encryption data from the | ||
| 333 | * internal stuff rather than what the | ||
| 334 | * user has passed us ... as we have to | ||
| 335 | * match exactly for some strange reason | ||
| 336 | */ | ||
| 337 | objstr = OBJ_nid2sn( | ||
| 338 | EVP_CIPHER_nid(xi->enc_cipher.cipher)); | ||
| 339 | if (objstr == NULL) { | ||
| 340 | PEMerror(PEM_R_UNSUPPORTED_CIPHER); | ||
| 341 | goto err; | ||
| 342 | } | ||
| 343 | |||
| 344 | /* create the right magic header stuff */ | ||
| 345 | if (strlen(objstr) + 23 + 2 * enc->iv_len + 13 > | ||
| 346 | sizeof buf) { | ||
| 347 | PEMerror(ASN1_R_BUFFER_TOO_SMALL); | ||
| 348 | goto err; | ||
| 349 | } | ||
| 350 | buf[0] = '\0'; | ||
| 351 | PEM_proc_type(buf, PEM_TYPE_ENCRYPTED); | ||
| 352 | PEM_dek_info(buf, objstr, enc->iv_len, (char *)iv); | ||
| 353 | |||
| 354 | /* use the normal code to write things out */ | ||
| 355 | i = PEM_write_bio(bp, PEM_STRING_RSA, buf, data, i); | ||
| 356 | if (i <= 0) | ||
| 357 | goto err; | ||
| 358 | } else { | ||
| 359 | /* Add DSA/DH */ | ||
| 360 | #ifndef OPENSSL_NO_RSA | ||
| 361 | /* normal optionally encrypted stuff */ | ||
| 362 | if (PEM_write_bio_RSAPrivateKey(bp, | ||
| 363 | xi->x_pkey->dec_pkey->pkey.rsa, | ||
| 364 | enc, kstr, klen, cb, u) <= 0) | ||
| 365 | goto err; | ||
| 366 | #endif | ||
| 367 | } | ||
| 368 | } | ||
| 369 | |||
| 370 | /* if we have a certificate then write it out now */ | ||
| 371 | if ((xi->x509 != NULL) && (PEM_write_bio_X509(bp, xi->x509) <= 0)) | ||
| 372 | goto err; | ||
| 373 | |||
| 374 | /* we are ignoring anything else that is loaded into the X509_INFO | ||
| 375 | * structure for the moment ... as I don't need it so I'm not | ||
| 376 | * coding it here and Eric can do it when this makes it into the | ||
| 377 | * base library --tjh | ||
| 378 | */ | ||
| 379 | |||
| 380 | ret = 1; | ||
| 381 | |||
| 382 | err: | ||
| 383 | explicit_bzero((char *)&ctx, sizeof(ctx)); | ||
| 384 | explicit_bzero(buf, PEM_BUFSIZE); | ||
| 385 | return (ret); | ||
| 386 | } | ||
| 387 | LCRYPTO_ALIAS(PEM_X509_INFO_write_bio); | ||
diff --git a/src/lib/libcrypto/pem/pem_lib.c b/src/lib/libcrypto/pem/pem_lib.c index 30db092c3e..7c7f776cae 100644 --- a/src/lib/libcrypto/pem/pem_lib.c +++ b/src/lib/libcrypto/pem/pem_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pem_lib.c,v 1.56 2024/02/18 15:44:10 tb Exp $ */ | 1 | /* $OpenBSD: pem_lib.c,v 1.57 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -64,7 +64,6 @@ | |||
| 64 | #include <openssl/opensslconf.h> | 64 | #include <openssl/opensslconf.h> |
| 65 | 65 | ||
| 66 | #include <openssl/buffer.h> | 66 | #include <openssl/buffer.h> |
| 67 | #include <openssl/err.h> | ||
| 68 | #include <openssl/evp.h> | 67 | #include <openssl/evp.h> |
| 69 | #include <openssl/objects.h> | 68 | #include <openssl/objects.h> |
| 70 | #include <openssl/pem.h> | 69 | #include <openssl/pem.h> |
| @@ -76,6 +75,7 @@ | |||
| 76 | #endif | 75 | #endif |
| 77 | 76 | ||
| 78 | #include "asn1_local.h" | 77 | #include "asn1_local.h" |
| 78 | #include "err_local.h" | ||
| 79 | #include "evp_local.h" | 79 | #include "evp_local.h" |
| 80 | 80 | ||
| 81 | #define MIN_LENGTH 4 | 81 | #define MIN_LENGTH 4 |
diff --git a/src/lib/libcrypto/pem/pem_oth.c b/src/lib/libcrypto/pem/pem_oth.c index 2dca978efd..d466179ad7 100644 --- a/src/lib/libcrypto/pem/pem_oth.c +++ b/src/lib/libcrypto/pem/pem_oth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pem_oth.c,v 1.9 2023/07/07 13:40:44 beck Exp $ */ | 1 | /* $OpenBSD: pem_oth.c,v 1.10 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -59,12 +59,13 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | 60 | ||
| 61 | #include <openssl/buffer.h> | 61 | #include <openssl/buffer.h> |
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
| 64 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
| 65 | #include <openssl/pem.h> | 64 | #include <openssl/pem.h> |
| 66 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
| 67 | 66 | ||
| 67 | #include "err_local.h" | ||
| 68 | |||
| 68 | /* Handle 'other' PEMs: not private keys */ | 69 | /* Handle 'other' PEMs: not private keys */ |
| 69 | 70 | ||
| 70 | void * | 71 | void * |
diff --git a/src/lib/libcrypto/pem/pem_pk8.c b/src/lib/libcrypto/pem/pem_pk8.c index 6d0c0cbd57..16bde39a7e 100644 --- a/src/lib/libcrypto/pem/pem_pk8.c +++ b/src/lib/libcrypto/pem/pem_pk8.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pem_pk8.c,v 1.14 2023/07/07 13:40:44 beck Exp $ */ | 1 | /* $OpenBSD: pem_pk8.c,v 1.15 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -60,13 +60,13 @@ | |||
| 60 | #include <string.h> | 60 | #include <string.h> |
| 61 | 61 | ||
| 62 | #include <openssl/buffer.h> | 62 | #include <openssl/buffer.h> |
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/evp.h> | ||
| 65 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
| 66 | #include <openssl/pem.h> | 64 | #include <openssl/pem.h> |
| 67 | #include <openssl/pkcs12.h> | 65 | #include <openssl/pkcs12.h> |
| 68 | #include <openssl/x509.h> | 66 | #include <openssl/x509.h> |
| 69 | 67 | ||
| 68 | #include "err_local.h" | ||
| 69 | |||
| 70 | static int do_pk8pkey(BIO *bp, EVP_PKEY *x, int isder, int nid, | 70 | static int do_pk8pkey(BIO *bp, EVP_PKEY *x, int isder, int nid, |
| 71 | const EVP_CIPHER *enc, char *kstr, int klen, pem_password_cb *cb, void *u); | 71 | const EVP_CIPHER *enc, char *kstr, int klen, pem_password_cb *cb, void *u); |
| 72 | static int do_pk8pkey_fp(FILE *bp, EVP_PKEY *x, int isder, int nid, | 72 | static int do_pk8pkey_fp(FILE *bp, EVP_PKEY *x, int isder, int nid, |
diff --git a/src/lib/libcrypto/pem/pem_pkey.c b/src/lib/libcrypto/pem/pem_pkey.c index d7001c83cc..df8ebaa036 100644 --- a/src/lib/libcrypto/pem/pem_pkey.c +++ b/src/lib/libcrypto/pem/pem_pkey.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pem_pkey.c,v 1.28 2023/11/19 15:46:10 tb Exp $ */ | 1 | /* $OpenBSD: pem_pkey.c,v 1.29 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -62,7 +62,6 @@ | |||
| 62 | #include <openssl/opensslconf.h> | 62 | #include <openssl/opensslconf.h> |
| 63 | 63 | ||
| 64 | #include <openssl/buffer.h> | 64 | #include <openssl/buffer.h> |
| 65 | #include <openssl/err.h> | ||
| 66 | #include <openssl/evp.h> | 65 | #include <openssl/evp.h> |
| 67 | #include <openssl/objects.h> | 66 | #include <openssl/objects.h> |
| 68 | #include <openssl/pem.h> | 67 | #include <openssl/pem.h> |
| @@ -70,6 +69,7 @@ | |||
| 70 | #include <openssl/x509.h> | 69 | #include <openssl/x509.h> |
| 71 | 70 | ||
| 72 | #include "asn1_local.h" | 71 | #include "asn1_local.h" |
| 72 | #include "err_local.h" | ||
| 73 | #include "evp_local.h" | 73 | #include "evp_local.h" |
| 74 | 74 | ||
| 75 | int pem_check_suffix(const char *pem_str, const char *suffix); | 75 | int pem_check_suffix(const char *pem_str, const char *suffix); |
diff --git a/src/lib/libcrypto/pem/pem_sign.c b/src/lib/libcrypto/pem/pem_sign.c index 461f957445..878be01b70 100644 --- a/src/lib/libcrypto/pem/pem_sign.c +++ b/src/lib/libcrypto/pem/pem_sign.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pem_sign.c,v 1.15 2023/07/07 13:40:44 beck Exp $ */ | 1 | /* $OpenBSD: pem_sign.c,v 1.16 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -58,12 +58,13 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | 60 | ||
| 61 | #include <openssl/err.h> | ||
| 62 | #include <openssl/evp.h> | 61 | #include <openssl/evp.h> |
| 63 | #include <openssl/objects.h> | 62 | #include <openssl/objects.h> |
| 64 | #include <openssl/pem.h> | 63 | #include <openssl/pem.h> |
| 65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
| 66 | 65 | ||
| 66 | #include "err_local.h" | ||
| 67 | |||
| 67 | int | 68 | int |
| 68 | PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type) | 69 | PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type) |
| 69 | { | 70 | { |
diff --git a/src/lib/libcrypto/pem/pvkfmt.c b/src/lib/libcrypto/pem/pvkfmt.c index 40c9feefe5..395fd9df83 100644 --- a/src/lib/libcrypto/pem/pvkfmt.c +++ b/src/lib/libcrypto/pem/pvkfmt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pvkfmt.c,v 1.28 2024/02/18 15:45:42 tb Exp $ */ | 1 | /* $OpenBSD: pvkfmt.c,v 1.30 2025/06/07 09:32:35 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2005. | 3 | * project 2005. |
| 4 | */ | 4 | */ |
| @@ -66,7 +66,6 @@ | |||
| 66 | #include <openssl/opensslconf.h> | 66 | #include <openssl/opensslconf.h> |
| 67 | 67 | ||
| 68 | #include <openssl/bn.h> | 68 | #include <openssl/bn.h> |
| 69 | #include <openssl/err.h> | ||
| 70 | #include <openssl/pem.h> | 69 | #include <openssl/pem.h> |
| 71 | 70 | ||
| 72 | #if !defined(OPENSSL_NO_RSA) && !defined(OPENSSL_NO_DSA) | 71 | #if !defined(OPENSSL_NO_RSA) && !defined(OPENSSL_NO_DSA) |
| @@ -75,6 +74,7 @@ | |||
| 75 | 74 | ||
| 76 | #include "bn_local.h" | 75 | #include "bn_local.h" |
| 77 | #include "dsa_local.h" | 76 | #include "dsa_local.h" |
| 77 | #include "err_local.h" | ||
| 78 | #include "evp_local.h" | 78 | #include "evp_local.h" |
| 79 | #include "rsa_local.h" | 79 | #include "rsa_local.h" |
| 80 | 80 | ||
| @@ -803,8 +803,8 @@ do_PVK_body(const unsigned char **in, unsigned int saltlen, | |||
| 803 | 803 | ||
| 804 | err: | 804 | err: |
| 805 | EVP_CIPHER_CTX_free(cctx); | 805 | EVP_CIPHER_CTX_free(cctx); |
| 806 | if (enctmp && saltlen) | 806 | free(enctmp); |
| 807 | free(enctmp); | 807 | |
| 808 | return ret; | 808 | return ret; |
| 809 | } | 809 | } |
| 810 | 810 | ||
diff --git a/src/lib/libcrypto/pkcs12/p12_add.c b/src/lib/libcrypto/pkcs12/p12_add.c index f6f42c558c..e45218ba96 100644 --- a/src/lib/libcrypto/pkcs12/p12_add.c +++ b/src/lib/libcrypto/pkcs12/p12_add.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: p12_add.c,v 1.25 2024/03/02 10:20:27 tb Exp $ */ | 1 | /* $OpenBSD: p12_add.c,v 1.26 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -58,9 +58,9 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | 60 | ||
| 61 | #include <openssl/err.h> | ||
| 62 | #include <openssl/pkcs12.h> | 61 | #include <openssl/pkcs12.h> |
| 63 | 62 | ||
| 63 | #include "err_local.h" | ||
| 64 | #include "pkcs12_local.h" | 64 | #include "pkcs12_local.h" |
| 65 | #include "x509_local.h" | 65 | #include "x509_local.h" |
| 66 | 66 | ||
diff --git a/src/lib/libcrypto/pkcs12/p12_crt.c b/src/lib/libcrypto/pkcs12/p12_crt.c index 502ccecd25..321115cfcd 100644 --- a/src/lib/libcrypto/pkcs12/p12_crt.c +++ b/src/lib/libcrypto/pkcs12/p12_crt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: p12_crt.c,v 1.26 2024/08/22 12:22:42 tb Exp $ */ | 1 | /* $OpenBSD: p12_crt.c,v 1.27 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project. | 3 | * project. |
| 4 | */ | 4 | */ |
| @@ -58,10 +58,10 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | 60 | ||
| 61 | #include <openssl/err.h> | ||
| 62 | #include <openssl/pkcs12.h> | 61 | #include <openssl/pkcs12.h> |
| 63 | #include <openssl/x509.h> | 62 | #include <openssl/x509.h> |
| 64 | 63 | ||
| 64 | #include "err_local.h" | ||
| 65 | #include "evp_local.h" | 65 | #include "evp_local.h" |
| 66 | #include "pkcs12_local.h" | 66 | #include "pkcs12_local.h" |
| 67 | #include "x509_local.h" | 67 | #include "x509_local.h" |
diff --git a/src/lib/libcrypto/pkcs12/p12_decr.c b/src/lib/libcrypto/pkcs12/p12_decr.c index 907d4e52a6..8466e92415 100644 --- a/src/lib/libcrypto/pkcs12/p12_decr.c +++ b/src/lib/libcrypto/pkcs12/p12_decr.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: p12_decr.c,v 1.26 2024/03/02 10:15:16 tb Exp $ */ | 1 | /* $OpenBSD: p12_decr.c,v 1.27 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -59,9 +59,9 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <string.h> | 60 | #include <string.h> |
| 61 | 61 | ||
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/pkcs12.h> | 62 | #include <openssl/pkcs12.h> |
| 64 | 63 | ||
| 64 | #include "err_local.h" | ||
| 65 | #include "evp_local.h" | 65 | #include "evp_local.h" |
| 66 | 66 | ||
| 67 | /* Encrypt/Decrypt a buffer based on password and algor, result in a | 67 | /* Encrypt/Decrypt a buffer based on password and algor, result in a |
diff --git a/src/lib/libcrypto/pkcs12/p12_init.c b/src/lib/libcrypto/pkcs12/p12_init.c index cd9422d215..ac0f1eeb57 100644 --- a/src/lib/libcrypto/pkcs12/p12_init.c +++ b/src/lib/libcrypto/pkcs12/p12_init.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: p12_init.c,v 1.17 2024/03/24 06:48:03 tb Exp $ */ | 1 | /* $OpenBSD: p12_init.c,v 1.18 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -58,9 +58,9 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | 60 | ||
| 61 | #include <openssl/err.h> | ||
| 62 | #include <openssl/pkcs12.h> | 61 | #include <openssl/pkcs12.h> |
| 63 | 62 | ||
| 63 | #include "err_local.h" | ||
| 64 | #include "pkcs12_local.h" | 64 | #include "pkcs12_local.h" |
| 65 | 65 | ||
| 66 | /* Initialise a PKCS12 structure to take data */ | 66 | /* Initialise a PKCS12 structure to take data */ |
diff --git a/src/lib/libcrypto/pkcs12/p12_key.c b/src/lib/libcrypto/pkcs12/p12_key.c index 443d632c87..29a99bbca4 100644 --- a/src/lib/libcrypto/pkcs12/p12_key.c +++ b/src/lib/libcrypto/pkcs12/p12_key.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: p12_key.c,v 1.36 2025/03/09 15:45:52 tb Exp $ */ | 1 | /* $OpenBSD: p12_key.c,v 1.37 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -60,9 +60,9 @@ | |||
| 60 | #include <string.h> | 60 | #include <string.h> |
| 61 | 61 | ||
| 62 | #include <openssl/bn.h> | 62 | #include <openssl/bn.h> |
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/pkcs12.h> | 63 | #include <openssl/pkcs12.h> |
| 65 | 64 | ||
| 65 | #include "err_local.h" | ||
| 66 | #include "evp_local.h" | 66 | #include "evp_local.h" |
| 67 | #include "pkcs12_local.h" | 67 | #include "pkcs12_local.h" |
| 68 | 68 | ||
diff --git a/src/lib/libcrypto/pkcs12/p12_kiss.c b/src/lib/libcrypto/pkcs12/p12_kiss.c index e4de2eb61c..f6f09ff2de 100644 --- a/src/lib/libcrypto/pkcs12/p12_kiss.c +++ b/src/lib/libcrypto/pkcs12/p12_kiss.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: p12_kiss.c,v 1.28 2025/01/06 23:35:25 tb Exp $ */ | 1 | /* $OpenBSD: p12_kiss.c,v 1.29 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -58,9 +58,9 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | 60 | ||
| 61 | #include <openssl/err.h> | ||
| 62 | #include <openssl/pkcs12.h> | 61 | #include <openssl/pkcs12.h> |
| 63 | 62 | ||
| 63 | #include "err_local.h" | ||
| 64 | #include "pkcs12_local.h" | 64 | #include "pkcs12_local.h" |
| 65 | 65 | ||
| 66 | /* Simplified PKCS#12 routines */ | 66 | /* Simplified PKCS#12 routines */ |
diff --git a/src/lib/libcrypto/pkcs12/p12_mutl.c b/src/lib/libcrypto/pkcs12/p12_mutl.c index 2060358188..4a9d0f9757 100644 --- a/src/lib/libcrypto/pkcs12/p12_mutl.c +++ b/src/lib/libcrypto/pkcs12/p12_mutl.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: p12_mutl.c,v 1.38 2024/03/24 06:48:03 tb Exp $ */ | 1 | /* $OpenBSD: p12_mutl.c,v 1.40 2025/06/03 08:42:15 kenjiro Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -64,10 +64,10 @@ | |||
| 64 | 64 | ||
| 65 | #ifndef OPENSSL_NO_HMAC | 65 | #ifndef OPENSSL_NO_HMAC |
| 66 | 66 | ||
| 67 | #include <openssl/err.h> | ||
| 68 | #include <openssl/hmac.h> | 67 | #include <openssl/hmac.h> |
| 69 | #include <openssl/pkcs12.h> | 68 | #include <openssl/pkcs12.h> |
| 70 | 69 | ||
| 70 | #include "err_local.h" | ||
| 71 | #include "evp_local.h" | 71 | #include "evp_local.h" |
| 72 | #include "hmac_local.h" | 72 | #include "hmac_local.h" |
| 73 | #include "pkcs12_local.h" | 73 | #include "pkcs12_local.h" |
| @@ -189,10 +189,10 @@ PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen) | |||
| 189 | PKCS12error(PKCS12_R_MAC_GENERATION_ERROR); | 189 | PKCS12error(PKCS12_R_MAC_GENERATION_ERROR); |
| 190 | return 0; | 190 | return 0; |
| 191 | } | 191 | } |
| 192 | if ((maclen != (unsigned int)p12->mac->dinfo->digest->length) || | 192 | if (maclen != (unsigned int)p12->mac->dinfo->digest->length) |
| 193 | memcmp(mac, p12->mac->dinfo->digest->data, maclen)) | ||
| 194 | return 0; | 193 | return 0; |
| 195 | return 1; | 194 | |
| 195 | return timingsafe_memcmp(mac, p12->mac->dinfo->digest->data, maclen) == 0; | ||
| 196 | } | 196 | } |
| 197 | LCRYPTO_ALIAS(PKCS12_verify_mac); | 197 | LCRYPTO_ALIAS(PKCS12_verify_mac); |
| 198 | 198 | ||
diff --git a/src/lib/libcrypto/pkcs12/p12_npas.c b/src/lib/libcrypto/pkcs12/p12_npas.c index 6d3b43ce22..c78deb9182 100644 --- a/src/lib/libcrypto/pkcs12/p12_npas.c +++ b/src/lib/libcrypto/pkcs12/p12_npas.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: p12_npas.c,v 1.27 2024/01/25 15:33:35 tb Exp $ */ | 1 | /* $OpenBSD: p12_npas.c,v 1.28 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -60,9 +60,9 @@ | |||
| 60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
| 61 | #include <string.h> | 61 | #include <string.h> |
| 62 | #include <openssl/pem.h> | 62 | #include <openssl/pem.h> |
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/pkcs12.h> | 63 | #include <openssl/pkcs12.h> |
| 65 | 64 | ||
| 65 | #include "err_local.h" | ||
| 66 | #include "pkcs12_local.h" | 66 | #include "pkcs12_local.h" |
| 67 | #include "x509_local.h" | 67 | #include "x509_local.h" |
| 68 | 68 | ||
diff --git a/src/lib/libcrypto/pkcs12/p12_p8e.c b/src/lib/libcrypto/pkcs12/p12_p8e.c index bf61593266..a8a5039dfb 100644 --- a/src/lib/libcrypto/pkcs12/p12_p8e.c +++ b/src/lib/libcrypto/pkcs12/p12_p8e.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: p12_p8e.c,v 1.13 2024/03/02 10:15:16 tb Exp $ */ | 1 | /* $OpenBSD: p12_p8e.c,v 1.14 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2001. | 3 | * project 2001. |
| 4 | */ | 4 | */ |
| @@ -58,9 +58,9 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | 60 | ||
| 61 | #include <openssl/err.h> | ||
| 62 | #include <openssl/pkcs12.h> | 61 | #include <openssl/pkcs12.h> |
| 63 | 62 | ||
| 63 | #include "err_local.h" | ||
| 64 | #include "pkcs12_local.h" | 64 | #include "pkcs12_local.h" |
| 65 | #include "x509_local.h" | 65 | #include "x509_local.h" |
| 66 | 66 | ||
diff --git a/src/lib/libcrypto/pkcs12/p12_sbag.c b/src/lib/libcrypto/pkcs12/p12_sbag.c index 1664e9409d..5fea54073b 100644 --- a/src/lib/libcrypto/pkcs12/p12_sbag.c +++ b/src/lib/libcrypto/pkcs12/p12_sbag.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: p12_sbag.c,v 1.9 2024/03/24 06:48:03 tb Exp $ */ | 1 | /* $OpenBSD: p12_sbag.c,v 1.10 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project |
| 4 | * 1999-2018. | 4 | * 1999-2018. |
| @@ -59,9 +59,9 @@ | |||
| 59 | 59 | ||
| 60 | #include <stdio.h> | 60 | #include <stdio.h> |
| 61 | 61 | ||
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/pkcs12.h> | 62 | #include <openssl/pkcs12.h> |
| 64 | 63 | ||
| 64 | #include "err_local.h" | ||
| 65 | #include "pkcs12_local.h" | 65 | #include "pkcs12_local.h" |
| 66 | #include "x509_local.h" | 66 | #include "x509_local.h" |
| 67 | 67 | ||
diff --git a/src/lib/libcrypto/pkcs12/pkcs12.h b/src/lib/libcrypto/pkcs12/pkcs12.h index 200712039b..aec0362806 100644 --- a/src/lib/libcrypto/pkcs12/pkcs12.h +++ b/src/lib/libcrypto/pkcs12/pkcs12.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pkcs12.h,v 1.29 2025/03/09 15:45:52 tb Exp $ */ | 1 | /* $OpenBSD: pkcs12.h,v 1.30 2025/05/10 19:01:16 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -77,7 +77,7 @@ extern "C" { | |||
| 77 | 77 | ||
| 78 | #define PKCS12_MAC_KEY_LENGTH 20 | 78 | #define PKCS12_MAC_KEY_LENGTH 20 |
| 79 | 79 | ||
| 80 | #define PKCS12_SALT_LEN 8 | 80 | #define PKCS12_SALT_LEN 16 |
| 81 | 81 | ||
| 82 | /* Uncomment out next line for unicode password and names, otherwise ASCII */ | 82 | /* Uncomment out next line for unicode password and names, otherwise ASCII */ |
| 83 | 83 | ||
diff --git a/src/lib/libcrypto/pkcs7/pk7_asn1.c b/src/lib/libcrypto/pkcs7/pk7_asn1.c index 8a6ae487da..be1c4c1a1d 100644 --- a/src/lib/libcrypto/pkcs7/pk7_asn1.c +++ b/src/lib/libcrypto/pkcs7/pk7_asn1.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pk7_asn1.c,v 1.18 2024/07/08 16:23:27 beck Exp $ */ | 1 | /* $OpenBSD: pk7_asn1.c,v 1.19 2025/06/11 18:11:55 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -84,7 +84,6 @@ static const ASN1_ADB_TABLE PKCS7_adbtbl[] = { | |||
| 84 | .field_name = "d.data", | 84 | .field_name = "d.data", |
| 85 | .item = &ASN1_OCTET_STRING_NDEF_it, | 85 | .item = &ASN1_OCTET_STRING_NDEF_it, |
| 86 | }, | 86 | }, |
| 87 | |||
| 88 | }, | 87 | }, |
| 89 | { | 88 | { |
| 90 | .value = NID_pkcs7_signed, | 89 | .value = NID_pkcs7_signed, |
| @@ -95,7 +94,6 @@ static const ASN1_ADB_TABLE PKCS7_adbtbl[] = { | |||
| 95 | .field_name = "d.sign", | 94 | .field_name = "d.sign", |
| 96 | .item = &PKCS7_SIGNED_it, | 95 | .item = &PKCS7_SIGNED_it, |
| 97 | }, | 96 | }, |
| 98 | |||
| 99 | }, | 97 | }, |
| 100 | { | 98 | { |
| 101 | .value = NID_pkcs7_enveloped, | 99 | .value = NID_pkcs7_enveloped, |
| @@ -106,7 +104,6 @@ static const ASN1_ADB_TABLE PKCS7_adbtbl[] = { | |||
| 106 | .field_name = "d.enveloped", | 104 | .field_name = "d.enveloped", |
| 107 | .item = &PKCS7_ENVELOPE_it, | 105 | .item = &PKCS7_ENVELOPE_it, |
| 108 | }, | 106 | }, |
| 109 | |||
| 110 | }, | 107 | }, |
| 111 | { | 108 | { |
| 112 | .value = NID_pkcs7_signedAndEnveloped, | 109 | .value = NID_pkcs7_signedAndEnveloped, |
| @@ -117,7 +114,6 @@ static const ASN1_ADB_TABLE PKCS7_adbtbl[] = { | |||
| 117 | .field_name = "d.signed_and_enveloped", | 114 | .field_name = "d.signed_and_enveloped", |
| 118 | .item = &PKCS7_SIGN_ENVELOPE_it, | 115 | .item = &PKCS7_SIGN_ENVELOPE_it, |
| 119 | }, | 116 | }, |
| 120 | |||
| 121 | }, | 117 | }, |
| 122 | { | 118 | { |
| 123 | .value = NID_pkcs7_digest, | 119 | .value = NID_pkcs7_digest, |
| @@ -128,7 +124,6 @@ static const ASN1_ADB_TABLE PKCS7_adbtbl[] = { | |||
| 128 | .field_name = "d.digest", | 124 | .field_name = "d.digest", |
| 129 | .item = &PKCS7_DIGEST_it, | 125 | .item = &PKCS7_DIGEST_it, |
| 130 | }, | 126 | }, |
| 131 | |||
| 132 | }, | 127 | }, |
| 133 | { | 128 | { |
| 134 | .value = NID_pkcs7_encrypted, | 129 | .value = NID_pkcs7_encrypted, |
| @@ -139,7 +134,6 @@ static const ASN1_ADB_TABLE PKCS7_adbtbl[] = { | |||
| 139 | .field_name = "d.encrypted", | 134 | .field_name = "d.encrypted", |
| 140 | .item = &PKCS7_ENCRYPT_it, | 135 | .item = &PKCS7_ENCRYPT_it, |
| 141 | }, | 136 | }, |
| 142 | |||
| 143 | }, | 137 | }, |
| 144 | }; | 138 | }; |
| 145 | 139 | ||
diff --git a/src/lib/libcrypto/pkcs7/pk7_attr.c b/src/lib/libcrypto/pkcs7/pk7_attr.c index 52463aa3a3..f2e17806db 100644 --- a/src/lib/libcrypto/pkcs7/pk7_attr.c +++ b/src/lib/libcrypto/pkcs7/pk7_attr.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pk7_attr.c,v 1.15 2024/02/19 15:37:44 tb Exp $ */ | 1 | /* $OpenBSD: pk7_attr.c,v 1.22 2025/07/31 02:24:21 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2001. | 3 | * project 2001. |
| 4 | */ | 4 | */ |
| @@ -59,23 +59,48 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | 60 | ||
| 61 | #include <openssl/asn1.h> | 61 | #include <openssl/asn1.h> |
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/objects.h> | 62 | #include <openssl/objects.h> |
| 64 | #include <openssl/pkcs7.h> | 63 | #include <openssl/pkcs7.h> |
| 65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
| 66 | 65 | ||
| 66 | #include "asn1_local.h" | ||
| 67 | #include "err_local.h" | ||
| 68 | #include "x509_local.h" | ||
| 69 | |||
| 67 | int | 70 | int |
| 68 | PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, STACK_OF(X509_ALGOR) *cap) | 71 | PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, STACK_OF(X509_ALGOR) *cap) |
| 69 | { | 72 | { |
| 70 | ASN1_STRING *seq; | 73 | ASN1_STRING *seq = NULL; |
| 71 | if (!(seq = ASN1_STRING_new())) { | 74 | unsigned char *data = NULL; |
| 75 | int len = 0; | ||
| 76 | int ret = 0; | ||
| 77 | |||
| 78 | if ((len = i2d_X509_ALGORS(cap, &data)) <= 0) { | ||
| 79 | len = 0; | ||
| 80 | goto err; | ||
| 81 | } | ||
| 82 | |||
| 83 | if ((seq = ASN1_STRING_new()) == NULL) { | ||
| 72 | PKCS7error(ERR_R_MALLOC_FAILURE); | 84 | PKCS7error(ERR_R_MALLOC_FAILURE); |
| 73 | return 0; | 85 | goto err; |
| 74 | } | 86 | } |
| 75 | seq->length = ASN1_item_i2d((ASN1_VALUE *)cap, &seq->data, | 87 | |
| 76 | &X509_ALGORS_it); | 88 | ASN1_STRING_set0(seq, data, len); |
| 77 | return PKCS7_add_signed_attribute(si, NID_SMIMECapabilities, | 89 | data = NULL; |
| 78 | V_ASN1_SEQUENCE, seq); | 90 | len = 0; |
| 91 | |||
| 92 | if (!PKCS7_add_signed_attribute(si, NID_SMIMECapabilities, | ||
| 93 | V_ASN1_SEQUENCE, seq)) | ||
| 94 | goto err; | ||
| 95 | seq = NULL; | ||
| 96 | |||
| 97 | ret = 1; | ||
| 98 | |||
| 99 | err: | ||
| 100 | ASN1_STRING_free(seq); | ||
| 101 | freezero(data, len); | ||
| 102 | |||
| 103 | return ret; | ||
| 79 | } | 104 | } |
| 80 | LCRYPTO_ALIAS(PKCS7_add_attrib_smimecap); | 105 | LCRYPTO_ALIAS(PKCS7_add_attrib_smimecap); |
| 81 | 106 | ||
| @@ -84,51 +109,60 @@ PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si) | |||
| 84 | { | 109 | { |
| 85 | ASN1_TYPE *cap; | 110 | ASN1_TYPE *cap; |
| 86 | const unsigned char *p; | 111 | const unsigned char *p; |
| 112 | int len; | ||
| 87 | 113 | ||
| 88 | cap = PKCS7_get_signed_attribute(si, NID_SMIMECapabilities); | 114 | if ((cap = PKCS7_get_signed_attribute(si, NID_SMIMECapabilities)) == NULL) |
| 89 | if (!cap || (cap->type != V_ASN1_SEQUENCE)) | 115 | return NULL; |
| 116 | if (cap->type != V_ASN1_SEQUENCE) | ||
| 90 | return NULL; | 117 | return NULL; |
| 118 | |||
| 91 | p = cap->value.sequence->data; | 119 | p = cap->value.sequence->data; |
| 92 | return (STACK_OF(X509_ALGOR) *) | 120 | len = cap->value.sequence->length; |
| 93 | ASN1_item_d2i(NULL, &p, cap->value.sequence->length, | 121 | |
| 94 | &X509_ALGORS_it); | 122 | return d2i_X509_ALGORS(NULL, &p, len); |
| 95 | } | 123 | } |
| 96 | LCRYPTO_ALIAS(PKCS7_get_smimecap); | 124 | LCRYPTO_ALIAS(PKCS7_get_smimecap); |
| 97 | 125 | ||
| 98 | /* Basic smime-capabilities OID and optional integer arg */ | 126 | /* |
| 127 | * Add AlgorithmIdentifier OID of type |nid| to the SMIMECapability attribute | ||
| 128 | * set |sk| (see RFC 3851, section 2.5.2). If keysize > 0, the OID has an | ||
| 129 | * integer parameter of value |keysize|, otherwise parameters are omitted. | ||
| 130 | * | ||
| 131 | * See also CMS_add_simple_smimecap(). | ||
| 132 | */ | ||
| 99 | int | 133 | int |
| 100 | PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg) | 134 | PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int keysize) |
| 101 | { | 135 | { |
| 102 | X509_ALGOR *alg; | 136 | X509_ALGOR *alg = NULL; |
| 137 | ASN1_INTEGER *parameter = NULL; | ||
| 138 | int parameter_type = V_ASN1_UNDEF; | ||
| 139 | int ret = 0; | ||
| 103 | 140 | ||
| 104 | if (!(alg = X509_ALGOR_new())) { | 141 | if (keysize > 0) { |
| 105 | PKCS7error(ERR_R_MALLOC_FAILURE); | 142 | if ((parameter = ASN1_INTEGER_new()) == NULL) |
| 106 | return 0; | ||
| 107 | } | ||
| 108 | ASN1_OBJECT_free(alg->algorithm); | ||
| 109 | alg->algorithm = OBJ_nid2obj(nid); | ||
| 110 | if (arg > 0) { | ||
| 111 | ASN1_INTEGER *nbit; | ||
| 112 | |||
| 113 | if (!(alg->parameter = ASN1_TYPE_new())) | ||
| 114 | goto err; | ||
| 115 | if (!(nbit = ASN1_INTEGER_new())) | ||
| 116 | goto err; | 143 | goto err; |
| 117 | if (!ASN1_INTEGER_set(nbit, arg)) { | 144 | if (!ASN1_INTEGER_set(parameter, keysize)) |
| 118 | ASN1_INTEGER_free(nbit); | ||
| 119 | goto err; | 145 | goto err; |
| 120 | } | 146 | parameter_type = V_ASN1_INTEGER; |
| 121 | alg->parameter->value.integer = nbit; | ||
| 122 | alg->parameter->type = V_ASN1_INTEGER; | ||
| 123 | } | 147 | } |
| 124 | if (sk_X509_ALGOR_push(sk, alg) == 0) | 148 | |
| 149 | if ((alg = X509_ALGOR_new()) == NULL) | ||
| 125 | goto err; | 150 | goto err; |
| 126 | return 1; | 151 | if (!X509_ALGOR_set0_by_nid(alg, nid, parameter_type, parameter)) |
| 152 | goto err; | ||
| 153 | parameter = NULL; | ||
| 154 | |||
| 155 | if (sk_X509_ALGOR_push(sk, alg) <= 0) | ||
| 156 | goto err; | ||
| 157 | alg = NULL; | ||
| 127 | 158 | ||
| 128 | err: | 159 | ret = 1; |
| 129 | PKCS7error(ERR_R_MALLOC_FAILURE); | 160 | |
| 161 | err: | ||
| 130 | X509_ALGOR_free(alg); | 162 | X509_ALGOR_free(alg); |
| 131 | return 0; | 163 | ASN1_INTEGER_free(parameter); |
| 164 | |||
| 165 | return ret; | ||
| 132 | } | 166 | } |
| 133 | LCRYPTO_ALIAS(PKCS7_simple_smimecap); | 167 | LCRYPTO_ALIAS(PKCS7_simple_smimecap); |
| 134 | 168 | ||
| @@ -147,30 +181,54 @@ LCRYPTO_ALIAS(PKCS7_add_attrib_content_type); | |||
| 147 | int | 181 | int |
| 148 | PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t) | 182 | PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t) |
| 149 | { | 183 | { |
| 150 | if (!t && !(t = X509_gmtime_adj(NULL, 0))) { | 184 | ASN1_TIME *tm; |
| 185 | int ret = 0; | ||
| 186 | |||
| 187 | if ((tm = t) == NULL) | ||
| 188 | tm = X509_gmtime_adj(NULL, 0); | ||
| 189 | if (tm == NULL) { | ||
| 151 | PKCS7error(ERR_R_MALLOC_FAILURE); | 190 | PKCS7error(ERR_R_MALLOC_FAILURE); |
| 152 | return 0; | 191 | goto err; |
| 153 | } | 192 | } |
| 154 | return PKCS7_add_signed_attribute(si, NID_pkcs9_signingTime, | 193 | |
| 155 | V_ASN1_UTCTIME, t); | 194 | /* RFC 5652, section 11.3 - UTCTime for the years 1950-2049. */ |
| 195 | if (ASN1_time_parse(tm->data, tm->length, NULL, tm->type) == -1) | ||
| 196 | goto err; | ||
| 197 | if (!PKCS7_add_signed_attribute(si, NID_pkcs9_signingTime, tm->type, tm)) | ||
| 198 | goto err; | ||
| 199 | tm = NULL; | ||
| 200 | |||
| 201 | ret = 1; | ||
| 202 | |||
| 203 | err: | ||
| 204 | if (tm != t) | ||
| 205 | ASN1_TIME_free(tm); | ||
| 206 | |||
| 207 | return ret; | ||
| 156 | } | 208 | } |
| 157 | LCRYPTO_ALIAS(PKCS7_add0_attrib_signing_time); | 209 | LCRYPTO_ALIAS(PKCS7_add0_attrib_signing_time); |
| 158 | 210 | ||
| 159 | int | 211 | int |
| 160 | PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si, const unsigned char *md, | 212 | PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si, const unsigned char *md, |
| 161 | int mdlen) | 213 | int md_len) |
| 162 | { | 214 | { |
| 163 | ASN1_OCTET_STRING *os; | 215 | ASN1_OCTET_STRING *os; |
| 216 | int ret = 0; | ||
| 164 | 217 | ||
| 165 | os = ASN1_OCTET_STRING_new(); | 218 | if ((os = ASN1_OCTET_STRING_new()) == NULL) |
| 166 | if (!os) | 219 | goto err; |
| 167 | return 0; | 220 | if (!ASN1_STRING_set(os, md, md_len)) |
| 168 | if (!ASN1_STRING_set(os, md, mdlen) || | 221 | goto err; |
| 169 | !PKCS7_add_signed_attribute(si, NID_pkcs9_messageDigest, | 222 | if (!PKCS7_add_signed_attribute(si, NID_pkcs9_messageDigest, |
| 170 | V_ASN1_OCTET_STRING, os)) { | 223 | V_ASN1_OCTET_STRING, os)) |
| 171 | ASN1_OCTET_STRING_free(os); | 224 | goto err; |
| 172 | return 0; | 225 | os = NULL; |
| 173 | } | 226 | |
| 174 | return 1; | 227 | ret = 1; |
| 228 | |||
| 229 | err: | ||
| 230 | ASN1_OCTET_STRING_free(os); | ||
| 231 | |||
| 232 | return ret; | ||
| 175 | } | 233 | } |
| 176 | LCRYPTO_ALIAS(PKCS7_add1_attrib_digest); | 234 | LCRYPTO_ALIAS(PKCS7_add1_attrib_digest); |
diff --git a/src/lib/libcrypto/pkcs7/pk7_doit.c b/src/lib/libcrypto/pkcs7/pk7_doit.c index 020de71fef..e39d960780 100644 --- a/src/lib/libcrypto/pkcs7/pk7_doit.c +++ b/src/lib/libcrypto/pkcs7/pk7_doit.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pk7_doit.c,v 1.59 2025/03/18 12:53:25 tb Exp $ */ | 1 | /* $OpenBSD: pk7_doit.c,v 1.61 2025/07/27 07:06:41 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -60,11 +60,11 @@ | |||
| 60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
| 61 | #include <string.h> | 61 | #include <string.h> |
| 62 | 62 | ||
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
| 65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
| 66 | #include <openssl/x509v3.h> | 65 | #include <openssl/x509v3.h> |
| 67 | 66 | ||
| 67 | #include "err_local.h" | ||
| 68 | #include "evp_local.h" | 68 | #include "evp_local.h" |
| 69 | #include "x509_local.h" | 69 | #include "x509_local.h" |
| 70 | 70 | ||
| @@ -1208,43 +1208,51 @@ PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si, STACK_OF(X509_ATTRIBUTE) *sk) | |||
| 1208 | LCRYPTO_ALIAS(PKCS7_set_attributes); | 1208 | LCRYPTO_ALIAS(PKCS7_set_attributes); |
| 1209 | 1209 | ||
| 1210 | static int | 1210 | static int |
| 1211 | add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype, void *value) | 1211 | add_attribute(STACK_OF(X509_ATTRIBUTE) **in_sk, int nid, int atrtype, void *value) |
| 1212 | { | 1212 | { |
| 1213 | X509_ATTRIBUTE *attr = NULL; | 1213 | STACK_OF(X509_ATTRIBUTE) *sk; |
| 1214 | X509_ATTRIBUTE *old_attr = NULL, *new_attr = NULL; | ||
| 1215 | int need_pop = 0; | ||
| 1216 | int i; | ||
| 1214 | 1217 | ||
| 1215 | if (*sk == NULL) { | 1218 | if ((sk = *in_sk) == NULL) |
| 1216 | *sk = sk_X509_ATTRIBUTE_new_null(); | 1219 | sk = sk_X509_ATTRIBUTE_new_null(); |
| 1217 | if (*sk == NULL) | 1220 | if (sk == NULL) |
| 1218 | return 0; | 1221 | goto err; |
| 1219 | new_attrib: | 1222 | |
| 1220 | if (!(attr = X509_ATTRIBUTE_create(nid, atrtype, value))) | 1223 | /* Replace an already existing attribute with the given nid. */ |
| 1221 | return 0; | 1224 | for (i = 0; i < sk_X509_ATTRIBUTE_num(sk); i++) { |
| 1222 | if (!sk_X509_ATTRIBUTE_push(*sk, attr)) { | 1225 | old_attr = sk_X509_ATTRIBUTE_value(sk, i); |
| 1223 | X509_ATTRIBUTE_free(attr); | 1226 | if(OBJ_obj2nid(old_attr->object) == nid) |
| 1224 | return 0; | 1227 | break; |
| 1225 | } | 1228 | } |
| 1226 | } else { | 1229 | |
| 1227 | int i; | 1230 | /* If there is none, make room for the new one, so _set() succeeds. */ |
| 1228 | 1231 | if (i == sk_X509_ATTRIBUTE_num(sk)) { | |
| 1229 | for (i = 0; i < sk_X509_ATTRIBUTE_num(*sk); i++) { | 1232 | old_attr = NULL; |
| 1230 | attr = sk_X509_ATTRIBUTE_value(*sk, i); | 1233 | if (sk_X509_ATTRIBUTE_push(sk, NULL) <= 0) |
| 1231 | if (OBJ_obj2nid(attr->object) == nid) { | 1234 | goto err; |
| 1232 | X509_ATTRIBUTE_free(attr); | 1235 | need_pop = 1; |
| 1233 | attr = X509_ATTRIBUTE_create(nid, atrtype, | ||
| 1234 | value); | ||
| 1235 | if (attr == NULL) | ||
| 1236 | return 0; | ||
| 1237 | if (!sk_X509_ATTRIBUTE_set(*sk, i, attr)) { | ||
| 1238 | X509_ATTRIBUTE_free(attr); | ||
| 1239 | return 0; | ||
| 1240 | } | ||
| 1241 | goto end; | ||
| 1242 | } | ||
| 1243 | } | ||
| 1244 | goto new_attrib; | ||
| 1245 | } | 1236 | } |
| 1246 | end: | 1237 | |
| 1238 | /* On success, new_attr owns value. */ | ||
| 1239 | if ((new_attr = X509_ATTRIBUTE_create(nid, atrtype, value)) == NULL) | ||
| 1240 | goto err; | ||
| 1241 | |||
| 1242 | X509_ATTRIBUTE_free(old_attr); | ||
| 1243 | (void)sk_X509_ATTRIBUTE_set(sk, i, new_attr); | ||
| 1244 | |||
| 1245 | *in_sk = sk; | ||
| 1246 | |||
| 1247 | return 1; | 1247 | return 1; |
| 1248 | |||
| 1249 | err: | ||
| 1250 | if (need_pop) | ||
| 1251 | (void)sk_X509_ATTRIBUTE_pop(sk); | ||
| 1252 | if (*in_sk != sk) | ||
| 1253 | sk_X509_ATTRIBUTE_pop_free(sk, X509_ATTRIBUTE_free); | ||
| 1254 | |||
| 1255 | return 0; | ||
| 1248 | } | 1256 | } |
| 1249 | 1257 | ||
| 1250 | int | 1258 | int |
diff --git a/src/lib/libcrypto/pkcs7/pk7_lib.c b/src/lib/libcrypto/pkcs7/pk7_lib.c index a1c7d61cca..8712a2ecc1 100644 --- a/src/lib/libcrypto/pkcs7/pk7_lib.c +++ b/src/lib/libcrypto/pkcs7/pk7_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pk7_lib.c,v 1.30 2024/12/06 07:10:20 tb Exp $ */ | 1 | /* $OpenBSD: pk7_lib.c,v 1.31 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -58,11 +58,11 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | 60 | ||
| 61 | #include <openssl/err.h> | ||
| 62 | #include <openssl/objects.h> | 61 | #include <openssl/objects.h> |
| 63 | #include <openssl/x509.h> | 62 | #include <openssl/x509.h> |
| 64 | 63 | ||
| 65 | #include "asn1_local.h" | 64 | #include "asn1_local.h" |
| 65 | #include "err_local.h" | ||
| 66 | #include "evp_local.h" | 66 | #include "evp_local.h" |
| 67 | #include "x509_local.h" | 67 | #include "x509_local.h" |
| 68 | 68 | ||
diff --git a/src/lib/libcrypto/pkcs7/pk7_smime.c b/src/lib/libcrypto/pkcs7/pk7_smime.c index cff89c34e1..9baff7f525 100644 --- a/src/lib/libcrypto/pkcs7/pk7_smime.c +++ b/src/lib/libcrypto/pkcs7/pk7_smime.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pk7_smime.c,v 1.27 2024/04/20 10:11:55 tb Exp $ */ | 1 | /* $OpenBSD: pk7_smime.c,v 1.29 2025/12/20 07:22:43 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project. | 3 | * project. |
| 4 | */ | 4 | */ |
| @@ -60,10 +60,10 @@ | |||
| 60 | 60 | ||
| 61 | #include <stdio.h> | 61 | #include <stdio.h> |
| 62 | 62 | ||
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/x509.h> | 63 | #include <openssl/x509.h> |
| 65 | #include <openssl/x509v3.h> | 64 | #include <openssl/x509v3.h> |
| 66 | 65 | ||
| 66 | #include "err_local.h" | ||
| 67 | #include "x509_local.h" | 67 | #include "x509_local.h" |
| 68 | 68 | ||
| 69 | static int pkcs7_copy_existing_digest(PKCS7 *p7, PKCS7_SIGNER_INFO *si); | 69 | static int pkcs7_copy_existing_digest(PKCS7 *p7, PKCS7_SIGNER_INFO *si); |
| @@ -277,14 +277,19 @@ PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, BIO *indata, | |||
| 277 | return 0; | 277 | return 0; |
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | /* | 280 | if ((flags & PKCS7_NO_DUAL_CONTENT) != 0) { |
| 281 | * Very old Netscape illegally included empty content with | 281 | /* |
| 282 | * a detached signature. Very old users should upgrade. | 282 | * This was originally "#if 0" because we thought that only old |
| 283 | */ | 283 | * broken Netscape did this. It turns out that Authenticode |
| 284 | /* Check for data and content: two sets of data */ | 284 | * uses this kind of "extended" PKCS7 format, and things like |
| 285 | if (!PKCS7_get_detached(p7) && indata) { | 285 | * UEFI secure boot and tools like osslsigncode need it. In |
| 286 | PKCS7error(PKCS7_R_CONTENT_AND_DATA_PRESENT); | 286 | * Authenticode the verification process is different, but the |
| 287 | return 0; | 287 | * existing PKCS7 verification works. |
| 288 | */ | ||
| 289 | if (!PKCS7_get_detached(p7) && indata != NULL) { | ||
| 290 | PKCS7error(PKCS7_R_CONTENT_AND_DATA_PRESENT); | ||
| 291 | return 0; | ||
| 292 | } | ||
| 288 | } | 293 | } |
| 289 | 294 | ||
| 290 | sinfos = PKCS7_get_signer_info(p7); | 295 | sinfos = PKCS7_get_signer_info(p7); |
diff --git a/src/lib/libcrypto/pkcs7/pkcs7.h b/src/lib/libcrypto/pkcs7/pkcs7.h index 6fd5adf457..bac461d30d 100644 --- a/src/lib/libcrypto/pkcs7/pkcs7.h +++ b/src/lib/libcrypto/pkcs7/pkcs7.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pkcs7.h,v 1.22 2024/10/23 01:57:19 jsg Exp $ */ | 1 | /* $OpenBSD: pkcs7.h,v 1.25 2025/12/20 07:22:43 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -82,7 +82,7 @@ typedef struct pkcs7_issuer_and_serial_st { | |||
| 82 | } PKCS7_ISSUER_AND_SERIAL; | 82 | } PKCS7_ISSUER_AND_SERIAL; |
| 83 | 83 | ||
| 84 | typedef struct pkcs7_signer_info_st { | 84 | typedef struct pkcs7_signer_info_st { |
| 85 | ASN1_INTEGER *version; /* version 1 */ | 85 | ASN1_INTEGER *version; /* version 1 */ |
| 86 | PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; | 86 | PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; |
| 87 | X509_ALGOR *digest_alg; | 87 | X509_ALGOR *digest_alg; |
| 88 | STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */ | 88 | STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */ |
| @@ -145,7 +145,7 @@ typedef struct pkcs7_signedandenveloped_st { | |||
| 145 | typedef struct pkcs7_digest_st { | 145 | typedef struct pkcs7_digest_st { |
| 146 | ASN1_INTEGER *version; /* version 0 */ | 146 | ASN1_INTEGER *version; /* version 0 */ |
| 147 | X509_ALGOR *md; /* md used */ | 147 | X509_ALGOR *md; /* md used */ |
| 148 | struct pkcs7_st *contents; | 148 | struct pkcs7_st *contents; |
| 149 | ASN1_OCTET_STRING *digest; | 149 | ASN1_OCTET_STRING *digest; |
| 150 | } PKCS7_DIGEST; | 150 | } PKCS7_DIGEST; |
| 151 | 151 | ||
| @@ -241,6 +241,7 @@ DECLARE_PKCS12_STACK_OF(PKCS7) | |||
| 241 | #define PKCS7_NOCRL 0x2000 | 241 | #define PKCS7_NOCRL 0x2000 |
| 242 | #define PKCS7_PARTIAL 0x4000 | 242 | #define PKCS7_PARTIAL 0x4000 |
| 243 | #define PKCS7_REUSE_DIGEST 0x8000 | 243 | #define PKCS7_REUSE_DIGEST 0x8000 |
| 244 | #define PKCS7_NO_DUAL_CONTENT 0x10000 | ||
| 244 | 245 | ||
| 245 | /* Flags: for compatibility with older code */ | 246 | /* Flags: for compatibility with older code */ |
| 246 | 247 | ||
| @@ -362,7 +363,7 @@ PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx); | |||
| 362 | ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk); | 363 | ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk); |
| 363 | int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int type, | 364 | int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int type, |
| 364 | void *data); | 365 | void *data); |
| 365 | int PKCS7_add_attribute (PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, | 366 | int PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, |
| 366 | void *value); | 367 | void *value); |
| 367 | ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid); | 368 | ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid); |
| 368 | ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid); | 369 | ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid); |
diff --git a/src/lib/libcrypto/rc2/rc2_cbc.c b/src/lib/libcrypto/rc2/rc2.c index 1d8e2def99..c122d4b810 100644 --- a/src/lib/libcrypto/rc2/rc2_cbc.c +++ b/src/lib/libcrypto/rc2/rc2.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rc2_cbc.c,v 1.8 2023/07/07 13:40:44 beck Exp $ */ | 1 | /* $OpenBSD: rc2.c,v 1.1 2025/05/25 05:29:54 jsing Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -57,86 +57,89 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <openssl/rc2.h> | 59 | #include <openssl/rc2.h> |
| 60 | |||
| 60 | #include "rc2_local.h" | 61 | #include "rc2_local.h" |
| 61 | 62 | ||
| 63 | static const unsigned char key_table[256]={ | ||
| 64 | 0xd9,0x78,0xf9,0xc4,0x19,0xdd,0xb5,0xed,0x28,0xe9,0xfd,0x79, | ||
| 65 | 0x4a,0xa0,0xd8,0x9d,0xc6,0x7e,0x37,0x83,0x2b,0x76,0x53,0x8e, | ||
| 66 | 0x62,0x4c,0x64,0x88,0x44,0x8b,0xfb,0xa2,0x17,0x9a,0x59,0xf5, | ||
| 67 | 0x87,0xb3,0x4f,0x13,0x61,0x45,0x6d,0x8d,0x09,0x81,0x7d,0x32, | ||
| 68 | 0xbd,0x8f,0x40,0xeb,0x86,0xb7,0x7b,0x0b,0xf0,0x95,0x21,0x22, | ||
| 69 | 0x5c,0x6b,0x4e,0x82,0x54,0xd6,0x65,0x93,0xce,0x60,0xb2,0x1c, | ||
| 70 | 0x73,0x56,0xc0,0x14,0xa7,0x8c,0xf1,0xdc,0x12,0x75,0xca,0x1f, | ||
| 71 | 0x3b,0xbe,0xe4,0xd1,0x42,0x3d,0xd4,0x30,0xa3,0x3c,0xb6,0x26, | ||
| 72 | 0x6f,0xbf,0x0e,0xda,0x46,0x69,0x07,0x57,0x27,0xf2,0x1d,0x9b, | ||
| 73 | 0xbc,0x94,0x43,0x03,0xf8,0x11,0xc7,0xf6,0x90,0xef,0x3e,0xe7, | ||
| 74 | 0x06,0xc3,0xd5,0x2f,0xc8,0x66,0x1e,0xd7,0x08,0xe8,0xea,0xde, | ||
| 75 | 0x80,0x52,0xee,0xf7,0x84,0xaa,0x72,0xac,0x35,0x4d,0x6a,0x2a, | ||
| 76 | 0x96,0x1a,0xd2,0x71,0x5a,0x15,0x49,0x74,0x4b,0x9f,0xd0,0x5e, | ||
| 77 | 0x04,0x18,0xa4,0xec,0xc2,0xe0,0x41,0x6e,0x0f,0x51,0xcb,0xcc, | ||
| 78 | 0x24,0x91,0xaf,0x50,0xa1,0xf4,0x70,0x39,0x99,0x7c,0x3a,0x85, | ||
| 79 | 0x23,0xb8,0xb4,0x7a,0xfc,0x02,0x36,0x5b,0x25,0x55,0x97,0x31, | ||
| 80 | 0x2d,0x5d,0xfa,0x98,0xe3,0x8a,0x92,0xae,0x05,0xdf,0x29,0x10, | ||
| 81 | 0x67,0x6c,0xba,0xc9,0xd3,0x00,0xe6,0xcf,0xe1,0x9e,0xa8,0x2c, | ||
| 82 | 0x63,0x16,0x01,0x3f,0x58,0xe2,0x89,0xa9,0x0d,0x38,0x34,0x1b, | ||
| 83 | 0xab,0x33,0xff,0xb0,0xbb,0x48,0x0c,0x5f,0xb9,0xb1,0xcd,0x2e, | ||
| 84 | 0xc5,0xf3,0xdb,0x47,0xe5,0xa5,0x9c,0x77,0x0a,0xa6,0x20,0x68, | ||
| 85 | 0xfe,0x7f,0xc1,0xad, | ||
| 86 | }; | ||
| 87 | |||
| 88 | /* It has come to my attention that there are 2 versions of the RC2 | ||
| 89 | * key schedule. One which is normal, and anther which has a hook to | ||
| 90 | * use a reduced key length. | ||
| 91 | * BSAFE uses the 'retarded' version. What I previously shipped is | ||
| 92 | * the same as specifying 1024 for the 'bits' parameter. Bsafe uses | ||
| 93 | * a version where the bits parameter is the same as len*8 */ | ||
| 62 | void | 94 | void |
| 63 | RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, | 95 | RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits) |
| 64 | RC2_KEY *ks, unsigned char *iv, int encrypt) | ||
| 65 | { | 96 | { |
| 66 | unsigned long tin0, tin1; | 97 | int i, j; |
| 67 | unsigned long tout0, tout1, xor0, xor1; | 98 | unsigned char *k; |
| 68 | long l = length; | 99 | RC2_INT *ki; |
| 69 | unsigned long tin[2]; | 100 | unsigned int c, d; |
| 70 | 101 | ||
| 71 | if (encrypt) { | 102 | k = (unsigned char *)&(key->data[0]); |
| 72 | c2l(iv, tout0); | 103 | *k = 0; /* for if there is a zero length key */ |
| 73 | c2l(iv, tout1); | 104 | |
| 74 | iv -= 8; | 105 | if (len > 128) |
| 75 | for (l -= 8; l >= 0; l -= 8) | 106 | len = 128; |
| 76 | { | 107 | if (bits <= 0) |
| 77 | c2l(in, tin0); | 108 | bits = 1024; |
| 78 | c2l(in, tin1); | 109 | if (bits > 1024) |
| 79 | tin0 ^= tout0; | 110 | bits = 1024; |
| 80 | tin1 ^= tout1; | 111 | |
| 81 | tin[0] = tin0; | 112 | for (i = 0; i < len; i++) |
| 82 | tin[1] = tin1; | 113 | k[i] = data[i]; |
| 83 | RC2_encrypt(tin, ks); | 114 | |
| 84 | tout0 = tin[0]; | 115 | /* expand table */ |
| 85 | l2c(tout0, out); | 116 | d = k[len - 1]; |
| 86 | tout1 = tin[1]; | 117 | j = 0; |
| 87 | l2c(tout1, out); | 118 | for (i = len; i < 128; i++, j++) |
| 88 | } | 119 | { |
| 89 | if (l != -8) { | 120 | d = key_table[(k[j] + d) & 0xff]; |
| 90 | c2ln(in, tin0, tin1, l + 8); | 121 | k[i] = d; |
| 91 | tin0 ^= tout0; | ||
| 92 | tin1 ^= tout1; | ||
| 93 | tin[0] = tin0; | ||
| 94 | tin[1] = tin1; | ||
| 95 | RC2_encrypt(tin, ks); | ||
| 96 | tout0 = tin[0]; | ||
| 97 | l2c(tout0, out); | ||
| 98 | tout1 = tin[1]; | ||
| 99 | l2c(tout1, out); | ||
| 100 | } | ||
| 101 | l2c(tout0, iv); | ||
| 102 | l2c(tout1, iv); | ||
| 103 | } else { | ||
| 104 | c2l(iv, xor0); | ||
| 105 | c2l(iv, xor1); | ||
| 106 | iv -= 8; | ||
| 107 | for (l -= 8; l >= 0; l -= 8) | ||
| 108 | { | ||
| 109 | c2l(in, tin0); | ||
| 110 | tin[0] = tin0; | ||
| 111 | c2l(in, tin1); | ||
| 112 | tin[1] = tin1; | ||
| 113 | RC2_decrypt(tin, ks); | ||
| 114 | tout0 = tin[0] ^ xor0; | ||
| 115 | tout1 = tin[1] ^ xor1; | ||
| 116 | l2c(tout0, out); | ||
| 117 | l2c(tout1, out); | ||
| 118 | xor0 = tin0; | ||
| 119 | xor1 = tin1; | ||
| 120 | } | ||
| 121 | if (l != -8) { | ||
| 122 | c2l(in, tin0); | ||
| 123 | tin[0] = tin0; | ||
| 124 | c2l(in, tin1); | ||
| 125 | tin[1] = tin1; | ||
| 126 | RC2_decrypt(tin, ks); | ||
| 127 | tout0 = tin[0] ^ xor0; | ||
| 128 | tout1 = tin[1] ^ xor1; | ||
| 129 | l2cn(tout0, tout1, out, l + 8); | ||
| 130 | xor0 = tin0; | ||
| 131 | xor1 = tin1; | ||
| 132 | } | ||
| 133 | l2c(xor0, iv); | ||
| 134 | l2c(xor1, iv); | ||
| 135 | } | 122 | } |
| 136 | tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0; | 123 | |
| 137 | tin[0] = tin[1] = 0; | 124 | /* hmm.... key reduction to 'bits' bits */ |
| 125 | |||
| 126 | j = (bits + 7) >> 3; | ||
| 127 | i = 128 - j; | ||
| 128 | c = (0xff >> (-bits & 0x07)); | ||
| 129 | |||
| 130 | d = key_table[k[i] & c]; | ||
| 131 | k[i] = d; | ||
| 132 | while (i--) { | ||
| 133 | d = key_table[k[i + j] ^ d]; | ||
| 134 | k[i] = d; | ||
| 135 | } | ||
| 136 | |||
| 137 | /* copy from bytes into RC2_INT's */ | ||
| 138 | ki = &(key->data[63]); | ||
| 139 | for (i = 127; i >= 0; i -= 2) | ||
| 140 | *(ki--) = ((k[i] << 8)|k[i - 1]) & 0xffff; | ||
| 138 | } | 141 | } |
| 139 | LCRYPTO_ALIAS(RC2_cbc_encrypt); | 142 | LCRYPTO_ALIAS(RC2_set_key); |
| 140 | 143 | ||
| 141 | void | 144 | void |
| 142 | RC2_encrypt(unsigned long *d, RC2_KEY *key) | 145 | RC2_encrypt(unsigned long *d, RC2_KEY *key) |
| @@ -234,3 +237,225 @@ RC2_decrypt(unsigned long *d, RC2_KEY *key) | |||
| 234 | 16L); | 237 | 16L); |
| 235 | } | 238 | } |
| 236 | LCRYPTO_ALIAS(RC2_decrypt); | 239 | LCRYPTO_ALIAS(RC2_decrypt); |
| 240 | |||
| 241 | void | ||
| 242 | RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, | ||
| 243 | RC2_KEY *ks, unsigned char *iv, int encrypt) | ||
| 244 | { | ||
| 245 | unsigned long tin0, tin1; | ||
| 246 | unsigned long tout0, tout1, xor0, xor1; | ||
| 247 | long l = length; | ||
| 248 | unsigned long tin[2]; | ||
| 249 | |||
| 250 | if (encrypt) { | ||
| 251 | c2l(iv, tout0); | ||
| 252 | c2l(iv, tout1); | ||
| 253 | iv -= 8; | ||
| 254 | for (l -= 8; l >= 0; l -= 8) | ||
| 255 | { | ||
| 256 | c2l(in, tin0); | ||
| 257 | c2l(in, tin1); | ||
| 258 | tin0 ^= tout0; | ||
| 259 | tin1 ^= tout1; | ||
| 260 | tin[0] = tin0; | ||
| 261 | tin[1] = tin1; | ||
| 262 | RC2_encrypt(tin, ks); | ||
| 263 | tout0 = tin[0]; | ||
| 264 | l2c(tout0, out); | ||
| 265 | tout1 = tin[1]; | ||
| 266 | l2c(tout1, out); | ||
| 267 | } | ||
| 268 | if (l != -8) { | ||
| 269 | c2ln(in, tin0, tin1, l + 8); | ||
| 270 | tin0 ^= tout0; | ||
| 271 | tin1 ^= tout1; | ||
| 272 | tin[0] = tin0; | ||
| 273 | tin[1] = tin1; | ||
| 274 | RC2_encrypt(tin, ks); | ||
| 275 | tout0 = tin[0]; | ||
| 276 | l2c(tout0, out); | ||
| 277 | tout1 = tin[1]; | ||
| 278 | l2c(tout1, out); | ||
| 279 | } | ||
| 280 | l2c(tout0, iv); | ||
| 281 | l2c(tout1, iv); | ||
| 282 | } else { | ||
| 283 | c2l(iv, xor0); | ||
| 284 | c2l(iv, xor1); | ||
| 285 | iv -= 8; | ||
| 286 | for (l -= 8; l >= 0; l -= 8) | ||
| 287 | { | ||
| 288 | c2l(in, tin0); | ||
| 289 | tin[0] = tin0; | ||
| 290 | c2l(in, tin1); | ||
| 291 | tin[1] = tin1; | ||
| 292 | RC2_decrypt(tin, ks); | ||
| 293 | tout0 = tin[0] ^ xor0; | ||
| 294 | tout1 = tin[1] ^ xor1; | ||
| 295 | l2c(tout0, out); | ||
| 296 | l2c(tout1, out); | ||
| 297 | xor0 = tin0; | ||
| 298 | xor1 = tin1; | ||
| 299 | } | ||
| 300 | if (l != -8) { | ||
| 301 | c2l(in, tin0); | ||
| 302 | tin[0] = tin0; | ||
| 303 | c2l(in, tin1); | ||
| 304 | tin[1] = tin1; | ||
| 305 | RC2_decrypt(tin, ks); | ||
| 306 | tout0 = tin[0] ^ xor0; | ||
| 307 | tout1 = tin[1] ^ xor1; | ||
| 308 | l2cn(tout0, tout1, out, l + 8); | ||
| 309 | xor0 = tin0; | ||
| 310 | xor1 = tin1; | ||
| 311 | } | ||
| 312 | l2c(xor0, iv); | ||
| 313 | l2c(xor1, iv); | ||
| 314 | } | ||
| 315 | tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0; | ||
| 316 | tin[0] = tin[1] = 0; | ||
| 317 | } | ||
| 318 | LCRYPTO_ALIAS(RC2_cbc_encrypt); | ||
| 319 | |||
| 320 | /* The input and output encrypted as though 64bit cfb mode is being | ||
| 321 | * used. The extra state information to record how much of the | ||
| 322 | * 64bit block we have used is contained in *num; | ||
| 323 | */ | ||
| 324 | void | ||
| 325 | RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out, | ||
| 326 | long length, RC2_KEY *schedule, unsigned char *ivec, | ||
| 327 | int *num, int encrypt) | ||
| 328 | { | ||
| 329 | unsigned long v0, v1, t; | ||
| 330 | int n = *num; | ||
| 331 | long l = length; | ||
| 332 | unsigned long ti[2]; | ||
| 333 | unsigned char *iv, c, cc; | ||
| 334 | |||
| 335 | iv = (unsigned char *)ivec; | ||
| 336 | if (encrypt) { | ||
| 337 | while (l--) { | ||
| 338 | if (n == 0) { | ||
| 339 | c2l(iv, v0); | ||
| 340 | ti[0] = v0; | ||
| 341 | c2l(iv, v1); | ||
| 342 | ti[1] = v1; | ||
| 343 | RC2_encrypt((unsigned long *)ti, schedule); | ||
| 344 | iv = (unsigned char *)ivec; | ||
| 345 | t = ti[0]; | ||
| 346 | l2c(t, iv); | ||
| 347 | t = ti[1]; | ||
| 348 | l2c(t, iv); | ||
| 349 | iv = (unsigned char *)ivec; | ||
| 350 | } | ||
| 351 | c = *(in++) ^ iv[n]; | ||
| 352 | *(out++) = c; | ||
| 353 | iv[n] = c; | ||
| 354 | n = (n + 1) & 0x07; | ||
| 355 | } | ||
| 356 | } else { | ||
| 357 | while (l--) { | ||
| 358 | if (n == 0) { | ||
| 359 | c2l(iv, v0); | ||
| 360 | ti[0] = v0; | ||
| 361 | c2l(iv, v1); | ||
| 362 | ti[1] = v1; | ||
| 363 | RC2_encrypt((unsigned long *)ti, schedule); | ||
| 364 | iv = (unsigned char *)ivec; | ||
| 365 | t = ti[0]; | ||
| 366 | l2c(t, iv); | ||
| 367 | t = ti[1]; | ||
| 368 | l2c(t, iv); | ||
| 369 | iv = (unsigned char *)ivec; | ||
| 370 | } | ||
| 371 | cc = *(in++); | ||
| 372 | c = iv[n]; | ||
| 373 | iv[n] = cc; | ||
| 374 | *(out++) = c ^ cc; | ||
| 375 | n = (n + 1) & 0x07; | ||
| 376 | } | ||
| 377 | } | ||
| 378 | v0 = v1 = ti[0] = ti[1] = t = c = cc = 0; | ||
| 379 | *num = n; | ||
| 380 | } | ||
| 381 | LCRYPTO_ALIAS(RC2_cfb64_encrypt); | ||
| 382 | |||
| 383 | /* RC2 as implemented frm a posting from | ||
| 384 | * Newsgroups: sci.crypt | ||
| 385 | * Sender: pgut01@cs.auckland.ac.nz (Peter Gutmann) | ||
| 386 | * Subject: Specification for Ron Rivests Cipher No.2 | ||
| 387 | * Message-ID: <4fk39f$f70@net.auckland.ac.nz> | ||
| 388 | * Date: 11 Feb 1996 06:45:03 GMT | ||
| 389 | */ | ||
| 390 | void | ||
| 391 | RC2_ecb_encrypt(const unsigned char *in, unsigned char *out, RC2_KEY *ks, | ||
| 392 | int encrypt) | ||
| 393 | { | ||
| 394 | unsigned long l, d[2]; | ||
| 395 | |||
| 396 | c2l(in, l); | ||
| 397 | d[0] = l; | ||
| 398 | c2l(in, l); | ||
| 399 | d[1] = l; | ||
| 400 | if (encrypt) | ||
| 401 | RC2_encrypt(d, ks); | ||
| 402 | else | ||
| 403 | RC2_decrypt(d, ks); | ||
| 404 | l = d[0]; | ||
| 405 | l2c(l, out); | ||
| 406 | l = d[1]; | ||
| 407 | l2c(l, out); | ||
| 408 | l = d[0] = d[1] = 0; | ||
| 409 | } | ||
| 410 | LCRYPTO_ALIAS(RC2_ecb_encrypt); | ||
| 411 | |||
| 412 | /* The input and output encrypted as though 64bit ofb mode is being | ||
| 413 | * used. The extra state information to record how much of the | ||
| 414 | * 64bit block we have used is contained in *num; | ||
| 415 | */ | ||
| 416 | void | ||
| 417 | RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out, | ||
| 418 | long length, RC2_KEY *schedule, unsigned char *ivec, | ||
| 419 | int *num) | ||
| 420 | { | ||
| 421 | unsigned long v0, v1, t; | ||
| 422 | int n = *num; | ||
| 423 | long l = length; | ||
| 424 | unsigned char d[8]; | ||
| 425 | char *dp; | ||
| 426 | unsigned long ti[2]; | ||
| 427 | unsigned char *iv; | ||
| 428 | int save = 0; | ||
| 429 | |||
| 430 | iv = (unsigned char *)ivec; | ||
| 431 | c2l(iv, v0); | ||
| 432 | c2l(iv, v1); | ||
| 433 | ti[0] = v0; | ||
| 434 | ti[1] = v1; | ||
| 435 | dp = (char *)d; | ||
| 436 | l2c(v0, dp); | ||
| 437 | l2c(v1, dp); | ||
| 438 | while (l--) { | ||
| 439 | if (n == 0) { | ||
| 440 | RC2_encrypt((unsigned long *)ti, schedule); | ||
| 441 | dp = (char *)d; | ||
| 442 | t = ti[0]; | ||
| 443 | l2c(t, dp); | ||
| 444 | t = ti[1]; | ||
| 445 | l2c(t, dp); | ||
| 446 | save++; | ||
| 447 | } | ||
| 448 | *(out++) = *(in++) ^ d[n]; | ||
| 449 | n = (n + 1) & 0x07; | ||
| 450 | } | ||
| 451 | if (save) { | ||
| 452 | v0 = ti[0]; | ||
| 453 | v1 = ti[1]; | ||
| 454 | iv = (unsigned char *)ivec; | ||
| 455 | l2c(v0, iv); | ||
| 456 | l2c(v1, iv); | ||
| 457 | } | ||
| 458 | t = v0 = v1 = ti[0] = ti[1] = 0; | ||
| 459 | *num = n; | ||
| 460 | } | ||
| 461 | LCRYPTO_ALIAS(RC2_ofb64_encrypt); | ||
diff --git a/src/lib/libcrypto/rc2/rc2.h b/src/lib/libcrypto/rc2/rc2.h index 96e395f32d..ead308cf51 100644 --- a/src/lib/libcrypto/rc2/rc2.h +++ b/src/lib/libcrypto/rc2/rc2.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rc2.h,v 1.13 2025/01/25 17:59:44 tb Exp $ */ | 1 | /* $OpenBSD: rc2.h,v 1.14 2025/06/09 14:37:49 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -59,7 +59,12 @@ | |||
| 59 | #ifndef HEADER_RC2_H | 59 | #ifndef HEADER_RC2_H |
| 60 | #define HEADER_RC2_H | 60 | #define HEADER_RC2_H |
| 61 | 61 | ||
| 62 | #include <openssl/opensslconf.h> /* OPENSSL_NO_RC2, RC2_INT */ | 62 | #include <openssl/opensslconf.h> /* OPENSSL_NO_RC2 */ |
| 63 | |||
| 64 | #ifndef RC2_INT | ||
| 65 | /* XXX - typedef */ | ||
| 66 | #define RC2_INT unsigned int | ||
| 67 | #endif | ||
| 63 | 68 | ||
| 64 | #define RC2_ENCRYPT 1 | 69 | #define RC2_ENCRYPT 1 |
| 65 | #define RC2_DECRYPT 0 | 70 | #define RC2_DECRYPT 0 |
diff --git a/src/lib/libcrypto/rc2/rc2_ecb.c b/src/lib/libcrypto/rc2/rc2_ecb.c deleted file mode 100644 index 6a3c8098eb..0000000000 --- a/src/lib/libcrypto/rc2/rc2_ecb.c +++ /dev/null | |||
| @@ -1,91 +0,0 @@ | |||
| 1 | /* $OpenBSD: rc2_ecb.c,v 1.9 2023/07/07 13:40:44 beck Exp $ */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <openssl/rc2.h> | ||
| 60 | #include "rc2_local.h" | ||
| 61 | #include <openssl/opensslv.h> | ||
| 62 | |||
| 63 | /* RC2 as implemented frm a posting from | ||
| 64 | * Newsgroups: sci.crypt | ||
| 65 | * Sender: pgut01@cs.auckland.ac.nz (Peter Gutmann) | ||
| 66 | * Subject: Specification for Ron Rivests Cipher No.2 | ||
| 67 | * Message-ID: <4fk39f$f70@net.auckland.ac.nz> | ||
| 68 | * Date: 11 Feb 1996 06:45:03 GMT | ||
| 69 | */ | ||
| 70 | |||
| 71 | void | ||
| 72 | RC2_ecb_encrypt(const unsigned char *in, unsigned char *out, RC2_KEY *ks, | ||
| 73 | int encrypt) | ||
| 74 | { | ||
| 75 | unsigned long l, d[2]; | ||
| 76 | |||
| 77 | c2l(in, l); | ||
| 78 | d[0] = l; | ||
| 79 | c2l(in, l); | ||
| 80 | d[1] = l; | ||
| 81 | if (encrypt) | ||
| 82 | RC2_encrypt(d, ks); | ||
| 83 | else | ||
| 84 | RC2_decrypt(d, ks); | ||
| 85 | l = d[0]; | ||
| 86 | l2c(l, out); | ||
| 87 | l = d[1]; | ||
| 88 | l2c(l, out); | ||
| 89 | l = d[0] = d[1] = 0; | ||
| 90 | } | ||
| 91 | LCRYPTO_ALIAS(RC2_ecb_encrypt); | ||
diff --git a/src/lib/libcrypto/rc2/rc2_local.h b/src/lib/libcrypto/rc2/rc2_local.h index dd5598760e..885b17aa5e 100644 --- a/src/lib/libcrypto/rc2/rc2_local.h +++ b/src/lib/libcrypto/rc2/rc2_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rc2_local.h,v 1.3 2024/03/29 05:03:48 jsing Exp $ */ | 1 | /* $OpenBSD: rc2_local.h,v 1.4 2025/11/26 10:19:57 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -56,6 +56,9 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #ifndef HEADER_RC2_LOCAL_H | ||
| 60 | #define HEADER_RC2_LOCAL_H | ||
| 61 | |||
| 59 | #undef c2l | 62 | #undef c2l |
| 60 | #define c2l(c,l) (l =((unsigned long)(*((c)++))) , \ | 63 | #define c2l(c,l) (l =((unsigned long)(*((c)++))) , \ |
| 61 | l|=((unsigned long)(*((c)++)))<< 8L, \ | 64 | l|=((unsigned long)(*((c)++)))<< 8L, \ |
| @@ -110,3 +113,5 @@ | |||
| 110 | x2=(t<<3)|(t>>13); \ | 113 | x2=(t<<3)|(t>>13); \ |
| 111 | t=(x3+(x0& ~x2)+(x1&x2)+ *(p0++))&0xffff; \ | 114 | t=(x3+(x0& ~x2)+(x1&x2)+ *(p0++))&0xffff; \ |
| 112 | x3=(t<<5)|(t>>11); | 115 | x3=(t<<5)|(t>>11); |
| 116 | |||
| 117 | #endif /* HEADER_RC2_LOCAL_H */ | ||
diff --git a/src/lib/libcrypto/rc2/rc2_skey.c b/src/lib/libcrypto/rc2/rc2_skey.c deleted file mode 100644 index d33c02da8c..0000000000 --- a/src/lib/libcrypto/rc2/rc2_skey.c +++ /dev/null | |||
| @@ -1,142 +0,0 @@ | |||
| 1 | /* $OpenBSD: rc2_skey.c,v 1.15 2023/07/07 13:40:44 beck Exp $ */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <openssl/crypto.h> | ||
| 60 | #include <openssl/rc2.h> | ||
| 61 | #include "rc2_local.h" | ||
| 62 | |||
| 63 | static const unsigned char key_table[256]={ | ||
| 64 | 0xd9,0x78,0xf9,0xc4,0x19,0xdd,0xb5,0xed,0x28,0xe9,0xfd,0x79, | ||
| 65 | 0x4a,0xa0,0xd8,0x9d,0xc6,0x7e,0x37,0x83,0x2b,0x76,0x53,0x8e, | ||
| 66 | 0x62,0x4c,0x64,0x88,0x44,0x8b,0xfb,0xa2,0x17,0x9a,0x59,0xf5, | ||
| 67 | 0x87,0xb3,0x4f,0x13,0x61,0x45,0x6d,0x8d,0x09,0x81,0x7d,0x32, | ||
| 68 | 0xbd,0x8f,0x40,0xeb,0x86,0xb7,0x7b,0x0b,0xf0,0x95,0x21,0x22, | ||
| 69 | 0x5c,0x6b,0x4e,0x82,0x54,0xd6,0x65,0x93,0xce,0x60,0xb2,0x1c, | ||
| 70 | 0x73,0x56,0xc0,0x14,0xa7,0x8c,0xf1,0xdc,0x12,0x75,0xca,0x1f, | ||
| 71 | 0x3b,0xbe,0xe4,0xd1,0x42,0x3d,0xd4,0x30,0xa3,0x3c,0xb6,0x26, | ||
| 72 | 0x6f,0xbf,0x0e,0xda,0x46,0x69,0x07,0x57,0x27,0xf2,0x1d,0x9b, | ||
| 73 | 0xbc,0x94,0x43,0x03,0xf8,0x11,0xc7,0xf6,0x90,0xef,0x3e,0xe7, | ||
| 74 | 0x06,0xc3,0xd5,0x2f,0xc8,0x66,0x1e,0xd7,0x08,0xe8,0xea,0xde, | ||
| 75 | 0x80,0x52,0xee,0xf7,0x84,0xaa,0x72,0xac,0x35,0x4d,0x6a,0x2a, | ||
| 76 | 0x96,0x1a,0xd2,0x71,0x5a,0x15,0x49,0x74,0x4b,0x9f,0xd0,0x5e, | ||
| 77 | 0x04,0x18,0xa4,0xec,0xc2,0xe0,0x41,0x6e,0x0f,0x51,0xcb,0xcc, | ||
| 78 | 0x24,0x91,0xaf,0x50,0xa1,0xf4,0x70,0x39,0x99,0x7c,0x3a,0x85, | ||
| 79 | 0x23,0xb8,0xb4,0x7a,0xfc,0x02,0x36,0x5b,0x25,0x55,0x97,0x31, | ||
| 80 | 0x2d,0x5d,0xfa,0x98,0xe3,0x8a,0x92,0xae,0x05,0xdf,0x29,0x10, | ||
| 81 | 0x67,0x6c,0xba,0xc9,0xd3,0x00,0xe6,0xcf,0xe1,0x9e,0xa8,0x2c, | ||
| 82 | 0x63,0x16,0x01,0x3f,0x58,0xe2,0x89,0xa9,0x0d,0x38,0x34,0x1b, | ||
| 83 | 0xab,0x33,0xff,0xb0,0xbb,0x48,0x0c,0x5f,0xb9,0xb1,0xcd,0x2e, | ||
| 84 | 0xc5,0xf3,0xdb,0x47,0xe5,0xa5,0x9c,0x77,0x0a,0xa6,0x20,0x68, | ||
| 85 | 0xfe,0x7f,0xc1,0xad, | ||
| 86 | }; | ||
| 87 | |||
| 88 | /* It has come to my attention that there are 2 versions of the RC2 | ||
| 89 | * key schedule. One which is normal, and anther which has a hook to | ||
| 90 | * use a reduced key length. | ||
| 91 | * BSAFE uses the 'retarded' version. What I previously shipped is | ||
| 92 | * the same as specifying 1024 for the 'bits' parameter. Bsafe uses | ||
| 93 | * a version where the bits parameter is the same as len*8 */ | ||
| 94 | void | ||
| 95 | RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits) | ||
| 96 | { | ||
| 97 | int i, j; | ||
| 98 | unsigned char *k; | ||
| 99 | RC2_INT *ki; | ||
| 100 | unsigned int c, d; | ||
| 101 | |||
| 102 | k = (unsigned char *)&(key->data[0]); | ||
| 103 | *k = 0; /* for if there is a zero length key */ | ||
| 104 | |||
| 105 | if (len > 128) | ||
| 106 | len = 128; | ||
| 107 | if (bits <= 0) | ||
| 108 | bits = 1024; | ||
| 109 | if (bits > 1024) | ||
| 110 | bits = 1024; | ||
| 111 | |||
| 112 | for (i = 0; i < len; i++) | ||
| 113 | k[i] = data[i]; | ||
| 114 | |||
| 115 | /* expand table */ | ||
| 116 | d = k[len - 1]; | ||
| 117 | j = 0; | ||
| 118 | for (i = len; i < 128; i++, j++) | ||
| 119 | { | ||
| 120 | d = key_table[(k[j] + d) & 0xff]; | ||
| 121 | k[i] = d; | ||
| 122 | } | ||
| 123 | |||
| 124 | /* hmm.... key reduction to 'bits' bits */ | ||
| 125 | |||
| 126 | j = (bits + 7) >> 3; | ||
| 127 | i = 128 - j; | ||
| 128 | c = (0xff >> (-bits & 0x07)); | ||
| 129 | |||
| 130 | d = key_table[k[i] & c]; | ||
| 131 | k[i] = d; | ||
| 132 | while (i--) { | ||
| 133 | d = key_table[k[i + j] ^ d]; | ||
| 134 | k[i] = d; | ||
| 135 | } | ||
| 136 | |||
| 137 | /* copy from bytes into RC2_INT's */ | ||
| 138 | ki = &(key->data[63]); | ||
| 139 | for (i = 127; i >= 0; i -= 2) | ||
| 140 | *(ki--) = ((k[i] << 8)|k[i - 1]) & 0xffff; | ||
| 141 | } | ||
| 142 | LCRYPTO_ALIAS(RC2_set_key); | ||
diff --git a/src/lib/libcrypto/rc2/rc2cfb64.c b/src/lib/libcrypto/rc2/rc2cfb64.c deleted file mode 100644 index 21266c430b..0000000000 --- a/src/lib/libcrypto/rc2/rc2cfb64.c +++ /dev/null | |||
| @@ -1,124 +0,0 @@ | |||
| 1 | /* $OpenBSD: rc2cfb64.c,v 1.8 2023/07/07 13:40:44 beck Exp $ */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <openssl/rc2.h> | ||
| 60 | #include "rc2_local.h" | ||
| 61 | |||
| 62 | /* The input and output encrypted as though 64bit cfb mode is being | ||
| 63 | * used. The extra state information to record how much of the | ||
| 64 | * 64bit block we have used is contained in *num; | ||
| 65 | */ | ||
| 66 | |||
| 67 | void | ||
| 68 | RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out, | ||
| 69 | long length, RC2_KEY *schedule, unsigned char *ivec, | ||
| 70 | int *num, int encrypt) | ||
| 71 | { | ||
| 72 | unsigned long v0, v1, t; | ||
| 73 | int n = *num; | ||
| 74 | long l = length; | ||
| 75 | unsigned long ti[2]; | ||
| 76 | unsigned char *iv, c, cc; | ||
| 77 | |||
| 78 | iv = (unsigned char *)ivec; | ||
| 79 | if (encrypt) { | ||
| 80 | while (l--) { | ||
| 81 | if (n == 0) { | ||
| 82 | c2l(iv, v0); | ||
| 83 | ti[0] = v0; | ||
| 84 | c2l(iv, v1); | ||
| 85 | ti[1] = v1; | ||
| 86 | RC2_encrypt((unsigned long *)ti, schedule); | ||
| 87 | iv = (unsigned char *)ivec; | ||
| 88 | t = ti[0]; | ||
| 89 | l2c(t, iv); | ||
| 90 | t = ti[1]; | ||
| 91 | l2c(t, iv); | ||
| 92 | iv = (unsigned char *)ivec; | ||
| 93 | } | ||
| 94 | c = *(in++) ^ iv[n]; | ||
| 95 | *(out++) = c; | ||
| 96 | iv[n] = c; | ||
| 97 | n = (n + 1) & 0x07; | ||
| 98 | } | ||
| 99 | } else { | ||
| 100 | while (l--) { | ||
| 101 | if (n == 0) { | ||
| 102 | c2l(iv, v0); | ||
| 103 | ti[0] = v0; | ||
| 104 | c2l(iv, v1); | ||
| 105 | ti[1] = v1; | ||
| 106 | RC2_encrypt((unsigned long *)ti, schedule); | ||
| 107 | iv = (unsigned char *)ivec; | ||
| 108 | t = ti[0]; | ||
| 109 | l2c(t, iv); | ||
| 110 | t = ti[1]; | ||
| 111 | l2c(t, iv); | ||
| 112 | iv = (unsigned char *)ivec; | ||
| 113 | } | ||
| 114 | cc = *(in++); | ||
| 115 | c = iv[n]; | ||
| 116 | iv[n] = cc; | ||
| 117 | *(out++) = c ^ cc; | ||
| 118 | n = (n + 1) & 0x07; | ||
| 119 | } | ||
| 120 | } | ||
| 121 | v0 = v1 = ti[0] = ti[1] = t = c = cc = 0; | ||
| 122 | *num = n; | ||
| 123 | } | ||
| 124 | LCRYPTO_ALIAS(RC2_cfb64_encrypt); | ||
diff --git a/src/lib/libcrypto/rc2/rc2ofb64.c b/src/lib/libcrypto/rc2/rc2ofb64.c deleted file mode 100644 index 73d8323e92..0000000000 --- a/src/lib/libcrypto/rc2/rc2ofb64.c +++ /dev/null | |||
| @@ -1,111 +0,0 @@ | |||
| 1 | /* $OpenBSD: rc2ofb64.c,v 1.8 2023/07/07 13:40:44 beck Exp $ */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <openssl/rc2.h> | ||
| 60 | #include "rc2_local.h" | ||
| 61 | |||
| 62 | /* The input and output encrypted as though 64bit ofb mode is being | ||
| 63 | * used. The extra state information to record how much of the | ||
| 64 | * 64bit block we have used is contained in *num; | ||
| 65 | */ | ||
| 66 | void | ||
| 67 | RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out, | ||
| 68 | long length, RC2_KEY *schedule, unsigned char *ivec, | ||
| 69 | int *num) | ||
| 70 | { | ||
| 71 | unsigned long v0, v1, t; | ||
| 72 | int n = *num; | ||
| 73 | long l = length; | ||
| 74 | unsigned char d[8]; | ||
| 75 | char *dp; | ||
| 76 | unsigned long ti[2]; | ||
| 77 | unsigned char *iv; | ||
| 78 | int save = 0; | ||
| 79 | |||
| 80 | iv = (unsigned char *)ivec; | ||
| 81 | c2l(iv, v0); | ||
| 82 | c2l(iv, v1); | ||
| 83 | ti[0] = v0; | ||
| 84 | ti[1] = v1; | ||
| 85 | dp = (char *)d; | ||
| 86 | l2c(v0, dp); | ||
| 87 | l2c(v1, dp); | ||
| 88 | while (l--) { | ||
| 89 | if (n == 0) { | ||
| 90 | RC2_encrypt((unsigned long *)ti, schedule); | ||
| 91 | dp = (char *)d; | ||
| 92 | t = ti[0]; | ||
| 93 | l2c(t, dp); | ||
| 94 | t = ti[1]; | ||
| 95 | l2c(t, dp); | ||
| 96 | save++; | ||
| 97 | } | ||
| 98 | *(out++) = *(in++) ^ d[n]; | ||
| 99 | n = (n + 1) & 0x07; | ||
| 100 | } | ||
| 101 | if (save) { | ||
| 102 | v0 = ti[0]; | ||
| 103 | v1 = ti[1]; | ||
| 104 | iv = (unsigned char *)ivec; | ||
| 105 | l2c(v0, iv); | ||
| 106 | l2c(v1, iv); | ||
| 107 | } | ||
| 108 | t = v0 = v1 = ti[0] = ti[1] = 0; | ||
| 109 | *num = n; | ||
| 110 | } | ||
| 111 | LCRYPTO_ALIAS(RC2_ofb64_encrypt); | ||
diff --git a/src/lib/libcrypto/rc2/rrc2.doc b/src/lib/libcrypto/rc2/rrc2.doc deleted file mode 100644 index f93ee003d2..0000000000 --- a/src/lib/libcrypto/rc2/rrc2.doc +++ /dev/null | |||
| @@ -1,219 +0,0 @@ | |||
| 1 | >From cygnus.mincom.oz.au!minbne.mincom.oz.au!bunyip.cc.uq.oz.au!munnari.OZ.AU!comp.vuw.ac.nz!waikato!auckland.ac.nz!news Mon Feb 12 18:48:17 EST 1996 | ||
| 2 | Article 23601 of sci.crypt: | ||
| 3 | Path: cygnus.mincom.oz.au!minbne.mincom.oz.au!bunyip.cc.uq.oz.au!munnari.OZ.AU!comp.vuw.ac.nz!waikato!auckland.ac.nz!news | ||
| 4 | >From: pgut01@cs.auckland.ac.nz (Peter Gutmann) | ||
| 5 | Newsgroups: sci.crypt | ||
| 6 | Subject: Specification for Ron Rivests Cipher No.2 | ||
| 7 | Date: 11 Feb 1996 06:45:03 GMT | ||
| 8 | Organization: University of Auckland | ||
| 9 | Lines: 203 | ||
| 10 | Sender: pgut01@cs.auckland.ac.nz (Peter Gutmann) | ||
| 11 | Message-ID: <4fk39f$f70@net.auckland.ac.nz> | ||
| 12 | NNTP-Posting-Host: cs26.cs.auckland.ac.nz | ||
| 13 | X-Newsreader: NN version 6.5.0 #3 (NOV) | ||
| 14 | |||
| 15 | |||
| 16 | |||
| 17 | |||
| 18 | Ron Rivest's Cipher No.2 | ||
| 19 | ------------------------ | ||
| 20 | |||
| 21 | Ron Rivest's Cipher No.2 (hereafter referred to as RRC.2, other people may | ||
| 22 | refer to it by other names) is word oriented, operating on a block of 64 bits | ||
| 23 | divided into four 16-bit words, with a key table of 64 words. All data units | ||
| 24 | are little-endian. This functional description of the algorithm is based in | ||
| 25 | the paper "The RC5 Encryption Algorithm" (RC5 is a trademark of RSADSI), using | ||
| 26 | the same general layout, terminology, and pseudocode style. | ||
| 27 | |||
| 28 | |||
| 29 | Notation and RRC.2 Primitive Operations | ||
| 30 | |||
| 31 | RRC.2 uses the following primitive operations: | ||
| 32 | |||
| 33 | 1. Two's-complement addition of words, denoted by "+". The inverse operation, | ||
| 34 | subtraction, is denoted by "-". | ||
| 35 | 2. Bitwise exclusive OR, denoted by "^". | ||
| 36 | 3. Bitwise AND, denoted by "&". | ||
| 37 | 4. Bitwise NOT, denoted by "~". | ||
| 38 | 5. A left-rotation of words; the rotation of word x left by y is denoted | ||
| 39 | x <<< y. The inverse operation, right-rotation, is denoted x >>> y. | ||
| 40 | |||
| 41 | These operations are directly and efficiently supported by most processors. | ||
| 42 | |||
| 43 | |||
| 44 | The RRC.2 Algorithm | ||
| 45 | |||
| 46 | RRC.2 consists of three components, a *key expansion* algorithm, an | ||
| 47 | *encryption* algorithm, and a *decryption* algorithm. | ||
| 48 | |||
| 49 | |||
| 50 | Key Expansion | ||
| 51 | |||
| 52 | The purpose of the key-expansion routine is to expand the user's key K to fill | ||
| 53 | the expanded key array S, so S resembles an array of random binary words | ||
| 54 | determined by the user's secret key K. | ||
| 55 | |||
| 56 | Initialising the S-box | ||
| 57 | |||
| 58 | RRC.2 uses a single 256-byte S-box derived from the ciphertext contents of | ||
| 59 | Beale Cipher No.1 XOR'd with a one-time pad. The Beale Ciphers predate modern | ||
| 60 | cryptography by enough time that there should be no concerns about trapdoors | ||
| 61 | hidden in the data. They have been published widely, and the S-box can be | ||
| 62 | easily recreated from the one-time pad values and the Beale Cipher data taken | ||
| 63 | from a standard source. To initialise the S-box: | ||
| 64 | |||
| 65 | for i = 0 to 255 do | ||
| 66 | sBox[ i ] = ( beale[ i ] mod 256 ) ^ pad[ i ] | ||
| 67 | |||
| 68 | The contents of Beale Cipher No.1 and the necessary one-time pad are given as | ||
| 69 | an appendix at the end of this document. For efficiency, implementors may wish | ||
| 70 | to skip the Beale Cipher expansion and store the sBox table directly. | ||
| 71 | |||
| 72 | Expanding the Secret Key to 128 Bytes | ||
| 73 | |||
| 74 | The secret key is first expanded to fill 128 bytes (64 words). The expansion | ||
| 75 | consists of taking the sum of the first and last bytes in the user key, looking | ||
| 76 | up the sum (modulo 256) in the S-box, and appending the result to the key. The | ||
| 77 | operation is repeated with the second byte and new last byte of the key until | ||
| 78 | all 128 bytes have been generated. Note that the following pseudocode treats | ||
| 79 | the S array as an array of 128 bytes rather than 64 words. | ||
| 80 | |||
| 81 | for j = 0 to length-1 do | ||
| 82 | S[ j ] = K[ j ] | ||
| 83 | for j = length to 127 do | ||
| 84 | s[ j ] = sBox[ ( S[ j-length ] + S[ j-1 ] ) mod 256 ]; | ||
| 85 | |||
| 86 | At this point it is possible to perform a truncation of the effective key | ||
| 87 | length to ease the creation of espionage-enabled software products. However | ||
| 88 | since the author cannot conceive why anyone would want to do this, it will not | ||
| 89 | be considered further. | ||
| 90 | |||
| 91 | The final phase of the key expansion involves replacing the first byte of S | ||
| 92 | with the entry selected from the S-box: | ||
| 93 | |||
| 94 | S[ 0 ] = sBox[ S[ 0 ] ] | ||
| 95 | |||
| 96 | |||
| 97 | Encryption | ||
| 98 | |||
| 99 | The cipher has 16 full rounds, each divided into 4 subrounds. Two of the full | ||
| 100 | rounds perform an additional transformation on the data. Note that the | ||
| 101 | following pseudocode treats the S array as an array of 64 words rather than 128 | ||
| 102 | bytes. | ||
| 103 | |||
| 104 | for i = 0 to 15 do | ||
| 105 | j = i * 4; | ||
| 106 | word0 = ( word0 + ( word1 & ~word3 ) + ( word2 & word3 ) + S[ j+0 ] ) <<< 1 | ||
| 107 | word1 = ( word1 + ( word2 & ~word0 ) + ( word3 & word0 ) + S[ j+1 ] ) <<< 2 | ||
| 108 | word2 = ( word2 + ( word3 & ~word1 ) + ( word0 & word1 ) + S[ j+2 ] ) <<< 3 | ||
| 109 | word3 = ( word3 + ( word0 & ~word2 ) + ( word1 & word2 ) + S[ j+3 ] ) <<< 5 | ||
| 110 | |||
| 111 | In addition the fifth and eleventh rounds add the contents of the S-box indexed | ||
| 112 | by one of the data words to another of the data words following the four | ||
| 113 | subrounds as follows: | ||
| 114 | |||
| 115 | word0 = word0 + S[ word3 & 63 ]; | ||
| 116 | word1 = word1 + S[ word0 & 63 ]; | ||
| 117 | word2 = word2 + S[ word1 & 63 ]; | ||
| 118 | word3 = word3 + S[ word2 & 63 ]; | ||
| 119 | |||
| 120 | |||
| 121 | Decryption | ||
| 122 | |||
| 123 | The decryption operation is simply the inverse of the encryption operation. | ||
| 124 | Note that the following pseudocode treats the S array as an array of 64 words | ||
| 125 | rather than 128 bytes. | ||
| 126 | |||
| 127 | for i = 15 downto 0 do | ||
| 128 | j = i * 4; | ||
| 129 | word3 = ( word3 >>> 5 ) - ( word0 & ~word2 ) - ( word1 & word2 ) - S[ j+3 ] | ||
| 130 | word2 = ( word2 >>> 3 ) - ( word3 & ~word1 ) - ( word0 & word1 ) - S[ j+2 ] | ||
| 131 | word1 = ( word1 >>> 2 ) - ( word2 & ~word0 ) - ( word3 & word0 ) - S[ j+1 ] | ||
| 132 | word0 = ( word0 >>> 1 ) - ( word1 & ~word3 ) - ( word2 & word3 ) - S[ j+0 ] | ||
| 133 | |||
| 134 | In addition the fifth and eleventh rounds subtract the contents of the S-box | ||
| 135 | indexed by one of the data words from another one of the data words following | ||
| 136 | the four subrounds as follows: | ||
| 137 | |||
| 138 | word3 = word3 - S[ word2 & 63 ] | ||
| 139 | word2 = word2 - S[ word1 & 63 ] | ||
| 140 | word1 = word1 - S[ word0 & 63 ] | ||
| 141 | word0 = word0 - S[ word3 & 63 ] | ||
| 142 | |||
| 143 | |||
| 144 | Test Vectors | ||
| 145 | |||
| 146 | The following test vectors may be used to test the correctness of an RRC.2 | ||
| 147 | implementation: | ||
| 148 | |||
| 149 | Key: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 150 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
| 151 | Plain: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
| 152 | Cipher: 0x1C, 0x19, 0x8A, 0x83, 0x8D, 0xF0, 0x28, 0xB7 | ||
| 153 | |||
| 154 | Key: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 155 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 | ||
| 156 | Plain: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
| 157 | Cipher: 0x21, 0x82, 0x9C, 0x78, 0xA9, 0xF9, 0xC0, 0x74 | ||
| 158 | |||
| 159 | Key: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 160 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
| 161 | Plain: 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF | ||
| 162 | Cipher: 0x13, 0xDB, 0x35, 0x17, 0xD3, 0x21, 0x86, 0x9E | ||
| 163 | |||
| 164 | Key: 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, | ||
| 165 | 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F | ||
| 166 | Plain: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
| 167 | Cipher: 0x50, 0xDC, 0x01, 0x62, 0xBD, 0x75, 0x7F, 0x31 | ||
| 168 | |||
| 169 | |||
| 170 | Appendix: Beale Cipher No.1, "The Locality of the Vault", and One-time Pad for | ||
| 171 | Creating the S-Box | ||
| 172 | |||
| 173 | Beale Cipher No.1. | ||
| 174 | |||
| 175 | 71, 194, 38,1701, 89, 76, 11, 83,1629, 48, 94, 63, 132, 16, 111, 95, | ||
| 176 | 84, 341, 975, 14, 40, 64, 27, 81, 139, 213, 63, 90,1120, 8, 15, 3, | ||
| 177 | 126,2018, 40, 74, 758, 485, 604, 230, 436, 664, 582, 150, 251, 284, 308, 231, | ||
| 178 | 124, 211, 486, 225, 401, 370, 11, 101, 305, 139, 189, 17, 33, 88, 208, 193, | ||
| 179 | 145, 1, 94, 73, 416, 918, 263, 28, 500, 538, 356, 117, 136, 219, 27, 176, | ||
| 180 | 130, 10, 460, 25, 485, 18, 436, 65, 84, 200, 283, 118, 320, 138, 36, 416, | ||
| 181 | 280, 15, 71, 224, 961, 44, 16, 401, 39, 88, 61, 304, 12, 21, 24, 283, | ||
| 182 | 134, 92, 63, 246, 486, 682, 7, 219, 184, 360, 780, 18, 64, 463, 474, 131, | ||
| 183 | 160, 79, 73, 440, 95, 18, 64, 581, 34, 69, 128, 367, 460, 17, 81, 12, | ||
| 184 | 103, 820, 62, 110, 97, 103, 862, 70, 60,1317, 471, 540, 208, 121, 890, 346, | ||
| 185 | 36, 150, 59, 568, 614, 13, 120, 63, 219, 812,2160,1780, 99, 35, 18, 21, | ||
| 186 | 136, 872, 15, 28, 170, 88, 4, 30, 44, 112, 18, 147, 436, 195, 320, 37, | ||
| 187 | 122, 113, 6, 140, 8, 120, 305, 42, 58, 461, 44, 106, 301, 13, 408, 680, | ||
| 188 | 93, 86, 116, 530, 82, 568, 9, 102, 38, 416, 89, 71, 216, 728, 965, 818, | ||
| 189 | 2, 38, 121, 195, 14, 326, 148, 234, 18, 55, 131, 234, 361, 824, 5, 81, | ||
| 190 | 623, 48, 961, 19, 26, 33, 10,1101, 365, 92, 88, 181, 275, 346, 201, 206 | ||
| 191 | |||
| 192 | One-time Pad. | ||
| 193 | |||
| 194 | 158, 186, 223, 97, 64, 145, 190, 190, 117, 217, 163, 70, 206, 176, 183, 194, | ||
| 195 | 146, 43, 248, 141, 3, 54, 72, 223, 233, 153, 91, 210, 36, 131, 244, 161, | ||
| 196 | 105, 120, 113, 191, 113, 86, 19, 245, 213, 221, 43, 27, 242, 157, 73, 213, | ||
| 197 | 193, 92, 166, 10, 23, 197, 112, 110, 193, 30, 156, 51, 125, 51, 158, 67, | ||
| 198 | 197, 215, 59, 218, 110, 246, 181, 0, 135, 76, 164, 97, 47, 87, 234, 108, | ||
| 199 | 144, 127, 6, 6, 222, 172, 80, 144, 22, 245, 207, 70, 227, 182, 146, 134, | ||
| 200 | 119, 176, 73, 58, 135, 69, 23, 198, 0, 170, 32, 171, 176, 129, 91, 24, | ||
| 201 | 126, 77, 248, 0, 118, 69, 57, 60, 190, 171, 217, 61, 136, 169, 196, 84, | ||
| 202 | 168, 167, 163, 102, 223, 64, 174, 178, 166, 239, 242, 195, 249, 92, 59, 38, | ||
| 203 | 241, 46, 236, 31, 59, 114, 23, 50, 119, 186, 7, 66, 212, 97, 222, 182, | ||
| 204 | 230, 118, 122, 86, 105, 92, 179, 243, 255, 189, 223, 164, 194, 215, 98, 44, | ||
| 205 | 17, 20, 53, 153, 137, 224, 176, 100, 208, 114, 36, 200, 145, 150, 215, 20, | ||
| 206 | 87, 44, 252, 20, 235, 242, 163, 132, 63, 18, 5, 122, 74, 97, 34, 97, | ||
| 207 | 142, 86, 146, 221, 179, 166, 161, 74, 69, 182, 88, 120, 128, 58, 76, 155, | ||
| 208 | 15, 30, 77, 216, 165, 117, 107, 90, 169, 127, 143, 181, 208, 137, 200, 127, | ||
| 209 | 170, 195, 26, 84, 255, 132, 150, 58, 103, 250, 120, 221, 237, 37, 8, 99 | ||
| 210 | |||
| 211 | |||
| 212 | Implementation | ||
| 213 | |||
| 214 | A non-US based programmer who has never seen any encryption code before will | ||
| 215 | shortly be implementing RRC.2 based solely on this specification and not on | ||
| 216 | knowledge of any other encryption algorithms. Stand by. | ||
| 217 | |||
| 218 | |||
| 219 | |||
diff --git a/src/lib/libcrypto/rc2/version b/src/lib/libcrypto/rc2/version deleted file mode 100644 index 8ca161a613..0000000000 --- a/src/lib/libcrypto/rc2/version +++ /dev/null | |||
| @@ -1,22 +0,0 @@ | |||
| 1 | 1.1 23/08/96 - eay | ||
| 2 | Changed RC2_set_key() so it now takes another argument. Many | ||
| 3 | thanks to Peter Gutmann <pgut01@cs.auckland.ac.nz> for the | ||
| 4 | clarification and original specification of RC2. BSAFE uses | ||
| 5 | this last parameter, 'bits'. It the key is 128 bits, BSAFE | ||
| 6 | also sets this parameter to 128. The old behaviour can be | ||
| 7 | duplicated by setting this parameter to 1024. | ||
| 8 | |||
| 9 | 1.0 08/04/96 - eay | ||
| 10 | First version of SSLeay with rc2. This has been written from the spec | ||
| 11 | posted sci.crypt. It is in this directory under rrc2.doc | ||
| 12 | I have no test values for any mode other than ecb, my wrappers for the | ||
| 13 | other modes should be ok since they are basically the same as | ||
| 14 | the ones taken from idea and des :-). I have implemented them as | ||
| 15 | little-endian operators. | ||
| 16 | While rc2 is included because it is used with SSL, I don't know how | ||
| 17 | far I trust it. It is about the same speed as IDEA and DES. | ||
| 18 | So if you are paranoid, used Triple DES, else IDEA. If RC2 | ||
| 19 | does get used more, perhaps more people will look for weaknesses in | ||
| 20 | it. | ||
| 21 | |||
| 22 | |||
diff --git a/src/lib/libcrypto/rc4/rc4.c b/src/lib/libcrypto/rc4/rc4.c index 56ed43cba7..69b7d0a815 100644 --- a/src/lib/libcrypto/rc4/rc4.c +++ b/src/lib/libcrypto/rc4/rc4.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rc4.c,v 1.13 2025/01/27 14:02:32 jsing Exp $ */ | 1 | /* $OpenBSD: rc4.c,v 1.15 2025/08/17 08:04:25 jsing Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -57,234 +57,123 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <endian.h> | 59 | #include <endian.h> |
| 60 | #include <stdint.h> | ||
| 60 | 61 | ||
| 61 | #include <openssl/rc4.h> | 62 | #include <openssl/rc4.h> |
| 62 | 63 | ||
| 63 | #include "crypto_arch.h" | 64 | #include "crypto_arch.h" |
| 64 | 65 | ||
| 65 | /* RC4 as implemented from a posting from | ||
| 66 | * Newsgroups: sci.crypt | ||
| 67 | * From: sterndark@netcom.com (David Sterndark) | ||
| 68 | * Subject: RC4 Algorithm revealed. | ||
| 69 | * Message-ID: <sternCvKL4B.Hyy@netcom.com> | ||
| 70 | * Date: Wed, 14 Sep 1994 06:35:31 GMT | ||
| 71 | */ | ||
| 72 | |||
| 73 | #ifdef HAVE_RC4_INTERNAL | 66 | #ifdef HAVE_RC4_INTERNAL |
| 74 | void rc4_internal(RC4_KEY *key, size_t len, const unsigned char *indata, | 67 | void rc4_internal(RC4_KEY *key, size_t len, const uint8_t *in, |
| 75 | unsigned char *outdata); | 68 | uint8_t *out); |
| 76 | 69 | ||
| 77 | #else | 70 | #else |
| 78 | static void | 71 | static inline RC4_INT |
| 79 | rc4_internal(RC4_KEY *key, size_t len, const unsigned char *indata, | 72 | rc4_step(RC4_INT *d, RC4_INT *x, RC4_INT *y) |
| 80 | unsigned char *outdata) | ||
| 81 | { | 73 | { |
| 82 | RC4_INT *d; | 74 | RC4_INT tx, ty; |
| 83 | RC4_INT x, y,tx, ty; | ||
| 84 | size_t i; | ||
| 85 | 75 | ||
| 86 | x = key->x; | 76 | *x = (*x + 1) & 0xff; |
| 87 | y = key->y; | 77 | tx = d[*x]; |
| 88 | d = key->data; | 78 | *y = (tx + *y) & 0xff; |
| 79 | d[*x] = ty = d[*y]; | ||
| 80 | d[*y] = tx; | ||
| 89 | 81 | ||
| 90 | #if defined(RC4_CHUNK) | 82 | return d[(tx + ty) & 0xff]; |
| 91 | /* | 83 | } |
| 92 | * The original reason for implementing this(*) was the fact that | ||
| 93 | * pre-21164a Alpha CPUs don't have byte load/store instructions | ||
| 94 | * and e.g. a byte store has to be done with 64-bit load, shift, | ||
| 95 | * and, or and finally 64-bit store. Peaking data and operating | ||
| 96 | * at natural word size made it possible to reduce amount of | ||
| 97 | * instructions as well as to perform early read-ahead without | ||
| 98 | * suffering from RAW (read-after-write) hazard. This resulted | ||
| 99 | * in ~40%(**) performance improvement on 21064 box with gcc. | ||
| 100 | * But it's not only Alpha users who win here:-) Thanks to the | ||
| 101 | * early-n-wide read-ahead this implementation also exhibits | ||
| 102 | * >40% speed-up on SPARC and 20-30% on 64-bit MIPS (depending | ||
| 103 | * on sizeof(RC4_INT)). | ||
| 104 | * | ||
| 105 | * (*) "this" means code which recognizes the case when input | ||
| 106 | * and output pointers appear to be aligned at natural CPU | ||
| 107 | * word boundary | ||
| 108 | * (**) i.e. according to 'apps/openssl speed rc4' benchmark, | ||
| 109 | * crypto/rc4/rc4speed.c exhibits almost 70% speed-up... | ||
| 110 | * | ||
| 111 | * Caveats. | ||
| 112 | * | ||
| 113 | * - RC4_CHUNK="unsigned long long" should be a #1 choice for | ||
| 114 | * UltraSPARC. Unfortunately gcc generates very slow code | ||
| 115 | * (2.5-3 times slower than one generated by Sun's WorkShop | ||
| 116 | * C) and therefore gcc (at least 2.95 and earlier) should | ||
| 117 | * always be told that RC4_CHUNK="unsigned long". | ||
| 118 | * | ||
| 119 | * <appro@fy.chalmers.se> | ||
| 120 | */ | ||
| 121 | 84 | ||
| 122 | # define RC4_STEP ( \ | 85 | #if BYTE_ORDER == BIG_ENDIAN |
| 123 | x=(x+1) &0xff, \ | 86 | static inline uint64_t |
| 124 | tx=d[x], \ | 87 | rc4_chunk(RC4_INT *d, RC4_INT *x, RC4_INT *y) |
| 125 | y=(tx+y)&0xff, \ | 88 | { |
| 126 | ty=d[y], \ | 89 | uint64_t chunk = 0; |
| 127 | d[y]=tx, \ | 90 | size_t i; |
| 128 | d[x]=ty, \ | ||
| 129 | (RC4_CHUNK)d[(tx+ty)&0xff]\ | ||
| 130 | ) | ||
| 131 | 91 | ||
| 132 | if ((((size_t)indata & (sizeof(RC4_CHUNK) - 1)) | | 92 | for (i = 0; i < 8; i++) |
| 133 | ((size_t)outdata & (sizeof(RC4_CHUNK) - 1))) == 0 ) { | 93 | chunk = chunk << 8 | (uint64_t)rc4_step(d, x, y); |
| 134 | RC4_CHUNK ichunk, otp; | 94 | |
| 95 | return chunk; | ||
| 96 | } | ||
| 135 | 97 | ||
| 136 | /* | ||
| 137 | * I reckon we can afford to implement both endian | ||
| 138 | * cases and to decide which way to take at run-time | ||
| 139 | * because the machine code appears to be very compact | ||
| 140 | * and redundant 1-2KB is perfectly tolerable (i.e. | ||
| 141 | * in case the compiler fails to eliminate it:-). By | ||
| 142 | * suggestion from Terrel Larson <terr@terralogic.net>. | ||
| 143 | * | ||
| 144 | * Special notes. | ||
| 145 | * | ||
| 146 | * - compilers (those I've tried) don't seem to have | ||
| 147 | * problems eliminating either the operators guarded | ||
| 148 | * by "if (sizeof(RC4_CHUNK)==8)" or the condition | ||
| 149 | * expressions themselves so I've got 'em to replace | ||
| 150 | * corresponding #ifdefs from the previous version; | ||
| 151 | * - I chose to let the redundant switch cases when | ||
| 152 | * sizeof(RC4_CHUNK)!=8 be (were also #ifdefed | ||
| 153 | * before); | ||
| 154 | * - in case you wonder "&(sizeof(RC4_CHUNK)*8-1)" in | ||
| 155 | * [LB]ESHFT guards against "shift is out of range" | ||
| 156 | * warnings when sizeof(RC4_CHUNK)!=8 | ||
| 157 | * | ||
| 158 | * <appro@fy.chalmers.se> | ||
| 159 | */ | ||
| 160 | #if BYTE_ORDER == BIG_ENDIAN | ||
| 161 | # define BESHFT(c) (((sizeof(RC4_CHUNK)-(c)-1)*8)&(sizeof(RC4_CHUNK)*8-1)) | ||
| 162 | for (; len & (0 - sizeof(RC4_CHUNK)); len -= sizeof(RC4_CHUNK)) { | ||
| 163 | ichunk = *(RC4_CHUNK *)indata; | ||
| 164 | otp = RC4_STEP << BESHFT(0); | ||
| 165 | otp |= RC4_STEP << BESHFT(1); | ||
| 166 | otp |= RC4_STEP << BESHFT(2); | ||
| 167 | otp |= RC4_STEP << BESHFT(3); | ||
| 168 | if (sizeof(RC4_CHUNK) == 8) { | ||
| 169 | otp |= RC4_STEP << BESHFT(4); | ||
| 170 | otp |= RC4_STEP << BESHFT(5); | ||
| 171 | otp |= RC4_STEP << BESHFT(6); | ||
| 172 | otp |= RC4_STEP << BESHFT(7); | ||
| 173 | } | ||
| 174 | *(RC4_CHUNK *)outdata = otp^ichunk; | ||
| 175 | indata += sizeof(RC4_CHUNK); | ||
| 176 | outdata += sizeof(RC4_CHUNK); | ||
| 177 | } | ||
| 178 | #else | 98 | #else |
| 179 | # define LESHFT(c) (((c)*8)&(sizeof(RC4_CHUNK)*8-1)) | 99 | static inline uint64_t |
| 180 | for (; len & (0 - sizeof(RC4_CHUNK)); len -= sizeof(RC4_CHUNK)) { | 100 | rc4_chunk(RC4_INT *d, RC4_INT *x, RC4_INT *y) |
| 181 | ichunk = *(RC4_CHUNK *)indata; | 101 | { |
| 182 | otp = RC4_STEP; | 102 | uint64_t chunk = 0; |
| 183 | otp |= RC4_STEP << 8; | 103 | size_t i; |
| 184 | otp |= RC4_STEP << 16; | 104 | |
| 185 | otp |= RC4_STEP << 24; | 105 | for (i = 0; i < 8; i++) |
| 186 | if (sizeof(RC4_CHUNK) == 8) { | 106 | chunk |= (uint64_t)rc4_step(d, x, y) << (i * 8); |
| 187 | otp |= RC4_STEP << LESHFT(4); | 107 | |
| 188 | otp |= RC4_STEP << LESHFT(5); | 108 | return chunk; |
| 189 | otp |= RC4_STEP << LESHFT(6); | 109 | } |
| 190 | otp |= RC4_STEP << LESHFT(7); | ||
| 191 | } | ||
| 192 | *(RC4_CHUNK *)outdata = otp ^ ichunk; | ||
| 193 | indata += sizeof(RC4_CHUNK); | ||
| 194 | outdata += sizeof(RC4_CHUNK); | ||
| 195 | } | ||
| 196 | #endif | ||
| 197 | } | ||
| 198 | #endif | 110 | #endif |
| 199 | #define RC4_LOOP(in,out) \ | ||
| 200 | x=((x+1)&0xff); \ | ||
| 201 | tx=d[x]; \ | ||
| 202 | y=(tx+y)&0xff; \ | ||
| 203 | d[x]=ty=d[y]; \ | ||
| 204 | d[y]=tx; \ | ||
| 205 | (out) = d[(tx+ty)&0xff]^ (in); | ||
| 206 | 111 | ||
| 207 | i = len >> 3; | 112 | static void |
| 208 | if (i) { | 113 | rc4_internal(RC4_KEY *key, size_t len, const uint8_t *in, uint8_t *out) |
| 209 | for (;;) { | 114 | { |
| 210 | RC4_LOOP(indata[0], outdata[0]); | 115 | RC4_INT *d, x, y; |
| 211 | RC4_LOOP(indata[1], outdata[1]); | 116 | size_t i; |
| 212 | RC4_LOOP(indata[2], outdata[2]); | ||
| 213 | RC4_LOOP(indata[3], outdata[3]); | ||
| 214 | RC4_LOOP(indata[4], outdata[4]); | ||
| 215 | RC4_LOOP(indata[5], outdata[5]); | ||
| 216 | RC4_LOOP(indata[6], outdata[6]); | ||
| 217 | RC4_LOOP(indata[7], outdata[7]); | ||
| 218 | 117 | ||
| 219 | indata += 8; | 118 | x = key->x; |
| 220 | outdata += 8; | 119 | y = key->y; |
| 120 | d = key->data; | ||
| 121 | |||
| 122 | /* Process uint64_t chunks if 8 byte aligned. */ | ||
| 123 | if ((((size_t)in | (size_t)out) % 8) == 0) { | ||
| 124 | while (len >= 8) { | ||
| 125 | *(uint64_t *)out = *(const uint64_t *)in ^ rc4_chunk(d, &x, &y); | ||
| 221 | 126 | ||
| 222 | if (--i == 0) | 127 | in += 8; |
| 223 | break; | 128 | out += 8; |
| 129 | len -= 8; | ||
| 224 | } | 130 | } |
| 225 | } | 131 | } |
| 226 | i = len&0x07; | 132 | |
| 227 | if (i) { | 133 | while (len >= 8) { |
| 228 | for (;;) { | 134 | for (i = 0; i < 8; i++) |
| 229 | RC4_LOOP(indata[0], outdata[0]); | 135 | out[i] = rc4_step(d, &x, &y) ^ in[i]; |
| 230 | if (--i == 0) | 136 | |
| 231 | break; | 137 | in += 8; |
| 232 | RC4_LOOP(indata[1], outdata[1]); | 138 | out += 8; |
| 233 | if (--i == 0) | 139 | len -= 8; |
| 234 | break; | ||
| 235 | RC4_LOOP(indata[2], outdata[2]); | ||
| 236 | if (--i == 0) | ||
| 237 | break; | ||
| 238 | RC4_LOOP(indata[3], outdata[3]); | ||
| 239 | if (--i == 0) | ||
| 240 | break; | ||
| 241 | RC4_LOOP(indata[4], outdata[4]); | ||
| 242 | if (--i == 0) | ||
| 243 | break; | ||
| 244 | RC4_LOOP(indata[5], outdata[5]); | ||
| 245 | if (--i == 0) | ||
| 246 | break; | ||
| 247 | RC4_LOOP(indata[6], outdata[6]); | ||
| 248 | if (--i == 0) | ||
| 249 | break; | ||
| 250 | } | ||
| 251 | } | 140 | } |
| 141 | for (i = 0; i < len; i++) | ||
| 142 | out[i] = rc4_step(d, &x, &y) ^ in[i]; | ||
| 143 | |||
| 252 | key->x = x; | 144 | key->x = x; |
| 253 | key->y = y; | 145 | key->y = y; |
| 254 | } | 146 | } |
| 255 | #endif | 147 | #endif |
| 256 | 148 | ||
| 257 | #ifdef HAVE_RC4_SET_KEY_INTERNAL | 149 | #ifdef HAVE_RC4_SET_KEY_INTERNAL |
| 258 | void rc4_set_key_internal(RC4_KEY *key, int len, const unsigned char *data); | 150 | void rc4_set_key_internal(RC4_KEY *key, int len, const uint8_t *data); |
| 259 | 151 | ||
| 260 | #else | 152 | #else |
| 261 | static inline void | 153 | static inline void |
| 262 | rc4_set_key_internal(RC4_KEY *key, int len, const unsigned char *data) | 154 | rc4_set_key_internal(RC4_KEY *key, int len, const uint8_t *data) |
| 263 | { | 155 | { |
| 264 | RC4_INT tmp; | 156 | RC4_INT *d, tmp; |
| 265 | int id1, id2; | 157 | int idx1, idx2; |
| 266 | RC4_INT *d; | 158 | int i, j; |
| 267 | unsigned int i; | ||
| 268 | 159 | ||
| 269 | d = &(key->data[0]); | 160 | d = key->data; |
| 270 | key->x = 0; | 161 | key->x = 0; |
| 271 | key->y = 0; | 162 | key->y = 0; |
| 272 | id1 = id2 = 0; | 163 | idx1 = idx2 = 0; |
| 273 | |||
| 274 | #define SK_LOOP(d,n) { \ | ||
| 275 | tmp=d[(n)]; \ | ||
| 276 | id2 = (data[id1] + tmp + id2) & 0xff; \ | ||
| 277 | if (++id1 == len) id1=0; \ | ||
| 278 | d[(n)]=d[id2]; \ | ||
| 279 | d[id2]=tmp; } | ||
| 280 | 164 | ||
| 281 | for (i = 0; i < 256; i++) | 165 | for (i = 0; i < 256; i++) |
| 282 | d[i] = i; | 166 | d[i] = i; |
| 283 | for (i = 0; i < 256; i += 4) { | 167 | for (i = 0; i < 256; i += 4) { |
| 284 | SK_LOOP(d, i + 0); | 168 | for (j = 0; j < 4; j++) { |
| 285 | SK_LOOP(d, i + 1); | 169 | tmp = d[i + j]; |
| 286 | SK_LOOP(d, i + 2); | 170 | idx2 = (data[idx1] + tmp + idx2) & 0xff; |
| 287 | SK_LOOP(d, i + 3); | 171 | d[i + j] = d[idx2]; |
| 172 | d[idx2] = tmp; | ||
| 173 | |||
| 174 | if (++idx1 == len) | ||
| 175 | idx1 = 0; | ||
| 176 | } | ||
| 288 | } | 177 | } |
| 289 | } | 178 | } |
| 290 | #endif | 179 | #endif |
diff --git a/src/lib/libcrypto/rc4/rc4.h b/src/lib/libcrypto/rc4/rc4.h index a20472372b..c994b39a31 100644 --- a/src/lib/libcrypto/rc4/rc4.h +++ b/src/lib/libcrypto/rc4/rc4.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rc4.h,v 1.16 2025/01/25 17:59:44 tb Exp $ */ | 1 | /* $OpenBSD: rc4.h,v 1.17 2025/06/09 14:37:49 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -59,10 +59,15 @@ | |||
| 59 | #ifndef HEADER_RC4_H | 59 | #ifndef HEADER_RC4_H |
| 60 | #define HEADER_RC4_H | 60 | #define HEADER_RC4_H |
| 61 | 61 | ||
| 62 | #include <openssl/opensslconf.h> /* OPENSSL_NO_RC4, RC4_INT */ | 62 | #include <openssl/opensslconf.h> /* OPENSSL_NO_RC4 */ |
| 63 | 63 | ||
| 64 | #include <stddef.h> | 64 | #include <stddef.h> |
| 65 | 65 | ||
| 66 | #ifndef RC4_INT | ||
| 67 | /* XXX - typedef */ | ||
| 68 | #define RC4_INT unsigned int | ||
| 69 | #endif | ||
| 70 | |||
| 66 | #ifdef __cplusplus | 71 | #ifdef __cplusplus |
| 67 | extern "C" { | 72 | extern "C" { |
| 68 | #endif | 73 | #endif |
diff --git a/src/lib/libcrypto/rsa/rsa_ameth.c b/src/lib/libcrypto/rsa/rsa_ameth.c index 5a87522289..00fa6afb3d 100644 --- a/src/lib/libcrypto/rsa/rsa_ameth.c +++ b/src/lib/libcrypto/rsa/rsa_ameth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_ameth.c,v 1.62 2024/11/02 07:11:14 tb Exp $ */ | 1 | /* $OpenBSD: rsa_ameth.c,v 1.63 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -66,7 +66,6 @@ | |||
| 66 | #include <openssl/bio.h> | 66 | #include <openssl/bio.h> |
| 67 | #include <openssl/bn.h> | 67 | #include <openssl/bn.h> |
| 68 | #include <openssl/cms.h> | 68 | #include <openssl/cms.h> |
| 69 | #include <openssl/err.h> | ||
| 70 | #include <openssl/evp.h> | 69 | #include <openssl/evp.h> |
| 71 | #include <openssl/objects.h> | 70 | #include <openssl/objects.h> |
| 72 | #include <openssl/pkcs7.h> | 71 | #include <openssl/pkcs7.h> |
| @@ -76,6 +75,7 @@ | |||
| 76 | 75 | ||
| 77 | #include "asn1_local.h" | 76 | #include "asn1_local.h" |
| 78 | #include "bn_local.h" | 77 | #include "bn_local.h" |
| 78 | #include "err_local.h" | ||
| 79 | #include "evp_local.h" | 79 | #include "evp_local.h" |
| 80 | #include "rsa_local.h" | 80 | #include "rsa_local.h" |
| 81 | #include "x509_local.h" | 81 | #include "x509_local.h" |
diff --git a/src/lib/libcrypto/rsa/rsa_blinding.c b/src/lib/libcrypto/rsa/rsa_blinding.c index cac5bd91d2..590b45f5a1 100644 --- a/src/lib/libcrypto/rsa/rsa_blinding.c +++ b/src/lib/libcrypto/rsa/rsa_blinding.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_blinding.c,v 1.3 2023/08/09 12:09:06 tb Exp $ */ | 1 | /* $OpenBSD: rsa_blinding.c,v 1.4 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -114,10 +114,10 @@ | |||
| 114 | 114 | ||
| 115 | #include <openssl/opensslconf.h> | 115 | #include <openssl/opensslconf.h> |
| 116 | 116 | ||
| 117 | #include <openssl/err.h> | ||
| 118 | #include <openssl/rsa.h> | 117 | #include <openssl/rsa.h> |
| 119 | 118 | ||
| 120 | #include "bn_local.h" | 119 | #include "bn_local.h" |
| 120 | #include "err_local.h" | ||
| 121 | #include "rsa_local.h" | 121 | #include "rsa_local.h" |
| 122 | 122 | ||
| 123 | #define BN_BLINDING_COUNTER 32 | 123 | #define BN_BLINDING_COUNTER 32 |
diff --git a/src/lib/libcrypto/rsa/rsa_chk.c b/src/lib/libcrypto/rsa/rsa_chk.c index b7666e0fed..87d261f88e 100644 --- a/src/lib/libcrypto/rsa/rsa_chk.c +++ b/src/lib/libcrypto/rsa/rsa_chk.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_chk.c,v 1.18 2023/07/08 12:26:45 beck Exp $ */ | 1 | /* $OpenBSD: rsa_chk.c,v 1.19 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -49,10 +49,10 @@ | |||
| 49 | */ | 49 | */ |
| 50 | 50 | ||
| 51 | #include <openssl/bn.h> | 51 | #include <openssl/bn.h> |
| 52 | #include <openssl/err.h> | ||
| 53 | #include <openssl/rsa.h> | 52 | #include <openssl/rsa.h> |
| 54 | 53 | ||
| 55 | #include "bn_local.h" | 54 | #include "bn_local.h" |
| 55 | #include "err_local.h" | ||
| 56 | #include "rsa_local.h" | 56 | #include "rsa_local.h" |
| 57 | 57 | ||
| 58 | int | 58 | int |
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c index c2e1e22f9a..65ccfc35e1 100644 --- a/src/lib/libcrypto/rsa/rsa_eay.c +++ b/src/lib/libcrypto/rsa/rsa_eay.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_eay.c,v 1.65 2023/08/09 12:09:06 tb Exp $ */ | 1 | /* $OpenBSD: rsa_eay.c,v 1.66 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -115,10 +115,10 @@ | |||
| 115 | #include <openssl/opensslconf.h> | 115 | #include <openssl/opensslconf.h> |
| 116 | 116 | ||
| 117 | #include <openssl/bn.h> | 117 | #include <openssl/bn.h> |
| 118 | #include <openssl/err.h> | ||
| 119 | #include <openssl/rsa.h> | 118 | #include <openssl/rsa.h> |
| 120 | 119 | ||
| 121 | #include "bn_local.h" | 120 | #include "bn_local.h" |
| 121 | #include "err_local.h" | ||
| 122 | #include "rsa_local.h" | 122 | #include "rsa_local.h" |
| 123 | 123 | ||
| 124 | static int | 124 | static int |
diff --git a/src/lib/libcrypto/rsa/rsa_gen.c b/src/lib/libcrypto/rsa/rsa_gen.c index ff64eb2f0e..6a8bd08160 100644 --- a/src/lib/libcrypto/rsa/rsa_gen.c +++ b/src/lib/libcrypto/rsa/rsa_gen.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_gen.c,v 1.30 2023/07/08 12:26:45 beck Exp $ */ | 1 | /* $OpenBSD: rsa_gen.c,v 1.32 2025/09/29 08:46:15 jan Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -60,10 +60,10 @@ | |||
| 60 | #include <time.h> | 60 | #include <time.h> |
| 61 | 61 | ||
| 62 | #include <openssl/bn.h> | 62 | #include <openssl/bn.h> |
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/rsa.h> | 63 | #include <openssl/rsa.h> |
| 65 | 64 | ||
| 66 | #include "bn_local.h" | 65 | #include "bn_local.h" |
| 66 | #include "err_local.h" | ||
| 67 | #include "rsa_local.h" | 67 | #include "rsa_local.h" |
| 68 | 68 | ||
| 69 | static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb); | 69 | static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb); |
| @@ -84,6 +84,7 @@ rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb) | |||
| 84 | BIGNUM pr0, d, p; | 84 | BIGNUM pr0, d, p; |
| 85 | int bitsp, bitsq, ok = -1, n = 0; | 85 | int bitsp, bitsq, ok = -1, n = 0; |
| 86 | BN_CTX *ctx = NULL; | 86 | BN_CTX *ctx = NULL; |
| 87 | BIGNUM *diff, *mindiff; | ||
| 87 | 88 | ||
| 88 | ctx = BN_CTX_new(); | 89 | ctx = BN_CTX_new(); |
| 89 | if (ctx == NULL) | 90 | if (ctx == NULL) |
| @@ -97,10 +98,24 @@ rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb) | |||
| 97 | goto err; | 98 | goto err; |
| 98 | if ((r3 = BN_CTX_get(ctx)) == NULL) | 99 | if ((r3 = BN_CTX_get(ctx)) == NULL) |
| 99 | goto err; | 100 | goto err; |
| 101 | if ((diff = BN_CTX_get(ctx)) == NULL) | ||
| 102 | goto err; | ||
| 103 | if ((mindiff = BN_CTX_get(ctx)) == NULL) | ||
| 104 | goto err; | ||
| 100 | 105 | ||
| 101 | bitsp = (bits + 1) / 2; | 106 | bitsp = (bits + 1) / 2; |
| 102 | bitsq = bits - bitsp; | 107 | bitsq = bits - bitsp; |
| 103 | 108 | ||
| 109 | /* | ||
| 110 | * To guarantee a minimum distance of 2^(bits/2 - 100) between p and q. | ||
| 111 | * | ||
| 112 | * NIST SP 800-56B, section 6.2.1, 3.c | ||
| 113 | */ | ||
| 114 | if (bits < 200) | ||
| 115 | goto err; | ||
| 116 | if (!BN_set_bit(mindiff, bits/2 - 100)) | ||
| 117 | goto err; | ||
| 118 | |||
| 104 | /* We need the RSA components non-NULL */ | 119 | /* We need the RSA components non-NULL */ |
| 105 | if (!rsa->n && ((rsa->n = BN_new()) == NULL)) | 120 | if (!rsa->n && ((rsa->n = BN_new()) == NULL)) |
| 106 | goto err; | 121 | goto err; |
| @@ -148,8 +163,9 @@ rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb) | |||
| 148 | if (!BN_generate_prime_ex(rsa->q, bitsq, 0, NULL, NULL, | 163 | if (!BN_generate_prime_ex(rsa->q, bitsq, 0, NULL, NULL, |
| 149 | cb)) | 164 | cb)) |
| 150 | goto err; | 165 | goto err; |
| 151 | } while (BN_cmp(rsa->p, rsa->q) == 0 && | 166 | if (!BN_sub(diff, rsa->p, rsa->q)) |
| 152 | ++degenerate < 3); | 167 | goto err; |
| 168 | } while (BN_ucmp(diff, mindiff) <= 0 && ++degenerate < 3); | ||
| 153 | if (degenerate == 3) { | 169 | if (degenerate == 3) { |
| 154 | ok = 0; /* we set our own err */ | 170 | ok = 0; /* we set our own err */ |
| 155 | RSAerror(RSA_R_KEY_SIZE_TOO_SMALL); | 171 | RSAerror(RSA_R_KEY_SIZE_TOO_SMALL); |
diff --git a/src/lib/libcrypto/rsa/rsa_lib.c b/src/lib/libcrypto/rsa/rsa_lib.c index 91f4938ec9..7b8babdf52 100644 --- a/src/lib/libcrypto/rsa/rsa_lib.c +++ b/src/lib/libcrypto/rsa/rsa_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_lib.c,v 1.50 2024/03/27 01:22:30 tb Exp $ */ | 1 | /* $OpenBSD: rsa_lib.c,v 1.51 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -62,12 +62,12 @@ | |||
| 62 | 62 | ||
| 63 | #include <openssl/bn.h> | 63 | #include <openssl/bn.h> |
| 64 | #include <openssl/crypto.h> | 64 | #include <openssl/crypto.h> |
| 65 | #include <openssl/err.h> | ||
| 66 | #include <openssl/evp.h> | 65 | #include <openssl/evp.h> |
| 67 | #include <openssl/lhash.h> | 66 | #include <openssl/lhash.h> |
| 68 | #include <openssl/rsa.h> | 67 | #include <openssl/rsa.h> |
| 69 | 68 | ||
| 70 | #include "bn_local.h" | 69 | #include "bn_local.h" |
| 70 | #include "err_local.h" | ||
| 71 | #include "evp_local.h" | 71 | #include "evp_local.h" |
| 72 | #include "rsa_local.h" | 72 | #include "rsa_local.h" |
| 73 | 73 | ||
diff --git a/src/lib/libcrypto/rsa/rsa_local.h b/src/lib/libcrypto/rsa/rsa_local.h index 3f88b952a2..a026a488b6 100644 --- a/src/lib/libcrypto/rsa/rsa_local.h +++ b/src/lib/libcrypto/rsa/rsa_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_local.h,v 1.10 2025/01/05 15:39:12 tb Exp $ */ | 1 | /* $OpenBSD: rsa_local.h,v 1.11 2025/11/26 10:19:57 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -56,6 +56,9 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #ifndef HEADER_RSA_LOCAL_H | ||
| 60 | #define HEADER_RSA_LOCAL_H | ||
| 61 | |||
| 59 | __BEGIN_HIDDEN_DECLS | 62 | __BEGIN_HIDDEN_DECLS |
| 60 | 63 | ||
| 61 | #define RSA_MIN_MODULUS_BITS 512 | 64 | #define RSA_MIN_MODULUS_BITS 512 |
| @@ -152,3 +155,5 @@ int BN_BLINDING_is_local(BN_BLINDING *b); | |||
| 152 | BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx); | 155 | BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx); |
| 153 | 156 | ||
| 154 | __END_HIDDEN_DECLS | 157 | __END_HIDDEN_DECLS |
| 158 | |||
| 159 | #endif /* HEADER_RSA_LOCAL_H */ | ||
diff --git a/src/lib/libcrypto/rsa/rsa_meth.c b/src/lib/libcrypto/rsa/rsa_meth.c index 71608caa01..131c4484ab 100644 --- a/src/lib/libcrypto/rsa/rsa_meth.c +++ b/src/lib/libcrypto/rsa/rsa_meth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_meth.c,v 1.7 2023/07/08 12:26:45 beck Exp $ */ | 1 | /* $OpenBSD: rsa_meth.c,v 1.8 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> | 3 | * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> |
| 4 | * | 4 | * |
| @@ -18,7 +18,6 @@ | |||
| 18 | #include <stdlib.h> | 18 | #include <stdlib.h> |
| 19 | #include <string.h> | 19 | #include <string.h> |
| 20 | 20 | ||
| 21 | #include <openssl/err.h> | ||
| 22 | #include <openssl/rsa.h> | 21 | #include <openssl/rsa.h> |
| 23 | 22 | ||
| 24 | #include "rsa_local.h" | 23 | #include "rsa_local.h" |
diff --git a/src/lib/libcrypto/rsa/rsa_none.c b/src/lib/libcrypto/rsa/rsa_none.c index 9c53dcf595..b8764d54ef 100644 --- a/src/lib/libcrypto/rsa/rsa_none.c +++ b/src/lib/libcrypto/rsa/rsa_none.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_none.c,v 1.12 2023/07/08 12:26:45 beck Exp $ */ | 1 | /* $OpenBSD: rsa_none.c,v 1.13 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -60,9 +60,10 @@ | |||
| 60 | #include <string.h> | 60 | #include <string.h> |
| 61 | 61 | ||
| 62 | #include <openssl/bn.h> | 62 | #include <openssl/bn.h> |
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/rsa.h> | 63 | #include <openssl/rsa.h> |
| 65 | 64 | ||
| 65 | #include "err_local.h" | ||
| 66 | |||
| 66 | int | 67 | int |
| 67 | RSA_padding_add_none(unsigned char *to, int tlen, const unsigned char *from, | 68 | RSA_padding_add_none(unsigned char *to, int tlen, const unsigned char *from, |
| 68 | int flen) | 69 | int flen) |
diff --git a/src/lib/libcrypto/rsa/rsa_oaep.c b/src/lib/libcrypto/rsa/rsa_oaep.c index d1e138c299..af7131704b 100644 --- a/src/lib/libcrypto/rsa/rsa_oaep.c +++ b/src/lib/libcrypto/rsa/rsa_oaep.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_oaep.c,v 1.39 2024/03/26 05:37:28 joshua Exp $ */ | 1 | /* $OpenBSD: rsa_oaep.c,v 1.41 2025/08/25 18:47:39 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. | 3 | * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. |
| 4 | * | 4 | * |
| @@ -7,7 +7,7 @@ | |||
| 7 | * are met: | 7 | * are met: |
| 8 | * | 8 | * |
| 9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. |
| 11 | * | 11 | * |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in | 13 | * notice, this list of conditions and the following disclaimer in |
| @@ -74,12 +74,12 @@ | |||
| 74 | #include <string.h> | 74 | #include <string.h> |
| 75 | 75 | ||
| 76 | #include <openssl/bn.h> | 76 | #include <openssl/bn.h> |
| 77 | #include <openssl/err.h> | ||
| 78 | #include <openssl/evp.h> | 77 | #include <openssl/evp.h> |
| 79 | #include <openssl/rsa.h> | 78 | #include <openssl/rsa.h> |
| 80 | #include <openssl/sha.h> | 79 | #include <openssl/sha.h> |
| 81 | 80 | ||
| 82 | #include "constant_time.h" | 81 | #include "constant_time.h" |
| 82 | #include "err_local.h" | ||
| 83 | #include "evp_local.h" | 83 | #include "evp_local.h" |
| 84 | #include "rsa_local.h" | 84 | #include "rsa_local.h" |
| 85 | 85 | ||
diff --git a/src/lib/libcrypto/rsa/rsa_pk1.c b/src/lib/libcrypto/rsa/rsa_pk1.c index 8e56a8c4cd..554e00e8f8 100644 --- a/src/lib/libcrypto/rsa/rsa_pk1.c +++ b/src/lib/libcrypto/rsa/rsa_pk1.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_pk1.c,v 1.17 2024/03/30 04:34:17 jsing Exp $ */ | 1 | /* $OpenBSD: rsa_pk1.c,v 1.18 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -61,10 +61,10 @@ | |||
| 61 | #include <string.h> | 61 | #include <string.h> |
| 62 | 62 | ||
| 63 | #include <openssl/bn.h> | 63 | #include <openssl/bn.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | #include <openssl/rsa.h> | 64 | #include <openssl/rsa.h> |
| 66 | 65 | ||
| 67 | #include "bytestring.h" | 66 | #include "bytestring.h" |
| 67 | #include "err_local.h" | ||
| 68 | 68 | ||
| 69 | int | 69 | int |
| 70 | RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, | 70 | RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, |
diff --git a/src/lib/libcrypto/rsa/rsa_pmeth.c b/src/lib/libcrypto/rsa/rsa_pmeth.c index 453570cf74..518b077dbc 100644 --- a/src/lib/libcrypto/rsa/rsa_pmeth.c +++ b/src/lib/libcrypto/rsa/rsa_pmeth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_pmeth.c,v 1.43 2025/01/17 15:39:19 tb Exp $ */ | 1 | /* $OpenBSD: rsa_pmeth.c,v 1.44 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -65,13 +65,13 @@ | |||
| 65 | 65 | ||
| 66 | #include <openssl/asn1t.h> | 66 | #include <openssl/asn1t.h> |
| 67 | #include <openssl/bn.h> | 67 | #include <openssl/bn.h> |
| 68 | #include <openssl/err.h> | ||
| 69 | #include <openssl/evp.h> | 68 | #include <openssl/evp.h> |
| 70 | #include <openssl/rsa.h> | 69 | #include <openssl/rsa.h> |
| 71 | #include <openssl/x509.h> | 70 | #include <openssl/x509.h> |
| 72 | #include <openssl/x509v3.h> | 71 | #include <openssl/x509v3.h> |
| 73 | 72 | ||
| 74 | #include "bn_local.h" | 73 | #include "bn_local.h" |
| 74 | #include "err_local.h" | ||
| 75 | #include "evp_local.h" | 75 | #include "evp_local.h" |
| 76 | #include "rsa_local.h" | 76 | #include "rsa_local.h" |
| 77 | 77 | ||
diff --git a/src/lib/libcrypto/rsa/rsa_prn.c b/src/lib/libcrypto/rsa/rsa_prn.c index 1783563661..ef08f76249 100644 --- a/src/lib/libcrypto/rsa/rsa_prn.c +++ b/src/lib/libcrypto/rsa/rsa_prn.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_prn.c,v 1.10 2023/07/08 12:26:45 beck Exp $ */ | 1 | /* $OpenBSD: rsa_prn.c,v 1.11 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -58,10 +58,11 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | 60 | ||
| 61 | #include <openssl/err.h> | ||
| 62 | #include <openssl/evp.h> | 61 | #include <openssl/evp.h> |
| 63 | #include <openssl/rsa.h> | 62 | #include <openssl/rsa.h> |
| 64 | 63 | ||
| 64 | #include "err_local.h" | ||
| 65 | |||
| 65 | int | 66 | int |
| 66 | RSA_print_fp(FILE *fp, const RSA *x, int off) | 67 | RSA_print_fp(FILE *fp, const RSA *x, int off) |
| 67 | { | 68 | { |
diff --git a/src/lib/libcrypto/rsa/rsa_pss.c b/src/lib/libcrypto/rsa/rsa_pss.c index 610ae7c928..72e252ef06 100644 --- a/src/lib/libcrypto/rsa/rsa_pss.c +++ b/src/lib/libcrypto/rsa/rsa_pss.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_pss.c,v 1.19 2024/03/26 05:26:27 joshua Exp $ */ | 1 | /* $OpenBSD: rsa_pss.c,v 1.20 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2005. | 3 | * project 2005. |
| 4 | */ | 4 | */ |
| @@ -61,11 +61,11 @@ | |||
| 61 | #include <string.h> | 61 | #include <string.h> |
| 62 | 62 | ||
| 63 | #include <openssl/bn.h> | 63 | #include <openssl/bn.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | #include <openssl/evp.h> | 64 | #include <openssl/evp.h> |
| 66 | #include <openssl/rsa.h> | 65 | #include <openssl/rsa.h> |
| 67 | #include <openssl/sha.h> | 66 | #include <openssl/sha.h> |
| 68 | 67 | ||
| 68 | #include "err_local.h" | ||
| 69 | #include "evp_local.h" | 69 | #include "evp_local.h" |
| 70 | #include "rsa_local.h" | 70 | #include "rsa_local.h" |
| 71 | 71 | ||
diff --git a/src/lib/libcrypto/rsa/rsa_saos.c b/src/lib/libcrypto/rsa/rsa_saos.c index 07a4f5d659..3052fa912f 100644 --- a/src/lib/libcrypto/rsa/rsa_saos.c +++ b/src/lib/libcrypto/rsa/rsa_saos.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_saos.c,v 1.25 2023/07/08 12:26:45 beck Exp $ */ | 1 | /* $OpenBSD: rsa_saos.c,v 1.26 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -60,11 +60,12 @@ | |||
| 60 | #include <string.h> | 60 | #include <string.h> |
| 61 | 61 | ||
| 62 | #include <openssl/bn.h> | 62 | #include <openssl/bn.h> |
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
| 65 | #include <openssl/rsa.h> | 64 | #include <openssl/rsa.h> |
| 66 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
| 67 | 66 | ||
| 67 | #include "err_local.h" | ||
| 68 | |||
| 68 | int | 69 | int |
| 69 | RSA_sign_ASN1_OCTET_STRING(int type, const unsigned char *m, unsigned int m_len, | 70 | RSA_sign_ASN1_OCTET_STRING(int type, const unsigned char *m, unsigned int m_len, |
| 70 | unsigned char *sigret, unsigned int *siglen, RSA *rsa) | 71 | unsigned char *sigret, unsigned int *siglen, RSA *rsa) |
diff --git a/src/lib/libcrypto/rsa/rsa_sign.c b/src/lib/libcrypto/rsa/rsa_sign.c index 6edd20626d..09e6972293 100644 --- a/src/lib/libcrypto/rsa/rsa_sign.c +++ b/src/lib/libcrypto/rsa/rsa_sign.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_sign.c,v 1.37 2025/01/05 15:39:12 tb Exp $ */ | 1 | /* $OpenBSD: rsa_sign.c,v 1.38 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -60,12 +60,12 @@ | |||
| 60 | #include <string.h> | 60 | #include <string.h> |
| 61 | 61 | ||
| 62 | #include <openssl/bn.h> | 62 | #include <openssl/bn.h> |
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
| 65 | #include <openssl/rsa.h> | 64 | #include <openssl/rsa.h> |
| 66 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
| 67 | 66 | ||
| 68 | #include "asn1_local.h" | 67 | #include "asn1_local.h" |
| 68 | #include "err_local.h" | ||
| 69 | #include "rsa_local.h" | 69 | #include "rsa_local.h" |
| 70 | #include "x509_local.h" | 70 | #include "x509_local.h" |
| 71 | 71 | ||
diff --git a/src/lib/libcrypto/rsa/rsa_x931.c b/src/lib/libcrypto/rsa/rsa_x931.c index 52f3f803b2..8a0190d7fe 100644 --- a/src/lib/libcrypto/rsa/rsa_x931.c +++ b/src/lib/libcrypto/rsa/rsa_x931.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_x931.c,v 1.12 2023/05/05 12:19:37 tb Exp $ */ | 1 | /* $OpenBSD: rsa_x931.c,v 1.13 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2005. | 3 | * project 2005. |
| 4 | */ | 4 | */ |
| @@ -60,10 +60,11 @@ | |||
| 60 | #include <string.h> | 60 | #include <string.h> |
| 61 | 61 | ||
| 62 | #include <openssl/bn.h> | 62 | #include <openssl/bn.h> |
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
| 65 | #include <openssl/rsa.h> | 64 | #include <openssl/rsa.h> |
| 66 | 65 | ||
| 66 | #include "err_local.h" | ||
| 67 | |||
| 67 | int | 68 | int |
| 68 | RSA_padding_add_X931(unsigned char *to, int tlen, const unsigned char *from, | 69 | RSA_padding_add_X931(unsigned char *to, int tlen, const unsigned char *from, |
| 69 | int flen) | 70 | int flen) |
diff --git a/src/lib/libcrypto/sha/asm/sha1-586.pl b/src/lib/libcrypto/sha/asm/sha1-586.pl index 5928e083c1..d2491766f3 100644 --- a/src/lib/libcrypto/sha/asm/sha1-586.pl +++ b/src/lib/libcrypto/sha/asm/sha1-586.pl | |||
| @@ -104,13 +104,7 @@ require "x86asm.pl"; | |||
| 104 | 104 | ||
| 105 | &asm_init($ARGV[0],"sha1-586.pl",$ARGV[$#ARGV] eq "386"); | 105 | &asm_init($ARGV[0],"sha1-586.pl",$ARGV[$#ARGV] eq "386"); |
| 106 | 106 | ||
| 107 | $xmm=$ymm=0; | 107 | $xmm=$ymm=1; |
| 108 | for (@ARGV) { $xmm=1 if (/-DOPENSSL_IA32_SSE2/); } | ||
| 109 | |||
| 110 | $ymm=1 if ($xmm && | ||
| 111 | `$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1` | ||
| 112 | =~ /GNU assembler version ([2-9]\.[0-9]+)/ && | ||
| 113 | $1>=2.19); # first version supporting AVX | ||
| 114 | 108 | ||
| 115 | &external_label("OPENSSL_ia32cap_P") if ($xmm); | 109 | &external_label("OPENSSL_ia32cap_P") if ($xmm); |
| 116 | 110 | ||
diff --git a/src/lib/libcrypto/sha/asm/sha512-586.pl b/src/lib/libcrypto/sha/asm/sha512-586.pl index c1d0684e92..fe1ff487bc 100644 --- a/src/lib/libcrypto/sha/asm/sha512-586.pl +++ b/src/lib/libcrypto/sha/asm/sha512-586.pl | |||
| @@ -38,8 +38,7 @@ require "x86asm.pl"; | |||
| 38 | 38 | ||
| 39 | &asm_init($ARGV[0],"sha512-586.pl",$ARGV[$#ARGV] eq "386"); | 39 | &asm_init($ARGV[0],"sha512-586.pl",$ARGV[$#ARGV] eq "386"); |
| 40 | 40 | ||
| 41 | $sse2=0; | 41 | $sse2=1; |
| 42 | for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } | ||
| 43 | 42 | ||
| 44 | &external_label("OPENSSL_ia32cap_P") if ($sse2); | 43 | &external_label("OPENSSL_ia32cap_P") if ($sse2); |
| 45 | 44 | ||
diff --git a/src/lib/libcrypto/sha/sha1_aarch64.c b/src/lib/libcrypto/sha/sha1_aarch64.c new file mode 100644 index 0000000000..04c87761e0 --- /dev/null +++ b/src/lib/libcrypto/sha/sha1_aarch64.c | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | /* $OpenBSD: sha1_aarch64.c,v 1.1 2025/06/28 12:51:08 jsing Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2025 Joel Sing <jsing@openbsd.org> | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <openssl/sha.h> | ||
| 19 | |||
| 20 | #include "crypto_arch.h" | ||
| 21 | |||
| 22 | void sha1_block_ce(SHA256_CTX *ctx, const void *in, size_t num); | ||
| 23 | void sha1_block_generic(SHA256_CTX *ctx, const void *in, size_t num); | ||
| 24 | |||
| 25 | void | ||
| 26 | sha1_block_data_order(SHA256_CTX *ctx, const void *in, size_t num) | ||
| 27 | { | ||
| 28 | if ((crypto_cpu_caps_aarch64 & CRYPTO_CPU_CAPS_AARCH64_SHA1) != 0) { | ||
| 29 | sha1_block_ce(ctx, in, num); | ||
| 30 | return; | ||
| 31 | } | ||
| 32 | |||
| 33 | sha1_block_generic(ctx, in, num); | ||
| 34 | } | ||
diff --git a/src/lib/libcrypto/sha/sha1_aarch64_ce.S b/src/lib/libcrypto/sha/sha1_aarch64_ce.S new file mode 100644 index 0000000000..ce7eb81115 --- /dev/null +++ b/src/lib/libcrypto/sha/sha1_aarch64_ce.S | |||
| @@ -0,0 +1,214 @@ | |||
| 1 | /* $OpenBSD: sha1_aarch64_ce.S,v 1.3 2026/01/17 06:31:45 jsing Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2023,2025 Joel Sing <jsing@openbsd.org> | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | /* | ||
| 19 | * SHA-1 implementation using the ARM Cryptographic Extension (CE). | ||
| 20 | * | ||
| 21 | * There are six instructions for hardware acceleration of SHA-1 - the | ||
| 22 | * documentation for these instructions is woefully inadequate: | ||
| 23 | * | ||
| 24 | * sha1c: hash update (choose) | ||
| 25 | * sha1h: fixed rotate | ||
| 26 | * sha1m: hash update (majority) | ||
| 27 | * sha1p: hash update (parity) | ||
| 28 | * sha1su0: message schedule update with sigma0 for four rounds | ||
| 29 | * sha1su1: message schedule update with sigma1 for four rounds | ||
| 30 | */ | ||
| 31 | |||
| 32 | #define ctx x0 | ||
| 33 | #define in x1 | ||
| 34 | #define num x2 | ||
| 35 | |||
| 36 | /* Note: the lower 64 bits of v8 through v15 are callee saved. */ | ||
| 37 | |||
| 38 | #define hc0 v16 | ||
| 39 | #define hc1 v17 | ||
| 40 | #define hc1s s17 | ||
| 41 | |||
| 42 | #define hs0 v18 | ||
| 43 | #define hs1 v19 | ||
| 44 | #define hs1s s19 | ||
| 45 | |||
| 46 | #define w0 v20 | ||
| 47 | #define w1 v21 | ||
| 48 | #define w2 v22 | ||
| 49 | #define w3 v23 | ||
| 50 | |||
| 51 | #define k0 v24 | ||
| 52 | #define k1 v25 | ||
| 53 | #define k2 v26 | ||
| 54 | #define k3 v27 | ||
| 55 | |||
| 56 | #define tmp0 v28 | ||
| 57 | #define tmp1 s29 | ||
| 58 | |||
| 59 | #define tmp2 w11 | ||
| 60 | |||
| 61 | /* | ||
| 62 | * Update message schedule for m0 (W0:W1:W2:W3), using m1 (W4:W5:W6:W7), | ||
| 63 | * m2 (W8:W9:W10:11) and m3 (W12:W13:W14:W15). The sha1su0 instruction computes | ||
| 64 | * W0 = W8 ^ W2 ^ W0, while sha1su1 computes rol(W0 ^ W13, 1). | ||
| 65 | */ | ||
| 66 | #define sha1_message_schedule_update(m0, m1, m2, m3) \ | ||
| 67 | sha1su0 m0.4s, m1.4s, m2.4s; \ | ||
| 68 | sha1su1 m0.4s, m3.4s; | ||
| 69 | |||
| 70 | /* | ||
| 71 | * Compute four SHA-1 rounds by adding W0:W1:W2:W3 + K0:K1:K2:K3, then | ||
| 72 | * computing the remainder of each round (including the shuffle) via | ||
| 73 | * sha1{c,p,m}/sha1h. | ||
| 74 | */ | ||
| 75 | |||
| 76 | #define sha1_round1(h0, h1, w, k) \ | ||
| 77 | add tmp0.4s, w.4s, k.4s; /* Tt = Wt + Kt */ \ | ||
| 78 | mov tmp1, h0.s[0]; \ | ||
| 79 | sha1c h0, h1, tmp0.4s; \ | ||
| 80 | sha1h h1, tmp1; | ||
| 81 | |||
| 82 | #define sha1_round2(h0, h1, w, k) \ | ||
| 83 | add tmp0.4s, w.4s, k.4s; /* Tt = Wt + Kt */ \ | ||
| 84 | mov tmp1, h0.s[0]; \ | ||
| 85 | sha1p h0, h1, tmp0.4s; \ | ||
| 86 | sha1h h1, tmp1; | ||
| 87 | |||
| 88 | #define sha1_round3(h0, h1, w, k) \ | ||
| 89 | add tmp0.4s, w.4s, k.4s; /* Tt = Wt + Kt */ \ | ||
| 90 | mov tmp1, h0.s[0]; \ | ||
| 91 | sha1m h0, h1, tmp0.4s; \ | ||
| 92 | sha1h h1, tmp1; | ||
| 93 | |||
| 94 | #define sha1_round4(h0, h1, w, k) \ | ||
| 95 | add tmp0.4s, w.4s, k.4s; /* Tt = Wt + Kt */ \ | ||
| 96 | mov tmp1, h0.s[0]; \ | ||
| 97 | sha1p h0, h1, tmp0.4s; \ | ||
| 98 | sha1h h1, tmp1; | ||
| 99 | |||
| 100 | .arch armv8-a+sha2 | ||
| 101 | |||
| 102 | .section .text | ||
| 103 | |||
| 104 | /* | ||
| 105 | * void sha1_block_ce(SHA256_CTX *ctx, const void *in, size_t num); | ||
| 106 | * | ||
| 107 | * Standard ARM ABI: x0 = ctx, x1 = in, x2 = num | ||
| 108 | */ | ||
| 109 | .globl sha1_block_ce | ||
| 110 | .type sha1_block_ce,@function | ||
| 111 | sha1_block_ce: | ||
| 112 | |||
| 113 | /* | ||
| 114 | * Load SHA-1 round constants. | ||
| 115 | */ | ||
| 116 | |||
| 117 | /* Round 1 - 0x5a827999 */ | ||
| 118 | movz tmp2, #0x5a82, lsl #16 | ||
| 119 | movk tmp2, #0x7999 | ||
| 120 | dup k0.4s, tmp2 | ||
| 121 | |||
| 122 | /* Round 2 - 0x6ed9eba1 */ | ||
| 123 | movz tmp2, #0x6ed9, lsl #16 | ||
| 124 | movk tmp2, #0xeba1 | ||
| 125 | dup k1.4s, tmp2 | ||
| 126 | |||
| 127 | /* Round 3 - 0x8f1bbcdc */ | ||
| 128 | movz tmp2, #0x8f1b, lsl #16 | ||
| 129 | movk tmp2, #0xbcdc | ||
| 130 | dup k2.4s, tmp2 | ||
| 131 | |||
| 132 | /* Round 4 - 0xca62c1d6 */ | ||
| 133 | movz tmp2, #0xca62, lsl #16 | ||
| 134 | movk tmp2, #0xc1d6 | ||
| 135 | dup k3.4s, tmp2 | ||
| 136 | |||
| 137 | /* Load current hash state from context (hc0 = a:b:c:d, hc1 = e). */ | ||
| 138 | ld1 {hc0.4s}, [ctx] | ||
| 139 | ldr hc1s, [ctx, #(4*4)] | ||
| 140 | |||
| 141 | .Lblock_loop: | ||
| 142 | /* Copy current hash state. */ | ||
| 143 | mov hs0.4s, hc0.4s | ||
| 144 | mov hs1s, hc1.s[0] | ||
| 145 | |||
| 146 | /* Load and byte swap message schedule. */ | ||
| 147 | ld1 {w0.16b, w1.16b, w2.16b, w3.16b}, [in], #64 | ||
| 148 | rev32 w0.16b, w0.16b | ||
| 149 | rev32 w1.16b, w1.16b | ||
| 150 | rev32 w2.16b, w2.16b | ||
| 151 | rev32 w3.16b, w3.16b | ||
| 152 | |||
| 153 | /* Rounds 0 through 15 (four rounds at a time). */ | ||
| 154 | sha1_round1(hs0, hs1s, w0, k0) | ||
| 155 | sha1_round1(hs0, hs1s, w1, k0) | ||
| 156 | sha1_round1(hs0, hs1s, w2, k0) | ||
| 157 | sha1_round1(hs0, hs1s, w3, k0) | ||
| 158 | |||
| 159 | /* Rounds 16 through 31 (four rounds at a time). */ | ||
| 160 | sha1_message_schedule_update(w0, w1, w2, w3) | ||
| 161 | sha1_message_schedule_update(w1, w2, w3, w0) | ||
| 162 | sha1_message_schedule_update(w2, w3, w0, w1) | ||
| 163 | sha1_message_schedule_update(w3, w0, w1, w2) | ||
| 164 | |||
| 165 | sha1_round1(hs0, hs1s, w0, k0) | ||
| 166 | sha1_round2(hs0, hs1s, w1, k1) | ||
| 167 | sha1_round2(hs0, hs1s, w2, k1) | ||
| 168 | sha1_round2(hs0, hs1s, w3, k1) | ||
| 169 | |||
| 170 | /* Rounds 32 through 47 (four rounds at a time). */ | ||
| 171 | sha1_message_schedule_update(w0, w1, w2, w3) | ||
| 172 | sha1_message_schedule_update(w1, w2, w3, w0) | ||
| 173 | sha1_message_schedule_update(w2, w3, w0, w1) | ||
| 174 | sha1_message_schedule_update(w3, w0, w1, w2) | ||
| 175 | |||
| 176 | sha1_round2(hs0, hs1s, w0, k1) | ||
| 177 | sha1_round2(hs0, hs1s, w1, k1) | ||
| 178 | sha1_round3(hs0, hs1s, w2, k2) | ||
| 179 | sha1_round3(hs0, hs1s, w3, k2) | ||
| 180 | |||
| 181 | /* Rounds 48 through 63 (four rounds at a time). */ | ||
| 182 | sha1_message_schedule_update(w0, w1, w2, w3) | ||
| 183 | sha1_message_schedule_update(w1, w2, w3, w0) | ||
| 184 | sha1_message_schedule_update(w2, w3, w0, w1) | ||
| 185 | sha1_message_schedule_update(w3, w0, w1, w2) | ||
| 186 | |||
| 187 | sha1_round3(hs0, hs1s, w0, k2) | ||
| 188 | sha1_round3(hs0, hs1s, w1, k2) | ||
| 189 | sha1_round3(hs0, hs1s, w2, k2) | ||
| 190 | sha1_round4(hs0, hs1s, w3, k3) | ||
| 191 | |||
| 192 | /* Rounds 64 through 79 (four rounds at a time). */ | ||
| 193 | sha1_message_schedule_update(w0, w1, w2, w3) | ||
| 194 | sha1_message_schedule_update(w1, w2, w3, w0) | ||
| 195 | sha1_message_schedule_update(w2, w3, w0, w1) | ||
| 196 | sha1_message_schedule_update(w3, w0, w1, w2) | ||
| 197 | |||
| 198 | sha1_round4(hs0, hs1s, w0, k3) | ||
| 199 | sha1_round4(hs0, hs1s, w1, k3) | ||
| 200 | sha1_round4(hs0, hs1s, w2, k3) | ||
| 201 | sha1_round4(hs0, hs1s, w3, k3) | ||
| 202 | |||
| 203 | /* Add intermediate state to hash state. */ | ||
| 204 | add hc0.4s, hc0.4s, hs0.4s | ||
| 205 | add hc1.4s, hc1.4s, hs1.4s | ||
| 206 | |||
| 207 | sub num, num, #1 | ||
| 208 | cbnz num, .Lblock_loop | ||
| 209 | |||
| 210 | /* Store hash state to context. */ | ||
| 211 | st1 {hc0.4s}, [ctx] | ||
| 212 | str hc1s, [ctx, #(4*4)] | ||
| 213 | |||
| 214 | ret | ||
diff --git a/src/lib/libcrypto/sha/sha1_amd64_generic.S b/src/lib/libcrypto/sha/sha1_amd64_generic.S index 38f49b0c3c..685d71edf8 100644 --- a/src/lib/libcrypto/sha/sha1_amd64_generic.S +++ b/src/lib/libcrypto/sha/sha1_amd64_generic.S | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: sha1_amd64_generic.S,v 1.2 2025/01/18 02:56:07 jsing Exp $ */ | 1 | /* $OpenBSD: sha1_amd64_generic.S,v 1.3 2026/01/17 06:31:45 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -156,7 +156,7 @@ | |||
| 156 | sha1_message_schedule_update(idx, %rsp, tmp0) \ | 156 | sha1_message_schedule_update(idx, %rsp, tmp0) \ |
| 157 | sha1_round_parity(a, b, c, d, e, 0xca62c1d6, tmp0) | 157 | sha1_round_parity(a, b, c, d, e, 0xca62c1d6, tmp0) |
| 158 | 158 | ||
| 159 | .text | 159 | .section .text |
| 160 | 160 | ||
| 161 | /* | 161 | /* |
| 162 | * void sha1_block_generic(SHA1_CTX *ctx, const void *in, size_t num); | 162 | * void sha1_block_generic(SHA1_CTX *ctx, const void *in, size_t num); |
diff --git a/src/lib/libcrypto/sha/sha1_amd64_shani.S b/src/lib/libcrypto/sha/sha1_amd64_shani.S index d7699d10f1..751554f1d5 100644 --- a/src/lib/libcrypto/sha/sha1_amd64_shani.S +++ b/src/lib/libcrypto/sha/sha1_amd64_shani.S | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: sha1_amd64_shani.S,v 1.1 2024/12/06 11:57:18 jsing Exp $ */ | 1 | /* $OpenBSD: sha1_amd64_shani.S,v 1.2 2026/01/17 06:31:45 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -71,7 +71,7 @@ | |||
| 71 | sha1_shani_round(fn, xm0, xe, xe_next); | 71 | sha1_shani_round(fn, xm0, xe, xe_next); |
| 72 | 72 | ||
| 73 | 73 | ||
| 74 | .text | 74 | .section .text |
| 75 | 75 | ||
| 76 | /* | 76 | /* |
| 77 | * void sha1_block_shani(SHA256_CTX *ctx, const void *in, size_t num); | 77 | * void sha1_block_shani(SHA256_CTX *ctx, const void *in, size_t num); |
| @@ -157,7 +157,7 @@ sha1_block_shani: | |||
| 157 | 157 | ||
| 158 | ret | 158 | ret |
| 159 | 159 | ||
| 160 | .rodata | 160 | .section .rodata |
| 161 | 161 | ||
| 162 | /* | 162 | /* |
| 163 | * Shuffle mask - byte reversal for little endian to big endian word conversion, | 163 | * Shuffle mask - byte reversal for little endian to big endian word conversion, |
diff --git a/src/lib/libcrypto/sha/sha256_aarch64_ce.S b/src/lib/libcrypto/sha/sha256_aarch64_ce.S index 15726827e6..b66969427b 100644 --- a/src/lib/libcrypto/sha/sha256_aarch64_ce.S +++ b/src/lib/libcrypto/sha/sha256_aarch64_ce.S | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: sha256_aarch64_ce.S,v 1.2 2025/03/12 12:53:33 jsing Exp $ */ | 1 | /* $OpenBSD: sha256_aarch64_ce.S,v 1.4 2026/01/17 06:31:45 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023,2025 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023,2025 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -84,7 +84,7 @@ | |||
| 84 | 84 | ||
| 85 | .arch armv8-a+sha2 | 85 | .arch armv8-a+sha2 |
| 86 | 86 | ||
| 87 | .text | 87 | .section .text |
| 88 | 88 | ||
| 89 | /* | 89 | /* |
| 90 | * void sha256_block_ce(SHA256_CTX *ctx, const void *in, size_t num); | 90 | * void sha256_block_ce(SHA256_CTX *ctx, const void *in, size_t num); |
| @@ -105,7 +105,7 @@ sha256_block_ce: | |||
| 105 | */ | 105 | */ |
| 106 | ld1 {hc0.4s, hc1.4s}, [ctx] | 106 | ld1 {hc0.4s, hc1.4s}, [ctx] |
| 107 | 107 | ||
| 108 | block_loop: | 108 | .Lblock_loop: |
| 109 | mov k256, k256_base | 109 | mov k256, k256_base |
| 110 | 110 | ||
| 111 | /* Copy current hash state. */ | 111 | /* Copy current hash state. */ |
| @@ -156,17 +156,18 @@ block_loop: | |||
| 156 | add hc1.4s, hc1.4s, hs1.4s | 156 | add hc1.4s, hc1.4s, hs1.4s |
| 157 | 157 | ||
| 158 | sub num, num, #1 | 158 | sub num, num, #1 |
| 159 | cbnz num, block_loop | 159 | cbnz num, .Lblock_loop |
| 160 | 160 | ||
| 161 | /* Store hash state to context. */ | 161 | /* Store hash state to context. */ |
| 162 | st1 {hc0.4s, hc1.4s}, [ctx] | 162 | st1 {hc0.4s, hc1.4s}, [ctx] |
| 163 | 163 | ||
| 164 | ret | 164 | ret |
| 165 | 165 | ||
| 166 | .section .rodata | ||
| 167 | |||
| 166 | /* | 168 | /* |
| 167 | * SHA-256 constants - see FIPS 180-4 section 4.2.3. | 169 | * SHA-256 constants - see FIPS 180-4 section 4.2.3. |
| 168 | */ | 170 | */ |
| 169 | .rodata | ||
| 170 | .align 4 | 171 | .align 4 |
| 171 | .type K256,@object | 172 | .type K256,@object |
| 172 | K256: | 173 | K256: |
diff --git a/src/lib/libcrypto/sha/sha256_amd64_generic.S b/src/lib/libcrypto/sha/sha256_amd64_generic.S index 166bce9ca8..a5bb3eca42 100644 --- a/src/lib/libcrypto/sha/sha256_amd64_generic.S +++ b/src/lib/libcrypto/sha/sha256_amd64_generic.S | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: sha256_amd64_generic.S,v 1.3 2024/11/16 12:34:16 jsing Exp $ */ | 1 | /* $OpenBSD: sha256_amd64_generic.S,v 1.4 2026/01/17 06:31:45 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -143,7 +143,7 @@ | |||
| 143 | sha256_message_schedule_update(idx, %rsp, tmp0) \ | 143 | sha256_message_schedule_update(idx, %rsp, tmp0) \ |
| 144 | sha256_round(idx, a, b, c, d, e, f, g, h, k256, %rsp, tmp0) | 144 | sha256_round(idx, a, b, c, d, e, f, g, h, k256, %rsp, tmp0) |
| 145 | 145 | ||
| 146 | .text | 146 | .section .text |
| 147 | 147 | ||
| 148 | /* | 148 | /* |
| 149 | * void sha256_block_generic(SHA256_CTX *ctx, const void *in, size_t num); | 149 | * void sha256_block_generic(SHA256_CTX *ctx, const void *in, size_t num); |
| @@ -276,10 +276,11 @@ sha256_block_generic: | |||
| 276 | 276 | ||
| 277 | ret | 277 | ret |
| 278 | 278 | ||
| 279 | .section .rodata | ||
| 280 | |||
| 279 | /* | 281 | /* |
| 280 | * SHA-256 constants - see FIPS 180-4 section 4.2.2. | 282 | * SHA-256 constants - see FIPS 180-4 section 4.2.2. |
| 281 | */ | 283 | */ |
| 282 | .rodata | ||
| 283 | .align 64 | 284 | .align 64 |
| 284 | .type K256,@object | 285 | .type K256,@object |
| 285 | K256: | 286 | K256: |
diff --git a/src/lib/libcrypto/sha/sha256_amd64_shani.S b/src/lib/libcrypto/sha/sha256_amd64_shani.S index df3a796b45..e43ecfa51f 100644 --- a/src/lib/libcrypto/sha/sha256_amd64_shani.S +++ b/src/lib/libcrypto/sha/sha256_amd64_shani.S | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: sha256_amd64_shani.S,v 1.1 2024/11/16 15:31:36 jsing Exp $ */ | 1 | /* $OpenBSD: sha256_amd64_shani.S,v 1.2 2026/01/17 06:31:45 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -80,7 +80,7 @@ | |||
| 80 | movdqa xmt0, xmsg; \ | 80 | movdqa xmt0, xmsg; \ |
| 81 | sha256_shani_round(idx); | 81 | sha256_shani_round(idx); |
| 82 | 82 | ||
| 83 | .text | 83 | .section .text |
| 84 | 84 | ||
| 85 | /* | 85 | /* |
| 86 | * void sha256_block_shani(SHA256_CTX *ctx, const void *in, size_t num); | 86 | * void sha256_block_shani(SHA256_CTX *ctx, const void *in, size_t num); |
| @@ -173,7 +173,7 @@ sha256_block_shani: | |||
| 173 | 173 | ||
| 174 | ret | 174 | ret |
| 175 | 175 | ||
| 176 | .rodata | 176 | .section .rodata |
| 177 | 177 | ||
| 178 | /* | 178 | /* |
| 179 | * Shuffle mask - little endian to big endian word conversion. | 179 | * Shuffle mask - little endian to big endian word conversion. |
diff --git a/src/lib/libcrypto/sha/sha3.c b/src/lib/libcrypto/sha/sha3.c index 6a7196d582..fde0da94ff 100644 --- a/src/lib/libcrypto/sha/sha3.c +++ b/src/lib/libcrypto/sha/sha3.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: sha3.c,v 1.16 2024/11/23 15:38:12 jsing Exp $ */ | 1 | /* $OpenBSD: sha3.c,v 1.20 2025/04/18 07:36:11 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * The MIT License (MIT) | 3 | * The MIT License (MIT) |
| 4 | * | 4 | * |
| @@ -26,12 +26,11 @@ | |||
| 26 | #include <endian.h> | 26 | #include <endian.h> |
| 27 | #include <string.h> | 27 | #include <string.h> |
| 28 | 28 | ||
| 29 | #include "crypto_internal.h" | ||
| 29 | #include "sha3_internal.h" | 30 | #include "sha3_internal.h" |
| 30 | 31 | ||
| 31 | #define KECCAKF_ROUNDS 24 | 32 | #define KECCAKF_ROUNDS 24 |
| 32 | 33 | ||
| 33 | #define ROTL64(x, y) (((x) << (y)) | ((x) >> (64 - (y)))) | ||
| 34 | |||
| 35 | static const uint64_t sha3_keccakf_rndc[24] = { | 34 | static const uint64_t sha3_keccakf_rndc[24] = { |
| 36 | 0x0000000000000001, 0x0000000000008082, 0x800000000000808a, | 35 | 0x0000000000000001, 0x0000000000008082, 0x800000000000808a, |
| 37 | 0x8000000080008000, 0x000000000000808b, 0x0000000080000001, | 36 | 0x8000000080008000, 0x000000000000808b, 0x0000000080000001, |
| @@ -54,7 +53,7 @@ static const int sha3_keccakf_piln[24] = { | |||
| 54 | static void | 53 | static void |
| 55 | sha3_keccakf(uint64_t st[25]) | 54 | sha3_keccakf(uint64_t st[25]) |
| 56 | { | 55 | { |
| 57 | uint64_t t, bc[5]; | 56 | uint64_t t0, t1, bc[5]; |
| 58 | int i, j, r; | 57 | int i, j, r; |
| 59 | 58 | ||
| 60 | for (i = 0; i < 25; i++) | 59 | for (i = 0; i < 25; i++) |
| @@ -67,18 +66,18 @@ sha3_keccakf(uint64_t st[25]) | |||
| 67 | bc[i] = st[i] ^ st[i + 5] ^ st[i + 10] ^ st[i + 15] ^ st[i + 20]; | 66 | bc[i] = st[i] ^ st[i + 5] ^ st[i + 10] ^ st[i + 15] ^ st[i + 20]; |
| 68 | 67 | ||
| 69 | for (i = 0; i < 5; i++) { | 68 | for (i = 0; i < 5; i++) { |
| 70 | t = bc[(i + 4) % 5] ^ ROTL64(bc[(i + 1) % 5], 1); | 69 | t0 = bc[(i + 4) % 5] ^ crypto_rol_u64(bc[(i + 1) % 5], 1); |
| 71 | for (j = 0; j < 25; j += 5) | 70 | for (j = 0; j < 25; j += 5) |
| 72 | st[j + i] ^= t; | 71 | st[j + i] ^= t0; |
| 73 | } | 72 | } |
| 74 | 73 | ||
| 75 | /* Rho Pi */ | 74 | /* Rho Pi */ |
| 76 | t = st[1]; | 75 | t0 = st[1]; |
| 77 | for (i = 0; i < 24; i++) { | 76 | for (i = 0; i < 24; i++) { |
| 78 | j = sha3_keccakf_piln[i]; | 77 | j = sha3_keccakf_piln[i]; |
| 79 | bc[0] = st[j]; | 78 | t1 = st[j]; |
| 80 | st[j] = ROTL64(t, sha3_keccakf_rotc[i]); | 79 | st[j] = crypto_rol_u64(t0, sha3_keccakf_rotc[i]); |
| 81 | t = bc[0]; | 80 | t0 = t1; |
| 82 | } | 81 | } |
| 83 | 82 | ||
| 84 | /* Chi */ | 83 | /* Chi */ |
| @@ -98,75 +97,77 @@ sha3_keccakf(uint64_t st[25]) | |||
| 98 | } | 97 | } |
| 99 | 98 | ||
| 100 | int | 99 | int |
| 101 | sha3_init(sha3_ctx *c, int mdlen) | 100 | sha3_init(sha3_ctx *ctx, int mdlen) |
| 102 | { | 101 | { |
| 103 | if (mdlen < 0 || mdlen >= KECCAK_BYTE_WIDTH / 2) | 102 | if (mdlen < 0 || mdlen >= KECCAK_BYTE_WIDTH / 2) |
| 104 | return 0; | 103 | return 0; |
| 105 | 104 | ||
| 106 | memset(c, 0, sizeof(*c)); | 105 | memset(ctx, 0, sizeof(*ctx)); |
| 107 | 106 | ||
| 108 | c->mdlen = mdlen; | 107 | ctx->mdlen = mdlen; |
| 109 | c->rsize = KECCAK_BYTE_WIDTH - 2 * mdlen; | 108 | ctx->rsize = KECCAK_BYTE_WIDTH - 2 * mdlen; |
| 110 | 109 | ||
| 111 | return 1; | 110 | return 1; |
| 112 | } | 111 | } |
| 113 | 112 | ||
| 114 | int | 113 | int |
| 115 | sha3_update(sha3_ctx *c, const void *data, size_t len) | 114 | sha3_update(sha3_ctx *ctx, const void *_data, size_t len) |
| 116 | { | 115 | { |
| 116 | const uint8_t *data = _data; | ||
| 117 | size_t i, j; | 117 | size_t i, j; |
| 118 | 118 | ||
| 119 | j = c->pt; | 119 | j = ctx->pt; |
| 120 | for (i = 0; i < len; i++) { | 120 | for (i = 0; i < len; i++) { |
| 121 | c->state.b[j++] ^= ((const uint8_t *) data)[i]; | 121 | ctx->state.b[j++] ^= data[i]; |
| 122 | if (j >= c->rsize) { | 122 | if (j >= ctx->rsize) { |
| 123 | sha3_keccakf(c->state.q); | 123 | sha3_keccakf(ctx->state.q); |
| 124 | j = 0; | 124 | j = 0; |
| 125 | } | 125 | } |
| 126 | } | 126 | } |
| 127 | c->pt = j; | 127 | ctx->pt = j; |
| 128 | 128 | ||
| 129 | return 1; | 129 | return 1; |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | int | 132 | int |
| 133 | sha3_final(void *md, sha3_ctx *c) | 133 | sha3_final(void *_md, sha3_ctx *ctx) |
| 134 | { | 134 | { |
| 135 | uint8_t *md = _md; | ||
| 135 | int i; | 136 | int i; |
| 136 | 137 | ||
| 137 | c->state.b[c->pt] ^= 0x06; | 138 | ctx->state.b[ctx->pt] ^= 0x06; |
| 138 | c->state.b[c->rsize - 1] ^= 0x80; | 139 | ctx->state.b[ctx->rsize - 1] ^= 0x80; |
| 139 | sha3_keccakf(c->state.q); | 140 | sha3_keccakf(ctx->state.q); |
| 140 | 141 | ||
| 141 | for (i = 0; i < c->mdlen; i++) { | 142 | for (i = 0; i < ctx->mdlen; i++) |
| 142 | ((uint8_t *) md)[i] = c->state.b[i]; | 143 | md[i] = ctx->state.b[i]; |
| 143 | } | ||
| 144 | 144 | ||
| 145 | return 1; | 145 | return 1; |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | /* SHAKE128 and SHAKE256 extensible-output functionality. */ | 148 | /* SHAKE128 and SHAKE256 extensible-output functionality. */ |
| 149 | void | 149 | void |
| 150 | shake_xof(sha3_ctx *c) | 150 | shake_xof(sha3_ctx *ctx) |
| 151 | { | 151 | { |
| 152 | c->state.b[c->pt] ^= 0x1F; | 152 | ctx->state.b[ctx->pt] ^= 0x1f; |
| 153 | c->state.b[c->rsize - 1] ^= 0x80; | 153 | ctx->state.b[ctx->rsize - 1] ^= 0x80; |
| 154 | sha3_keccakf(c->state.q); | 154 | sha3_keccakf(ctx->state.q); |
| 155 | c->pt = 0; | 155 | ctx->pt = 0; |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | void | 158 | void |
| 159 | shake_out(sha3_ctx *c, void *out, size_t len) | 159 | shake_out(sha3_ctx *ctx, void *_out, size_t len) |
| 160 | { | 160 | { |
| 161 | uint8_t *out = _out; | ||
| 161 | size_t i, j; | 162 | size_t i, j; |
| 162 | 163 | ||
| 163 | j = c->pt; | 164 | j = ctx->pt; |
| 164 | for (i = 0; i < len; i++) { | 165 | for (i = 0; i < len; i++) { |
| 165 | if (j >= c->rsize) { | 166 | if (j >= ctx->rsize) { |
| 166 | sha3_keccakf(c->state.q); | 167 | sha3_keccakf(ctx->state.q); |
| 167 | j = 0; | 168 | j = 0; |
| 168 | } | 169 | } |
| 169 | ((uint8_t *) out)[i] = c->state.b[j++]; | 170 | out[i] = ctx->state.b[j++]; |
| 170 | } | 171 | } |
| 171 | c->pt = j; | 172 | ctx->pt = j; |
| 172 | } | 173 | } |
diff --git a/src/lib/libcrypto/sha/sha3_internal.h b/src/lib/libcrypto/sha/sha3_internal.h index 53a4980c19..db09d06cc0 100644 --- a/src/lib/libcrypto/sha/sha3_internal.h +++ b/src/lib/libcrypto/sha/sha3_internal.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: sha3_internal.h,v 1.15 2023/04/25 19:32:19 tb Exp $ */ | 1 | /* $OpenBSD: sha3_internal.h,v 1.16 2025/04/18 07:36:11 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * The MIT License (MIT) | 3 | * The MIT License (MIT) |
| 4 | * | 4 | * |
| @@ -66,16 +66,16 @@ typedef struct sha3_ctx_st { | |||
| 66 | size_t mdlen; | 66 | size_t mdlen; |
| 67 | } sha3_ctx; | 67 | } sha3_ctx; |
| 68 | 68 | ||
| 69 | int sha3_init(sha3_ctx *c, int mdlen); | 69 | int sha3_init(sha3_ctx *ctx, int mdlen); |
| 70 | int sha3_update(sha3_ctx *c, const void *data, size_t len); | 70 | int sha3_update(sha3_ctx *ctx, const void *data, size_t len); |
| 71 | int sha3_final(void *md, sha3_ctx *c); | 71 | int sha3_final(void *md, sha3_ctx *ctx); |
| 72 | 72 | ||
| 73 | /* SHAKE128 and SHAKE256 extensible-output functions. */ | 73 | /* SHAKE128 and SHAKE256 extensible-output functions. */ |
| 74 | #define shake128_init(c) sha3_init(c, 16) | 74 | #define shake128_init(ctx) sha3_init((ctx), 16) |
| 75 | #define shake256_init(c) sha3_init(c, 32) | 75 | #define shake256_init(ctx) sha3_init((ctx), 32) |
| 76 | #define shake_update sha3_update | 76 | #define shake_update sha3_update |
| 77 | 77 | ||
| 78 | void shake_xof(sha3_ctx *c); | 78 | void shake_xof(sha3_ctx *ctx); |
| 79 | void shake_out(sha3_ctx *c, void *out, size_t len); | 79 | void shake_out(sha3_ctx *ctx, void *out, size_t len); |
| 80 | 80 | ||
| 81 | #endif | 81 | #endif |
diff --git a/src/lib/libcrypto/sha/sha512_aarch64_ce.S b/src/lib/libcrypto/sha/sha512_aarch64_ce.S index 89109a78ba..bec56a49e5 100644 --- a/src/lib/libcrypto/sha/sha512_aarch64_ce.S +++ b/src/lib/libcrypto/sha/sha512_aarch64_ce.S | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: sha512_aarch64_ce.S,v 1.1 2025/03/12 14:13:41 jsing Exp $ */ | 1 | /* $OpenBSD: sha512_aarch64_ce.S,v 1.3 2026/01/17 06:31:45 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023,2025 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023,2025 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -151,7 +151,7 @@ | |||
| 151 | 151 | ||
| 152 | .arch armv8-a+sha3 | 152 | .arch armv8-a+sha3 |
| 153 | 153 | ||
| 154 | .text | 154 | .section .text |
| 155 | 155 | ||
| 156 | /* | 156 | /* |
| 157 | * void sha512_block_ce(SHA512_CTX *ctx, const void *in, size_t num); | 157 | * void sha512_block_ce(SHA512_CTX *ctx, const void *in, size_t num); |
| @@ -177,7 +177,7 @@ sha512_block_ce: | |||
| 177 | */ | 177 | */ |
| 178 | ld1 {hc0.2d, hc1.2d, hc2.2d, hc3.2d}, [ctx] | 178 | ld1 {hc0.2d, hc1.2d, hc2.2d, hc3.2d}, [ctx] |
| 179 | 179 | ||
| 180 | block_loop: | 180 | .Lblock_loop: |
| 181 | mov k512, k512_base | 181 | mov k512, k512_base |
| 182 | 182 | ||
| 183 | /* Copy current hash state. */ | 183 | /* Copy current hash state. */ |
| @@ -271,7 +271,7 @@ block_loop: | |||
| 271 | add hc3.2d, hc3.2d, hs3.2d | 271 | add hc3.2d, hc3.2d, hs3.2d |
| 272 | 272 | ||
| 273 | sub num, num, #1 | 273 | sub num, num, #1 |
| 274 | cbnz num, block_loop | 274 | cbnz num, .Lblock_loop |
| 275 | 275 | ||
| 276 | /* Store hash state to context. */ | 276 | /* Store hash state to context. */ |
| 277 | st1 {hc0.2d, hc1.2d, hc2.2d, hc3.2d}, [ctx] | 277 | st1 {hc0.2d, hc1.2d, hc2.2d, hc3.2d}, [ctx] |
| @@ -282,10 +282,11 @@ block_loop: | |||
| 282 | 282 | ||
| 283 | ret | 283 | ret |
| 284 | 284 | ||
| 285 | .section .rodata | ||
| 286 | |||
| 285 | /* | 287 | /* |
| 286 | * SHA-512 constants - see FIPS 180-4 section 4.2.3. | 288 | * SHA-512 constants - see FIPS 180-4 section 4.2.3. |
| 287 | */ | 289 | */ |
| 288 | .rodata | ||
| 289 | .align 4 | 290 | .align 4 |
| 290 | .type K512,@object | 291 | .type K512,@object |
| 291 | K512: | 292 | K512: |
diff --git a/src/lib/libcrypto/sha/sha512_amd64_generic.S b/src/lib/libcrypto/sha/sha512_amd64_generic.S index 8419d60b8e..3b6a9719e1 100644 --- a/src/lib/libcrypto/sha/sha512_amd64_generic.S +++ b/src/lib/libcrypto/sha/sha512_amd64_generic.S | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: sha512_amd64_generic.S,v 1.1 2024/11/16 14:56:39 jsing Exp $ */ | 1 | /* $OpenBSD: sha512_amd64_generic.S,v 1.2 2026/01/17 06:31:45 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -144,7 +144,7 @@ | |||
| 144 | sha512_message_schedule_update(idx, %rsp, tmp0) \ | 144 | sha512_message_schedule_update(idx, %rsp, tmp0) \ |
| 145 | sha512_round(idx, a, b, c, d, e, f, g, h, k512, %rsp, tmp0) | 145 | sha512_round(idx, a, b, c, d, e, f, g, h, k512, %rsp, tmp0) |
| 146 | 146 | ||
| 147 | .text | 147 | .section .text |
| 148 | 148 | ||
| 149 | /* | 149 | /* |
| 150 | * void sha512_block_generic(SHA512_CTX *ctx, const void *in, size_t num); | 150 | * void sha512_block_generic(SHA512_CTX *ctx, const void *in, size_t num); |
| @@ -277,10 +277,11 @@ sha512_block_generic: | |||
| 277 | 277 | ||
| 278 | ret | 278 | ret |
| 279 | 279 | ||
| 280 | .section .rodata | ||
| 281 | |||
| 280 | /* | 282 | /* |
| 281 | * SHA-512 constants - see FIPS 180-4 section 4.2.3. | 283 | * SHA-512 constants - see FIPS 180-4 section 4.2.3. |
| 282 | */ | 284 | */ |
| 283 | .rodata | ||
| 284 | .align 64 | 285 | .align 64 |
| 285 | .type K512,@object | 286 | .type K512,@object |
| 286 | K512: | 287 | K512: |
diff --git a/src/lib/libcrypto/shlib_version b/src/lib/libcrypto/shlib_version index a5cb76dd4f..7fa7e46d0c 100644 --- a/src/lib/libcrypto/shlib_version +++ b/src/lib/libcrypto/shlib_version | |||
| @@ -1,3 +1,3 @@ | |||
| 1 | # Don't forget to give libssl and libtls the same type of bump! | 1 | # Don't forget to give libssl and libtls the same type of bump! |
| 2 | major=56 | 2 | major=57 |
| 3 | minor=0 | 3 | minor=2 |
diff --git a/src/lib/libcrypto/sm2/sm2_crypt.c b/src/lib/libcrypto/sm2/sm2_crypt.c index 63fe1e6ab9..3bc1f21fb6 100644 --- a/src/lib/libcrypto/sm2/sm2_crypt.c +++ b/src/lib/libcrypto/sm2/sm2_crypt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: sm2_crypt.c,v 1.3 2024/02/09 07:43:52 tb Exp $ */ | 1 | /* $OpenBSD: sm2_crypt.c,v 1.4 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2017, 2019 Ribose Inc | 3 | * Copyright (c) 2017, 2019 Ribose Inc |
| 4 | * | 4 | * |
| @@ -22,10 +22,10 @@ | |||
| 22 | #include <openssl/asn1.h> | 22 | #include <openssl/asn1.h> |
| 23 | #include <openssl/asn1t.h> | 23 | #include <openssl/asn1t.h> |
| 24 | #include <openssl/bn.h> | 24 | #include <openssl/bn.h> |
| 25 | #include <openssl/err.h> | ||
| 26 | #include <openssl/evp.h> | 25 | #include <openssl/evp.h> |
| 27 | #include <openssl/sm2.h> | 26 | #include <openssl/sm2.h> |
| 28 | 27 | ||
| 28 | #include "err_local.h" | ||
| 29 | #include "sm2_local.h" | 29 | #include "sm2_local.h" |
| 30 | 30 | ||
| 31 | typedef struct SM2_Ciphertext_st SM2_Ciphertext; | 31 | typedef struct SM2_Ciphertext_st SM2_Ciphertext; |
diff --git a/src/lib/libcrypto/sm2/sm2_pmeth.c b/src/lib/libcrypto/sm2/sm2_pmeth.c index 441f5475d1..786e48a992 100644 --- a/src/lib/libcrypto/sm2/sm2_pmeth.c +++ b/src/lib/libcrypto/sm2/sm2_pmeth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: sm2_pmeth.c,v 1.2 2022/11/26 16:08:54 tb Exp $ */ | 1 | /* $OpenBSD: sm2_pmeth.c,v 1.3 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2017, 2019 Ribose Inc | 3 | * Copyright (c) 2017, 2019 Ribose Inc |
| 4 | * | 4 | * |
| @@ -22,9 +22,9 @@ | |||
| 22 | #include <openssl/sm2.h> | 22 | #include <openssl/sm2.h> |
| 23 | #include <openssl/asn1t.h> | 23 | #include <openssl/asn1t.h> |
| 24 | #include <openssl/x509.h> | 24 | #include <openssl/x509.h> |
| 25 | #include <openssl/err.h> | ||
| 26 | #include <openssl/evp.h> | 25 | #include <openssl/evp.h> |
| 27 | 26 | ||
| 27 | #include "err_local.h" | ||
| 28 | #include "evp_local.h" | 28 | #include "evp_local.h" |
| 29 | #include "sm2_local.h" | 29 | #include "sm2_local.h" |
| 30 | 30 | ||
diff --git a/src/lib/libcrypto/sm2/sm2_sign.c b/src/lib/libcrypto/sm2/sm2_sign.c index a5e3a8aee5..1a88d860bc 100644 --- a/src/lib/libcrypto/sm2/sm2_sign.c +++ b/src/lib/libcrypto/sm2/sm2_sign.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: sm2_sign.c,v 1.4 2023/07/05 17:36:19 tb Exp $ */ | 1 | /* $OpenBSD: sm2_sign.c,v 1.5 2025/05/10 05:54:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2017, 2019 Ribose Inc | 3 | * Copyright (c) 2017, 2019 Ribose Inc |
| 4 | * | 4 | * |
| @@ -21,10 +21,10 @@ | |||
| 21 | 21 | ||
| 22 | #include <openssl/sm2.h> | 22 | #include <openssl/sm2.h> |
| 23 | #include <openssl/evp.h> | 23 | #include <openssl/evp.h> |
| 24 | #include <openssl/err.h> | ||
| 25 | #include <openssl/bn.h> | 24 | #include <openssl/bn.h> |
| 26 | 25 | ||
| 27 | #include "bn_local.h" | 26 | #include "bn_local.h" |
| 27 | #include "err_local.h" | ||
| 28 | #include "sm2_local.h" | 28 | #include "sm2_local.h" |
| 29 | 29 | ||
| 30 | static BIGNUM * | 30 | static BIGNUM * |
diff --git a/src/lib/libcrypto/stack/stack.c b/src/lib/libcrypto/stack/stack.c index 1424661879..dd9d8b8395 100644 --- a/src/lib/libcrypto/stack/stack.c +++ b/src/lib/libcrypto/stack/stack.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: stack.c,v 1.33 2025/01/03 08:04:16 tb Exp $ */ | 1 | /* $OpenBSD: stack.c,v 1.35 2026/01/14 17:43:49 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -86,17 +86,17 @@ _STACK * | |||
| 86 | sk_dup(_STACK *sk) | 86 | sk_dup(_STACK *sk) |
| 87 | { | 87 | { |
| 88 | _STACK *ret; | 88 | _STACK *ret; |
| 89 | char **s; | 89 | void **s; |
| 90 | 90 | ||
| 91 | if ((ret = sk_new(sk->comp)) == NULL) | 91 | if ((ret = sk_new(sk->comp)) == NULL) |
| 92 | goto err; | 92 | goto err; |
| 93 | s = reallocarray(ret->data, sk->num_alloc, sizeof(char *)); | 93 | s = reallocarray(ret->data, sk->num_alloc, sizeof(void *)); |
| 94 | if (s == NULL) | 94 | if (s == NULL) |
| 95 | goto err; | 95 | goto err; |
| 96 | ret->data = s; | 96 | ret->data = s; |
| 97 | 97 | ||
| 98 | ret->num = sk->num; | 98 | ret->num = sk->num; |
| 99 | memcpy(ret->data, sk->data, sizeof(char *) * sk->num); | 99 | memcpy(ret->data, sk->data, sizeof(void *) * sk->num); |
| 100 | ret->sorted = sk->sorted; | 100 | ret->sorted = sk->sorted; |
| 101 | ret->num_alloc = sk->num_alloc; | 101 | ret->num_alloc = sk->num_alloc; |
| 102 | ret->comp = sk->comp; | 102 | ret->comp = sk->comp; |
| @@ -124,7 +124,7 @@ sk_new(int (*c)(const void *, const void *)) | |||
| 124 | 124 | ||
| 125 | if ((ret = malloc(sizeof(_STACK))) == NULL) | 125 | if ((ret = malloc(sizeof(_STACK))) == NULL) |
| 126 | goto err; | 126 | goto err; |
| 127 | if ((ret->data = reallocarray(NULL, MIN_NODES, sizeof(char *))) == NULL) | 127 | if ((ret->data = reallocarray(NULL, MIN_NODES, sizeof(void *))) == NULL) |
| 128 | goto err; | 128 | goto err; |
| 129 | for (i = 0; i < MIN_NODES; i++) | 129 | for (i = 0; i < MIN_NODES; i++) |
| 130 | ret->data[i] = NULL; | 130 | ret->data[i] = NULL; |
| @@ -143,12 +143,12 @@ LCRYPTO_ALIAS(sk_new); | |||
| 143 | int | 143 | int |
| 144 | sk_insert(_STACK *st, void *data, int loc) | 144 | sk_insert(_STACK *st, void *data, int loc) |
| 145 | { | 145 | { |
| 146 | char **s; | 146 | void **s; |
| 147 | 147 | ||
| 148 | if (st == NULL) | 148 | if (st == NULL) |
| 149 | return 0; | 149 | return 0; |
| 150 | if (st->num_alloc <= st->num + 1) { | 150 | if (st->num_alloc <= st->num + 1) { |
| 151 | s = reallocarray(st->data, st->num_alloc, 2 * sizeof(char *)); | 151 | s = reallocarray(st->data, st->num_alloc, 2 * sizeof(void *)); |
| 152 | if (s == NULL) | 152 | if (s == NULL) |
| 153 | return (0); | 153 | return (0); |
| 154 | st->data = s; | 154 | st->data = s; |
| @@ -158,7 +158,7 @@ sk_insert(_STACK *st, void *data, int loc) | |||
| 158 | st->data[st->num] = data; | 158 | st->data[st->num] = data; |
| 159 | else { | 159 | else { |
| 160 | memmove(&(st->data[loc + 1]), &(st->data[loc]), | 160 | memmove(&(st->data[loc + 1]), &(st->data[loc]), |
| 161 | sizeof(char *)*(st->num - loc)); | 161 | sizeof(void *) * (st->num - loc)); |
| 162 | st->data[loc] = data; | 162 | st->data[loc] = data; |
| 163 | } | 163 | } |
| 164 | st->num++; | 164 | st->num++; |
| @@ -182,7 +182,7 @@ LCRYPTO_ALIAS(sk_delete_ptr); | |||
| 182 | void * | 182 | void * |
| 183 | sk_delete(_STACK *st, int loc) | 183 | sk_delete(_STACK *st, int loc) |
| 184 | { | 184 | { |
| 185 | char *ret; | 185 | void *ret; |
| 186 | 186 | ||
| 187 | if (!st || (loc < 0) || (loc >= st->num)) | 187 | if (!st || (loc < 0) || (loc >= st->num)) |
| 188 | return NULL; | 188 | return NULL; |
| @@ -190,7 +190,7 @@ sk_delete(_STACK *st, int loc) | |||
| 190 | ret = st->data[loc]; | 190 | ret = st->data[loc]; |
| 191 | if (loc != st->num - 1) { | 191 | if (loc != st->num - 1) { |
| 192 | memmove(&(st->data[loc]), &(st->data[loc + 1]), | 192 | memmove(&(st->data[loc]), &(st->data[loc + 1]), |
| 193 | sizeof(char *)*(st->num - 1 - loc)); | 193 | sizeof(void *) * (st->num - 1 - loc)); |
| 194 | } | 194 | } |
| 195 | st->num--; | 195 | st->num--; |
| 196 | return (ret); | 196 | return (ret); |
| @@ -244,7 +244,7 @@ sk_find(_STACK *st, void *data) | |||
| 244 | r = obj_bsearch_ex(&data, st->data, st->num, sizeof(void *), st->comp); | 244 | r = obj_bsearch_ex(&data, st->data, st->num, sizeof(void *), st->comp); |
| 245 | if (r == NULL) | 245 | if (r == NULL) |
| 246 | return (-1); | 246 | return (-1); |
| 247 | return (int)((char **)r - st->data); | 247 | return (int)((void **)r - st->data); |
| 248 | } | 248 | } |
| 249 | LCRYPTO_ALIAS(sk_find); | 249 | LCRYPTO_ALIAS(sk_find); |
| 250 | 250 | ||
| @@ -360,7 +360,7 @@ sk_sort(_STACK *st) | |||
| 360 | * type** with type**, so we leave the casting until absolutely | 360 | * type** with type**, so we leave the casting until absolutely |
| 361 | * necessary (ie. "now"). */ | 361 | * necessary (ie. "now"). */ |
| 362 | comp_func = (int (*)(const void *, const void *))(st->comp); | 362 | comp_func = (int (*)(const void *, const void *))(st->comp); |
| 363 | qsort(st->data, st->num, sizeof(char *), comp_func); | 363 | qsort(st->data, st->num, sizeof(void *), comp_func); |
| 364 | st->sorted = 1; | 364 | st->sorted = 1; |
| 365 | } | 365 | } |
| 366 | } | 366 | } |
diff --git a/src/lib/libcrypto/stack/stack_local.h b/src/lib/libcrypto/stack/stack_local.h index a330707192..63d793303a 100644 --- a/src/lib/libcrypto/stack/stack_local.h +++ b/src/lib/libcrypto/stack/stack_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: stack_local.h,v 1.1 2024/03/02 11:11:11 tb Exp $ */ | 1 | /* $OpenBSD: stack_local.h,v 1.2 2025/12/21 07:35:11 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -61,7 +61,7 @@ | |||
| 61 | 61 | ||
| 62 | struct stack_st { | 62 | struct stack_st { |
| 63 | int num; | 63 | int num; |
| 64 | char **data; | 64 | void **data; |
| 65 | int sorted; | 65 | int sorted; |
| 66 | 66 | ||
| 67 | int num_alloc; | 67 | int num_alloc; |
diff --git a/src/lib/libcrypto/ts/ts_asn1.c b/src/lib/libcrypto/ts/ts_asn1.c index feb2da68f9..aa3f4ba867 100644 --- a/src/lib/libcrypto/ts/ts_asn1.c +++ b/src/lib/libcrypto/ts/ts_asn1.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ts_asn1.c,v 1.15 2024/04/15 15:52:46 tb Exp $ */ | 1 | /* $OpenBSD: ts_asn1.c,v 1.16 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Written by Nils Larsch for the OpenSSL project 2004. | 2 | /* Written by Nils Larsch for the OpenSSL project 2004. |
| 3 | */ | 3 | */ |
| 4 | /* ==================================================================== | 4 | /* ==================================================================== |
| @@ -58,9 +58,9 @@ | |||
| 58 | #include <openssl/opensslconf.h> | 58 | #include <openssl/opensslconf.h> |
| 59 | 59 | ||
| 60 | #include <openssl/ts.h> | 60 | #include <openssl/ts.h> |
| 61 | #include <openssl/err.h> | ||
| 62 | #include <openssl/asn1t.h> | 61 | #include <openssl/asn1t.h> |
| 63 | 62 | ||
| 63 | #include "err_local.h" | ||
| 64 | #include "ts_local.h" | 64 | #include "ts_local.h" |
| 65 | 65 | ||
| 66 | static const ASN1_TEMPLATE TS_MSG_IMPRINT_seq_tt[] = { | 66 | static const ASN1_TEMPLATE TS_MSG_IMPRINT_seq_tt[] = { |
diff --git a/src/lib/libcrypto/ts/ts_conf.c b/src/lib/libcrypto/ts/ts_conf.c index bd499238f5..0acefa902f 100644 --- a/src/lib/libcrypto/ts/ts_conf.c +++ b/src/lib/libcrypto/ts/ts_conf.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ts_conf.c,v 1.15 2024/08/26 22:01:28 op Exp $ */ | 1 | /* $OpenBSD: ts_conf.c,v 1.16 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL | 2 | /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL |
| 3 | * project 2002. | 3 | * project 2002. |
| 4 | */ | 4 | */ |
| @@ -63,7 +63,6 @@ | |||
| 63 | #include <openssl/opensslconf.h> | 63 | #include <openssl/opensslconf.h> |
| 64 | 64 | ||
| 65 | #include <openssl/crypto.h> | 65 | #include <openssl/crypto.h> |
| 66 | #include <openssl/err.h> | ||
| 67 | #include <openssl/pem.h> | 66 | #include <openssl/pem.h> |
| 68 | #include <openssl/ts.h> | 67 | #include <openssl/ts.h> |
| 69 | 68 | ||
diff --git a/src/lib/libcrypto/ts/ts_lib.c b/src/lib/libcrypto/ts/ts_lib.c index 7e40101752..d497fed9d8 100644 --- a/src/lib/libcrypto/ts/ts_lib.c +++ b/src/lib/libcrypto/ts/ts_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ts_lib.c,v 1.15 2025/01/07 14:22:19 tb Exp $ */ | 1 | /* $OpenBSD: ts_lib.c,v 1.16 2025/12/05 14:19:27 tb Exp $ */ |
| 2 | /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL | 2 | /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL |
| 3 | * project 2002. | 3 | * project 2002. |
| 4 | */ | 4 | */ |
| @@ -155,7 +155,7 @@ TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *a) | |||
| 155 | 155 | ||
| 156 | BIO_printf(bio, "Message data:\n"); | 156 | BIO_printf(bio, "Message data:\n"); |
| 157 | msg = TS_MSG_IMPRINT_get_msg(a); | 157 | msg = TS_MSG_IMPRINT_get_msg(a); |
| 158 | BIO_dump_indent(bio, (const char *)ASN1_STRING_data(msg), | 158 | BIO_dump_indent(bio, (const char *)ASN1_STRING_get0_data(msg), |
| 159 | ASN1_STRING_length(msg), 4); | 159 | ASN1_STRING_length(msg), 4); |
| 160 | 160 | ||
| 161 | return 1; | 161 | return 1; |
diff --git a/src/lib/libcrypto/ts/ts_req_utils.c b/src/lib/libcrypto/ts/ts_req_utils.c index d679418060..fa3123863c 100644 --- a/src/lib/libcrypto/ts/ts_req_utils.c +++ b/src/lib/libcrypto/ts/ts_req_utils.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ts_req_utils.c,v 1.9 2023/07/07 19:37:54 beck Exp $ */ | 1 | /* $OpenBSD: ts_req_utils.c,v 1.10 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL | 2 | /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL |
| 3 | * project 2002. | 3 | * project 2002. |
| 4 | */ | 4 | */ |
| @@ -58,11 +58,11 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | 60 | ||
| 61 | #include <openssl/err.h> | ||
| 62 | #include <openssl/objects.h> | 61 | #include <openssl/objects.h> |
| 63 | #include <openssl/ts.h> | 62 | #include <openssl/ts.h> |
| 64 | #include <openssl/x509v3.h> | 63 | #include <openssl/x509v3.h> |
| 65 | 64 | ||
| 65 | #include "err_local.h" | ||
| 66 | #include "ts_local.h" | 66 | #include "ts_local.h" |
| 67 | 67 | ||
| 68 | int | 68 | int |
diff --git a/src/lib/libcrypto/ts/ts_rsp_sign.c b/src/lib/libcrypto/ts/ts_rsp_sign.c index e3101340c5..b8cc7e2baf 100644 --- a/src/lib/libcrypto/ts/ts_rsp_sign.c +++ b/src/lib/libcrypto/ts/ts_rsp_sign.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ts_rsp_sign.c,v 1.35 2024/03/26 00:39:22 beck Exp $ */ | 1 | /* $OpenBSD: ts_rsp_sign.c,v 1.37 2025/07/31 02:02:35 tb Exp $ */ |
| 2 | /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL | 2 | /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL |
| 3 | * project 2002. | 3 | * project 2002. |
| 4 | */ | 4 | */ |
| @@ -60,11 +60,11 @@ | |||
| 60 | 60 | ||
| 61 | #include <string.h> | 61 | #include <string.h> |
| 62 | 62 | ||
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
| 65 | #include <openssl/pkcs7.h> | 64 | #include <openssl/pkcs7.h> |
| 66 | #include <openssl/ts.h> | 65 | #include <openssl/ts.h> |
| 67 | 66 | ||
| 67 | #include "err_local.h" | ||
| 68 | #include "evp_local.h" | 68 | #include "evp_local.h" |
| 69 | #include "ts_local.h" | 69 | #include "ts_local.h" |
| 70 | #include "x509_local.h" | 70 | #include "x509_local.h" |
| @@ -955,28 +955,32 @@ static int | |||
| 955 | ESS_add_signing_cert(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *sc) | 955 | ESS_add_signing_cert(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *sc) |
| 956 | { | 956 | { |
| 957 | ASN1_STRING *seq = NULL; | 957 | ASN1_STRING *seq = NULL; |
| 958 | unsigned char *p, *pp = NULL; | 958 | unsigned char *data = NULL; |
| 959 | int len; | 959 | int len = 0; |
| 960 | int ret = 0; | ||
| 960 | 961 | ||
| 961 | len = i2d_ESS_SIGNING_CERT(sc, NULL); | 962 | if ((len = i2d_ESS_SIGNING_CERT(sc, &data)) <= 0) { |
| 962 | if (!(pp = malloc(len))) { | 963 | len = 0; |
| 963 | TSerror(ERR_R_MALLOC_FAILURE); | ||
| 964 | goto err; | 964 | goto err; |
| 965 | } | 965 | } |
| 966 | p = pp; | 966 | |
| 967 | i2d_ESS_SIGNING_CERT(sc, &p); | 967 | if ((seq = ASN1_STRING_new()) == NULL) |
| 968 | if (!(seq = ASN1_STRING_new()) || !ASN1_STRING_set(seq, pp, len)) { | ||
| 969 | TSerror(ERR_R_MALLOC_FAILURE); | ||
| 970 | goto err; | 968 | goto err; |
| 971 | } | ||
| 972 | free(pp); | ||
| 973 | pp = NULL; | ||
| 974 | return PKCS7_add_signed_attribute(si, | ||
| 975 | NID_id_smime_aa_signingCertificate, V_ASN1_SEQUENCE, seq); | ||
| 976 | 969 | ||
| 977 | err: | 970 | ASN1_STRING_set0(seq, data, len); |
| 971 | data = NULL; | ||
| 972 | len = 0; | ||
| 973 | |||
| 974 | if (!PKCS7_add_signed_attribute(si, NID_id_smime_aa_signingCertificate, | ||
| 975 | V_ASN1_SEQUENCE, seq)) | ||
| 976 | goto err; | ||
| 977 | seq = NULL; | ||
| 978 | |||
| 979 | ret = 1; | ||
| 980 | |||
| 981 | err: | ||
| 978 | ASN1_STRING_free(seq); | 982 | ASN1_STRING_free(seq); |
| 979 | free(pp); | 983 | freezero(data, len); |
| 980 | 984 | ||
| 981 | return 0; | 985 | return ret; |
| 982 | } | 986 | } |
diff --git a/src/lib/libcrypto/ts/ts_rsp_utils.c b/src/lib/libcrypto/ts/ts_rsp_utils.c index 34994adce8..ecdb46773f 100644 --- a/src/lib/libcrypto/ts/ts_rsp_utils.c +++ b/src/lib/libcrypto/ts/ts_rsp_utils.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ts_rsp_utils.c,v 1.11 2023/07/07 19:37:54 beck Exp $ */ | 1 | /* $OpenBSD: ts_rsp_utils.c,v 1.12 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL | 2 | /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL |
| 3 | * project 2002. | 3 | * project 2002. |
| 4 | */ | 4 | */ |
| @@ -58,11 +58,11 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | 60 | ||
| 61 | #include <openssl/err.h> | ||
| 62 | #include <openssl/objects.h> | 61 | #include <openssl/objects.h> |
| 63 | #include <openssl/pkcs7.h> | 62 | #include <openssl/pkcs7.h> |
| 64 | #include <openssl/ts.h> | 63 | #include <openssl/ts.h> |
| 65 | 64 | ||
| 65 | #include "err_local.h" | ||
| 66 | #include "ts_local.h" | 66 | #include "ts_local.h" |
| 67 | 67 | ||
| 68 | /* Function definitions. */ | 68 | /* Function definitions. */ |
diff --git a/src/lib/libcrypto/ts/ts_rsp_verify.c b/src/lib/libcrypto/ts/ts_rsp_verify.c index 69236f68ab..e9a778bb88 100644 --- a/src/lib/libcrypto/ts/ts_rsp_verify.c +++ b/src/lib/libcrypto/ts/ts_rsp_verify.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ts_rsp_verify.c,v 1.30 2023/07/07 07:25:21 beck Exp $ */ | 1 | /* $OpenBSD: ts_rsp_verify.c,v 1.32 2025/12/05 14:19:27 tb Exp $ */ |
| 2 | /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL | 2 | /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL |
| 3 | * project 2002. | 3 | * project 2002. |
| 4 | */ | 4 | */ |
| @@ -59,11 +59,11 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <string.h> | 60 | #include <string.h> |
| 61 | 61 | ||
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/objects.h> | 62 | #include <openssl/objects.h> |
| 64 | #include <openssl/pkcs7.h> | 63 | #include <openssl/pkcs7.h> |
| 65 | #include <openssl/ts.h> | 64 | #include <openssl/ts.h> |
| 66 | 65 | ||
| 66 | #include "err_local.h" | ||
| 67 | #include "evp_local.h" | 67 | #include "evp_local.h" |
| 68 | #include "ts_local.h" | 68 | #include "ts_local.h" |
| 69 | #include "x509_local.h" | 69 | #include "x509_local.h" |
| @@ -667,7 +667,7 @@ TS_get_status_text(STACK_OF(ASN1_UTF8STRING) *text) | |||
| 667 | ASN1_UTF8STRING *current = sk_ASN1_UTF8STRING_value(text, i); | 667 | ASN1_UTF8STRING *current = sk_ASN1_UTF8STRING_value(text, i); |
| 668 | if (i > 0) | 668 | if (i > 0) |
| 669 | strlcat(result, "/", length); | 669 | strlcat(result, "/", length); |
| 670 | strlcat(result, (const char *)ASN1_STRING_data(current), length); | 670 | strlcat(result, (const char *)ASN1_STRING_get0_data(current), length); |
| 671 | } | 671 | } |
| 672 | return result; | 672 | return result; |
| 673 | } | 673 | } |
| @@ -771,7 +771,7 @@ TS_check_imprints(X509_ALGOR *algor_a, unsigned char *imprint_a, unsigned len_a, | |||
| 771 | 771 | ||
| 772 | /* Compare octet strings. */ | 772 | /* Compare octet strings. */ |
| 773 | ret = len_a == (unsigned) ASN1_STRING_length(b->hashed_msg) && | 773 | ret = len_a == (unsigned) ASN1_STRING_length(b->hashed_msg) && |
| 774 | memcmp(imprint_a, ASN1_STRING_data(b->hashed_msg), len_a) == 0; | 774 | memcmp(imprint_a, ASN1_STRING_get0_data(b->hashed_msg), len_a) == 0; |
| 775 | 775 | ||
| 776 | err: | 776 | err: |
| 777 | if (!ret) | 777 | if (!ret) |
diff --git a/src/lib/libcrypto/ts/ts_verify_ctx.c b/src/lib/libcrypto/ts/ts_verify_ctx.c index 5a2d95c680..b2b160c511 100644 --- a/src/lib/libcrypto/ts/ts_verify_ctx.c +++ b/src/lib/libcrypto/ts/ts_verify_ctx.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ts_verify_ctx.c,v 1.14 2023/07/07 07:25:21 beck Exp $ */ | 1 | /* $OpenBSD: ts_verify_ctx.c,v 1.16 2025/12/05 14:19:27 tb Exp $ */ |
| 2 | /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL | 2 | /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL |
| 3 | * project 2003. | 3 | * project 2003. |
| 4 | */ | 4 | */ |
| @@ -58,10 +58,10 @@ | |||
| 58 | 58 | ||
| 59 | #include <string.h> | 59 | #include <string.h> |
| 60 | 60 | ||
| 61 | #include <openssl/err.h> | ||
| 62 | #include <openssl/objects.h> | 61 | #include <openssl/objects.h> |
| 63 | #include <openssl/ts.h> | 62 | #include <openssl/ts.h> |
| 64 | 63 | ||
| 64 | #include "err_local.h" | ||
| 65 | #include "ts_local.h" | 65 | #include "ts_local.h" |
| 66 | 66 | ||
| 67 | TS_VERIFY_CTX * | 67 | TS_VERIFY_CTX * |
| @@ -215,7 +215,7 @@ TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx) | |||
| 215 | ret->imprint_len = ASN1_STRING_length(msg); | 215 | ret->imprint_len = ASN1_STRING_length(msg); |
| 216 | if (!(ret->imprint = malloc(ret->imprint_len))) | 216 | if (!(ret->imprint = malloc(ret->imprint_len))) |
| 217 | goto err; | 217 | goto err; |
| 218 | memcpy(ret->imprint, ASN1_STRING_data(msg), ret->imprint_len); | 218 | memcpy(ret->imprint, ASN1_STRING_get0_data(msg), ret->imprint_len); |
| 219 | 219 | ||
| 220 | /* Setting nonce. */ | 220 | /* Setting nonce. */ |
| 221 | if ((nonce = TS_REQ_get_nonce(req)) != NULL) { | 221 | if ((nonce = TS_REQ_get_nonce(req)) != NULL) { |
diff --git a/src/lib/libcrypto/ui/ui_lib.c b/src/lib/libcrypto/ui/ui_lib.c index 73d899afcc..cc9de59c19 100644 --- a/src/lib/libcrypto/ui/ui_lib.c +++ b/src/lib/libcrypto/ui/ui_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ui_lib.c,v 1.51 2023/02/16 08:38:17 tb Exp $ */ | 1 | /* $OpenBSD: ui_lib.c,v 1.52 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | 2 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL |
| 3 | * project 2001. | 3 | * project 2001. |
| 4 | */ | 4 | */ |
| @@ -61,9 +61,9 @@ | |||
| 61 | #include <openssl/opensslconf.h> | 61 | #include <openssl/opensslconf.h> |
| 62 | 62 | ||
| 63 | #include <openssl/buffer.h> | 63 | #include <openssl/buffer.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | #include <openssl/ui.h> | 64 | #include <openssl/ui.h> |
| 66 | 65 | ||
| 66 | #include "err_local.h" | ||
| 67 | #include "ui_local.h" | 67 | #include "ui_local.h" |
| 68 | 68 | ||
| 69 | static const UI_METHOD *default_UI_meth = NULL; | 69 | static const UI_METHOD *default_UI_meth = NULL; |
diff --git a/src/lib/libcrypto/x509/by_dir.c b/src/lib/libcrypto/x509/by_dir.c index 2b2733a04b..9b239c1e9d 100644 --- a/src/lib/libcrypto/x509/by_dir.c +++ b/src/lib/libcrypto/x509/by_dir.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: by_dir.c,v 1.48 2024/08/31 10:19:17 tb Exp $ */ | 1 | /* $OpenBSD: by_dir.c,v 1.49 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -64,9 +64,9 @@ | |||
| 64 | 64 | ||
| 65 | #include <openssl/opensslconf.h> | 65 | #include <openssl/opensslconf.h> |
| 66 | 66 | ||
| 67 | #include <openssl/err.h> | ||
| 68 | #include <openssl/x509.h> | 67 | #include <openssl/x509.h> |
| 69 | 68 | ||
| 69 | #include "err_local.h" | ||
| 70 | #include "x509_local.h" | 70 | #include "x509_local.h" |
| 71 | 71 | ||
| 72 | typedef struct lookup_dir_hashes_st { | 72 | typedef struct lookup_dir_hashes_st { |
diff --git a/src/lib/libcrypto/x509/by_file.c b/src/lib/libcrypto/x509/by_file.c index 9b0fd2542c..86d4cd6b60 100644 --- a/src/lib/libcrypto/x509/by_file.c +++ b/src/lib/libcrypto/x509/by_file.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: by_file.c,v 1.31 2024/08/31 10:19:17 tb Exp $ */ | 1 | /* $OpenBSD: by_file.c,v 1.32 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -62,10 +62,10 @@ | |||
| 62 | #include <unistd.h> | 62 | #include <unistd.h> |
| 63 | 63 | ||
| 64 | #include <openssl/buffer.h> | 64 | #include <openssl/buffer.h> |
| 65 | #include <openssl/err.h> | ||
| 66 | #include <openssl/pem.h> | 65 | #include <openssl/pem.h> |
| 67 | #include <openssl/x509.h> | 66 | #include <openssl/x509.h> |
| 68 | 67 | ||
| 68 | #include "err_local.h" | ||
| 69 | #include "x509_local.h" | 69 | #include "x509_local.h" |
| 70 | 70 | ||
| 71 | static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, | 71 | static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, |
diff --git a/src/lib/libcrypto/x509/by_mem.c b/src/lib/libcrypto/x509/by_mem.c index 71afefa8a4..66093dd445 100644 --- a/src/lib/libcrypto/x509/by_mem.c +++ b/src/lib/libcrypto/x509/by_mem.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: by_mem.c,v 1.10 2024/08/31 10:19:17 tb Exp $ */ | 1 | /* $OpenBSD: by_mem.c,v 1.11 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -63,11 +63,11 @@ | |||
| 63 | #include <unistd.h> | 63 | #include <unistd.h> |
| 64 | 64 | ||
| 65 | #include <openssl/buffer.h> | 65 | #include <openssl/buffer.h> |
| 66 | #include <openssl/err.h> | ||
| 67 | #include <openssl/pem.h> | 66 | #include <openssl/pem.h> |
| 68 | #include <openssl/lhash.h> | 67 | #include <openssl/lhash.h> |
| 69 | #include <openssl/x509.h> | 68 | #include <openssl/x509.h> |
| 70 | 69 | ||
| 70 | #include "err_local.h" | ||
| 71 | #include "x509_local.h" | 71 | #include "x509_local.h" |
| 72 | 72 | ||
| 73 | static int by_mem_ctrl(X509_LOOKUP *, int, const char *, long, char **); | 73 | static int by_mem_ctrl(X509_LOOKUP *, int, const char *, long, char **); |
diff --git a/src/lib/libcrypto/x509/x509.h b/src/lib/libcrypto/x509/x509.h index a198b23202..7b33fef3c3 100644 --- a/src/lib/libcrypto/x509/x509.h +++ b/src/lib/libcrypto/x509/x509.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509.h,v 1.121 2025/03/09 15:17:22 tb Exp $ */ | 1 | /* $OpenBSD: x509.h,v 1.126 2026/01/01 06:51:49 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -178,6 +178,7 @@ DECLARE_STACK_OF(X509) | |||
| 178 | #define X509_FLAG_NO_SIGDUMP (1L << 9) | 178 | #define X509_FLAG_NO_SIGDUMP (1L << 9) |
| 179 | #define X509_FLAG_NO_AUX (1L << 10) | 179 | #define X509_FLAG_NO_AUX (1L << 10) |
| 180 | #define X509_FLAG_NO_ATTRIBUTES (1L << 11) | 180 | #define X509_FLAG_NO_ATTRIBUTES (1L << 11) |
| 181 | #define X509_FLAG_NO_IDS (1L << 12) | ||
| 181 | 182 | ||
| 182 | /* Flags specific to X509_NAME_print_ex() */ | 183 | /* Flags specific to X509_NAME_print_ex() */ |
| 183 | 184 | ||
| @@ -243,24 +244,9 @@ typedef struct X509_crl_info_st X509_CRL_INFO; | |||
| 243 | 244 | ||
| 244 | DECLARE_STACK_OF(X509_CRL) | 245 | DECLARE_STACK_OF(X509_CRL) |
| 245 | 246 | ||
| 247 | /* www/apache2 reaches into this. */ | ||
| 246 | typedef struct private_key_st { | 248 | typedef struct private_key_st { |
| 247 | int version; | ||
| 248 | /* The PKCS#8 data types */ | ||
| 249 | X509_ALGOR *enc_algor; | ||
| 250 | ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */ | ||
| 251 | |||
| 252 | /* When decrypted, the following will not be NULL */ | ||
| 253 | EVP_PKEY *dec_pkey; | 249 | EVP_PKEY *dec_pkey; |
| 254 | |||
| 255 | /* used to encrypt and decrypt */ | ||
| 256 | int key_length; | ||
| 257 | char *key_data; | ||
| 258 | int key_free; /* true if we should auto free key_data */ | ||
| 259 | |||
| 260 | /* expanded version of 'enc_algor' */ | ||
| 261 | EVP_CIPHER_INFO cipher; | ||
| 262 | |||
| 263 | int references; | ||
| 264 | } X509_PKEY; | 250 | } X509_PKEY; |
| 265 | 251 | ||
| 266 | #ifndef OPENSSL_NO_EVP | 252 | #ifndef OPENSSL_NO_EVP |
| @@ -312,7 +298,7 @@ extern "C" { | |||
| 312 | 298 | ||
| 313 | #define X509_extract_key(x) X509_get_pubkey(x) /*****/ | 299 | #define X509_extract_key(x) X509_get_pubkey(x) /*****/ |
| 314 | #define X509_REQ_extract_key(a) X509_REQ_get_pubkey(a) | 300 | #define X509_REQ_extract_key(a) X509_REQ_get_pubkey(a) |
| 315 | #define X509_name_cmp(a,b) X509_NAME_cmp((a),(b)) | 301 | #define X509_name_cmp(a, b) X509_NAME_cmp((a), (b)) |
| 316 | 302 | ||
| 317 | int X509_CRL_up_ref(X509_CRL *x); | 303 | int X509_CRL_up_ref(X509_CRL *x); |
| 318 | int X509_CRL_get_signature_nid(const X509_CRL *crl); | 304 | int X509_CRL_get_signature_nid(const X509_CRL *crl); |
| @@ -367,31 +353,31 @@ int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md); | |||
| 367 | int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx); | 353 | int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx); |
| 368 | int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md); | 354 | int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md); |
| 369 | 355 | ||
| 370 | int X509_pubkey_digest(const X509 *data,const EVP_MD *type, | 356 | int X509_pubkey_digest(const X509 *data, const EVP_MD *type, |
| 371 | unsigned char *md, unsigned int *len); | 357 | unsigned char *md, unsigned int *len); |
| 372 | int X509_digest(const X509 *data,const EVP_MD *type, | 358 | int X509_digest(const X509 *data, const EVP_MD *type, |
| 373 | unsigned char *md, unsigned int *len); | 359 | unsigned char *md, unsigned int *len); |
| 374 | int X509_CRL_digest(const X509_CRL *data,const EVP_MD *type, | 360 | int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type, |
| 375 | unsigned char *md, unsigned int *len); | 361 | unsigned char *md, unsigned int *len); |
| 376 | int X509_REQ_digest(const X509_REQ *data,const EVP_MD *type, | 362 | int X509_REQ_digest(const X509_REQ *data, const EVP_MD *type, |
| 377 | unsigned char *md, unsigned int *len); | 363 | unsigned char *md, unsigned int *len); |
| 378 | int X509_NAME_digest(const X509_NAME *data,const EVP_MD *type, | 364 | int X509_NAME_digest(const X509_NAME *data, const EVP_MD *type, |
| 379 | unsigned char *md, unsigned int *len); | 365 | unsigned char *md, unsigned int *len); |
| 380 | #endif | 366 | #endif |
| 381 | 367 | ||
| 382 | X509 *d2i_X509_fp(FILE *fp, X509 **x509); | 368 | X509 *d2i_X509_fp(FILE *fp, X509 **x509); |
| 383 | int i2d_X509_fp(FILE *fp,X509 *x509); | 369 | int i2d_X509_fp(FILE *fp, X509 *x509); |
| 384 | X509_CRL *d2i_X509_CRL_fp(FILE *fp,X509_CRL **crl); | 370 | X509_CRL *d2i_X509_CRL_fp(FILE *fp, X509_CRL **crl); |
| 385 | int i2d_X509_CRL_fp(FILE *fp,X509_CRL *crl); | 371 | int i2d_X509_CRL_fp(FILE *fp, X509_CRL *crl); |
| 386 | X509_REQ *d2i_X509_REQ_fp(FILE *fp,X509_REQ **req); | 372 | X509_REQ *d2i_X509_REQ_fp(FILE *fp, X509_REQ **req); |
| 387 | int i2d_X509_REQ_fp(FILE *fp,X509_REQ *req); | 373 | int i2d_X509_REQ_fp(FILE *fp, X509_REQ *req); |
| 388 | #ifndef OPENSSL_NO_RSA | 374 | #ifndef OPENSSL_NO_RSA |
| 389 | RSA *d2i_RSAPrivateKey_fp(FILE *fp,RSA **rsa); | 375 | RSA *d2i_RSAPrivateKey_fp(FILE *fp, RSA **rsa); |
| 390 | int i2d_RSAPrivateKey_fp(FILE *fp,RSA *rsa); | 376 | int i2d_RSAPrivateKey_fp(FILE *fp, RSA *rsa); |
| 391 | RSA *d2i_RSAPublicKey_fp(FILE *fp,RSA **rsa); | 377 | RSA *d2i_RSAPublicKey_fp(FILE *fp, RSA **rsa); |
| 392 | int i2d_RSAPublicKey_fp(FILE *fp,RSA *rsa); | 378 | int i2d_RSAPublicKey_fp(FILE *fp, RSA *rsa); |
| 393 | RSA *d2i_RSA_PUBKEY_fp(FILE *fp,RSA **rsa); | 379 | RSA *d2i_RSA_PUBKEY_fp(FILE *fp, RSA **rsa); |
| 394 | int i2d_RSA_PUBKEY_fp(FILE *fp,RSA *rsa); | 380 | int i2d_RSA_PUBKEY_fp(FILE *fp, RSA *rsa); |
| 395 | #endif | 381 | #endif |
| 396 | #ifndef OPENSSL_NO_DSA | 382 | #ifndef OPENSSL_NO_DSA |
| 397 | DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa); | 383 | DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa); |
| @@ -405,11 +391,11 @@ int i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey); | |||
| 405 | EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey); | 391 | EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey); |
| 406 | int i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey); | 392 | int i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey); |
| 407 | #endif | 393 | #endif |
| 408 | X509_SIG *d2i_PKCS8_fp(FILE *fp,X509_SIG **p8); | 394 | X509_SIG *d2i_PKCS8_fp(FILE *fp, X509_SIG **p8); |
| 409 | int i2d_PKCS8_fp(FILE *fp,X509_SIG *p8); | 395 | int i2d_PKCS8_fp(FILE *fp, X509_SIG *p8); |
| 410 | PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, | 396 | PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, |
| 411 | PKCS8_PRIV_KEY_INFO **p8inf); | 397 | PKCS8_PRIV_KEY_INFO **p8inf); |
| 412 | int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,PKCS8_PRIV_KEY_INFO *p8inf); | 398 | int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, PKCS8_PRIV_KEY_INFO *p8inf); |
| 413 | int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key); | 399 | int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key); |
| 414 | int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey); | 400 | int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey); |
| 415 | EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a); | 401 | EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a); |
| @@ -417,19 +403,19 @@ int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey); | |||
| 417 | EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a); | 403 | EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a); |
| 418 | 404 | ||
| 419 | #ifndef OPENSSL_NO_BIO | 405 | #ifndef OPENSSL_NO_BIO |
| 420 | X509 *d2i_X509_bio(BIO *bp,X509 **x509); | 406 | X509 *d2i_X509_bio(BIO *bp, X509 **x509); |
| 421 | int i2d_X509_bio(BIO *bp,X509 *x509); | 407 | int i2d_X509_bio(BIO *bp, X509 *x509); |
| 422 | X509_CRL *d2i_X509_CRL_bio(BIO *bp,X509_CRL **crl); | 408 | X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **crl); |
| 423 | int i2d_X509_CRL_bio(BIO *bp,X509_CRL *crl); | 409 | int i2d_X509_CRL_bio(BIO *bp, X509_CRL *crl); |
| 424 | X509_REQ *d2i_X509_REQ_bio(BIO *bp,X509_REQ **req); | 410 | X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **req); |
| 425 | int i2d_X509_REQ_bio(BIO *bp,X509_REQ *req); | 411 | int i2d_X509_REQ_bio(BIO *bp, X509_REQ *req); |
| 426 | #ifndef OPENSSL_NO_RSA | 412 | #ifndef OPENSSL_NO_RSA |
| 427 | RSA *d2i_RSAPrivateKey_bio(BIO *bp,RSA **rsa); | 413 | RSA *d2i_RSAPrivateKey_bio(BIO *bp, RSA **rsa); |
| 428 | int i2d_RSAPrivateKey_bio(BIO *bp,RSA *rsa); | 414 | int i2d_RSAPrivateKey_bio(BIO *bp, RSA *rsa); |
| 429 | RSA *d2i_RSAPublicKey_bio(BIO *bp,RSA **rsa); | 415 | RSA *d2i_RSAPublicKey_bio(BIO *bp, RSA **rsa); |
| 430 | int i2d_RSAPublicKey_bio(BIO *bp,RSA *rsa); | 416 | int i2d_RSAPublicKey_bio(BIO *bp, RSA *rsa); |
| 431 | RSA *d2i_RSA_PUBKEY_bio(BIO *bp,RSA **rsa); | 417 | RSA *d2i_RSA_PUBKEY_bio(BIO *bp, RSA **rsa); |
| 432 | int i2d_RSA_PUBKEY_bio(BIO *bp,RSA *rsa); | 418 | int i2d_RSA_PUBKEY_bio(BIO *bp, RSA *rsa); |
| 433 | #endif | 419 | #endif |
| 434 | #ifndef OPENSSL_NO_DSA | 420 | #ifndef OPENSSL_NO_DSA |
| 435 | DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa); | 421 | DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa); |
| @@ -443,11 +429,11 @@ int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *eckey); | |||
| 443 | EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey); | 429 | EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey); |
| 444 | int i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey); | 430 | int i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey); |
| 445 | #endif | 431 | #endif |
| 446 | X509_SIG *d2i_PKCS8_bio(BIO *bp,X509_SIG **p8); | 432 | X509_SIG *d2i_PKCS8_bio(BIO *bp, X509_SIG **p8); |
| 447 | int i2d_PKCS8_bio(BIO *bp,X509_SIG *p8); | 433 | int i2d_PKCS8_bio(BIO *bp, X509_SIG *p8); |
| 448 | PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, | 434 | PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, |
| 449 | PKCS8_PRIV_KEY_INFO **p8inf); | 435 | PKCS8_PRIV_KEY_INFO **p8inf); |
| 450 | int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,PKCS8_PRIV_KEY_INFO *p8inf); | 436 | int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, PKCS8_PRIV_KEY_INFO *p8inf); |
| 451 | int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key); | 437 | int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key); |
| 452 | int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey); | 438 | int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey); |
| 453 | EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a); | 439 | EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a); |
| @@ -485,7 +471,7 @@ const char * X509_get_default_cert_file_env(void ); | |||
| 485 | const char * X509_get_default_private_dir(void ); | 471 | const char * X509_get_default_private_dir(void ); |
| 486 | 472 | ||
| 487 | X509_REQ * X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); | 473 | X509_REQ * X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); |
| 488 | X509 * X509_REQ_to_X509(X509_REQ *r, int days,EVP_PKEY *pkey); | 474 | X509 * X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey); |
| 489 | 475 | ||
| 490 | X509_ALGOR *X509_ALGOR_new(void); | 476 | X509_ALGOR *X509_ALGOR_new(void); |
| 491 | void X509_ALGOR_free(X509_ALGOR *a); | 477 | void X509_ALGOR_free(X509_ALGOR *a); |
| @@ -512,17 +498,17 @@ EVP_PKEY * X509_PUBKEY_get(X509_PUBKEY *key); | |||
| 512 | EVP_PKEY * X509_PUBKEY_get0(X509_PUBKEY *key); | 498 | EVP_PKEY * X509_PUBKEY_get0(X509_PUBKEY *key); |
| 513 | int X509_get_pubkey_parameters(EVP_PKEY *pkey, | 499 | int X509_get_pubkey_parameters(EVP_PKEY *pkey, |
| 514 | STACK_OF(X509) *chain); | 500 | STACK_OF(X509) *chain); |
| 515 | int i2d_PUBKEY(EVP_PKEY *a,unsigned char **pp); | 501 | int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp); |
| 516 | EVP_PKEY * d2i_PUBKEY(EVP_PKEY **a,const unsigned char **pp, | 502 | EVP_PKEY * d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, |
| 517 | long length); | 503 | long length); |
| 518 | #ifndef OPENSSL_NO_RSA | 504 | #ifndef OPENSSL_NO_RSA |
| 519 | int i2d_RSA_PUBKEY(RSA *a,unsigned char **pp); | 505 | int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp); |
| 520 | RSA * d2i_RSA_PUBKEY(RSA **a,const unsigned char **pp, | 506 | RSA * d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, |
| 521 | long length); | 507 | long length); |
| 522 | #endif | 508 | #endif |
| 523 | #ifndef OPENSSL_NO_DSA | 509 | #ifndef OPENSSL_NO_DSA |
| 524 | int i2d_DSA_PUBKEY(DSA *a,unsigned char **pp); | 510 | int i2d_DSA_PUBKEY(DSA *a, unsigned char **pp); |
| 525 | DSA * d2i_DSA_PUBKEY(DSA **a,const unsigned char **pp, | 511 | DSA * d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp, |
| 526 | long length); | 512 | long length); |
| 527 | #endif | 513 | #endif |
| 528 | #ifndef OPENSSL_NO_EC | 514 | #ifndef OPENSSL_NO_EC |
| @@ -598,8 +584,8 @@ int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | |||
| 598 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); | 584 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); |
| 599 | int X509_set_ex_data(X509 *r, int idx, void *arg); | 585 | int X509_set_ex_data(X509 *r, int idx, void *arg); |
| 600 | void *X509_get_ex_data(X509 *r, int idx); | 586 | void *X509_get_ex_data(X509 *r, int idx); |
| 601 | int i2d_X509_AUX(X509 *a,unsigned char **pp); | 587 | int i2d_X509_AUX(X509 *a, unsigned char **pp); |
| 602 | X509 * d2i_X509_AUX(X509 **a,const unsigned char **pp,long length); | 588 | X509 * d2i_X509_AUX(X509 **a, const unsigned char **pp, long length); |
| 603 | 589 | ||
| 604 | int i2d_re_X509_tbs(X509 *x, unsigned char **pp); | 590 | int i2d_re_X509_tbs(X509 *x, unsigned char **pp); |
| 605 | 591 | ||
| @@ -646,9 +632,6 @@ int X509_CRL_get0_by_serial(X509_CRL *crl, | |||
| 646 | X509_REVOKED **ret, ASN1_INTEGER *serial); | 632 | X509_REVOKED **ret, ASN1_INTEGER *serial); |
| 647 | int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x); | 633 | int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x); |
| 648 | 634 | ||
| 649 | X509_PKEY * X509_PKEY_new(void ); | ||
| 650 | void X509_PKEY_free(X509_PKEY *a); | ||
| 651 | |||
| 652 | NETSCAPE_SPKI *NETSCAPE_SPKI_new(void); | 635 | NETSCAPE_SPKI *NETSCAPE_SPKI_new(void); |
| 653 | void NETSCAPE_SPKI_free(NETSCAPE_SPKI *a); | 636 | void NETSCAPE_SPKI_free(NETSCAPE_SPKI *a); |
| 654 | NETSCAPE_SPKI *d2i_NETSCAPE_SPKI(NETSCAPE_SPKI **a, const unsigned char **in, long len); | 637 | NETSCAPE_SPKI *d2i_NETSCAPE_SPKI(NETSCAPE_SPKI **a, const unsigned char **in, long len); |
| @@ -665,11 +648,11 @@ X509_INFO * X509_INFO_new(void); | |||
| 665 | void X509_INFO_free(X509_INFO *a); | 648 | void X509_INFO_free(X509_INFO *a); |
| 666 | char * X509_NAME_oneline(const X509_NAME *a, char *buf, int size); | 649 | char * X509_NAME_oneline(const X509_NAME *a, char *buf, int size); |
| 667 | 650 | ||
| 668 | int ASN1_item_digest(const ASN1_ITEM *it,const EVP_MD *type,void *data, | 651 | int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *data, |
| 669 | unsigned char *md,unsigned int *len); | 652 | unsigned char *md, unsigned int *len); |
| 670 | 653 | ||
| 671 | int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1, | 654 | int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1, |
| 672 | ASN1_BIT_STRING *signature,void *data,EVP_PKEY *pkey); | 655 | ASN1_BIT_STRING *signature, void *data, EVP_PKEY *pkey); |
| 673 | 656 | ||
| 674 | int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, | 657 | int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, |
| 675 | ASN1_BIT_STRING *signature, | 658 | ASN1_BIT_STRING *signature, |
| @@ -710,7 +693,7 @@ int X509_get_signature_type(const X509 *x); | |||
| 710 | #define X509_get_notBefore X509_getm_notBefore | 693 | #define X509_get_notBefore X509_getm_notBefore |
| 711 | #define X509_get_notAfter X509_getm_notAfter | 694 | #define X509_get_notAfter X509_getm_notAfter |
| 712 | 695 | ||
| 713 | int X509_REQ_set_version(X509_REQ *x,long version); | 696 | int X509_REQ_set_version(X509_REQ *x, long version); |
| 714 | long X509_REQ_get_version(const X509_REQ *x); | 697 | long X509_REQ_get_version(const X509_REQ *x); |
| 715 | int X509_REQ_set_subject_name(X509_REQ *req, X509_NAME *name); | 698 | int X509_REQ_set_subject_name(X509_REQ *req, X509_NAME *name); |
| 716 | X509_NAME *X509_REQ_get_subject_name(const X509_REQ *x); | 699 | X509_NAME *X509_REQ_get_subject_name(const X509_REQ *x); |
| @@ -755,7 +738,7 @@ const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *x); | |||
| 755 | int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm); | 738 | int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm); |
| 756 | int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial); | 739 | int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial); |
| 757 | 740 | ||
| 758 | int X509_REQ_check_private_key(X509_REQ *x509,EVP_PKEY *pkey); | 741 | int X509_REQ_check_private_key(X509_REQ *x509, EVP_PKEY *pkey); |
| 759 | 742 | ||
| 760 | int X509_check_private_key(const X509 *x509, const EVP_PKEY *pkey); | 743 | int X509_check_private_key(const X509 *x509, const EVP_PKEY *pkey); |
| 761 | 744 | ||
| @@ -780,29 +763,29 @@ unsigned long X509_NAME_hash_old(X509_NAME *x); | |||
| 780 | 763 | ||
| 781 | int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b); | 764 | int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b); |
| 782 | int X509_CRL_match(const X509_CRL *a, const X509_CRL *b); | 765 | int X509_CRL_match(const X509_CRL *a, const X509_CRL *b); |
| 783 | int X509_print_ex_fp(FILE *bp,X509 *x, unsigned long nmflag, unsigned long cflag); | 766 | int X509_print_ex_fp(FILE *bp, X509 *x, unsigned long nmflag, unsigned long cflag); |
| 784 | int X509_print_fp(FILE *bp,X509 *x); | 767 | int X509_print_fp(FILE *bp, X509 *x); |
| 785 | int X509_CRL_print_fp(FILE *bp,X509_CRL *x); | 768 | int X509_CRL_print_fp(FILE *bp, X509_CRL *x); |
| 786 | int X509_REQ_print_fp(FILE *bp,X509_REQ *req); | 769 | int X509_REQ_print_fp(FILE *bp, X509_REQ *req); |
| 787 | int X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm, int indent, | 770 | int X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm, int indent, |
| 788 | unsigned long flags); | 771 | unsigned long flags); |
| 789 | 772 | ||
| 790 | #ifndef OPENSSL_NO_BIO | 773 | #ifndef OPENSSL_NO_BIO |
| 791 | int X509_NAME_print_ex(BIO *out, const X509_NAME *nm, int indent, | 774 | int X509_NAME_print_ex(BIO *out, const X509_NAME *nm, int indent, |
| 792 | unsigned long flags); | 775 | unsigned long flags); |
| 793 | int X509_print_ex(BIO *bp,X509 *x, unsigned long nmflag, unsigned long cflag); | 776 | int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflag, unsigned long cflag); |
| 794 | int X509_print(BIO *bp,X509 *x); | 777 | int X509_print(BIO *bp, X509 *x); |
| 795 | int X509_ocspid_print(BIO *bp,X509 *x); | 778 | int X509_ocspid_print(BIO *bp, X509 *x); |
| 796 | int X509_CRL_print(BIO *bp,X509_CRL *x); | 779 | int X509_CRL_print(BIO *bp, X509_CRL *x); |
| 797 | int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag, unsigned long cflag); | 780 | int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag, unsigned long cflag); |
| 798 | int X509_REQ_print(BIO *bp,X509_REQ *req); | 781 | int X509_REQ_print(BIO *bp, X509_REQ *req); |
| 799 | #endif | 782 | #endif |
| 800 | 783 | ||
| 801 | int X509_NAME_entry_count(const X509_NAME *name); | 784 | int X509_NAME_entry_count(const X509_NAME *name); |
| 802 | int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, | 785 | int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, |
| 803 | char *buf,int len); | 786 | char *buf, int len); |
| 804 | int X509_NAME_get_text_by_OBJ(X509_NAME *name, | 787 | int X509_NAME_get_text_by_OBJ(X509_NAME *name, |
| 805 | const ASN1_OBJECT *obj, char *buf,int len); | 788 | const ASN1_OBJECT *obj, char *buf, int len); |
| 806 | 789 | ||
| 807 | /* NOTE: you should be passing -1, not 0 as lastpos. The functions that use | 790 | /* NOTE: you should be passing -1, not 0 as lastpos. The functions that use |
| 808 | * lastpos, search after that position on. */ | 791 | * lastpos, search after that position on. */ |
| @@ -920,9 +903,9 @@ ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx); | |||
| 920 | int X509_verify_cert(X509_STORE_CTX *ctx); | 903 | int X509_verify_cert(X509_STORE_CTX *ctx); |
| 921 | 904 | ||
| 922 | /* lookup a cert from a X509 STACK */ | 905 | /* lookup a cert from a X509 STACK */ |
| 923 | X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk,X509_NAME *name, | 906 | X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk, X509_NAME *name, |
| 924 | ASN1_INTEGER *serial); | 907 | ASN1_INTEGER *serial); |
| 925 | X509 *X509_find_by_subject(STACK_OF(X509) *sk,X509_NAME *name); | 908 | X509 *X509_find_by_subject(STACK_OF(X509) *sk, X509_NAME *name); |
| 926 | 909 | ||
| 927 | extern const ASN1_ITEM PBEPARAM_it; | 910 | extern const ASN1_ITEM PBEPARAM_it; |
| 928 | 911 | ||
| @@ -1013,6 +996,7 @@ void ERR_load_X509_strings(void); | |||
| 1013 | #define X509_R_ERR_ASN1_LIB 102 | 996 | #define X509_R_ERR_ASN1_LIB 102 |
| 1014 | #define X509_R_INVALID_DIRECTORY 113 | 997 | #define X509_R_INVALID_DIRECTORY 113 |
| 1015 | #define X509_R_INVALID_FIELD_NAME 119 | 998 | #define X509_R_INVALID_FIELD_NAME 119 |
| 999 | #define X509_R_INVALID_POLICY_EXTENSION 201 | ||
| 1016 | #define X509_R_INVALID_TRUST 123 | 1000 | #define X509_R_INVALID_TRUST 123 |
| 1017 | #define X509_R_INVALID_VERSION 137 | 1001 | #define X509_R_INVALID_VERSION 137 |
| 1018 | #define X509_R_KEY_TYPE_MISMATCH 115 | 1002 | #define X509_R_KEY_TYPE_MISMATCH 115 |
diff --git a/src/lib/libcrypto/x509/x509_addr.c b/src/lib/libcrypto/x509/x509_addr.c index 2208cc434e..b4ee92a14b 100644 --- a/src/lib/libcrypto/x509/x509_addr.c +++ b/src/lib/libcrypto/x509/x509_addr.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_addr.c,v 1.93 2024/07/13 15:08:58 tb Exp $ */ | 1 | /* $OpenBSD: x509_addr.c,v 1.94 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Contributed to the OpenSSL Project by the American Registry for | 3 | * Contributed to the OpenSSL Project by the American Registry for |
| 4 | * Internet Numbers ("ARIN"). | 4 | * Internet Numbers ("ARIN"). |
| @@ -69,12 +69,12 @@ | |||
| 69 | #include <openssl/asn1t.h> | 69 | #include <openssl/asn1t.h> |
| 70 | #include <openssl/buffer.h> | 70 | #include <openssl/buffer.h> |
| 71 | #include <openssl/conf.h> | 71 | #include <openssl/conf.h> |
| 72 | #include <openssl/err.h> | ||
| 73 | #include <openssl/x509.h> | 72 | #include <openssl/x509.h> |
| 74 | #include <openssl/x509v3.h> | 73 | #include <openssl/x509v3.h> |
| 75 | 74 | ||
| 76 | #include "asn1_local.h" | 75 | #include "asn1_local.h" |
| 77 | #include "bytestring.h" | 76 | #include "bytestring.h" |
| 77 | #include "err_local.h" | ||
| 78 | #include "x509_local.h" | 78 | #include "x509_local.h" |
| 79 | 79 | ||
| 80 | #ifndef OPENSSL_NO_RFC3779 | 80 | #ifndef OPENSSL_NO_RFC3779 |
diff --git a/src/lib/libcrypto/x509/x509_akey.c b/src/lib/libcrypto/x509/x509_akey.c index 926508c4cd..524fea8009 100644 --- a/src/lib/libcrypto/x509/x509_akey.c +++ b/src/lib/libcrypto/x509/x509_akey.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_akey.c,v 1.3 2024/08/31 10:03:03 tb Exp $ */ | 1 | /* $OpenBSD: x509_akey.c,v 1.4 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -62,9 +62,9 @@ | |||
| 62 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
| 63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
| 64 | #include <openssl/conf.h> | 64 | #include <openssl/conf.h> |
| 65 | #include <openssl/err.h> | ||
| 66 | #include <openssl/x509v3.h> | 65 | #include <openssl/x509v3.h> |
| 67 | 66 | ||
| 67 | #include "err_local.h" | ||
| 68 | #include "x509_local.h" | 68 | #include "x509_local.h" |
| 69 | 69 | ||
| 70 | static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_KEYID(X509V3_EXT_METHOD *method, | 70 | static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_KEYID(X509V3_EXT_METHOD *method, |
diff --git a/src/lib/libcrypto/x509/x509_alt.c b/src/lib/libcrypto/x509/x509_alt.c index 34734a55bd..ca91493848 100644 --- a/src/lib/libcrypto/x509/x509_alt.c +++ b/src/lib/libcrypto/x509/x509_alt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_alt.c,v 1.19 2025/03/06 07:20:01 tb Exp $ */ | 1 | /* $OpenBSD: x509_alt.c,v 1.20 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project. | 3 | * project. |
| 4 | */ | 4 | */ |
| @@ -60,9 +60,9 @@ | |||
| 60 | #include <string.h> | 60 | #include <string.h> |
| 61 | 61 | ||
| 62 | #include <openssl/conf.h> | 62 | #include <openssl/conf.h> |
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/x509v3.h> | 63 | #include <openssl/x509v3.h> |
| 65 | 64 | ||
| 65 | #include "err_local.h" | ||
| 66 | #include "x509_internal.h" | 66 | #include "x509_internal.h" |
| 67 | 67 | ||
| 68 | static GENERAL_NAMES *v2i_subject_alt(X509V3_EXT_METHOD *method, | 68 | static GENERAL_NAMES *v2i_subject_alt(X509V3_EXT_METHOD *method, |
diff --git a/src/lib/libcrypto/x509/x509_asid.c b/src/lib/libcrypto/x509/x509_asid.c index 40ee201a9f..45a154e7d9 100644 --- a/src/lib/libcrypto/x509/x509_asid.c +++ b/src/lib/libcrypto/x509/x509_asid.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_asid.c,v 1.45 2024/07/13 15:08:58 tb Exp $ */ | 1 | /* $OpenBSD: x509_asid.c,v 1.46 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Contributed to the OpenSSL Project by the American Registry for | 3 | * Contributed to the OpenSSL Project by the American Registry for |
| 4 | * Internet Numbers ("ARIN"). | 4 | * Internet Numbers ("ARIN"). |
| @@ -68,10 +68,10 @@ | |||
| 68 | #include <openssl/asn1t.h> | 68 | #include <openssl/asn1t.h> |
| 69 | #include <openssl/bn.h> | 69 | #include <openssl/bn.h> |
| 70 | #include <openssl/conf.h> | 70 | #include <openssl/conf.h> |
| 71 | #include <openssl/err.h> | ||
| 72 | #include <openssl/x509.h> | 71 | #include <openssl/x509.h> |
| 73 | #include <openssl/x509v3.h> | 72 | #include <openssl/x509v3.h> |
| 74 | 73 | ||
| 74 | #include "err_local.h" | ||
| 75 | #include "x509_local.h" | 75 | #include "x509_local.h" |
| 76 | 76 | ||
| 77 | #ifndef OPENSSL_NO_RFC3779 | 77 | #ifndef OPENSSL_NO_RFC3779 |
diff --git a/src/lib/libcrypto/x509/x509_att.c b/src/lib/libcrypto/x509/x509_att.c index 4931cbbc17..a442a17746 100644 --- a/src/lib/libcrypto/x509/x509_att.c +++ b/src/lib/libcrypto/x509/x509_att.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_att.c,v 1.25 2024/08/31 10:46:40 tb Exp $ */ | 1 | /* $OpenBSD: x509_att.c,v 1.26 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -59,13 +59,13 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | 60 | ||
| 61 | #include <openssl/asn1.h> | 61 | #include <openssl/asn1.h> |
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
| 64 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
| 65 | #include <openssl/stack.h> | 64 | #include <openssl/stack.h> |
| 66 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
| 67 | #include <openssl/x509v3.h> | 66 | #include <openssl/x509v3.h> |
| 68 | 67 | ||
| 68 | #include "err_local.h" | ||
| 69 | #include "x509_local.h" | 69 | #include "x509_local.h" |
| 70 | 70 | ||
| 71 | int | 71 | int |
diff --git a/src/lib/libcrypto/x509/x509_bcons.c b/src/lib/libcrypto/x509/x509_bcons.c index 99cb5afe9a..c10f822ccc 100644 --- a/src/lib/libcrypto/x509/x509_bcons.c +++ b/src/lib/libcrypto/x509/x509_bcons.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_bcons.c,v 1.6 2024/08/31 10:03:03 tb Exp $ */ | 1 | /* $OpenBSD: x509_bcons.c,v 1.7 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -62,9 +62,9 @@ | |||
| 62 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
| 63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
| 64 | #include <openssl/conf.h> | 64 | #include <openssl/conf.h> |
| 65 | #include <openssl/err.h> | ||
| 66 | #include <openssl/x509v3.h> | 65 | #include <openssl/x509v3.h> |
| 67 | 66 | ||
| 67 | #include "err_local.h" | ||
| 68 | #include "x509_local.h" | 68 | #include "x509_local.h" |
| 69 | 69 | ||
| 70 | static STACK_OF(CONF_VALUE) *i2v_BASIC_CONSTRAINTS(X509V3_EXT_METHOD *method, | 70 | static STACK_OF(CONF_VALUE) *i2v_BASIC_CONSTRAINTS(X509V3_EXT_METHOD *method, |
diff --git a/src/lib/libcrypto/x509/x509_bitst.c b/src/lib/libcrypto/x509/x509_bitst.c index 2bc4f9911a..89289b7af0 100644 --- a/src/lib/libcrypto/x509/x509_bitst.c +++ b/src/lib/libcrypto/x509/x509_bitst.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_bitst.c,v 1.8 2024/08/31 10:23:13 tb Exp $ */ | 1 | /* $OpenBSD: x509_bitst.c,v 1.9 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -60,9 +60,9 @@ | |||
| 60 | #include <string.h> | 60 | #include <string.h> |
| 61 | 61 | ||
| 62 | #include <openssl/conf.h> | 62 | #include <openssl/conf.h> |
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/x509v3.h> | 63 | #include <openssl/x509v3.h> |
| 65 | 64 | ||
| 65 | #include "err_local.h" | ||
| 66 | #include "x509_local.h" | 66 | #include "x509_local.h" |
| 67 | 67 | ||
| 68 | static const BIT_STRING_BITNAME ns_cert_type_table[] = { | 68 | static const BIT_STRING_BITNAME ns_cert_type_table[] = { |
diff --git a/src/lib/libcrypto/x509/x509_cmp.c b/src/lib/libcrypto/x509/x509_cmp.c index 2c1e427093..2479dcdd0d 100644 --- a/src/lib/libcrypto/x509/x509_cmp.c +++ b/src/lib/libcrypto/x509/x509_cmp.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_cmp.c,v 1.44 2024/03/25 03:41:16 joshua Exp $ */ | 1 | /* $OpenBSD: x509_cmp.c,v 1.45 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -63,11 +63,11 @@ | |||
| 63 | #include <openssl/opensslconf.h> | 63 | #include <openssl/opensslconf.h> |
| 64 | 64 | ||
| 65 | #include <openssl/asn1.h> | 65 | #include <openssl/asn1.h> |
| 66 | #include <openssl/err.h> | ||
| 67 | #include <openssl/objects.h> | 66 | #include <openssl/objects.h> |
| 68 | #include <openssl/x509.h> | 67 | #include <openssl/x509.h> |
| 69 | #include <openssl/x509v3.h> | 68 | #include <openssl/x509v3.h> |
| 70 | 69 | ||
| 70 | #include "err_local.h" | ||
| 71 | #include "evp_local.h" | 71 | #include "evp_local.h" |
| 72 | #include "x509_local.h" | 72 | #include "x509_local.h" |
| 73 | 73 | ||
diff --git a/src/lib/libcrypto/x509/x509_conf.c b/src/lib/libcrypto/x509/x509_conf.c index e5b18c2f77..2089f72bc7 100644 --- a/src/lib/libcrypto/x509/x509_conf.c +++ b/src/lib/libcrypto/x509/x509_conf.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_conf.c,v 1.29 2025/03/06 07:20:01 tb Exp $ */ | 1 | /* $OpenBSD: x509_conf.c,v 1.31 2025/06/02 12:18:21 jsg Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -62,11 +62,11 @@ | |||
| 62 | #include <string.h> | 62 | #include <string.h> |
| 63 | 63 | ||
| 64 | #include <openssl/conf.h> | 64 | #include <openssl/conf.h> |
| 65 | #include <openssl/err.h> | ||
| 66 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
| 67 | #include <openssl/x509v3.h> | 66 | #include <openssl/x509v3.h> |
| 68 | 67 | ||
| 69 | #include "conf_local.h" | 68 | #include "conf_local.h" |
| 69 | #include "err_local.h" | ||
| 70 | #include "x509_local.h" | 70 | #include "x509_local.h" |
| 71 | 71 | ||
| 72 | static int v3_check_critical(const char **value); | 72 | static int v3_check_critical(const char **value); |
| @@ -242,8 +242,9 @@ v3_check_critical(const char **value) | |||
| 242 | if ((strlen(p) < 9) || strncmp(p, "critical,", 9)) | 242 | if ((strlen(p) < 9) || strncmp(p, "critical,", 9)) |
| 243 | return 0; | 243 | return 0; |
| 244 | p += 9; | 244 | p += 9; |
| 245 | while (isspace((unsigned char)*p)) p++; | 245 | while (isspace((unsigned char)*p)) |
| 246 | *value = p; | 246 | p++; |
| 247 | *value = p; | ||
| 247 | return 1; | 248 | return 1; |
| 248 | } | 249 | } |
| 249 | 250 | ||
diff --git a/src/lib/libcrypto/x509/x509_cpols.c b/src/lib/libcrypto/x509/x509_cpols.c index 6bae2a0482..25a40b0739 100644 --- a/src/lib/libcrypto/x509/x509_cpols.c +++ b/src/lib/libcrypto/x509/x509_cpols.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_cpols.c,v 1.15 2025/03/06 07:20:01 tb Exp $ */ | 1 | /* $OpenBSD: x509_cpols.c,v 1.20 2025/11/28 06:03:40 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -62,9 +62,9 @@ | |||
| 62 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
| 63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
| 64 | #include <openssl/conf.h> | 64 | #include <openssl/conf.h> |
| 65 | #include <openssl/err.h> | ||
| 66 | #include <openssl/x509v3.h> | 65 | #include <openssl/x509v3.h> |
| 67 | 66 | ||
| 67 | #include "err_local.h" | ||
| 68 | #include "x509_local.h" | 68 | #include "x509_local.h" |
| 69 | 69 | ||
| 70 | /* Certificate policies extension support: this one is a bit complex... */ | 70 | /* Certificate policies extension support: this one is a bit complex... */ |
| @@ -488,7 +488,7 @@ r2i_certpol(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, char *value) | |||
| 488 | sk_CONF_VALUE_pop_free(vals, X509V3_conf_free); | 488 | sk_CONF_VALUE_pop_free(vals, X509V3_conf_free); |
| 489 | return pols; | 489 | return pols; |
| 490 | 490 | ||
| 491 | err: | 491 | err: |
| 492 | sk_CONF_VALUE_pop_free(vals, X509V3_conf_free); | 492 | sk_CONF_VALUE_pop_free(vals, X509V3_conf_free); |
| 493 | sk_POLICYINFO_pop_free(pols, POLICYINFO_free); | 493 | sk_POLICYINFO_pop_free(pols, POLICYINFO_free); |
| 494 | return NULL; | 494 | return NULL; |
| @@ -573,10 +573,10 @@ policy_section(X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *polstrs, int ia5org) | |||
| 573 | 573 | ||
| 574 | return pol; | 574 | return pol; |
| 575 | 575 | ||
| 576 | merr: | 576 | merr: |
| 577 | X509V3error(ERR_R_MALLOC_FAILURE); | 577 | X509V3error(ERR_R_MALLOC_FAILURE); |
| 578 | 578 | ||
| 579 | err: | 579 | err: |
| 580 | POLICYQUALINFO_free(nqual); | 580 | POLICYQUALINFO_free(nqual); |
| 581 | POLICYINFO_free(pol); | 581 | POLICYINFO_free(pol); |
| 582 | return NULL; | 582 | return NULL; |
| @@ -659,10 +659,10 @@ notice_section(X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *unot, int ia5org) | |||
| 659 | 659 | ||
| 660 | return qual; | 660 | return qual; |
| 661 | 661 | ||
| 662 | merr: | 662 | merr: |
| 663 | X509V3error(ERR_R_MALLOC_FAILURE); | 663 | X509V3error(ERR_R_MALLOC_FAILURE); |
| 664 | 664 | ||
| 665 | err: | 665 | err: |
| 666 | POLICYQUALINFO_free(qual); | 666 | POLICYQUALINFO_free(qual); |
| 667 | return NULL; | 667 | return NULL; |
| 668 | } | 668 | } |
| @@ -676,21 +676,18 @@ nref_nos(STACK_OF(ASN1_INTEGER) *nnums, STACK_OF(CONF_VALUE) *nos) | |||
| 676 | 676 | ||
| 677 | for (i = 0; i < sk_CONF_VALUE_num(nos); i++) { | 677 | for (i = 0; i < sk_CONF_VALUE_num(nos); i++) { |
| 678 | cnf = sk_CONF_VALUE_value(nos, i); | 678 | cnf = sk_CONF_VALUE_value(nos, i); |
| 679 | if (!(aint = s2i_ASN1_INTEGER(NULL, cnf->name))) { | 679 | if ((aint = s2i_ASN1_INTEGER(NULL, cnf->name)) == NULL) { |
| 680 | X509V3error(X509V3_R_INVALID_NUMBER); | 680 | X509V3error(X509V3_R_INVALID_NUMBER); |
| 681 | goto err; | 681 | return 0; |
| 682 | } | ||
| 683 | if (sk_ASN1_INTEGER_push(nnums, aint) <= 0) { | ||
| 684 | X509V3error(ERR_R_MALLOC_FAILURE); | ||
| 685 | ASN1_INTEGER_free(aint); | ||
| 686 | return 0; | ||
| 682 | } | 687 | } |
| 683 | if (!sk_ASN1_INTEGER_push(nnums, aint)) | ||
| 684 | goto merr; | ||
| 685 | } | 688 | } |
| 686 | return 1; | ||
| 687 | 689 | ||
| 688 | merr: | 690 | return 1; |
| 689 | X509V3error(ERR_R_MALLOC_FAILURE); | ||
| 690 | |||
| 691 | err: | ||
| 692 | sk_ASN1_INTEGER_pop_free(nnums, ASN1_STRING_free); | ||
| 693 | return 0; | ||
| 694 | } | 691 | } |
| 695 | 692 | ||
| 696 | static int | 693 | static int |
diff --git a/src/lib/libcrypto/x509/x509_crld.c b/src/lib/libcrypto/x509/x509_crld.c index 81f2010df5..75afcefca8 100644 --- a/src/lib/libcrypto/x509/x509_crld.c +++ b/src/lib/libcrypto/x509/x509_crld.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_crld.c,v 1.9 2025/03/06 07:20:01 tb Exp $ */ | 1 | /* $OpenBSD: x509_crld.c,v 1.10 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -62,9 +62,9 @@ | |||
| 62 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
| 63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
| 64 | #include <openssl/conf.h> | 64 | #include <openssl/conf.h> |
| 65 | #include <openssl/err.h> | ||
| 66 | #include <openssl/x509v3.h> | 65 | #include <openssl/x509v3.h> |
| 67 | 66 | ||
| 67 | #include "err_local.h" | ||
| 68 | #include "x509_local.h" | 68 | #include "x509_local.h" |
| 69 | 69 | ||
| 70 | static void *v2i_crld(const X509V3_EXT_METHOD *method, | 70 | static void *v2i_crld(const X509V3_EXT_METHOD *method, |
diff --git a/src/lib/libcrypto/x509/x509_extku.c b/src/lib/libcrypto/x509/x509_extku.c index da5036a09a..35460ca46b 100644 --- a/src/lib/libcrypto/x509/x509_extku.c +++ b/src/lib/libcrypto/x509/x509_extku.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_extku.c,v 1.6 2024/08/31 10:03:03 tb Exp $ */ | 1 | /* $OpenBSD: x509_extku.c,v 1.7 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -60,9 +60,9 @@ | |||
| 60 | 60 | ||
| 61 | #include <openssl/asn1t.h> | 61 | #include <openssl/asn1t.h> |
| 62 | #include <openssl/conf.h> | 62 | #include <openssl/conf.h> |
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/x509v3.h> | 63 | #include <openssl/x509v3.h> |
| 65 | 64 | ||
| 65 | #include "err_local.h" | ||
| 66 | #include "x509_local.h" | 66 | #include "x509_local.h" |
| 67 | 67 | ||
| 68 | static void *v2i_EXTENDED_KEY_USAGE(const X509V3_EXT_METHOD *method, | 68 | static void *v2i_EXTENDED_KEY_USAGE(const X509V3_EXT_METHOD *method, |
diff --git a/src/lib/libcrypto/x509/x509_genn.c b/src/lib/libcrypto/x509/x509_genn.c index 1ea7155795..5214c394ed 100644 --- a/src/lib/libcrypto/x509/x509_genn.c +++ b/src/lib/libcrypto/x509/x509_genn.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_genn.c,v 1.7 2024/07/08 14:47:44 beck Exp $ */ | 1 | /* $OpenBSD: x509_genn.c,v 1.8 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -63,6 +63,8 @@ | |||
| 63 | #include <openssl/conf.h> | 63 | #include <openssl/conf.h> |
| 64 | #include <openssl/x509v3.h> | 64 | #include <openssl/x509v3.h> |
| 65 | 65 | ||
| 66 | #include "err_local.h" | ||
| 67 | |||
| 66 | static const ASN1_TEMPLATE OTHERNAME_seq_tt[] = { | 68 | static const ASN1_TEMPLATE OTHERNAME_seq_tt[] = { |
| 67 | { | 69 | { |
| 68 | .flags = 0, | 70 | .flags = 0, |
diff --git a/src/lib/libcrypto/x509/x509_ia5.c b/src/lib/libcrypto/x509/x509_ia5.c index 4f62a9134c..b8886c6cb8 100644 --- a/src/lib/libcrypto/x509/x509_ia5.c +++ b/src/lib/libcrypto/x509/x509_ia5.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_ia5.c,v 1.2 2024/07/13 15:08:58 tb Exp $ */ | 1 | /* $OpenBSD: x509_ia5.c,v 1.3 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -61,9 +61,10 @@ | |||
| 61 | 61 | ||
| 62 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
| 63 | #include <openssl/conf.h> | 63 | #include <openssl/conf.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | #include <openssl/x509v3.h> | 64 | #include <openssl/x509v3.h> |
| 66 | 65 | ||
| 66 | #include "err_local.h" | ||
| 67 | |||
| 67 | static char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5); | 68 | static char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5); |
| 68 | static ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, | 69 | static ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, |
| 69 | X509V3_CTX *ctx, char *str); | 70 | X509V3_CTX *ctx, char *str); |
diff --git a/src/lib/libcrypto/x509/x509_info.c b/src/lib/libcrypto/x509/x509_info.c index d1de346ee6..c91642a02e 100644 --- a/src/lib/libcrypto/x509/x509_info.c +++ b/src/lib/libcrypto/x509/x509_info.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_info.c,v 1.5 2024/07/13 15:08:58 tb Exp $ */ | 1 | /* $OpenBSD: x509_info.c,v 1.6 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -62,9 +62,10 @@ | |||
| 62 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
| 63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
| 64 | #include <openssl/conf.h> | 64 | #include <openssl/conf.h> |
| 65 | #include <openssl/err.h> | ||
| 66 | #include <openssl/x509v3.h> | 65 | #include <openssl/x509v3.h> |
| 67 | 66 | ||
| 67 | #include "err_local.h" | ||
| 68 | |||
| 68 | static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS( | 69 | static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS( |
| 69 | X509V3_EXT_METHOD *method, AUTHORITY_INFO_ACCESS *ainfo, | 70 | X509V3_EXT_METHOD *method, AUTHORITY_INFO_ACCESS *ainfo, |
| 70 | STACK_OF(CONF_VALUE) *ret); | 71 | STACK_OF(CONF_VALUE) *ret); |
diff --git a/src/lib/libcrypto/x509/x509_lib.c b/src/lib/libcrypto/x509/x509_lib.c index 6fa66ab88e..0285ac0d3a 100644 --- a/src/lib/libcrypto/x509/x509_lib.c +++ b/src/lib/libcrypto/x509/x509_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_lib.c,v 1.24 2024/07/13 15:08:58 tb Exp $ */ | 1 | /* $OpenBSD: x509_lib.c,v 1.25 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -60,9 +60,9 @@ | |||
| 60 | #include <stdio.h> | 60 | #include <stdio.h> |
| 61 | 61 | ||
| 62 | #include <openssl/conf.h> | 62 | #include <openssl/conf.h> |
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/x509v3.h> | 63 | #include <openssl/x509v3.h> |
| 65 | 64 | ||
| 65 | #include "err_local.h" | ||
| 66 | #include "x509_local.h" | 66 | #include "x509_local.h" |
| 67 | 67 | ||
| 68 | const X509V3_EXT_METHOD * | 68 | const X509V3_EXT_METHOD * |
diff --git a/src/lib/libcrypto/x509/x509_local.h b/src/lib/libcrypto/x509/x509_local.h index 796a2ee718..5b9c1e51f7 100644 --- a/src/lib/libcrypto/x509/x509_local.h +++ b/src/lib/libcrypto/x509/x509_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_local.h,v 1.38 2025/03/06 07:20:01 tb Exp $ */ | 1 | /* $OpenBSD: x509_local.h,v 1.39 2025/10/10 11:31:13 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2013. | 3 | * project 2013. |
| 4 | */ | 4 | */ |
| @@ -213,7 +213,6 @@ struct x509_revoked_st { | |||
| 213 | STACK_OF(GENERAL_NAME) *issuer; | 213 | STACK_OF(GENERAL_NAME) *issuer; |
| 214 | /* Revocation reason */ | 214 | /* Revocation reason */ |
| 215 | int reason; | 215 | int reason; |
| 216 | int sequence; /* load sequence */ | ||
| 217 | }; | 216 | }; |
| 218 | 217 | ||
| 219 | struct X509_crl_info_st { | 218 | struct X509_crl_info_st { |
diff --git a/src/lib/libcrypto/x509/x509_lu.c b/src/lib/libcrypto/x509/x509_lu.c index 0367794fca..1ac3436a6e 100644 --- a/src/lib/libcrypto/x509/x509_lu.c +++ b/src/lib/libcrypto/x509/x509_lu.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_lu.c,v 1.67 2025/03/09 15:20:20 tb Exp $ */ | 1 | /* $OpenBSD: x509_lu.c,v 1.68 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -59,11 +59,11 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <string.h> | 60 | #include <string.h> |
| 61 | 61 | ||
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/lhash.h> | 62 | #include <openssl/lhash.h> |
| 64 | #include <openssl/x509.h> | 63 | #include <openssl/x509.h> |
| 65 | #include <openssl/x509v3.h> | 64 | #include <openssl/x509v3.h> |
| 66 | 65 | ||
| 66 | #include "err_local.h" | ||
| 67 | #include "x509_local.h" | 67 | #include "x509_local.h" |
| 68 | 68 | ||
| 69 | static int X509_OBJECT_up_ref_count(X509_OBJECT *a); | 69 | static int X509_OBJECT_up_ref_count(X509_OBJECT *a); |
diff --git a/src/lib/libcrypto/x509/x509_ncons.c b/src/lib/libcrypto/x509/x509_ncons.c index 148a66e887..f197488d70 100644 --- a/src/lib/libcrypto/x509/x509_ncons.c +++ b/src/lib/libcrypto/x509/x509_ncons.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_ncons.c,v 1.11 2024/07/13 15:08:58 tb Exp $ */ | 1 | /* $OpenBSD: x509_ncons.c,v 1.12 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project. | 3 | * project. |
| 4 | */ | 4 | */ |
| @@ -61,9 +61,9 @@ | |||
| 61 | 61 | ||
| 62 | #include <openssl/asn1t.h> | 62 | #include <openssl/asn1t.h> |
| 63 | #include <openssl/conf.h> | 63 | #include <openssl/conf.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | #include <openssl/x509v3.h> | 64 | #include <openssl/x509v3.h> |
| 66 | 65 | ||
| 66 | #include "err_local.h" | ||
| 67 | #include "x509_local.h" | 67 | #include "x509_local.h" |
| 68 | 68 | ||
| 69 | static void *v2i_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method, | 69 | static void *v2i_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method, |
diff --git a/src/lib/libcrypto/x509/x509_ocsp.c b/src/lib/libcrypto/x509/x509_ocsp.c index 6531b4c420..d0a0d49890 100644 --- a/src/lib/libcrypto/x509/x509_ocsp.c +++ b/src/lib/libcrypto/x509/x509_ocsp.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_ocsp.c,v 1.4 2024/12/24 09:14:33 schwarze Exp $ */ | 1 | /* $OpenBSD: x509_ocsp.c,v 1.5 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -65,10 +65,10 @@ | |||
| 65 | 65 | ||
| 66 | #include <openssl/asn1.h> | 66 | #include <openssl/asn1.h> |
| 67 | #include <openssl/conf.h> | 67 | #include <openssl/conf.h> |
| 68 | #include <openssl/err.h> | ||
| 69 | #include <openssl/ocsp.h> | 68 | #include <openssl/ocsp.h> |
| 70 | #include <openssl/x509v3.h> | 69 | #include <openssl/x509v3.h> |
| 71 | 70 | ||
| 71 | #include "err_local.h" | ||
| 72 | #include "ocsp_local.h" | 72 | #include "ocsp_local.h" |
| 73 | 73 | ||
| 74 | /* OCSP extensions and a couple of CRL entry extensions | 74 | /* OCSP extensions and a couple of CRL entry extensions |
diff --git a/src/lib/libcrypto/x509/x509_pcons.c b/src/lib/libcrypto/x509/x509_pcons.c index 66dc57abf6..404fa28724 100644 --- a/src/lib/libcrypto/x509/x509_pcons.c +++ b/src/lib/libcrypto/x509/x509_pcons.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_pcons.c,v 1.6 2024/08/31 10:03:03 tb Exp $ */ | 1 | /* $OpenBSD: x509_pcons.c,v 1.7 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project. | 3 | * project. |
| 4 | */ | 4 | */ |
| @@ -62,9 +62,9 @@ | |||
| 62 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
| 63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
| 64 | #include <openssl/conf.h> | 64 | #include <openssl/conf.h> |
| 65 | #include <openssl/err.h> | ||
| 66 | #include <openssl/x509v3.h> | 65 | #include <openssl/x509v3.h> |
| 67 | 66 | ||
| 67 | #include "err_local.h" | ||
| 68 | #include "x509_local.h" | 68 | #include "x509_local.h" |
| 69 | 69 | ||
| 70 | static STACK_OF(CONF_VALUE) * | 70 | static STACK_OF(CONF_VALUE) * |
diff --git a/src/lib/libcrypto/x509/x509_pmaps.c b/src/lib/libcrypto/x509/x509_pmaps.c index 5039f65f2e..141a3a6f90 100644 --- a/src/lib/libcrypto/x509/x509_pmaps.c +++ b/src/lib/libcrypto/x509/x509_pmaps.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_pmaps.c,v 1.6 2024/08/31 10:03:03 tb Exp $ */ | 1 | /* $OpenBSD: x509_pmaps.c,v 1.7 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project. | 3 | * project. |
| 4 | */ | 4 | */ |
| @@ -61,9 +61,9 @@ | |||
| 61 | 61 | ||
| 62 | #include <openssl/asn1t.h> | 62 | #include <openssl/asn1t.h> |
| 63 | #include <openssl/conf.h> | 63 | #include <openssl/conf.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | #include <openssl/x509v3.h> | 64 | #include <openssl/x509v3.h> |
| 66 | 65 | ||
| 66 | #include "err_local.h" | ||
| 67 | #include "x509_local.h" | 67 | #include "x509_local.h" |
| 68 | 68 | ||
| 69 | static void *v2i_POLICY_MAPPINGS(const X509V3_EXT_METHOD *method, | 69 | static void *v2i_POLICY_MAPPINGS(const X509V3_EXT_METHOD *method, |
diff --git a/src/lib/libcrypto/x509/x509_policy.c b/src/lib/libcrypto/x509/x509_policy.c index d93760755d..2df965aad1 100644 --- a/src/lib/libcrypto/x509/x509_policy.c +++ b/src/lib/libcrypto/x509/x509_policy.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_policy.c,v 1.31 2025/03/28 13:11:57 tb Exp $ */ | 1 | /* $OpenBSD: x509_policy.c,v 1.33 2025/08/10 06:36:45 beck Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2022, Google Inc. | 3 | * Copyright (c) 2022, Google Inc. |
| 4 | * | 4 | * |
| @@ -17,19 +17,16 @@ | |||
| 17 | 17 | ||
| 18 | #include <string.h> | 18 | #include <string.h> |
| 19 | 19 | ||
| 20 | #include <openssl/err.h> | ||
| 21 | #include <openssl/objects.h> | 20 | #include <openssl/objects.h> |
| 22 | #include <openssl/stack.h> | 21 | #include <openssl/stack.h> |
| 23 | #include <openssl/x509.h> | 22 | #include <openssl/x509.h> |
| 24 | #include <openssl/x509v3.h> | 23 | #include <openssl/x509v3.h> |
| 25 | 24 | ||
| 25 | #include "err_local.h" | ||
| 26 | #include "stack_local.h" | 26 | #include "stack_local.h" |
| 27 | #include "x509_internal.h" | 27 | #include "x509_internal.h" |
| 28 | #include "x509_local.h" | 28 | #include "x509_local.h" |
| 29 | 29 | ||
| 30 | /* XXX move to proper place */ | ||
| 31 | #define X509_R_INVALID_POLICY_EXTENSION 201 | ||
| 32 | |||
| 33 | /* | 30 | /* |
| 34 | * This file computes the X.509 policy tree, as described in RFC 5280, | 31 | * This file computes the X.509 policy tree, as described in RFC 5280, |
| 35 | * section 6.1 and RFC 9618. It differs in that: | 32 | * section 6.1 and RFC 9618. It differs in that: |
diff --git a/src/lib/libcrypto/x509/x509_prn.c b/src/lib/libcrypto/x509/x509_prn.c index 3bf7c803e5..23c649a7b9 100644 --- a/src/lib/libcrypto/x509/x509_prn.c +++ b/src/lib/libcrypto/x509/x509_prn.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_prn.c,v 1.6 2023/05/08 05:30:38 tb Exp $ */ | 1 | /* $OpenBSD: x509_prn.c,v 1.7 2025/06/02 12:18:22 jsg Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -87,8 +87,9 @@ X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, int ml) | |||
| 87 | for (i = 0; i < sk_CONF_VALUE_num(val); i++) { | 87 | for (i = 0; i < sk_CONF_VALUE_num(val); i++) { |
| 88 | if (ml) | 88 | if (ml) |
| 89 | BIO_printf(out, "%*s", indent, ""); | 89 | BIO_printf(out, "%*s", indent, ""); |
| 90 | else if (i > 0) BIO_printf(out, ", "); | 90 | else if (i > 0) |
| 91 | nval = sk_CONF_VALUE_value(val, i); | 91 | BIO_printf(out, ", "); |
| 92 | nval = sk_CONF_VALUE_value(val, i); | ||
| 92 | if (!nval->name) | 93 | if (!nval->name) |
| 93 | BIO_puts(out, nval->value); | 94 | BIO_puts(out, nval->value); |
| 94 | else if (!nval->value) | 95 | else if (!nval->value) |
diff --git a/src/lib/libcrypto/x509/x509_purp.c b/src/lib/libcrypto/x509/x509_purp.c index 619a4b890a..36dfe6abee 100644 --- a/src/lib/libcrypto/x509/x509_purp.c +++ b/src/lib/libcrypto/x509/x509_purp.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_purp.c,v 1.43 2024/07/12 18:15:10 beck Exp $ */ | 1 | /* $OpenBSD: x509_purp.c,v 1.44 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2001. | 3 | * project 2001. |
| 4 | */ | 4 | */ |
| @@ -61,7 +61,6 @@ | |||
| 61 | 61 | ||
| 62 | #include <openssl/opensslconf.h> | 62 | #include <openssl/opensslconf.h> |
| 63 | 63 | ||
| 64 | #include <openssl/err.h> | ||
| 65 | #include <openssl/x509v3.h> | 64 | #include <openssl/x509v3.h> |
| 66 | #include <openssl/x509_vfy.h> | 65 | #include <openssl/x509_vfy.h> |
| 67 | 66 | ||
diff --git a/src/lib/libcrypto/x509/x509_r2x.c b/src/lib/libcrypto/x509/x509_r2x.c index 39b392259b..4ca8a87935 100644 --- a/src/lib/libcrypto/x509/x509_r2x.c +++ b/src/lib/libcrypto/x509/x509_r2x.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_r2x.c,v 1.17 2023/04/25 09:46:36 job Exp $ */ | 1 | /* $OpenBSD: x509_r2x.c,v 1.18 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -61,11 +61,11 @@ | |||
| 61 | #include <openssl/asn1.h> | 61 | #include <openssl/asn1.h> |
| 62 | #include <openssl/bn.h> | 62 | #include <openssl/bn.h> |
| 63 | #include <openssl/buffer.h> | 63 | #include <openssl/buffer.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | #include <openssl/evp.h> | 64 | #include <openssl/evp.h> |
| 66 | #include <openssl/objects.h> | 65 | #include <openssl/objects.h> |
| 67 | #include <openssl/x509.h> | 66 | #include <openssl/x509.h> |
| 68 | 67 | ||
| 68 | #include "err_local.h" | ||
| 69 | #include "x509_local.h" | 69 | #include "x509_local.h" |
| 70 | 70 | ||
| 71 | X509 * | 71 | X509 * |
diff --git a/src/lib/libcrypto/x509/x509_req.c b/src/lib/libcrypto/x509/x509_req.c index 704acbd897..df1119a55c 100644 --- a/src/lib/libcrypto/x509/x509_req.c +++ b/src/lib/libcrypto/x509/x509_req.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_req.c,v 1.43 2024/08/31 10:16:52 tb Exp $ */ | 1 | /* $OpenBSD: x509_req.c,v 1.44 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -64,13 +64,13 @@ | |||
| 64 | #include <openssl/asn1t.h> | 64 | #include <openssl/asn1t.h> |
| 65 | #include <openssl/bn.h> | 65 | #include <openssl/bn.h> |
| 66 | #include <openssl/buffer.h> | 66 | #include <openssl/buffer.h> |
| 67 | #include <openssl/err.h> | ||
| 68 | #include <openssl/evp.h> | 67 | #include <openssl/evp.h> |
| 69 | #include <openssl/objects.h> | 68 | #include <openssl/objects.h> |
| 70 | #include <openssl/pem.h> | 69 | #include <openssl/pem.h> |
| 71 | #include <openssl/x509.h> | 70 | #include <openssl/x509.h> |
| 72 | 71 | ||
| 73 | #include "asn1_local.h" | 72 | #include "asn1_local.h" |
| 73 | #include "err_local.h" | ||
| 74 | #include "evp_local.h" | 74 | #include "evp_local.h" |
| 75 | #include "x509_local.h" | 75 | #include "x509_local.h" |
| 76 | 76 | ||
diff --git a/src/lib/libcrypto/x509/x509_skey.c b/src/lib/libcrypto/x509/x509_skey.c index d2c90b6f1c..e9e915a0c7 100644 --- a/src/lib/libcrypto/x509/x509_skey.c +++ b/src/lib/libcrypto/x509/x509_skey.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_skey.c,v 1.6 2024/07/13 15:08:58 tb Exp $ */ | 1 | /* $OpenBSD: x509_skey.c,v 1.7 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -59,9 +59,9 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <string.h> | 60 | #include <string.h> |
| 61 | 61 | ||
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/x509v3.h> | 62 | #include <openssl/x509v3.h> |
| 64 | 63 | ||
| 64 | #include "err_local.h" | ||
| 65 | #include "x509_local.h" | 65 | #include "x509_local.h" |
| 66 | 66 | ||
| 67 | static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method, | 67 | static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method, |
diff --git a/src/lib/libcrypto/x509/x509_utl.c b/src/lib/libcrypto/x509/x509_utl.c index 08383849c9..2e60834edf 100644 --- a/src/lib/libcrypto/x509/x509_utl.c +++ b/src/lib/libcrypto/x509/x509_utl.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_utl.c,v 1.26 2025/01/26 13:51:41 tb Exp $ */ | 1 | /* $OpenBSD: x509_utl.c,v 1.28 2026/01/12 22:08:34 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project. | 3 | * project. |
| 4 | */ | 4 | */ |
| @@ -64,11 +64,11 @@ | |||
| 64 | #include <openssl/asn1.h> | 64 | #include <openssl/asn1.h> |
| 65 | #include <openssl/bn.h> | 65 | #include <openssl/bn.h> |
| 66 | #include <openssl/conf.h> | 66 | #include <openssl/conf.h> |
| 67 | #include <openssl/err.h> | ||
| 68 | #include <openssl/x509v3.h> | 67 | #include <openssl/x509v3.h> |
| 69 | 68 | ||
| 70 | #include "bytestring.h" | 69 | #include "bytestring.h" |
| 71 | #include "conf_local.h" | 70 | #include "conf_local.h" |
| 71 | #include "err_local.h" | ||
| 72 | 72 | ||
| 73 | /* | 73 | /* |
| 74 | * Match reference identifiers starting with "." to any sub-domain. This | 74 | * Match reference identifiers starting with "." to any sub-domain. This |
| @@ -148,8 +148,6 @@ X509V3_add_value_uchar(const char *name, const unsigned char *value, | |||
| 148 | return X509V3_add_value(name, (const char *)value, extlist); | 148 | return X509V3_add_value(name, (const char *)value, extlist); |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | /* Free function for STACK_OF(CONF_VALUE) */ | ||
| 152 | |||
| 153 | void | 151 | void |
| 154 | X509V3_conf_free(CONF_VALUE *conf) | 152 | X509V3_conf_free(CONF_VALUE *conf) |
| 155 | { | 153 | { |
| @@ -354,8 +352,6 @@ X509V3_get_value_int(const CONF_VALUE *value, ASN1_INTEGER **aint) | |||
| 354 | #define HDR_NAME 1 | 352 | #define HDR_NAME 1 |
| 355 | #define HDR_VALUE 2 | 353 | #define HDR_VALUE 2 |
| 356 | 354 | ||
| 357 | /*#define DEBUG*/ | ||
| 358 | |||
| 359 | STACK_OF(CONF_VALUE) * | 355 | STACK_OF(CONF_VALUE) * |
| 360 | X509V3_parse_list(const char *line) | 356 | X509V3_parse_list(const char *line) |
| 361 | { | 357 | { |
diff --git a/src/lib/libcrypto/x509/x509_v3.c b/src/lib/libcrypto/x509/x509_v3.c index 688aed15a2..ee14d2dcef 100644 --- a/src/lib/libcrypto/x509/x509_v3.c +++ b/src/lib/libcrypto/x509/x509_v3.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_v3.c,v 1.43 2024/07/12 09:57:04 tb Exp $ */ | 1 | /* $OpenBSD: x509_v3.c,v 1.44 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -59,12 +59,12 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | 60 | ||
| 61 | #include <openssl/asn1.h> | 61 | #include <openssl/asn1.h> |
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/objects.h> | 62 | #include <openssl/objects.h> |
| 64 | #include <openssl/stack.h> | 63 | #include <openssl/stack.h> |
| 65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
| 66 | #include <openssl/x509v3.h> | 65 | #include <openssl/x509v3.h> |
| 67 | 66 | ||
| 67 | #include "err_local.h" | ||
| 68 | #include "x509_local.h" | 68 | #include "x509_local.h" |
| 69 | 69 | ||
| 70 | int | 70 | int |
diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c index c93ae81bd8..3d0abda615 100644 --- a/src/lib/libcrypto/x509/x509_vfy.c +++ b/src/lib/libcrypto/x509/x509_vfy.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_vfy.c,v 1.147 2025/03/04 08:43:25 tb Exp $ */ | 1 | /* $OpenBSD: x509_vfy.c,v 1.148 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -67,7 +67,6 @@ | |||
| 67 | #include <openssl/asn1.h> | 67 | #include <openssl/asn1.h> |
| 68 | #include <openssl/buffer.h> | 68 | #include <openssl/buffer.h> |
| 69 | #include <openssl/crypto.h> | 69 | #include <openssl/crypto.h> |
| 70 | #include <openssl/err.h> | ||
| 71 | #include <openssl/evp.h> | 70 | #include <openssl/evp.h> |
| 72 | #include <openssl/lhash.h> | 71 | #include <openssl/lhash.h> |
| 73 | #include <openssl/objects.h> | 72 | #include <openssl/objects.h> |
| @@ -75,6 +74,7 @@ | |||
| 75 | #include <openssl/x509v3.h> | 74 | #include <openssl/x509v3.h> |
| 76 | 75 | ||
| 77 | #include "asn1_local.h" | 76 | #include "asn1_local.h" |
| 77 | #include "err_local.h" | ||
| 78 | #include "x509_internal.h" | 78 | #include "x509_internal.h" |
| 79 | #include "x509_issuer_cache.h" | 79 | #include "x509_issuer_cache.h" |
| 80 | #include "x509_local.h" | 80 | #include "x509_local.h" |
diff --git a/src/lib/libcrypto/x509/x509_vfy.h b/src/lib/libcrypto/x509/x509_vfy.h index 7058bbc5b0..04e555149a 100644 --- a/src/lib/libcrypto/x509/x509_vfy.h +++ b/src/lib/libcrypto/x509/x509_vfy.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_vfy.h,v 1.70 2025/03/09 15:20:20 tb Exp $ */ | 1 | /* $OpenBSD: x509_vfy.h,v 1.71 2025/10/24 11:33:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -441,6 +441,7 @@ int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param, const char *name, | |||
| 441 | size_t namelen); | 441 | size_t namelen); |
| 442 | int X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param, const char *name, | 442 | int X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param, const char *name, |
| 443 | size_t namelen); | 443 | size_t namelen); |
| 444 | unsigned int X509_VERIFY_PARAM_get_hostflags(const X509_VERIFY_PARAM *param); | ||
| 444 | void X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param, | 445 | void X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param, |
| 445 | unsigned int flags); | 446 | unsigned int flags); |
| 446 | char *X509_VERIFY_PARAM_get0_peername(X509_VERIFY_PARAM *param); | 447 | char *X509_VERIFY_PARAM_get0_peername(X509_VERIFY_PARAM *param); |
diff --git a/src/lib/libcrypto/x509/x509_vpm.c b/src/lib/libcrypto/x509/x509_vpm.c index 9efe473fc3..7b4ce3b7a6 100644 --- a/src/lib/libcrypto/x509/x509_vpm.c +++ b/src/lib/libcrypto/x509/x509_vpm.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_vpm.c,v 1.55 2025/03/19 17:11:21 tb Exp $ */ | 1 | /* $OpenBSD: x509_vpm.c,v 1.58 2025/10/24 11:33:38 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2004. | 3 | * project 2004. |
| 4 | */ | 4 | */ |
| @@ -61,12 +61,12 @@ | |||
| 61 | 61 | ||
| 62 | #include <openssl/buffer.h> | 62 | #include <openssl/buffer.h> |
| 63 | #include <openssl/crypto.h> | 63 | #include <openssl/crypto.h> |
| 64 | #include <openssl/err.h> | ||
| 65 | #include <openssl/lhash.h> | 64 | #include <openssl/lhash.h> |
| 66 | #include <openssl/stack.h> | 65 | #include <openssl/stack.h> |
| 67 | #include <openssl/x509.h> | 66 | #include <openssl/x509.h> |
| 68 | #include <openssl/x509v3.h> | 67 | #include <openssl/x509v3.h> |
| 69 | 68 | ||
| 69 | #include "err_local.h" | ||
| 70 | #include "x509_local.h" | 70 | #include "x509_local.h" |
| 71 | 71 | ||
| 72 | /* X509_VERIFY_PARAM functions */ | 72 | /* X509_VERIFY_PARAM functions */ |
| @@ -543,12 +543,12 @@ X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param, | |||
| 543 | } | 543 | } |
| 544 | LCRYPTO_ALIAS(X509_VERIFY_PARAM_add1_host); | 544 | LCRYPTO_ALIAS(X509_VERIFY_PARAM_add1_host); |
| 545 | 545 | ||
| 546 | /* Public API in OpenSSL - nothing seems to use this. */ | ||
| 547 | unsigned int | 546 | unsigned int |
| 548 | X509_VERIFY_PARAM_get_hostflags(X509_VERIFY_PARAM *param) | 547 | X509_VERIFY_PARAM_get_hostflags(const X509_VERIFY_PARAM *param) |
| 549 | { | 548 | { |
| 550 | return param->hostflags; | 549 | return param->hostflags; |
| 551 | } | 550 | } |
| 551 | LCRYPTO_ALIAS(X509_VERIFY_PARAM_get_hostflags); | ||
| 552 | 552 | ||
| 553 | void | 553 | void |
| 554 | X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param, unsigned int flags) | 554 | X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param, unsigned int flags) |
diff --git a/src/lib/libcrypto/x509/x509cset.c b/src/lib/libcrypto/x509/x509cset.c index 468831266f..facca27880 100644 --- a/src/lib/libcrypto/x509/x509cset.c +++ b/src/lib/libcrypto/x509/x509cset.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509cset.c,v 1.22 2024/03/26 23:41:45 tb Exp $ */ | 1 | /* $OpenBSD: x509cset.c,v 1.23 2025/10/10 11:31:13 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2001. | 3 | * project 2001. |
| 4 | */ | 4 | */ |
| @@ -156,15 +156,7 @@ LCRYPTO_ALIAS(X509_CRL_set1_nextUpdate); | |||
| 156 | int | 156 | int |
| 157 | X509_CRL_sort(X509_CRL *c) | 157 | X509_CRL_sort(X509_CRL *c) |
| 158 | { | 158 | { |
| 159 | X509_REVOKED *r; | ||
| 160 | int i; | ||
| 161 | |||
| 162 | /* Sort the data so it will be written in serial number order */ | ||
| 163 | sk_X509_REVOKED_sort(c->crl->revoked); | 159 | sk_X509_REVOKED_sort(c->crl->revoked); |
| 164 | for (i = 0; i < sk_X509_REVOKED_num(c->crl->revoked); i++) { | ||
| 165 | r = sk_X509_REVOKED_value(c->crl->revoked, i); | ||
| 166 | r->sequence = i; | ||
| 167 | } | ||
| 168 | c->crl->enc.modified = 1; | 160 | c->crl->enc.modified = 1; |
| 169 | return 1; | 161 | return 1; |
| 170 | } | 162 | } |
diff --git a/src/lib/libcrypto/x509/x509name.c b/src/lib/libcrypto/x509/x509name.c index d2df06ccc6..e60d8b7a3b 100644 --- a/src/lib/libcrypto/x509/x509name.c +++ b/src/lib/libcrypto/x509/x509name.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509name.c,v 1.35 2023/05/29 11:54:50 beck Exp $ */ | 1 | /* $OpenBSD: x509name.c,v 1.39 2025/12/21 10:02:05 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -60,13 +60,13 @@ | |||
| 60 | #include <string.h> | 60 | #include <string.h> |
| 61 | 61 | ||
| 62 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/evp.h> | 63 | #include <openssl/evp.h> |
| 65 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
| 66 | #include <openssl/stack.h> | 65 | #include <openssl/stack.h> |
| 67 | #include <openssl/x509.h> | 66 | #include <openssl/x509.h> |
| 68 | 67 | ||
| 69 | #include "bytestring.h" | 68 | #include "bytestring.h" |
| 69 | #include "err_local.h" | ||
| 70 | #include "x509_local.h" | 70 | #include "x509_local.h" |
| 71 | 71 | ||
| 72 | int | 72 | int |
| @@ -404,25 +404,19 @@ int | |||
| 404 | X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, | 404 | X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, |
| 405 | const unsigned char *bytes, int len) | 405 | const unsigned char *bytes, int len) |
| 406 | { | 406 | { |
| 407 | int i; | 407 | if (ne == NULL || (bytes == NULL && len != 0)) |
| 408 | 408 | return 0; | |
| 409 | if ((ne == NULL) || ((bytes == NULL) && (len != 0))) | 409 | if (type > 0 && (type & MBSTRING_FLAG) != 0) |
| 410 | return (0); | ||
| 411 | if ((type > 0) && (type & MBSTRING_FLAG)) | ||
| 412 | return ASN1_STRING_set_by_NID(&ne->value, bytes, len, type, | 410 | return ASN1_STRING_set_by_NID(&ne->value, bytes, len, type, |
| 413 | OBJ_obj2nid(ne->object)) ? 1 : 0; | 411 | OBJ_obj2nid(ne->object)) ? 1 : 0; |
| 414 | if (len < 0) | 412 | if (len < 0) |
| 415 | len = strlen((const char *)bytes); | 413 | len = strlen((const char *)bytes); |
| 416 | i = ASN1_STRING_set(ne->value, bytes, len); | 414 | if (!ASN1_STRING_set(ne->value, bytes, len)) |
| 417 | if (!i) | 415 | return 0; |
| 418 | return (0); | 416 | if (type != V_ASN1_UNDEF) |
| 419 | if (type != V_ASN1_UNDEF) { | 417 | ne->value->type = type; |
| 420 | if (type == V_ASN1_APP_CHOOSE) | 418 | |
| 421 | ne->value->type = ASN1_PRINTABLE_type(bytes, len); | 419 | return 1; |
| 422 | else | ||
| 423 | ne->value->type = type; | ||
| 424 | } | ||
| 425 | return (1); | ||
| 426 | } | 420 | } |
| 427 | LCRYPTO_ALIAS(X509_NAME_ENTRY_set_data); | 421 | LCRYPTO_ALIAS(X509_NAME_ENTRY_set_data); |
| 428 | 422 | ||
diff --git a/src/lib/libcrypto/x509/x509spki.c b/src/lib/libcrypto/x509/x509spki.c index 04c9a6f01b..ef5f9e34c8 100644 --- a/src/lib/libcrypto/x509/x509spki.c +++ b/src/lib/libcrypto/x509/x509spki.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509spki.c,v 1.16 2023/02/16 08:38:17 tb Exp $ */ | 1 | /* $OpenBSD: x509spki.c,v 1.17 2025/05/10 05:54:39 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -60,9 +60,10 @@ | |||
| 60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
| 61 | #include <string.h> | 61 | #include <string.h> |
| 62 | 62 | ||
| 63 | #include <openssl/err.h> | ||
| 64 | #include <openssl/x509.h> | 63 | #include <openssl/x509.h> |
| 65 | 64 | ||
| 65 | #include "err_local.h" | ||
| 66 | |||
| 66 | int | 67 | int |
| 67 | NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey) | 68 | NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey) |
| 68 | { | 69 | { |
diff --git a/src/lib/libcrypto/x509/x_all.c b/src/lib/libcrypto/x509/x_all.c index 5997714061..b5d50ae4ee 100644 --- a/src/lib/libcrypto/x509/x_all.c +++ b/src/lib/libcrypto/x509/x_all.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x_all.c,v 1.32 2024/06/19 08:00:53 tb Exp $ */ | 1 | /* $OpenBSD: x_all.c,v 1.33 2025/07/10 18:50:23 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -399,7 +399,11 @@ LCRYPTO_ALIAS(i2d_PKCS8PrivateKeyInfo_fp); | |||
| 399 | int | 399 | int |
| 400 | X509_verify(X509 *a, EVP_PKEY *r) | 400 | X509_verify(X509 *a, EVP_PKEY *r) |
| 401 | { | 401 | { |
| 402 | if (X509_ALGOR_cmp(a->sig_alg, a->cert_info->signature)) | 402 | /* |
| 403 | * The Certificate's signature AlgorithmIdentifier must match the one | ||
| 404 | * inside the TBSCertificate, see RFC 5280, 4.1.1.2, 4.1.2.3. | ||
| 405 | */ | ||
| 406 | if (X509_ALGOR_cmp(a->sig_alg, a->cert_info->signature) != 0) | ||
| 403 | return 0; | 407 | return 0; |
| 404 | return ASN1_item_verify(&X509_CINF_it, a->sig_alg, | 408 | return ASN1_item_verify(&X509_CINF_it, a->sig_alg, |
| 405 | a->signature, a->cert_info, r); | 409 | a->signature, a->cert_info, r); |
diff --git a/src/lib/libssl/LICENSE b/src/lib/libssl/LICENSE index 892e14a450..c41ff4d1ca 100644 --- a/src/lib/libssl/LICENSE +++ b/src/lib/libssl/LICENSE | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | 1 | ||
| 2 | LibReSSL files are retained under the copyright of the authors. New | 2 | LibreSSL files are retained under the copyright of the authors. New |
| 3 | additions are ISC licensed as per OpenBSD's normal licensing policy, | 3 | additions are ISC licensed as per OpenBSD's normal licensing policy, |
| 4 | or are placed in the public domain. | 4 | or are placed in the public domain. |
| 5 | 5 | ||
| 6 | The OpenSSL code is distributed under the terms of the original OpenSSL | 6 | The OpenSSL code is distributed under the terms of the original OpenSSL |
| 7 | licenses which follow: | 7 | licenses which follow: |
| @@ -25,7 +25,7 @@ | |||
| 25 | * are met: | 25 | * are met: |
| 26 | * | 26 | * |
| 27 | * 1. Redistributions of source code must retain the above copyright | 27 | * 1. Redistributions of source code must retain the above copyright |
| 28 | * notice, this list of conditions and the following disclaimer. | 28 | * notice, this list of conditions and the following disclaimer. |
| 29 | * | 29 | * |
| 30 | * 2. Redistributions in binary form must reproduce the above copyright | 30 | * 2. Redistributions in binary form must reproduce the above copyright |
| 31 | * notice, this list of conditions and the following disclaimer in | 31 | * notice, this list of conditions and the following disclaimer in |
| @@ -80,21 +80,21 @@ | |||
| 80 | * This package is an SSL implementation written | 80 | * This package is an SSL implementation written |
| 81 | * by Eric Young (eay@cryptsoft.com). | 81 | * by Eric Young (eay@cryptsoft.com). |
| 82 | * The implementation was written so as to conform with Netscapes SSL. | 82 | * The implementation was written so as to conform with Netscapes SSL. |
| 83 | * | 83 | * |
| 84 | * This library is free for commercial and non-commercial use as long as | 84 | * This library is free for commercial and non-commercial use as long as |
| 85 | * the following conditions are aheared to. The following conditions | 85 | * the following conditions are aheared to. The following conditions |
| 86 | * apply to all code found in this distribution, be it the RC4, RSA, | 86 | * apply to all code found in this distribution, be it the RC4, RSA, |
| 87 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | 87 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation |
| 88 | * included with this distribution is covered by the same copyright terms | 88 | * included with this distribution is covered by the same copyright terms |
| 89 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 89 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
| 90 | * | 90 | * |
| 91 | * Copyright remains Eric Young's, and as such any Copyright notices in | 91 | * Copyright remains Eric Young's, and as such any Copyright notices in |
| 92 | * the code are not to be removed. | 92 | * the code are not to be removed. |
| 93 | * If this package is used in a product, Eric Young should be given attribution | 93 | * If this package is used in a product, Eric Young should be given attribution |
| 94 | * as the author of the parts of the library used. | 94 | * as the author of the parts of the library used. |
| 95 | * This can be in the form of a textual message at program startup or | 95 | * This can be in the form of a textual message at program startup or |
| 96 | * in documentation (online or textual) provided with the package. | 96 | * in documentation (online or textual) provided with the package. |
| 97 | * | 97 | * |
| 98 | * Redistribution and use in source and binary forms, with or without | 98 | * Redistribution and use in source and binary forms, with or without |
| 99 | * modification, are permitted provided that the following conditions | 99 | * modification, are permitted provided that the following conditions |
| 100 | * are met: | 100 | * are met: |
| @@ -109,10 +109,10 @@ | |||
| 109 | * Eric Young (eay@cryptsoft.com)" | 109 | * Eric Young (eay@cryptsoft.com)" |
| 110 | * The word 'cryptographic' can be left out if the rouines from the library | 110 | * The word 'cryptographic' can be left out if the rouines from the library |
| 111 | * being used are not cryptographic related :-). | 111 | * being used are not cryptographic related :-). |
| 112 | * 4. If you include any Windows specific code (or a derivative thereof) from | 112 | * 4. If you include any Windows specific code (or a derivative thereof) from |
| 113 | * the apps directory (application code) you must include an acknowledgement: | 113 | * the apps directory (application code) you must include an acknowledgement: |
| 114 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 114 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
| 115 | * | 115 | * |
| 116 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 116 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
| 117 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 117 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 118 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 118 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| @@ -124,7 +124,7 @@ | |||
| 124 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 124 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 125 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 125 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 126 | * SUCH DAMAGE. | 126 | * SUCH DAMAGE. |
| 127 | * | 127 | * |
| 128 | * The licence and distribution terms for any publically available version or | 128 | * The licence and distribution terms for any publically available version or |
| 129 | * derivative of this code cannot be changed. i.e. this code cannot simply be | 129 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
| 130 | * copied and put under another distribution licence | 130 | * copied and put under another distribution licence |
diff --git a/src/lib/libssl/Symbols.list b/src/lib/libssl/Symbols.list index 65cd3e7f86..0d82c7c726 100644 --- a/src/lib/libssl/Symbols.list +++ b/src/lib/libssl/Symbols.list | |||
| @@ -137,6 +137,7 @@ SSL_CTX_use_certificate_ASN1 | |||
| 137 | SSL_CTX_use_certificate_chain_file | 137 | SSL_CTX_use_certificate_chain_file |
| 138 | SSL_CTX_use_certificate_chain_mem | 138 | SSL_CTX_use_certificate_chain_mem |
| 139 | SSL_CTX_use_certificate_file | 139 | SSL_CTX_use_certificate_file |
| 140 | SSL_SESSION_dup | ||
| 140 | SSL_SESSION_free | 141 | SSL_SESSION_free |
| 141 | SSL_SESSION_get0_cipher | 142 | SSL_SESSION_get0_cipher |
| 142 | SSL_SESSION_get0_id_context | 143 | SSL_SESSION_get0_id_context |
diff --git a/src/lib/libssl/bio_ssl.c b/src/lib/libssl/bio_ssl.c index 6dd1699606..13e4f30539 100644 --- a/src/lib/libssl/bio_ssl.c +++ b/src/lib/libssl/bio_ssl.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bio_ssl.c,v 1.40 2023/07/19 13:34:33 tb Exp $ */ | 1 | /* $OpenBSD: bio_ssl.c,v 1.41 2025/06/02 12:18:22 jsg Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -229,9 +229,7 @@ ssl_write(BIO *b, const char *out, int outl) | |||
| 229 | 229 | ||
| 230 | BIO_clear_retry_flags(b); | 230 | BIO_clear_retry_flags(b); |
| 231 | 231 | ||
| 232 | /* ret=SSL_do_handshake(ssl); | 232 | ret = SSL_write(ssl, out, outl); |
| 233 | if (ret > 0) */ | ||
| 234 | ret = SSL_write(ssl, out, outl); | ||
| 235 | 233 | ||
| 236 | switch (SSL_get_error(ssl, ret)) { | 234 | switch (SSL_get_error(ssl, ret)) { |
| 237 | case SSL_ERROR_NONE: | 235 | case SSL_ERROR_NONE: |
diff --git a/src/lib/libssl/hidden/openssl/ssl.h b/src/lib/libssl/hidden/openssl/ssl.h index b854dd7b73..b010488d7f 100644 --- a/src/lib/libssl/hidden/openssl/ssl.h +++ b/src/lib/libssl/hidden/openssl/ssl.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl.h,v 1.9 2024/08/31 10:51:48 tb Exp $ */ | 1 | /* $OpenBSD: ssl.h,v 1.10 2025/10/24 11:36:08 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2023 Bob Beck <beck@openbsd.org> |
| 4 | * | 4 | * |
| @@ -182,6 +182,7 @@ LSSL_USED(SSL_SESSION_set1_id_context); | |||
| 182 | LSSL_USED(SSL_SESSION_is_resumable); | 182 | LSSL_USED(SSL_SESSION_is_resumable); |
| 183 | LSSL_USED(SSL_SESSION_new); | 183 | LSSL_USED(SSL_SESSION_new); |
| 184 | LSSL_USED(SSL_SESSION_free); | 184 | LSSL_USED(SSL_SESSION_free); |
| 185 | LSSL_USED(SSL_SESSION_dup); | ||
| 185 | LSSL_USED(SSL_SESSION_up_ref); | 186 | LSSL_USED(SSL_SESSION_up_ref); |
| 186 | LSSL_USED(SSL_SESSION_get_id); | 187 | LSSL_USED(SSL_SESSION_get_id); |
| 187 | LSSL_USED(SSL_SESSION_get0_id_context); | 188 | LSSL_USED(SSL_SESSION_get0_id_context); |
diff --git a/src/lib/libssl/hidden/ssl_namespace.h b/src/lib/libssl/hidden/ssl_namespace.h index 5d26516f3c..763dcd700f 100644 --- a/src/lib/libssl/hidden/ssl_namespace.h +++ b/src/lib/libssl/hidden/ssl_namespace.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_namespace.h,v 1.3 2024/07/12 05:26:34 miod Exp $ */ | 1 | /* $OpenBSD: ssl_namespace.h,v 1.4 2025/08/18 16:00:53 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2016 Philip Guenther <guenther@openbsd.org> | 3 | * Copyright (c) 2016 Philip Guenther <guenther@openbsd.org> |
| 4 | * | 4 | * |
| @@ -35,7 +35,11 @@ | |||
| 35 | #else | 35 | #else |
| 36 | #define LSSL_UNUSED(x) | 36 | #define LSSL_UNUSED(x) |
| 37 | #define LSSL_USED(x) | 37 | #define LSSL_USED(x) |
| 38 | #ifdef _MSC_VER | ||
| 39 | #define LSSL_ALIAS(x) | ||
| 40 | #else | ||
| 38 | #define LSSL_ALIAS(x) asm("") | 41 | #define LSSL_ALIAS(x) asm("") |
| 42 | #endif /* _MSC_VER */ | ||
| 39 | #endif | 43 | #endif |
| 40 | 44 | ||
| 41 | #endif /* _LIBSSL_SSL_NAMESPACE_H_ */ | 45 | #endif /* _LIBSSL_SSL_NAMESPACE_H_ */ |
diff --git a/src/lib/libssl/man/BIO_f_ssl.3 b/src/lib/libssl/man/BIO_f_ssl.3 index 3b74a3d6a4..e23a15e121 100644 --- a/src/lib/libssl/man/BIO_f_ssl.3 +++ b/src/lib/libssl/man/BIO_f_ssl.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_f_ssl.3,v 1.16 2024/01/13 18:37:51 tb Exp $ | 1 | .\" $OpenBSD: BIO_f_ssl.3,v 1.17 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL f672aee4 Feb 9 11:52:40 2016 -0500 | 2 | .\" full merge up to: OpenSSL f672aee4 Feb 9 11:52:40 2016 -0500 |
| 3 | .\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 | 3 | .\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 |
| 4 | .\" | 4 | .\" |
| @@ -50,7 +50,7 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: January 13 2024 $ | 53 | .Dd $Mdocdate: June 8 2025 $ |
| 54 | .Dt BIO_F_SSL 3 | 54 | .Dt BIO_F_SSL 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| @@ -69,6 +69,7 @@ | |||
| 69 | .Nm BIO_do_handshake | 69 | .Nm BIO_do_handshake |
| 70 | .Nd SSL BIO | 70 | .Nd SSL BIO |
| 71 | .Sh SYNOPSIS | 71 | .Sh SYNOPSIS |
| 72 | .Lb libssl libcrypto | ||
| 72 | .In openssl/bio.h | 73 | .In openssl/bio.h |
| 73 | .In openssl/ssl.h | 74 | .In openssl/ssl.h |
| 74 | .Ft const BIO_METHOD * | 75 | .Ft const BIO_METHOD * |
diff --git a/src/lib/libssl/man/DTLSv1_listen.3 b/src/lib/libssl/man/DTLSv1_listen.3 index 047ec0a7ff..bdba1c59b0 100644 --- a/src/lib/libssl/man/DTLSv1_listen.3 +++ b/src/lib/libssl/man/DTLSv1_listen.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: DTLSv1_listen.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: DTLSv1_listen.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL 7795475f Dec 18 13:18:31 2015 -0500 | 2 | .\" OpenSSL 7795475f Dec 18 13:18:31 2015 -0500 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Matt Caswell <matt@openssl.org>. | 4 | .\" This file was written by Matt Caswell <matt@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt DTLSV1_LISTEN 3 | 52 | .Dt DTLSV1_LISTEN 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm DTLSv1_listen | 55 | .Nm DTLSv1_listen |
| 56 | .Nd listen for incoming DTLS connections | 56 | .Nd listen for incoming DTLS connections |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/ssl.h | 59 | .In openssl/ssl.h |
| 59 | .Ft int | 60 | .Ft int |
| 60 | .Fo DTLSv1_listen | 61 | .Fo DTLSv1_listen |
diff --git a/src/lib/libssl/man/OPENSSL_init_ssl.3 b/src/lib/libssl/man/OPENSSL_init_ssl.3 index f37dccfaac..ec840f5e1c 100644 --- a/src/lib/libssl/man/OPENSSL_init_ssl.3 +++ b/src/lib/libssl/man/OPENSSL_init_ssl.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: OPENSSL_init_ssl.3,v 1.4 2019/06/14 13:41:31 schwarze Exp $ | 1 | .\" $OpenBSD: OPENSSL_init_ssl.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org> | 2 | .\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org> |
| 3 | .\" | 3 | .\" |
| 4 | .\" Permission to use, copy, modify, and distribute this software for any | 4 | .\" Permission to use, copy, modify, and distribute this software for any |
| @@ -13,13 +13,14 @@ | |||
| 13 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 13 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 14 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | .\" | 15 | .\" |
| 16 | .Dd $Mdocdate: June 14 2019 $ | 16 | .Dd $Mdocdate: June 8 2025 $ |
| 17 | .Dt OPENSSL_INIT_SSL 3 | 17 | .Dt OPENSSL_INIT_SSL 3 |
| 18 | .Os | 18 | .Os |
| 19 | .Sh NAME | 19 | .Sh NAME |
| 20 | .Nm OPENSSL_init_ssl | 20 | .Nm OPENSSL_init_ssl |
| 21 | .Nd initialise the crypto and ssl libraries | 21 | .Nd initialise the crypto and ssl libraries |
| 22 | .Sh SYNOPSIS | 22 | .Sh SYNOPSIS |
| 23 | .Lb libssl libcrypto | ||
| 23 | .In openssl/ssl.h | 24 | .In openssl/ssl.h |
| 24 | .Ft int | 25 | .Ft int |
| 25 | .Fo OPENSSL_init_ssl | 26 | .Fo OPENSSL_init_ssl |
diff --git a/src/lib/libssl/man/PEM_read_SSL_SESSION.3 b/src/lib/libssl/man/PEM_read_SSL_SESSION.3 index 3eb1414c62..93bd0b8ebd 100644 --- a/src/lib/libssl/man/PEM_read_SSL_SESSION.3 +++ b/src/lib/libssl/man/PEM_read_SSL_SESSION.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PEM_read_SSL_SESSION.3,v 1.4 2019/06/12 09:36:30 schwarze Exp $ | 1 | .\" $OpenBSD: PEM_read_SSL_SESSION.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL doc/man3/PEM_read_CMS.pod b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL doc/man3/PEM_read_CMS.pod b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Rich Salz <rsalz@openssl.org>. | 4 | .\" This file was written by Rich Salz <rsalz@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 12 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt PEM_READ_SSL_SESSION 3 | 52 | .Dt PEM_READ_SSL_SESSION 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm PEM_write_bio_SSL_SESSION | 58 | .Nm PEM_write_bio_SSL_SESSION |
| 59 | .Nd encode and decode SSL session objects in PEM format | 59 | .Nd encode and decode SSL session objects in PEM format |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libssl libcrypto | ||
| 61 | .In openssl/ssl.h | 62 | .In openssl/ssl.h |
| 62 | .Ft SSL_SESSION * | 63 | .Ft SSL_SESSION * |
| 63 | .Fo PEM_read_SSL_SESSION | 64 | .Fo PEM_read_SSL_SESSION |
diff --git a/src/lib/libssl/man/SSL_CIPHER_get_name.3 b/src/lib/libssl/man/SSL_CIPHER_get_name.3 index 86c1d3c0ba..fc92eb9723 100644 --- a/src/lib/libssl/man/SSL_CIPHER_get_name.3 +++ b/src/lib/libssl/man/SSL_CIPHER_get_name.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CIPHER_get_name.3,v 1.17 2024/07/16 10:19:38 tb Exp $ | 1 | .\" $OpenBSD: SSL_CIPHER_get_name.3,v 1.19 2025/06/13 18:34:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 | 3 | .\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 |
| 4 | .\" | 4 | .\" |
| @@ -52,7 +52,7 @@ | |||
| 52 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 52 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 53 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 53 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 54 | .\" | 54 | .\" |
| 55 | .Dd $Mdocdate: July 16 2024 $ | 55 | .Dd $Mdocdate: June 13 2025 $ |
| 56 | .Dt SSL_CIPHER_GET_NAME 3 | 56 | .Dt SSL_CIPHER_GET_NAME 3 |
| 57 | .Os | 57 | .Os |
| 58 | .Sh NAME | 58 | .Sh NAME |
| @@ -70,6 +70,7 @@ | |||
| 70 | .Nm SSL_CIPHER_description | 70 | .Nm SSL_CIPHER_description |
| 71 | .Nd get SSL_CIPHER properties | 71 | .Nd get SSL_CIPHER properties |
| 72 | .Sh SYNOPSIS | 72 | .Sh SYNOPSIS |
| 73 | .Lb libssl libcrypto | ||
| 73 | .In openssl/ssl.h | 74 | .In openssl/ssl.h |
| 74 | .Ft const char * | 75 | .Ft const char * |
| 75 | .Fn SSL_CIPHER_get_name "const SSL_CIPHER *cipher" | 76 | .Fn SSL_CIPHER_get_name "const SSL_CIPHER *cipher" |
| @@ -81,7 +82,7 @@ | |||
| 81 | .Fn SSL_CIPHER_get_cipher_nid "const SSL_CIPHER *cipher" | 82 | .Fn SSL_CIPHER_get_cipher_nid "const SSL_CIPHER *cipher" |
| 82 | .Ft int | 83 | .Ft int |
| 83 | .Fn SSL_CIPHER_get_digest_nid "const SSL_CIPHER *cipher" | 84 | .Fn SSL_CIPHER_get_digest_nid "const SSL_CIPHER *cipher" |
| 84 | .Ft "const EVP_MD *" | 85 | .Ft const EVP_MD * |
| 85 | .Fn SSL_CIPHER_get_handshake_digest "const SSL_CIPHER *cipher" | 86 | .Fn SSL_CIPHER_get_handshake_digest "const SSL_CIPHER *cipher" |
| 86 | .Ft int | 87 | .Ft int |
| 87 | .Fn SSL_CIPHER_get_kx_nid "const SSL_CIPHER *cipher" | 88 | .Fn SSL_CIPHER_get_kx_nid "const SSL_CIPHER *cipher" |
diff --git a/src/lib/libssl/man/SSL_COMP_add_compression_method.3 b/src/lib/libssl/man/SSL_COMP_add_compression_method.3 index f9e25358d7..0b990ca88e 100644 --- a/src/lib/libssl/man/SSL_COMP_add_compression_method.3 +++ b/src/lib/libssl/man/SSL_COMP_add_compression_method.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_COMP_add_compression_method.3,v 1.7 2024/08/31 10:51:48 tb Exp $ | 1 | .\" $OpenBSD: SSL_COMP_add_compression_method.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: August 31 2024 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt SSL_COMP_ADD_COMPRESSION_METHOD 3 | 18 | .Dt SSL_COMP_ADD_COMPRESSION_METHOD 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm SSL_COMP_get_compression_methods | 21 | .Nm SSL_COMP_get_compression_methods |
| 22 | .Nd handle SSL/TLS integrated compression methods | 22 | .Nd handle SSL/TLS integrated compression methods |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libssl libcrypto | ||
| 24 | .In openssl/ssl.h | 25 | .In openssl/ssl.h |
| 25 | .Ft STACK_OF(SSL_COMP) * | 26 | .Ft STACK_OF(SSL_COMP) * |
| 26 | .Fn SSL_COMP_get_compression_methods void | 27 | .Fn SSL_COMP_get_compression_methods void |
diff --git a/src/lib/libssl/man/SSL_CTX_add1_chain_cert.3 b/src/lib/libssl/man/SSL_CTX_add1_chain_cert.3 index 86eb27a523..91c4c80758 100644 --- a/src/lib/libssl/man/SSL_CTX_add1_chain_cert.3 +++ b/src/lib/libssl/man/SSL_CTX_add1_chain_cert.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_add1_chain_cert.3,v 1.2 2025/01/18 10:45:12 tb Exp $ | 1 | .\" $OpenBSD: SSL_CTX_add1_chain_cert.3,v 1.3 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 | 2 | .\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org> | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org> |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: January 18 2025 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_CTX_ADD1_CHAIN_CERT 3 | 53 | .Dt SSL_CTX_ADD1_CHAIN_CERT 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -67,6 +67,7 @@ | |||
| 67 | .Nm SSL_clear_chain_certs | 67 | .Nm SSL_clear_chain_certs |
| 68 | .Nd extra chain certificate processing | 68 | .Nd extra chain certificate processing |
| 69 | .Sh SYNOPSIS | 69 | .Sh SYNOPSIS |
| 70 | .Lb libssl libcrypto | ||
| 70 | .In openssl/ssl.h | 71 | .In openssl/ssl.h |
| 71 | .Ft int | 72 | .Ft int |
| 72 | .Fo SSL_CTX_set0_chain | 73 | .Fo SSL_CTX_set0_chain |
diff --git a/src/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 b/src/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 index b9694b0cbc..891c22a40a 100644 --- a/src/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 +++ b/src/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_add_extra_chain_cert.3,v 1.8 2025/01/18 10:45:12 tb Exp $ | 1 | .\" $OpenBSD: SSL_CTX_add_extra_chain_cert.3,v 1.9 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org> and | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org> and |
| @@ -50,7 +50,7 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: January 18 2025 $ | 53 | .Dd $Mdocdate: June 8 2025 $ |
| 54 | .Dt SSL_CTX_ADD_EXTRA_CHAIN_CERT 3 | 54 | .Dt SSL_CTX_ADD_EXTRA_CHAIN_CERT 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| @@ -60,6 +60,7 @@ | |||
| 60 | .Nm SSL_CTX_clear_extra_chain_certs | 60 | .Nm SSL_CTX_clear_extra_chain_certs |
| 61 | .Nd add, retrieve, and clear extra chain certificates | 61 | .Nd add, retrieve, and clear extra chain certificates |
| 62 | .Sh SYNOPSIS | 62 | .Sh SYNOPSIS |
| 63 | .Lb libssl libcrypto | ||
| 63 | .In openssl/ssl.h | 64 | .In openssl/ssl.h |
| 64 | .Ft long | 65 | .Ft long |
| 65 | .Fn SSL_CTX_add_extra_chain_cert "SSL_CTX *ctx" "X509 *x509" | 66 | .Fn SSL_CTX_add_extra_chain_cert "SSL_CTX *ctx" "X509 *x509" |
diff --git a/src/lib/libssl/man/SSL_CTX_add_session.3 b/src/lib/libssl/man/SSL_CTX_add_session.3 index 443bdb542a..df634bcdda 100644 --- a/src/lib/libssl/man/SSL_CTX_add_session.3 +++ b/src/lib/libssl/man/SSL_CTX_add_session.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_add_session.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_add_session.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL SSL_CTX_add_session.pod 1722496f Jun 8 15:18:38 2017 -0400 | 2 | .\" OpenSSL SSL_CTX_add_session.pod 1722496f Jun 8 15:18:38 2017 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org> and | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org> and |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: March 27 2018 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_CTX_ADD_SESSION 3 | 53 | .Dt SSL_CTX_ADD_SESSION 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm SSL_CTX_remove_session | 57 | .Nm SSL_CTX_remove_session |
| 58 | .Nd manipulate session cache | 58 | .Nd manipulate session cache |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libssl libcrypto | ||
| 60 | .In openssl/ssl.h | 61 | .In openssl/ssl.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fn SSL_CTX_add_session "SSL_CTX *ctx" "SSL_SESSION *c" | 63 | .Fn SSL_CTX_add_session "SSL_CTX *ctx" "SSL_SESSION *c" |
diff --git a/src/lib/libssl/man/SSL_CTX_ctrl.3 b/src/lib/libssl/man/SSL_CTX_ctrl.3 index c91ddff374..4d254d8f48 100644 --- a/src/lib/libssl/man/SSL_CTX_ctrl.3 +++ b/src/lib/libssl/man/SSL_CTX_ctrl.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_ctrl.3,v 1.7 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_ctrl.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_CTRL 3 | 52 | .Dt SSL_CTX_CTRL 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm SSL_callback_ctrl | 58 | .Nm SSL_callback_ctrl |
| 59 | .Nd internal handling functions for SSL_CTX and SSL objects | 59 | .Nd internal handling functions for SSL_CTX and SSL objects |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libssl libcrypto | ||
| 61 | .In openssl/ssl.h | 62 | .In openssl/ssl.h |
| 62 | .Ft long | 63 | .Ft long |
| 63 | .Fn SSL_CTX_ctrl "SSL_CTX *ctx" "int cmd" "long larg" "void *parg" | 64 | .Fn SSL_CTX_ctrl "SSL_CTX *ctx" "int cmd" "long larg" "void *parg" |
diff --git a/src/lib/libssl/man/SSL_CTX_flush_sessions.3 b/src/lib/libssl/man/SSL_CTX_flush_sessions.3 index 2ef781cb4a..deabf5200a 100644 --- a/src/lib/libssl/man/SSL_CTX_flush_sessions.3 +++ b/src/lib/libssl/man/SSL_CTX_flush_sessions.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_flush_sessions.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_flush_sessions.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL SSL_CTX_flush_sessions.pod 1722496f Jun 8 15:18:38 2017 -0400 | 2 | .\" OpenSSL SSL_CTX_flush_sessions.pod 1722496f Jun 8 15:18:38 2017 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_FLUSH_SESSIONS 3 | 52 | .Dt SSL_CTX_FLUSH_SESSIONS 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_CTX_flush_sessions | 55 | .Nm SSL_CTX_flush_sessions |
| 56 | .Nd remove expired sessions | 56 | .Nd remove expired sessions |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/ssl.h | 59 | .In openssl/ssl.h |
| 59 | .Ft void | 60 | .Ft void |
| 60 | .Fn SSL_CTX_flush_sessions "SSL_CTX *ctx" "long tm" | 61 | .Fn SSL_CTX_flush_sessions "SSL_CTX *ctx" "long tm" |
diff --git a/src/lib/libssl/man/SSL_CTX_free.3 b/src/lib/libssl/man/SSL_CTX_free.3 index 47f247631b..0afef7cd0e 100644 --- a/src/lib/libssl/man/SSL_CTX_free.3 +++ b/src/lib/libssl/man/SSL_CTX_free.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_free.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_free.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_FREE 3 | 52 | .Dt SSL_CTX_FREE 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_CTX_free | 55 | .Nm SSL_CTX_free |
| 56 | .Nd free an allocated SSL_CTX object | 56 | .Nd free an allocated SSL_CTX object |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/ssl.h | 59 | .In openssl/ssl.h |
| 59 | .Ft void | 60 | .Ft void |
| 60 | .Fn SSL_CTX_free "SSL_CTX *ctx" | 61 | .Fn SSL_CTX_free "SSL_CTX *ctx" |
diff --git a/src/lib/libssl/man/SSL_CTX_get0_certificate.3 b/src/lib/libssl/man/SSL_CTX_get0_certificate.3 index 63c86bd5e0..226e6cd87a 100644 --- a/src/lib/libssl/man/SSL_CTX_get0_certificate.3 +++ b/src/lib/libssl/man/SSL_CTX_get0_certificate.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_get0_certificate.3,v 1.3 2019/06/12 09:36:30 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_get0_certificate.3,v 1.4 2025/06/08 22:47:20 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,15 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: June 12 2019 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt SSL_CTX_GET0_CERTIFICATE 3 | 18 | .Dt SSL_CTX_GET0_CERTIFICATE 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm SSL_CTX_get0_certificate | 21 | .Nm SSL_CTX_get0_certificate |
| 22 | .Nd get the active certificate from an SSL context | 22 | .Nd get the active certificate from an SSL context |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libssl libcrypto | ||
| 25 | .In openssl/ssl.h | ||
| 24 | .Ft X509 * | 26 | .Ft X509 * |
| 25 | .Fo SSL_CTX_get0_certificate | 27 | .Fo SSL_CTX_get0_certificate |
| 26 | .Fa "const SSL_CTX *ctx" | 28 | .Fa "const SSL_CTX *ctx" |
diff --git a/src/lib/libssl/man/SSL_CTX_get_ex_new_index.3 b/src/lib/libssl/man/SSL_CTX_get_ex_new_index.3 index 3dbaf2e981..30a02cc317 100644 --- a/src/lib/libssl/man/SSL_CTX_get_ex_new_index.3 +++ b/src/lib/libssl/man/SSL_CTX_get_ex_new_index.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_get_ex_new_index.3,v 1.3 2018/03/21 08:06:34 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_get_ex_new_index.3,v 1.4 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 | 2 | .\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 21 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_GET_EX_NEW_INDEX 3 | 52 | .Dt SSL_CTX_GET_EX_NEW_INDEX 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm SSL_CTX_get_ex_data | 57 | .Nm SSL_CTX_get_ex_data |
| 58 | .Nd internal application specific data functions | 58 | .Nd internal application specific data functions |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libssl libcrypto | ||
| 60 | .In openssl/ssl.h | 61 | .In openssl/ssl.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fo SSL_CTX_get_ex_new_index | 63 | .Fo SSL_CTX_get_ex_new_index |
diff --git a/src/lib/libssl/man/SSL_CTX_get_verify_mode.3 b/src/lib/libssl/man/SSL_CTX_get_verify_mode.3 index 7c87775069..88187f7f3c 100644 --- a/src/lib/libssl/man/SSL_CTX_get_verify_mode.3 +++ b/src/lib/libssl/man/SSL_CTX_get_verify_mode.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_get_verify_mode.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_get_verify_mode.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_GET_VERIFY_MODE 3 | 52 | .Dt SSL_CTX_GET_VERIFY_MODE 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -60,6 +60,7 @@ | |||
| 60 | .Nm SSL_CTX_get_verify_callback | 60 | .Nm SSL_CTX_get_verify_callback |
| 61 | .Nd get currently set verification parameters | 61 | .Nd get currently set verification parameters |
| 62 | .Sh SYNOPSIS | 62 | .Sh SYNOPSIS |
| 63 | .Lb libssl libcrypto | ||
| 63 | .In openssl/ssl.h | 64 | .In openssl/ssl.h |
| 64 | .Ft int | 65 | .Ft int |
| 65 | .Fn SSL_CTX_get_verify_mode "const SSL_CTX *ctx" | 66 | .Fn SSL_CTX_get_verify_mode "const SSL_CTX *ctx" |
diff --git a/src/lib/libssl/man/SSL_CTX_load_verify_locations.3 b/src/lib/libssl/man/SSL_CTX_load_verify_locations.3 index 373df2402e..0cc22f433d 100644 --- a/src/lib/libssl/man/SSL_CTX_load_verify_locations.3 +++ b/src/lib/libssl/man/SSL_CTX_load_verify_locations.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_load_verify_locations.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_load_verify_locations.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 | 2 | .\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: March 27 2018 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_CTX_LOAD_VERIFY_LOCATIONS 3 | 53 | .Dt SSL_CTX_LOAD_VERIFY_LOCATIONS 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm SSL_CTX_set_default_verify_paths | 57 | .Nm SSL_CTX_set_default_verify_paths |
| 58 | .Nd set default locations for trusted CA certificates | 58 | .Nd set default locations for trusted CA certificates |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libssl libcrypto | ||
| 60 | .In openssl/ssl.h | 61 | .In openssl/ssl.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fo SSL_CTX_load_verify_locations | 63 | .Fo SSL_CTX_load_verify_locations |
diff --git a/src/lib/libssl/man/SSL_CTX_new.3 b/src/lib/libssl/man/SSL_CTX_new.3 index 4b50a03de4..2afad5378c 100644 --- a/src/lib/libssl/man/SSL_CTX_new.3 +++ b/src/lib/libssl/man/SSL_CTX_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_new.3,v 1.17 2022/07/13 22:05:53 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_new.3,v 1.18 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 21cd6e00 Oct 21 14:40:15 2015 +0100 | 2 | .\" full merge up to: OpenSSL 21cd6e00 Oct 21 14:40:15 2015 +0100 |
| 3 | .\" selective merge up to: OpenSSL 8f75443f May 24 14:04:26 2019 +0200 | 3 | .\" selective merge up to: OpenSSL 8f75443f May 24 14:04:26 2019 +0200 |
| 4 | .\" | 4 | .\" |
| @@ -50,7 +50,7 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: July 13 2022 $ | 53 | .Dd $Mdocdate: June 8 2025 $ |
| 54 | .Dt SSL_CTX_NEW 3 | 54 | .Dt SSL_CTX_NEW 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| @@ -82,6 +82,7 @@ | |||
| 82 | .Nm DTLSv1_2_client_method | 82 | .Nm DTLSv1_2_client_method |
| 83 | .Nd create a new SSL_CTX object as a framework for TLS enabled functions | 83 | .Nd create a new SSL_CTX object as a framework for TLS enabled functions |
| 84 | .Sh SYNOPSIS | 84 | .Sh SYNOPSIS |
| 85 | .Lb libssl libcrypto | ||
| 85 | .In openssl/ssl.h | 86 | .In openssl/ssl.h |
| 86 | .Ft SSL_CTX * | 87 | .Ft SSL_CTX * |
| 87 | .Fn SSL_CTX_new "const SSL_METHOD *method" | 88 | .Fn SSL_CTX_new "const SSL_METHOD *method" |
diff --git a/src/lib/libssl/man/SSL_CTX_sess_number.3 b/src/lib/libssl/man/SSL_CTX_sess_number.3 index 76d436cd17..854f6256eb 100644 --- a/src/lib/libssl/man/SSL_CTX_sess_number.3 +++ b/src/lib/libssl/man/SSL_CTX_sess_number.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_sess_number.3,v 1.9 2019/06/12 09:36:30 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_sess_number.3,v 1.10 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL SSL_CTX_sess_number.pod 7bd27895 Mar 29 11:45:29 2017 +1000 | 2 | .\" OpenSSL SSL_CTX_sess_number.pod 7bd27895 Mar 29 11:45:29 2017 +1000 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 12 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_SESS_NUMBER 3 | 52 | .Dt SSL_CTX_SESS_NUMBER 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -66,6 +66,7 @@ | |||
| 66 | .Nm SSL_CTX_sess_cache_full | 66 | .Nm SSL_CTX_sess_cache_full |
| 67 | .Nd obtain session cache statistics | 67 | .Nd obtain session cache statistics |
| 68 | .Sh SYNOPSIS | 68 | .Sh SYNOPSIS |
| 69 | .Lb libssl libcrypto | ||
| 69 | .In openssl/ssl.h | 70 | .In openssl/ssl.h |
| 70 | .Ft long | 71 | .Ft long |
| 71 | .Fn SSL_CTX_sess_number "SSL_CTX *ctx" | 72 | .Fn SSL_CTX_sess_number "SSL_CTX *ctx" |
diff --git a/src/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 b/src/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 index 6d5fede0b6..e8bfe50a3c 100644 --- a/src/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 +++ b/src/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_sess_set_cache_size.3,v 1.5 2019/06/12 09:36:30 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_sess_set_cache_size.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 12 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_SESS_SET_CACHE_SIZE 3 | 52 | .Dt SSL_CTX_SESS_SET_CACHE_SIZE 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm SSL_CTX_sess_get_cache_size | 56 | .Nm SSL_CTX_sess_get_cache_size |
| 57 | .Nd manipulate session cache size | 57 | .Nd manipulate session cache size |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libssl libcrypto | ||
| 59 | .In openssl/ssl.h | 60 | .In openssl/ssl.h |
| 60 | .Ft long | 61 | .Ft long |
| 61 | .Fn SSL_CTX_sess_set_cache_size "SSL_CTX *ctx" "long t" | 62 | .Fn SSL_CTX_sess_set_cache_size "SSL_CTX *ctx" "long t" |
diff --git a/src/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 b/src/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 index e99f2be671..62a6698399 100644 --- a/src/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 +++ b/src/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_sess_set_get_cb.3,v 1.7 2022/03/29 18:15:52 naddy Exp $ | 1 | .\" $OpenBSD: SSL_CTX_sess_set_get_cb.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: March 29 2022 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_CTX_SESS_SET_GET_CB 3 | 53 | .Dt SSL_CTX_SESS_SET_GET_CB 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -61,6 +61,7 @@ | |||
| 61 | .Nm SSL_CTX_sess_get_get_cb | 61 | .Nm SSL_CTX_sess_get_get_cb |
| 62 | .Nd provide callback functions for server side external session caching | 62 | .Nd provide callback functions for server side external session caching |
| 63 | .Sh SYNOPSIS | 63 | .Sh SYNOPSIS |
| 64 | .Lb libssl libcrypto | ||
| 64 | .In openssl/ssl.h | 65 | .In openssl/ssl.h |
| 65 | .Ft void | 66 | .Ft void |
| 66 | .Fo SSL_CTX_sess_set_new_cb | 67 | .Fo SSL_CTX_sess_set_new_cb |
diff --git a/src/lib/libssl/man/SSL_CTX_sessions.3 b/src/lib/libssl/man/SSL_CTX_sessions.3 index 964d1a7346..627c694cd8 100644 --- a/src/lib/libssl/man/SSL_CTX_sessions.3 +++ b/src/lib/libssl/man/SSL_CTX_sessions.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_sessions.3,v 1.5 2018/04/25 14:19:39 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_sessions.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: April 25 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_SESSIONS 3 | 52 | .Dt SSL_CTX_SESSIONS 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_CTX_sessions | 55 | .Nm SSL_CTX_sessions |
| 56 | .Nd access internal session cache | 56 | .Nd access internal session cache |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/ssl.h | 59 | .In openssl/ssl.h |
| 59 | .Ft LHASH_OF(SSL_SESSION) * | 60 | .Ft LHASH_OF(SSL_SESSION) * |
| 60 | .Fn SSL_CTX_sessions "SSL_CTX *ctx" | 61 | .Fn SSL_CTX_sessions "SSL_CTX *ctx" |
diff --git a/src/lib/libssl/man/SSL_CTX_set1_groups.3 b/src/lib/libssl/man/SSL_CTX_set1_groups.3 index 0d1eb36ea7..8cd620d3b4 100644 --- a/src/lib/libssl/man/SSL_CTX_set1_groups.3 +++ b/src/lib/libssl/man/SSL_CTX_set1_groups.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set1_groups.3,v 1.2 2017/08/19 19:36:39 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set1_groups.3,v 1.3 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL SSL_CTX_set1_curves.pod de4d764e Nov 9 14:51:06 2016 +0000 | 2 | .\" OpenSSL SSL_CTX_set1_curves.pod de4d764e Nov 9 14:51:06 2016 +0000 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: August 19 2017 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_SET1_GROUPS 3 | 52 | .Dt SSL_CTX_SET1_GROUPS 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -62,6 +62,7 @@ | |||
| 62 | .Nm SSL_set1_curves_list | 62 | .Nm SSL_set1_curves_list |
| 63 | .Nd choose supported EC groups | 63 | .Nd choose supported EC groups |
| 64 | .Sh SYNOPSIS | 64 | .Sh SYNOPSIS |
| 65 | .Lb libssl libcrypto | ||
| 65 | .In openssl/ssl.h | 66 | .In openssl/ssl.h |
| 66 | .Ft int | 67 | .Ft int |
| 67 | .Fo SSL_CTX_set1_groups | 68 | .Fo SSL_CTX_set1_groups |
diff --git a/src/lib/libssl/man/SSL_CTX_set_alpn_select_cb.3 b/src/lib/libssl/man/SSL_CTX_set_alpn_select_cb.3 index 2317c57af4..ff69408247 100644 --- a/src/lib/libssl/man/SSL_CTX_set_alpn_select_cb.3 +++ b/src/lib/libssl/man/SSL_CTX_set_alpn_select_cb.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_alpn_select_cb.3,v 1.11 2025/02/04 14:00:05 tb Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_alpn_select_cb.3,v 1.12 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL 87b81496 Apr 19 12:38:27 2017 -0400 | 2 | .\" OpenSSL 87b81496 Apr 19 12:38:27 2017 -0400 |
| 3 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 3 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: February 4 2025 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_CTX_SET_ALPN_SELECT_CB 3 | 53 | .Dt SSL_CTX_SET_ALPN_SELECT_CB 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -60,6 +60,7 @@ | |||
| 60 | .Nm SSL_get0_alpn_selected | 60 | .Nm SSL_get0_alpn_selected |
| 61 | .Nd handle application layer protocol negotiation (ALPN) | 61 | .Nd handle application layer protocol negotiation (ALPN) |
| 62 | .Sh SYNOPSIS | 62 | .Sh SYNOPSIS |
| 63 | .Lb libssl libcrypto | ||
| 63 | .In openssl/ssl.h | 64 | .In openssl/ssl.h |
| 64 | .Ft int | 65 | .Ft int |
| 65 | .Fo SSL_CTX_set_alpn_protos | 66 | .Fo SSL_CTX_set_alpn_protos |
diff --git a/src/lib/libssl/man/SSL_CTX_set_cert_store.3 b/src/lib/libssl/man/SSL_CTX_set_cert_store.3 index 1be1ba2f68..75c145fd78 100644 --- a/src/lib/libssl/man/SSL_CTX_set_cert_store.3 +++ b/src/lib/libssl/man/SSL_CTX_set_cert_store.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_cert_store.3,v 1.8 2024/08/03 04:53:01 tb Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_cert_store.3,v 1.9 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: August 3 2024 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_SET_CERT_STORE 3 | 52 | .Dt SSL_CTX_SET_CERT_STORE 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm SSL_CTX_get_cert_store | 57 | .Nm SSL_CTX_get_cert_store |
| 58 | .Nd manipulate X509 certificate verification storage | 58 | .Nd manipulate X509 certificate verification storage |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libssl libcrypto | ||
| 60 | .In openssl/ssl.h | 61 | .In openssl/ssl.h |
| 61 | .Ft void | 62 | .Ft void |
| 62 | .Fn SSL_CTX_set_cert_store "SSL_CTX *ctx" "X509_STORE *store" | 63 | .Fn SSL_CTX_set_cert_store "SSL_CTX *ctx" "X509_STORE *store" |
diff --git a/src/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 b/src/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 index 0e12b48c78..2e2beac850 100644 --- a/src/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 +++ b/src/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_cert_verify_callback.3,v 1.5 2019/06/08 15:25:43 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_cert_verify_callback.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 8 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_SET_CERT_VERIFY_CALLBACK 3 | 52 | .Dt SSL_CTX_SET_CERT_VERIFY_CALLBACK 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_CTX_set_cert_verify_callback | 55 | .Nm SSL_CTX_set_cert_verify_callback |
| 56 | .Nd set peer certificate verification procedure | 56 | .Nd set peer certificate verification procedure |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/ssl.h | 59 | .In openssl/ssl.h |
| 59 | .Ft void | 60 | .Ft void |
| 60 | .Fo SSL_CTX_set_cert_verify_callback | 61 | .Fo SSL_CTX_set_cert_verify_callback |
diff --git a/src/lib/libssl/man/SSL_CTX_set_cipher_list.3 b/src/lib/libssl/man/SSL_CTX_set_cipher_list.3 index b3f0dc3541..6201dc9f55 100644 --- a/src/lib/libssl/man/SSL_CTX_set_cipher_list.3 +++ b/src/lib/libssl/man/SSL_CTX_set_cipher_list.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_cipher_list.3,v 1.18 2025/01/18 12:20:02 tb Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_cipher_list.3,v 1.19 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: January 18 2025 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt SSL_CTX_SET_CIPHER_LIST 3 | 69 | .Dt SSL_CTX_SET_CIPHER_LIST 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -73,6 +73,7 @@ | |||
| 73 | .Nm SSL_set_cipher_list | 73 | .Nm SSL_set_cipher_list |
| 74 | .Nd choose list of available SSL_CIPHERs | 74 | .Nd choose list of available SSL_CIPHERs |
| 75 | .Sh SYNOPSIS | 75 | .Sh SYNOPSIS |
| 76 | .Lb libssl libcrypto | ||
| 76 | .In openssl/ssl.h | 77 | .In openssl/ssl.h |
| 77 | .Ft int | 78 | .Ft int |
| 78 | .Fn SSL_CTX_set_cipher_list "SSL_CTX *ctx" "const char *control" | 79 | .Fn SSL_CTX_set_cipher_list "SSL_CTX *ctx" "const char *control" |
diff --git a/src/lib/libssl/man/SSL_CTX_set_client_CA_list.3 b/src/lib/libssl/man/SSL_CTX_set_client_CA_list.3 index d19fb93ed0..520be04318 100644 --- a/src/lib/libssl/man/SSL_CTX_set_client_CA_list.3 +++ b/src/lib/libssl/man/SSL_CTX_set_client_CA_list.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_client_CA_list.3,v 1.6 2020/03/30 10:28:59 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_client_CA_list.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,16 +48,17 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 30 2020 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_SET_CLIENT_CA_LIST 3 | 52 | .Dt SSL_CTX_SET_CLIENT_CA_LIST 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_CTX_set_client_CA_list , | 55 | .Nm SSL_CTX_set_client_CA_list , |
| 56 | .Nm SSL_set_client_CA_list , | 56 | .Nm SSL_set_client_CA_list , |
| 57 | .Nm SSL_CTX_add_client_CA , | 57 | .Nm SSL_CTX_add_client_CA , |
| 58 | .Nm SSL_add_client_CA | 58 | .Nm SSL_add_client_CA |
| 59 | .Nd set list of CAs sent to the client when requesting a client certificate | 59 | .Nd set list of CAs sent to the client when requesting a client certificate |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libssl libcrypto | ||
| 61 | .In openssl/ssl.h | 62 | .In openssl/ssl.h |
| 62 | .Ft void | 63 | .Ft void |
| 63 | .Fn SSL_CTX_set_client_CA_list "SSL_CTX *ctx" "STACK_OF(X509_NAME) *list" | 64 | .Fn SSL_CTX_set_client_CA_list "SSL_CTX *ctx" "STACK_OF(X509_NAME) *list" |
diff --git a/src/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 b/src/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 index a2433b5e92..2cf8275602 100644 --- a/src/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 +++ b/src/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_client_cert_cb.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_client_cert_cb.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_SET_CLIENT_CERT_CB 3 | 52 | .Dt SSL_CTX_SET_CLIENT_CERT_CB 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm SSL_CTX_get_client_cert_cb | 56 | .Nm SSL_CTX_get_client_cert_cb |
| 57 | .Nd handle client certificate callback function | 57 | .Nd handle client certificate callback function |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libssl libcrypto | ||
| 59 | .In openssl/ssl.h | 60 | .In openssl/ssl.h |
| 60 | .Ft void | 61 | .Ft void |
| 61 | .Fo SSL_CTX_set_client_cert_cb | 62 | .Fo SSL_CTX_set_client_cert_cb |
diff --git a/src/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 b/src/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 index 94b4ea543d..e3da1bec66 100644 --- a/src/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 +++ b/src/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_default_passwd_cb.3,v 1.9 2023/09/19 09:40:35 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_default_passwd_cb.3,v 1.10 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 | 2 | .\" full merge up to: OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 |
| 3 | .\" selective merge up to: OpenSSL 18bad535 Apr 9 15:13:55 2019 +0100 | 3 | .\" selective merge up to: OpenSSL 18bad535 Apr 9 15:13:55 2019 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -67,7 +67,7 @@ | |||
| 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 69 | .\" | 69 | .\" |
| 70 | .Dd $Mdocdate: September 19 2023 $ | 70 | .Dd $Mdocdate: June 8 2025 $ |
| 71 | .Dt SSL_CTX_SET_DEFAULT_PASSWD_CB 3 | 71 | .Dt SSL_CTX_SET_DEFAULT_PASSWD_CB 3 |
| 72 | .Os | 72 | .Os |
| 73 | .Sh NAME | 73 | .Sh NAME |
| @@ -77,6 +77,7 @@ | |||
| 77 | .Nm SSL_CTX_get_default_passwd_cb_userdata | 77 | .Nm SSL_CTX_get_default_passwd_cb_userdata |
| 78 | .Nd set or get passwd callback for encrypted PEM file handling | 78 | .Nd set or get passwd callback for encrypted PEM file handling |
| 79 | .Sh SYNOPSIS | 79 | .Sh SYNOPSIS |
| 80 | .Lb libssl libcrypto | ||
| 80 | .In openssl/ssl.h | 81 | .In openssl/ssl.h |
| 81 | .Ft void | 82 | .Ft void |
| 82 | .Fn SSL_CTX_set_default_passwd_cb "SSL_CTX *ctx" "pem_password_cb *cb" | 83 | .Fn SSL_CTX_set_default_passwd_cb "SSL_CTX *ctx" "pem_password_cb *cb" |
diff --git a/src/lib/libssl/man/SSL_CTX_set_generate_session_id.3 b/src/lib/libssl/man/SSL_CTX_set_generate_session_id.3 index d85383d776..29c102ac50 100644 --- a/src/lib/libssl/man/SSL_CTX_set_generate_session_id.3 +++ b/src/lib/libssl/man/SSL_CTX_set_generate_session_id.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_generate_session_id.3,v 1.5 2018/03/22 21:09:18 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_generate_session_id.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 22 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_SET_GENERATE_SESSION_ID 3 | 52 | .Dt SSL_CTX_SET_GENERATE_SESSION_ID 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm GEN_SESSION_CB | 58 | .Nm GEN_SESSION_CB |
| 59 | .Nd manipulate generation of SSL session IDs (server only) | 59 | .Nd manipulate generation of SSL session IDs (server only) |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libssl libcrypto | ||
| 61 | .In openssl/ssl.h | 62 | .In openssl/ssl.h |
| 62 | .Ft typedef int | 63 | .Ft typedef int |
| 63 | .Fo (*GEN_SESSION_CB) | 64 | .Fo (*GEN_SESSION_CB) |
diff --git a/src/lib/libssl/man/SSL_CTX_set_info_callback.3 b/src/lib/libssl/man/SSL_CTX_set_info_callback.3 index 76eb8bee61..ec251b5b69 100644 --- a/src/lib/libssl/man/SSL_CTX_set_info_callback.3 +++ b/src/lib/libssl/man/SSL_CTX_set_info_callback.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_info_callback.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_info_callback.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_SET_INFO_CALLBACK 3 | 52 | .Dt SSL_CTX_SET_INFO_CALLBACK 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm SSL_get_info_callback | 58 | .Nm SSL_get_info_callback |
| 59 | .Nd handle information callback for SSL connections | 59 | .Nd handle information callback for SSL connections |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libssl libcrypto | ||
| 61 | .In openssl/ssl.h | 62 | .In openssl/ssl.h |
| 62 | .Ft void | 63 | .Ft void |
| 63 | .Fo SSL_CTX_set_info_callback | 64 | .Fo SSL_CTX_set_info_callback |
diff --git a/src/lib/libssl/man/SSL_CTX_set_keylog_callback.3 b/src/lib/libssl/man/SSL_CTX_set_keylog_callback.3 index 24b8f9992f..0cb36b07c6 100644 --- a/src/lib/libssl/man/SSL_CTX_set_keylog_callback.3 +++ b/src/lib/libssl/man/SSL_CTX_set_keylog_callback.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_keylog_callback.3,v 1.3 2024/05/16 08:39:30 tb Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_keylog_callback.3,v 1.4 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL pod checked up to: 61f805c1 Jan 16 01:01:46 2018 +0800 | 2 | .\" OpenSSL pod checked up to: 61f805c1 Jan 16 01:01:46 2018 +0800 |
| 3 | .\" | 3 | .\" |
| 4 | .\" Copyright (c) 2021 Bob Beck <beck@openbsd.org> | 4 | .\" Copyright (c) 2021 Bob Beck <beck@openbsd.org> |
| @@ -15,7 +15,7 @@ | |||
| 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 | .\" | 17 | .\" |
| 18 | .Dd $Mdocdate: May 16 2024 $ | 18 | .Dd $Mdocdate: June 8 2025 $ |
| 19 | .Dt SSL_CTX_SET_KEYLOG_CALLBACK 3 | 19 | .Dt SSL_CTX_SET_KEYLOG_CALLBACK 3 |
| 20 | .Os | 20 | .Os |
| 21 | .Sh NAME | 21 | .Sh NAME |
| @@ -23,6 +23,7 @@ | |||
| 23 | .Nm SSL_CTX_get_keylog_callback | 23 | .Nm SSL_CTX_get_keylog_callback |
| 24 | .Nd set and get the unused key logging callback | 24 | .Nd set and get the unused key logging callback |
| 25 | .Sh SYNOPSIS | 25 | .Sh SYNOPSIS |
| 26 | .Lb libssl libcrypto | ||
| 26 | .In openssl/ssl.h | 27 | .In openssl/ssl.h |
| 27 | .Ft typedef void | 28 | .Ft typedef void |
| 28 | .Fo (*SSL_CTX_keylog_cb_func) | 29 | .Fo (*SSL_CTX_keylog_cb_func) |
diff --git a/src/lib/libssl/man/SSL_CTX_set_max_cert_list.3 b/src/lib/libssl/man/SSL_CTX_set_max_cert_list.3 index 89513b1006..700f534f54 100644 --- a/src/lib/libssl/man/SSL_CTX_set_max_cert_list.3 +++ b/src/lib/libssl/man/SSL_CTX_set_max_cert_list.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_max_cert_list.3,v 1.6 2019/06/12 09:36:30 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_max_cert_list.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 12 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_SET_MAX_CERT_LIST 3 | 52 | .Dt SSL_CTX_SET_MAX_CERT_LIST 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm SSL_get_max_cert_list | 58 | .Nm SSL_get_max_cert_list |
| 59 | .Nd manipulate allowed size for the peer's certificate chain | 59 | .Nd manipulate allowed size for the peer's certificate chain |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libssl libcrypto | ||
| 61 | .In openssl/ssl.h | 62 | .In openssl/ssl.h |
| 62 | .Ft long | 63 | .Ft long |
| 63 | .Fn SSL_CTX_set_max_cert_list "SSL_CTX *ctx" "long size" | 64 | .Fn SSL_CTX_set_max_cert_list "SSL_CTX *ctx" "long size" |
diff --git a/src/lib/libssl/man/SSL_CTX_set_min_proto_version.3 b/src/lib/libssl/man/SSL_CTX_set_min_proto_version.3 index a2597cda83..50a5fc448d 100644 --- a/src/lib/libssl/man/SSL_CTX_set_min_proto_version.3 +++ b/src/lib/libssl/man/SSL_CTX_set_min_proto_version.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_min_proto_version.3,v 1.5 2021/04/15 16:40:32 tb Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_min_proto_version.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 3edabd3c Sep 14 09:28:39 2017 +0200 | 2 | .\" full merge up to: OpenSSL 3edabd3c Sep 14 09:28:39 2017 +0200 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Kurt Roeckx <kurt@roeckx.be> and | 4 | .\" This file was written by Kurt Roeckx <kurt@roeckx.be> and |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: April 15 2021 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_CTX_SET_MIN_PROTO_VERSION 3 | 53 | .Dt SSL_CTX_SET_MIN_PROTO_VERSION 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -63,6 +63,7 @@ | |||
| 63 | .Nm SSL_get_max_proto_version | 63 | .Nm SSL_get_max_proto_version |
| 64 | .Nd get and set minimum and maximum supported protocol version | 64 | .Nd get and set minimum and maximum supported protocol version |
| 65 | .Sh SYNOPSIS | 65 | .Sh SYNOPSIS |
| 66 | .Lb libssl libcrypto | ||
| 66 | .In openssl/ssl.h | 67 | .In openssl/ssl.h |
| 67 | .Ft int | 68 | .Ft int |
| 68 | .Fo SSL_CTX_set_min_proto_version | 69 | .Fo SSL_CTX_set_min_proto_version |
diff --git a/src/lib/libssl/man/SSL_CTX_set_mode.3 b/src/lib/libssl/man/SSL_CTX_set_mode.3 index fca1a977d0..62a7a6deda 100644 --- a/src/lib/libssl/man/SSL_CTX_set_mode.3 +++ b/src/lib/libssl/man/SSL_CTX_set_mode.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_mode.3,v 1.7 2020/10/08 16:02:38 tb Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_mode.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 8671b898 Jun 3 02:48:34 2008 +0000 | 2 | .\" full merge up to: OpenSSL 8671b898 Jun 3 02:48:34 2008 +0000 |
| 3 | .\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 | 3 | .\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -50,7 +50,7 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: October 8 2020 $ | 53 | .Dd $Mdocdate: June 8 2025 $ |
| 54 | .Dt SSL_CTX_SET_MODE 3 | 54 | .Dt SSL_CTX_SET_MODE 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| @@ -62,6 +62,7 @@ | |||
| 62 | .Nm SSL_get_mode | 62 | .Nm SSL_get_mode |
| 63 | .Nd manipulate SSL engine mode | 63 | .Nd manipulate SSL engine mode |
| 64 | .Sh SYNOPSIS | 64 | .Sh SYNOPSIS |
| 65 | .Lb libssl libcrypto | ||
| 65 | .In openssl/ssl.h | 66 | .In openssl/ssl.h |
| 66 | .Ft long | 67 | .Ft long |
| 67 | .Fn SSL_CTX_set_mode "SSL_CTX *ctx" "long mode" | 68 | .Fn SSL_CTX_set_mode "SSL_CTX *ctx" "long mode" |
diff --git a/src/lib/libssl/man/SSL_CTX_set_msg_callback.3 b/src/lib/libssl/man/SSL_CTX_set_msg_callback.3 index a27333e6d9..65df06016a 100644 --- a/src/lib/libssl/man/SSL_CTX_set_msg_callback.3 +++ b/src/lib/libssl/man/SSL_CTX_set_msg_callback.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_msg_callback.3,v 1.5 2021/04/15 16:43:27 tb Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_msg_callback.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL SSL_CTX_set_msg_callback.pod e9b77246 Jan 20 19:58:49 2017 +0100 | 2 | .\" OpenSSL SSL_CTX_set_msg_callback.pod e9b77246 Jan 20 19:58:49 2017 +0100 |
| 3 | .\" OpenSSL SSL_CTX_set_msg_callback.pod b97fdb57 Nov 11 09:33:09 2016 +0100 | 3 | .\" OpenSSL SSL_CTX_set_msg_callback.pod b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: April 15 2021 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_CTX_SET_MSG_CALLBACK 3 | 53 | .Dt SSL_CTX_SET_MSG_CALLBACK 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -59,6 +59,7 @@ | |||
| 59 | .Nm SSL_set_msg_callback_arg | 59 | .Nm SSL_set_msg_callback_arg |
| 60 | .Nd install callback for observing protocol messages | 60 | .Nd install callback for observing protocol messages |
| 61 | .Sh SYNOPSIS | 61 | .Sh SYNOPSIS |
| 62 | .Lb libssl libcrypto | ||
| 62 | .In openssl/ssl.h | 63 | .In openssl/ssl.h |
| 63 | .Ft void | 64 | .Ft void |
| 64 | .Fo SSL_CTX_set_msg_callback | 65 | .Fo SSL_CTX_set_msg_callback |
diff --git a/src/lib/libssl/man/SSL_CTX_set_num_tickets.3 b/src/lib/libssl/man/SSL_CTX_set_num_tickets.3 index cb6d7e000a..093387725a 100644 --- a/src/lib/libssl/man/SSL_CTX_set_num_tickets.3 +++ b/src/lib/libssl/man/SSL_CTX_set_num_tickets.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_num_tickets.3,v 1.2 2021/10/23 17:20:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_num_tickets.3,v 1.3 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL pod checked up to: 5402f96a Sep 11 09:58:52 2021 +0100 | 2 | .\" OpenSSL pod checked up to: 5402f96a Sep 11 09:58:52 2021 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" Copyright (c) 2021 Bob Beck <beck@openbsd.org> | 4 | .\" Copyright (c) 2021 Bob Beck <beck@openbsd.org> |
| @@ -15,7 +15,7 @@ | |||
| 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 | .\" | 17 | .\" |
| 18 | .Dd $Mdocdate: October 23 2021 $ | 18 | .Dd $Mdocdate: June 8 2025 $ |
| 19 | .Dt SSL_CTX_SET_NUM_TICKETS 3 | 19 | .Dt SSL_CTX_SET_NUM_TICKETS 3 |
| 20 | .Os | 20 | .Os |
| 21 | .Sh NAME | 21 | .Sh NAME |
| @@ -25,6 +25,7 @@ | |||
| 25 | .Nm SSL_get_num_tickets | 25 | .Nm SSL_get_num_tickets |
| 26 | .Nd set and get the number of TLS 1.3 session tickets to be sent | 26 | .Nd set and get the number of TLS 1.3 session tickets to be sent |
| 27 | .Sh SYNOPSIS | 27 | .Sh SYNOPSIS |
| 28 | .Lb libssl libcrypto | ||
| 28 | .In openssl/ssl.h | 29 | .In openssl/ssl.h |
| 29 | .Ft int | 30 | .Ft int |
| 30 | .Fn SSL_CTX_set_num_tickets "SSL_CTX *ctx" "size_t num_tickets" | 31 | .Fn SSL_CTX_set_num_tickets "SSL_CTX *ctx" "size_t num_tickets" |
diff --git a/src/lib/libssl/man/SSL_CTX_set_options.3 b/src/lib/libssl/man/SSL_CTX_set_options.3 index 5df0b07785..5e81c978bd 100644 --- a/src/lib/libssl/man/SSL_CTX_set_options.3 +++ b/src/lib/libssl/man/SSL_CTX_set_options.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_options.3,v 1.16 2022/03/31 17:27:18 naddy Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_options.3,v 1.17 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 7946ab33 Dec 6 17:56:41 2015 +0100 | 2 | .\" full merge up to: OpenSSL 7946ab33 Dec 6 17:56:41 2015 +0100 |
| 3 | .\" selective merge up to: OpenSSL edb79c3a Mar 29 10:07:14 2017 +1000 | 3 | .\" selective merge up to: OpenSSL edb79c3a Mar 29 10:07:14 2017 +1000 |
| 4 | .\" | 4 | .\" |
| @@ -52,7 +52,7 @@ | |||
| 52 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 52 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 53 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 53 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 54 | .\" | 54 | .\" |
| 55 | .Dd $Mdocdate: March 31 2022 $ | 55 | .Dd $Mdocdate: June 8 2025 $ |
| 56 | .Dt SSL_CTX_SET_OPTIONS 3 | 56 | .Dt SSL_CTX_SET_OPTIONS 3 |
| 57 | .Os | 57 | .Os |
| 58 | .Sh NAME | 58 | .Sh NAME |
| @@ -65,6 +65,7 @@ | |||
| 65 | .Nm SSL_get_secure_renegotiation_support | 65 | .Nm SSL_get_secure_renegotiation_support |
| 66 | .Nd manipulate SSL options | 66 | .Nd manipulate SSL options |
| 67 | .Sh SYNOPSIS | 67 | .Sh SYNOPSIS |
| 68 | .Lb libssl libcrypto | ||
| 68 | .In openssl/ssl.h | 69 | .In openssl/ssl.h |
| 69 | .Ft long | 70 | .Ft long |
| 70 | .Fn SSL_CTX_set_options "SSL_CTX *ctx" "long options" | 71 | .Fn SSL_CTX_set_options "SSL_CTX *ctx" "long options" |
diff --git a/src/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 b/src/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 index 71463f1eca..20b882167b 100644 --- a/src/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 +++ b/src/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_quiet_shutdown.3,v 1.6 2020/03/30 10:28:59 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_quiet_shutdown.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 30 2020 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_SET_QUIET_SHUTDOWN 3 | 52 | .Dt SSL_CTX_SET_QUIET_SHUTDOWN 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm SSL_get_quiet_shutdown | 58 | .Nm SSL_get_quiet_shutdown |
| 59 | .Nd manipulate shutdown behaviour | 59 | .Nd manipulate shutdown behaviour |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libssl libcrypto | ||
| 61 | .In openssl/ssl.h | 62 | .In openssl/ssl.h |
| 62 | .Ft void | 63 | .Ft void |
| 63 | .Fn SSL_CTX_set_quiet_shutdown "SSL_CTX *ctx" "int mode" | 64 | .Fn SSL_CTX_set_quiet_shutdown "SSL_CTX *ctx" "int mode" |
diff --git a/src/lib/libssl/man/SSL_CTX_set_read_ahead.3 b/src/lib/libssl/man/SSL_CTX_set_read_ahead.3 index eae76eb472..208ecfbf1a 100644 --- a/src/lib/libssl/man/SSL_CTX_set_read_ahead.3 +++ b/src/lib/libssl/man/SSL_CTX_set_read_ahead.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_read_ahead.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_read_ahead.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Matt Caswell <matt@openssl.org>. | 4 | .\" This file was written by Matt Caswell <matt@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_SET_READ_AHEAD 3 | 52 | .Dt SSL_CTX_SET_READ_AHEAD 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -59,6 +59,7 @@ | |||
| 59 | .Nm SSL_CTX_get_default_read_ahead | 59 | .Nm SSL_CTX_get_default_read_ahead |
| 60 | .Nd manage whether to read as many input bytes as possible | 60 | .Nd manage whether to read as many input bytes as possible |
| 61 | .Sh SYNOPSIS | 61 | .Sh SYNOPSIS |
| 62 | .Lb libssl libcrypto | ||
| 62 | .In openssl/ssl.h | 63 | .In openssl/ssl.h |
| 63 | .Ft void | 64 | .Ft void |
| 64 | .Fo SSL_CTX_set_read_ahead | 65 | .Fo SSL_CTX_set_read_ahead |
diff --git a/src/lib/libssl/man/SSL_CTX_set_security_level.3 b/src/lib/libssl/man/SSL_CTX_set_security_level.3 index 89adb3d65d..2d3afa5785 100644 --- a/src/lib/libssl/man/SSL_CTX_set_security_level.3 +++ b/src/lib/libssl/man/SSL_CTX_set_security_level.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_security_level.3,v 1.2 2025/01/18 10:45:12 tb Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_security_level.3,v 1.3 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: January 18 2025 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt SSL_CTX_SET_SECURITY_LEVEL 3 | 18 | .Dt SSL_CTX_SET_SECURITY_LEVEL 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -24,6 +24,7 @@ | |||
| 24 | .Nm SSL_get_security_level | 24 | .Nm SSL_get_security_level |
| 25 | .Nd change security level for TLS | 25 | .Nd change security level for TLS |
| 26 | .Sh SYNOPSIS | 26 | .Sh SYNOPSIS |
| 27 | .Lb libssl libcrypto | ||
| 27 | .In openssl/ssl.h | 28 | .In openssl/ssl.h |
| 28 | .Ft void | 29 | .Ft void |
| 29 | .Fo SSL_CTX_set_security_level | 30 | .Fo SSL_CTX_set_security_level |
diff --git a/src/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 b/src/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 index 1fe67b2a7e..d19ff79545 100644 --- a/src/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 +++ b/src/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_session_cache_mode.3,v 1.7 2019/06/12 09:36:30 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_session_cache_mode.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL 67adf0a7 Dec 25 19:58:38 2016 +0100 | 2 | .\" OpenSSL 67adf0a7 Dec 25 19:58:38 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org> and | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org> and |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: June 12 2019 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_CTX_SET_SESSION_CACHE_MODE 3 | 53 | .Dt SSL_CTX_SET_SESSION_CACHE_MODE 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm SSL_CTX_get_session_cache_mode | 57 | .Nm SSL_CTX_get_session_cache_mode |
| 58 | .Nd enable/disable session caching | 58 | .Nd enable/disable session caching |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libssl libcrypto | ||
| 60 | .In openssl/ssl.h | 61 | .In openssl/ssl.h |
| 61 | .Ft long | 62 | .Ft long |
| 62 | .Fn SSL_CTX_set_session_cache_mode "SSL_CTX ctx" "long mode" | 63 | .Fn SSL_CTX_set_session_cache_mode "SSL_CTX ctx" "long mode" |
diff --git a/src/lib/libssl/man/SSL_CTX_set_session_id_context.3 b/src/lib/libssl/man/SSL_CTX_set_session_id_context.3 index 06fd9348ae..53923888db 100644 --- a/src/lib/libssl/man/SSL_CTX_set_session_id_context.3 +++ b/src/lib/libssl/man/SSL_CTX_set_session_id_context.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_session_id_context.3,v 1.6 2019/06/08 15:25:43 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_session_id_context.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 8 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_SET_SESSION_ID_CONTEXT 3 | 52 | .Dt SSL_CTX_SET_SESSION_ID_CONTEXT 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm SSL_set_session_id_context | 56 | .Nm SSL_set_session_id_context |
| 57 | .Nd set context within which session can be reused (server side only) | 57 | .Nd set context within which session can be reused (server side only) |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libssl libcrypto | ||
| 59 | .In openssl/ssl.h | 60 | .In openssl/ssl.h |
| 60 | .Ft int | 61 | .Ft int |
| 61 | .Fo SSL_CTX_set_session_id_context | 62 | .Fo SSL_CTX_set_session_id_context |
diff --git a/src/lib/libssl/man/SSL_CTX_set_ssl_version.3 b/src/lib/libssl/man/SSL_CTX_set_ssl_version.3 index b1bdb92bb0..fe9febe431 100644 --- a/src/lib/libssl/man/SSL_CTX_set_ssl_version.3 +++ b/src/lib/libssl/man/SSL_CTX_set_ssl_version.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_ssl_version.3,v 1.5 2021/05/11 19:48:56 tb Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_ssl_version.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: May 11 2021 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_SET_SSL_VERSION 3 | 52 | .Dt SSL_CTX_SET_SSL_VERSION 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm SSL_get_ssl_method | 58 | .Nm SSL_get_ssl_method |
| 59 | .Nd choose a new TLS/SSL method | 59 | .Nd choose a new TLS/SSL method |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libssl libcrypto | ||
| 61 | .In openssl/ssl.h | 62 | .In openssl/ssl.h |
| 62 | .Ft int | 63 | .Ft int |
| 63 | .Fn SSL_CTX_set_ssl_version "SSL_CTX *ctx" "const SSL_METHOD *method" | 64 | .Fn SSL_CTX_set_ssl_version "SSL_CTX *ctx" "const SSL_METHOD *method" |
diff --git a/src/lib/libssl/man/SSL_CTX_set_timeout.3 b/src/lib/libssl/man/SSL_CTX_set_timeout.3 index ab99e2016e..da2f811528 100644 --- a/src/lib/libssl/man/SSL_CTX_set_timeout.3 +++ b/src/lib/libssl/man/SSL_CTX_set_timeout.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_timeout.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_timeout.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_SET_TIMEOUT 3 | 52 | .Dt SSL_CTX_SET_TIMEOUT 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm SSL_CTX_get_timeout | 56 | .Nm SSL_CTX_get_timeout |
| 57 | .Nd manipulate timeout values for session caching | 57 | .Nd manipulate timeout values for session caching |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libssl libcrypto | ||
| 59 | .In openssl/ssl.h | 60 | .In openssl/ssl.h |
| 60 | .Ft long | 61 | .Ft long |
| 61 | .Fn SSL_CTX_set_timeout "SSL_CTX *ctx" "long t" | 62 | .Fn SSL_CTX_set_timeout "SSL_CTX *ctx" "long t" |
diff --git a/src/lib/libssl/man/SSL_CTX_set_tlsext_servername_callback.3 b/src/lib/libssl/man/SSL_CTX_set_tlsext_servername_callback.3 index 2b54406de8..b6cece259c 100644 --- a/src/lib/libssl/man/SSL_CTX_set_tlsext_servername_callback.3 +++ b/src/lib/libssl/man/SSL_CTX_set_tlsext_servername_callback.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_tlsext_servername_callback.3,v 1.6 2021/09/01 13:56:03 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_tlsext_servername_callback.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 190b9a03 Jun 28 15:46:13 2017 +0800 | 2 | .\" full merge up to: OpenSSL 190b9a03 Jun 28 15:46:13 2017 +0800 |
| 3 | .\" selective merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 | 3 | .\" selective merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 |
| 4 | .\" | 4 | .\" |
| @@ -51,7 +51,7 @@ | |||
| 51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 53 | .\" | 53 | .\" |
| 54 | .Dd $Mdocdate: September 1 2021 $ | 54 | .Dd $Mdocdate: June 8 2025 $ |
| 55 | .Dt SSL_CTX_SET_TLSEXT_SERVERNAME_CALLBACK 3 | 55 | .Dt SSL_CTX_SET_TLSEXT_SERVERNAME_CALLBACK 3 |
| 56 | .Os | 56 | .Os |
| 57 | .Sh NAME | 57 | .Sh NAME |
| @@ -62,6 +62,7 @@ | |||
| 62 | .Nm SSL_set_tlsext_host_name | 62 | .Nm SSL_set_tlsext_host_name |
| 63 | .Nd handle server name indication (SNI) | 63 | .Nd handle server name indication (SNI) |
| 64 | .Sh SYNOPSIS | 64 | .Sh SYNOPSIS |
| 65 | .Lb libssl libcrypto | ||
| 65 | .In openssl/ssl.h | 66 | .In openssl/ssl.h |
| 66 | .Ft long | 67 | .Ft long |
| 67 | .Fo SSL_CTX_set_tlsext_servername_callback | 68 | .Fo SSL_CTX_set_tlsext_servername_callback |
| @@ -84,7 +85,7 @@ | |||
| 84 | .Fc | 85 | .Fc |
| 85 | .Ft int | 86 | .Ft int |
| 86 | .Fo SSL_set_tlsext_host_name | 87 | .Fo SSL_set_tlsext_host_name |
| 87 | .Fa "const SSL *ssl" | 88 | .Fa "SSL *ssl" |
| 88 | .Fa "const char *name" | 89 | .Fa "const char *name" |
| 89 | .Fc | 90 | .Fc |
| 90 | .Sh DESCRIPTION | 91 | .Sh DESCRIPTION |
diff --git a/src/lib/libssl/man/SSL_CTX_set_tlsext_status_cb.3 b/src/lib/libssl/man/SSL_CTX_set_tlsext_status_cb.3 index d5979af1e8..c9763f9d2f 100644 --- a/src/lib/libssl/man/SSL_CTX_set_tlsext_status_cb.3 +++ b/src/lib/libssl/man/SSL_CTX_set_tlsext_status_cb.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_tlsext_status_cb.3,v 1.8 2021/09/11 18:58:41 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_tlsext_status_cb.3,v 1.9 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 43c34894 Nov 30 16:04:51 2015 +0000 | 2 | .\" full merge up to: OpenSSL 43c34894 Nov 30 16:04:51 2015 +0000 |
| 3 | .\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 | 3 | .\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: September 11 2021 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_CTX_SET_TLSEXT_STATUS_CB 3 | 53 | .Dt SSL_CTX_SET_TLSEXT_STATUS_CB 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -63,6 +63,7 @@ | |||
| 63 | .Nm SSL_set_tlsext_status_ocsp_resp | 63 | .Nm SSL_set_tlsext_status_ocsp_resp |
| 64 | .Nd OCSP Certificate Status Request functions | 64 | .Nd OCSP Certificate Status Request functions |
| 65 | .Sh SYNOPSIS | 65 | .Sh SYNOPSIS |
| 66 | .Lb libssl libcrypto | ||
| 66 | .In openssl/tls1.h | 67 | .In openssl/tls1.h |
| 67 | .Ft long | 68 | .Ft long |
| 68 | .Fo SSL_CTX_set_tlsext_status_cb | 69 | .Fo SSL_CTX_set_tlsext_status_cb |
diff --git a/src/lib/libssl/man/SSL_CTX_set_tlsext_ticket_key_cb.3 b/src/lib/libssl/man/SSL_CTX_set_tlsext_ticket_key_cb.3 index b6ccabaeca..0427f7dcf5 100644 --- a/src/lib/libssl/man/SSL_CTX_set_tlsext_ticket_key_cb.3 +++ b/src/lib/libssl/man/SSL_CTX_set_tlsext_ticket_key_cb.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_tlsext_ticket_key_cb.3,v 1.8 2022/01/25 18:01:20 tb Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_tlsext_ticket_key_cb.3,v 1.9 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Rich Salz <rsalz@akamai.com> | 4 | .\" This file was written by Rich Salz <rsalz@akamai.com> |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: January 25 2022 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_SET_TLSEXT_TICKET_KEY_CB 3 | 52 | .Dt SSL_CTX_SET_TLSEXT_TICKET_KEY_CB 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_CTX_set_tlsext_ticket_key_cb | 55 | .Nm SSL_CTX_set_tlsext_ticket_key_cb |
| 56 | .Nd set a callback for session ticket processing | 56 | .Nd set a callback for session ticket processing |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/tls1.h | 59 | .In openssl/tls1.h |
| 59 | .Ft long | 60 | .Ft long |
| 60 | .Fo SSL_CTX_set_tlsext_ticket_key_cb | 61 | .Fo SSL_CTX_set_tlsext_ticket_key_cb |
diff --git a/src/lib/libssl/man/SSL_CTX_set_tlsext_use_srtp.3 b/src/lib/libssl/man/SSL_CTX_set_tlsext_use_srtp.3 index 04c4833c6a..4acd452ad5 100644 --- a/src/lib/libssl/man/SSL_CTX_set_tlsext_use_srtp.3 +++ b/src/lib/libssl/man/SSL_CTX_set_tlsext_use_srtp.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_tlsext_use_srtp.3,v 1.6 2021/06/11 19:41:39 jmc Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_tlsext_use_srtp.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL b0edda11 Mar 20 13:00:17 2018 +0000 | 2 | .\" full merge up to: OpenSSL b0edda11 Mar 20 13:00:17 2018 +0000 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Matt Caswell <matt@openssl.org>. | 4 | .\" This file was written by Matt Caswell <matt@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 11 2021 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_SET_TLSEXT_USE_SRTP 3 | 52 | .Dt SSL_CTX_SET_TLSEXT_USE_SRTP 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm SSL_get_selected_srtp_profile | 58 | .Nm SSL_get_selected_srtp_profile |
| 59 | .Nd Configure and query SRTP support | 59 | .Nd Configure and query SRTP support |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libssl libcrypto | ||
| 61 | .In openssl/srtp.h | 62 | .In openssl/srtp.h |
| 62 | .Ft int | 63 | .Ft int |
| 63 | .Fo SSL_CTX_set_tlsext_use_srtp | 64 | .Fo SSL_CTX_set_tlsext_use_srtp |
diff --git a/src/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 b/src/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 index c6f5253431..9fa830656a 100644 --- a/src/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 +++ b/src/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_tmp_dh_callback.3,v 1.11 2025/01/18 10:45:12 tb Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_tmp_dh_callback.3,v 1.12 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: January 18 2025 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_SET_TMP_DH_CALLBACK 3 | 52 | .Dt SSL_CTX_SET_TMP_DH_CALLBACK 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm SSL_set_tmp_dh | 58 | .Nm SSL_set_tmp_dh |
| 59 | .Nd handle DH keys for ephemeral key exchange | 59 | .Nd handle DH keys for ephemeral key exchange |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libssl libcrypto | ||
| 61 | .In openssl/ssl.h | 62 | .In openssl/ssl.h |
| 62 | .Ft void | 63 | .Ft void |
| 63 | .Fo SSL_CTX_set_tmp_dh_callback | 64 | .Fo SSL_CTX_set_tmp_dh_callback |
diff --git a/src/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 b/src/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 index b4c3a3c647..7009ac6ab5 100644 --- a/src/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 +++ b/src/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_tmp_rsa_callback.3,v 1.9 2022/03/29 14:27:59 naddy Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_tmp_rsa_callback.3,v 1.10 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL 0b30fc90 Dec 19 15:23:05 2013 -0500 | 2 | .\" OpenSSL 0b30fc90 Dec 19 15:23:05 2013 -0500 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 29 2022 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_CTX_SET_TMP_RSA_CALLBACK 3 | 52 | .Dt SSL_CTX_SET_TMP_RSA_CALLBACK 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -60,6 +60,7 @@ | |||
| 60 | .Nm SSL_need_tmp_RSA | 60 | .Nm SSL_need_tmp_RSA |
| 61 | .Nd handle RSA keys for ephemeral key exchange | 61 | .Nd handle RSA keys for ephemeral key exchange |
| 62 | .Sh SYNOPSIS | 62 | .Sh SYNOPSIS |
| 63 | .Lb libssl libcrypto | ||
| 63 | .In openssl/ssl.h | 64 | .In openssl/ssl.h |
| 64 | .Ft void | 65 | .Ft void |
| 65 | .Fo SSL_CTX_set_tmp_rsa_callback | 66 | .Fo SSL_CTX_set_tmp_rsa_callback |
diff --git a/src/lib/libssl/man/SSL_CTX_set_verify.3 b/src/lib/libssl/man/SSL_CTX_set_verify.3 index 1ed86407e9..656c85afd4 100644 --- a/src/lib/libssl/man/SSL_CTX_set_verify.3 +++ b/src/lib/libssl/man/SSL_CTX_set_verify.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_set_verify.3,v 1.9 2021/06/12 16:59:53 jmc Exp $ | 1 | .\" $OpenBSD: SSL_CTX_set_verify.3,v 1.10 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 | 2 | .\" full merge up to: OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 |
| 3 | .\" selective merge up to: OpenSSL 1cb7eff4 Sep 10 13:56:40 2019 +0100 | 3 | .\" selective merge up to: OpenSSL 1cb7eff4 Sep 10 13:56:40 2019 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -50,7 +50,7 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: June 12 2021 $ | 53 | .Dd $Mdocdate: June 8 2025 $ |
| 54 | .Dt SSL_CTX_SET_VERIFY 3 | 54 | .Dt SSL_CTX_SET_VERIFY 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| @@ -60,6 +60,7 @@ | |||
| 60 | .Nm SSL_set_verify_depth | 60 | .Nm SSL_set_verify_depth |
| 61 | .Nd set peer certificate verification parameters | 61 | .Nd set peer certificate verification parameters |
| 62 | .Sh SYNOPSIS | 62 | .Sh SYNOPSIS |
| 63 | .Lb libssl libcrypto | ||
| 63 | .In openssl/ssl.h | 64 | .In openssl/ssl.h |
| 64 | .Ft void | 65 | .Ft void |
| 65 | .Fo SSL_CTX_set_verify | 66 | .Fo SSL_CTX_set_verify |
diff --git a/src/lib/libssl/man/SSL_CTX_use_certificate.3 b/src/lib/libssl/man/SSL_CTX_use_certificate.3 index c88a6971b2..27ec834d16 100644 --- a/src/lib/libssl/man/SSL_CTX_use_certificate.3 +++ b/src/lib/libssl/man/SSL_CTX_use_certificate.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_CTX_use_certificate.3,v 1.17 2025/01/18 10:45:12 tb Exp $ | 1 | .\" $OpenBSD: SSL_CTX_use_certificate.3,v 1.18 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 3aaa1bd0 Mar 28 16:35:25 2017 +1000 | 2 | .\" full merge up to: OpenSSL 3aaa1bd0 Mar 28 16:35:25 2017 +1000 |
| 3 | .\" selective merge up to: OpenSSL d1f7a1e6 Apr 26 14:05:40 2018 +0100 | 3 | .\" selective merge up to: OpenSSL d1f7a1e6 Apr 26 14:05:40 2018 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -50,7 +50,7 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: January 18 2025 $ | 53 | .Dd $Mdocdate: June 8 2025 $ |
| 54 | .Dt SSL_CTX_USE_CERTIFICATE 3 | 54 | .Dt SSL_CTX_USE_CERTIFICATE 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| @@ -79,6 +79,7 @@ | |||
| 79 | .Nm SSL_check_private_key | 79 | .Nm SSL_check_private_key |
| 80 | .Nd load certificate and key data | 80 | .Nd load certificate and key data |
| 81 | .Sh SYNOPSIS | 81 | .Sh SYNOPSIS |
| 82 | .Lb libssl libcrypto | ||
| 82 | .In openssl/ssl.h | 83 | .In openssl/ssl.h |
| 83 | .Ft int | 84 | .Ft int |
| 84 | .Fn SSL_CTX_use_certificate "SSL_CTX *ctx" "X509 *x" | 85 | .Fn SSL_CTX_use_certificate "SSL_CTX *ctx" "X509 *x" |
diff --git a/src/lib/libssl/man/SSL_SESSION_free.3 b/src/lib/libssl/man/SSL_SESSION_free.3 index 3f785e95e5..af02a273a0 100644 --- a/src/lib/libssl/man/SSL_SESSION_free.3 +++ b/src/lib/libssl/man/SSL_SESSION_free.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_SESSION_free.3,v 1.7 2019/06/12 09:36:30 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_SESSION_free.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL b31db505 Mar 24 16:01:50 2017 +0000 | 2 | .\" full merge up to: OpenSSL b31db505 Mar 24 16:01:50 2017 +0000 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org> | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org> |
| @@ -50,7 +50,7 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: June 12 2019 $ | 53 | .Dd $Mdocdate: June 8 2025 $ |
| 54 | .Dt SSL_SESSION_FREE 3 | 54 | .Dt SSL_SESSION_FREE 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm SSL_SESSION_free | 58 | .Nm SSL_SESSION_free |
| 59 | .Nd SSL_SESSION reference counting | 59 | .Nd SSL_SESSION reference counting |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libssl libcrypto | ||
| 61 | .In openssl/ssl.h | 62 | .In openssl/ssl.h |
| 62 | .Ft int | 63 | .Ft int |
| 63 | .Fn SSL_SESSION_up_ref "SSL_SESSION *session" | 64 | .Fn SSL_SESSION_up_ref "SSL_SESSION *session" |
diff --git a/src/lib/libssl/man/SSL_SESSION_get0_cipher.3 b/src/lib/libssl/man/SSL_SESSION_get0_cipher.3 index 239a426dbd..4e5b0bb057 100644 --- a/src/lib/libssl/man/SSL_SESSION_get0_cipher.3 +++ b/src/lib/libssl/man/SSL_SESSION_get0_cipher.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_SESSION_get0_cipher.3,v 1.1 2021/05/12 14:16:25 tb Exp $ | 1 | .\" $OpenBSD: SSL_SESSION_get0_cipher.3,v 1.2 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL d42e7759f Mar 30 19:40:04 2017 +0200 | 2 | .\" full merge up to: OpenSSL d42e7759f Mar 30 19:40:04 2017 +0200 |
| 3 | .\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 | 3 | .\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -49,13 +49,14 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: May 12 2021 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_SESSION_GET0_CIPHER 3 | 53 | .Dt SSL_SESSION_GET0_CIPHER 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| 56 | .Nm SSL_SESSION_get0_cipher | 56 | .Nm SSL_SESSION_get0_cipher |
| 57 | .Nd retrieve the SSL cipher associated with a session | 57 | .Nd retrieve the SSL cipher associated with a session |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libssl libcrypto | ||
| 59 | .In openssl/ssl.h | 60 | .In openssl/ssl.h |
| 60 | .Ft const SSL_CIPHER * | 61 | .Ft const SSL_CIPHER * |
| 61 | .Fo SSL_SESSION_get0_cipher | 62 | .Fo SSL_SESSION_get0_cipher |
diff --git a/src/lib/libssl/man/SSL_SESSION_get0_peer.3 b/src/lib/libssl/man/SSL_SESSION_get0_peer.3 index 6b1ef6680e..98ae1bab9d 100644 --- a/src/lib/libssl/man/SSL_SESSION_get0_peer.3 +++ b/src/lib/libssl/man/SSL_SESSION_get0_peer.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_SESSION_get0_peer.3,v 1.2 2018/03/23 05:50:30 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_SESSION_get0_peer.3,v 1.3 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL SSL_SESSION_get0_peer.pod b31db505 Mar 24 16:01:50 2017 +0000 | 2 | .\" OpenSSL SSL_SESSION_get0_peer.pod b31db505 Mar 24 16:01:50 2017 +0000 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Matt Caswell <matt@openssl.org> | 4 | .\" This file was written by Matt Caswell <matt@openssl.org> |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 23 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_SESSION_GET0_PEER 3 | 52 | .Dt SSL_SESSION_GET0_PEER 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_SESSION_get0_peer | 55 | .Nm SSL_SESSION_get0_peer |
| 56 | .Nd get details about peer's certificate for a session | 56 | .Nd get details about peer's certificate for a session |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/ssl.h | 59 | .In openssl/ssl.h |
| 59 | .Ft X509 * | 60 | .Ft X509 * |
| 60 | .Fo SSL_SESSION_get0_peer | 61 | .Fo SSL_SESSION_get0_peer |
diff --git a/src/lib/libssl/man/SSL_SESSION_get_compress_id.3 b/src/lib/libssl/man/SSL_SESSION_get_compress_id.3 index aedc216a15..da0d48ff6c 100644 --- a/src/lib/libssl/man/SSL_SESSION_get_compress_id.3 +++ b/src/lib/libssl/man/SSL_SESSION_get_compress_id.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_SESSION_get_compress_id.3,v 1.3 2018/03/23 05:50:30 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_SESSION_get_compress_id.3,v 1.4 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL SSL_SESSION_get_compress_id.pod b31db505 Mar 24 16:01:50 2017 | 2 | .\" OpenSSL SSL_SESSION_get_compress_id.pod b31db505 Mar 24 16:01:50 2017 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Matt Caswell <matt@openssl.org> | 4 | .\" This file was written by Matt Caswell <matt@openssl.org> |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 23 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_SESSION_GET_COMPRESS_ID 3 | 52 | .Dt SSL_SESSION_GET_COMPRESS_ID 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_SESSION_get_compress_id | 55 | .Nm SSL_SESSION_get_compress_id |
| 56 | .Nd get details about the compression associated with a session | 56 | .Nd get details about the compression associated with a session |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/ssl.h | 59 | .In openssl/ssl.h |
| 59 | .Ft unsigned int | 60 | .Ft unsigned int |
| 60 | .Fo SSL_SESSION_get_compress_id | 61 | .Fo SSL_SESSION_get_compress_id |
diff --git a/src/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 b/src/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 index 9fd6949b6a..55cde1c66b 100644 --- a/src/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 +++ b/src/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_SESSION_get_ex_new_index.3,v 1.3 2018/03/21 08:06:34 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_SESSION_get_ex_new_index.3,v 1.4 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 | 2 | .\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 21 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_SESSION_GET_EX_NEW_INDEX 3 | 52 | .Dt SSL_SESSION_GET_EX_NEW_INDEX 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm SSL_SESSION_get_ex_data | 57 | .Nm SSL_SESSION_get_ex_data |
| 58 | .Nd internal application specific data functions | 58 | .Nd internal application specific data functions |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libssl libcrypto | ||
| 60 | .In openssl/ssl.h | 61 | .In openssl/ssl.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fo SSL_SESSION_get_ex_new_index | 63 | .Fo SSL_SESSION_get_ex_new_index |
diff --git a/src/lib/libssl/man/SSL_SESSION_get_id.3 b/src/lib/libssl/man/SSL_SESSION_get_id.3 index 6d0de1e52e..eb14d24111 100644 --- a/src/lib/libssl/man/SSL_SESSION_get_id.3 +++ b/src/lib/libssl/man/SSL_SESSION_get_id.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_SESSION_get_id.3,v 1.6 2018/03/24 00:55:37 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_SESSION_get_id.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: | 2 | .\" full merge up to: |
| 3 | .\" OpenSSL SSL_SESSION_set1_id 17b60280 Dec 21 09:08:25 2017 +0100 | 3 | .\" OpenSSL SSL_SESSION_set1_id 17b60280 Dec 21 09:08:25 2017 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -50,7 +50,7 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: March 24 2018 $ | 53 | .Dd $Mdocdate: June 8 2025 $ |
| 54 | .Dt SSL_SESSION_GET_ID 3 | 54 | .Dt SSL_SESSION_GET_ID 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm SSL_SESSION_set1_id | 58 | .Nm SSL_SESSION_set1_id |
| 59 | .Nd get and set the SSL session ID | 59 | .Nd get and set the SSL session ID |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libssl libcrypto | ||
| 61 | .In openssl/ssl.h | 62 | .In openssl/ssl.h |
| 62 | .Ft const unsigned char * | 63 | .Ft const unsigned char * |
| 63 | .Fo SSL_SESSION_get_id | 64 | .Fo SSL_SESSION_get_id |
diff --git a/src/lib/libssl/man/SSL_SESSION_get_protocol_version.3 b/src/lib/libssl/man/SSL_SESSION_get_protocol_version.3 index f14c0490e9..dad9eab7ef 100644 --- a/src/lib/libssl/man/SSL_SESSION_get_protocol_version.3 +++ b/src/lib/libssl/man/SSL_SESSION_get_protocol_version.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_SESSION_get_protocol_version.3,v 1.2 2018/03/24 00:55:37 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_SESSION_get_protocol_version.3,v 1.3 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by TJ Saunders <tj@castaglia.org> | 4 | .\" This file was written by TJ Saunders <tj@castaglia.org> |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 24 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_SESSION_GET_PROTOCOL_VERSION 3 | 52 | .Dt SSL_SESSION_GET_PROTOCOL_VERSION 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_SESSION_get_protocol_version | 55 | .Nm SSL_SESSION_get_protocol_version |
| 56 | .Nd get the session protocol version | 56 | .Nd get the session protocol version |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/ssl.h | 59 | .In openssl/ssl.h |
| 59 | .Ft int | 60 | .Ft int |
| 60 | .Fo SSL_SESSION_get_protocol_version | 61 | .Fo SSL_SESSION_get_protocol_version |
diff --git a/src/lib/libssl/man/SSL_SESSION_get_time.3 b/src/lib/libssl/man/SSL_SESSION_get_time.3 index aaadec5137..28aeedf72c 100644 --- a/src/lib/libssl/man/SSL_SESSION_get_time.3 +++ b/src/lib/libssl/man/SSL_SESSION_get_time.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_SESSION_get_time.3,v 1.8 2019/06/08 15:25:43 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_SESSION_get_time.3,v 1.9 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: June 8 2019 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_SESSION_GET_TIME 3 | 53 | .Dt SSL_SESSION_GET_TIME 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -63,6 +63,7 @@ | |||
| 63 | .Nm SSL_set_timeout | 63 | .Nm SSL_set_timeout |
| 64 | .Nd retrieve and manipulate session time and timeout settings | 64 | .Nd retrieve and manipulate session time and timeout settings |
| 65 | .Sh SYNOPSIS | 65 | .Sh SYNOPSIS |
| 66 | .Lb libssl libcrypto | ||
| 66 | .In openssl/ssl.h | 67 | .In openssl/ssl.h |
| 67 | .Ft long | 68 | .Ft long |
| 68 | .Fn SSL_SESSION_get_time "const SSL_SESSION *s" | 69 | .Fn SSL_SESSION_get_time "const SSL_SESSION *s" |
diff --git a/src/lib/libssl/man/SSL_SESSION_has_ticket.3 b/src/lib/libssl/man/SSL_SESSION_has_ticket.3 index 322b49feef..07b894c4f8 100644 --- a/src/lib/libssl/man/SSL_SESSION_has_ticket.3 +++ b/src/lib/libssl/man/SSL_SESSION_has_ticket.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_SESSION_has_ticket.3,v 1.2 2018/03/24 00:55:37 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_SESSION_has_ticket.3,v 1.3 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL f2baac27 Feb 8 15:43:16 2015 +0000 | 2 | .\" full merge up to: OpenSSL f2baac27 Feb 8 15:43:16 2015 +0000 |
| 3 | .\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 | 3 | .\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 |
| 4 | .\" | 4 | .\" |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: March 24 2018 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_SESSION_HAS_TICKET 3 | 53 | .Dt SSL_SESSION_HAS_TICKET 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm SSL_SESSION_get_ticket_lifetime_hint | 57 | .Nm SSL_SESSION_get_ticket_lifetime_hint |
| 58 | .Nd get details about the ticket associated with a session | 58 | .Nd get details about the ticket associated with a session |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libssl libcrypto | ||
| 60 | .In openssl/ssl.h | 61 | .In openssl/ssl.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fo SSL_SESSION_has_ticket | 63 | .Fo SSL_SESSION_has_ticket |
diff --git a/src/lib/libssl/man/SSL_SESSION_is_resumable.3 b/src/lib/libssl/man/SSL_SESSION_is_resumable.3 index 48d7d17889..ddc037c1aa 100644 --- a/src/lib/libssl/man/SSL_SESSION_is_resumable.3 +++ b/src/lib/libssl/man/SSL_SESSION_is_resumable.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_SESSION_is_resumable.3,v 1.1 2021/09/14 14:08:15 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_SESSION_is_resumable.3,v 1.2 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 | 2 | .\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Matt Caswell <matt@openssl.org>. | 4 | .\" This file was written by Matt Caswell <matt@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: September 14 2021 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_SESSION_IS_RESUMABLE 3 | 52 | .Dt SSL_SESSION_IS_RESUMABLE 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_SESSION_is_resumable | 55 | .Nm SSL_SESSION_is_resumable |
| 56 | .Nd determine whether an SSL_SESSION object can be used for resumption | 56 | .Nd determine whether an SSL_SESSION object can be used for resumption |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/ssl.h | 59 | .In openssl/ssl.h |
| 59 | .Ft int | 60 | .Ft int |
| 60 | .Fo SSL_SESSION_is_resumable | 61 | .Fo SSL_SESSION_is_resumable |
diff --git a/src/lib/libssl/man/SSL_SESSION_new.3 b/src/lib/libssl/man/SSL_SESSION_new.3 index 2dcdb264c1..182266a311 100644 --- a/src/lib/libssl/man/SSL_SESSION_new.3 +++ b/src/lib/libssl/man/SSL_SESSION_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_SESSION_new.3,v 1.9 2021/09/14 14:08:15 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_SESSION_new.3,v 1.12 2025/10/24 13:18:22 tb Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,16 +14,20 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: September 14 2021 $ | 17 | .Dd $Mdocdate: October 24 2025 $ |
| 18 | .Dt SSL_SESSION_NEW 3 | 18 | .Dt SSL_SESSION_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm SSL_SESSION_new | 21 | .Nm SSL_SESSION_new , |
| 22 | .Nm SSL_SESSION_dup | ||
| 22 | .Nd construct a new SSL_SESSION object | 23 | .Nd construct a new SSL_SESSION object |
| 23 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libssl libcrypto | ||
| 24 | .In openssl/ssl.h | 26 | .In openssl/ssl.h |
| 25 | .Ft SSL_SESSION * | 27 | .Ft SSL_SESSION * |
| 26 | .Fn SSL_SESSION_new void | 28 | .Fn SSL_SESSION_new void |
| 29 | .Ft SSL_SESSION * | ||
| 30 | .Fn SSL_SESSION_dup "const SSL_SESSION *src" | ||
| 27 | .Sh DESCRIPTION | 31 | .Sh DESCRIPTION |
| 28 | .Fn SSL_SESSION_new | 32 | .Fn SSL_SESSION_new |
| 29 | allocates and initializes a new | 33 | allocates and initializes a new |
| @@ -38,9 +42,20 @@ When the object is no longer needed, it can be destructed with | |||
| 38 | .Fn SSL_SESSION_new | 42 | .Fn SSL_SESSION_new |
| 39 | is used internally, for example by | 43 | is used internally, for example by |
| 40 | .Xr SSL_connect 3 . | 44 | .Xr SSL_connect 3 . |
| 45 | .Pp | ||
| 46 | .Fn SSL_SESSION_dup | ||
| 47 | creates a deep copy of | ||
| 48 | .Fa src | ||
| 49 | with the exception that | ||
| 50 | the reference count is set to 1, that | ||
| 51 | the peer certificate is shared with | ||
| 52 | .Fa src , | ||
| 53 | and that the new session is not part of any session cache. | ||
| 41 | .Sh RETURN VALUES | 54 | .Sh RETURN VALUES |
| 42 | .Fn SSL_SESSION_new | 55 | .Fn SSL_SESSION_new |
| 43 | returns the new | 56 | and |
| 57 | .Fn SSL_SESSION_dup | ||
| 58 | return the new | ||
| 44 | .Vt SSL_SESSION | 59 | .Vt SSL_SESSION |
| 45 | object or | 60 | object or |
| 46 | .Dv NULL | 61 | .Dv NULL |
| @@ -76,3 +91,7 @@ returns | |||
| 76 | .Fn SSL_SESSION_new | 91 | .Fn SSL_SESSION_new |
| 77 | first appeared in SSLeay 0.5.2 and has been available since | 92 | first appeared in SSLeay 0.5.2 and has been available since |
| 78 | .Ox 2.4 . | 93 | .Ox 2.4 . |
| 94 | .Pp | ||
| 95 | .Fn SSL_SESSION_dup | ||
| 96 | first appeared in OpenSSL 1.1.1 and has been available since | ||
| 97 | .Ox 7.9 . | ||
diff --git a/src/lib/libssl/man/SSL_SESSION_print.3 b/src/lib/libssl/man/SSL_SESSION_print.3 index e92debde0e..65742140d0 100644 --- a/src/lib/libssl/man/SSL_SESSION_print.3 +++ b/src/lib/libssl/man/SSL_SESSION_print.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_SESSION_print.3,v 1.4 2019/06/12 09:36:30 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_SESSION_print.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: June 12 2019 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt SSL_SESSION_PRINT 3 | 18 | .Dt SSL_SESSION_PRINT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm SSL_SESSION_print_fp | 22 | .Nm SSL_SESSION_print_fp |
| 23 | .Nd print some properties of an SSL_SESSION object | 23 | .Nd print some properties of an SSL_SESSION object |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libssl libcrypto | ||
| 25 | .In openssl/ssl.h | 26 | .In openssl/ssl.h |
| 26 | .Ft int | 27 | .Ft int |
| 27 | .Fo SSL_SESSION_print | 28 | .Fo SSL_SESSION_print |
diff --git a/src/lib/libssl/man/SSL_SESSION_set1_id_context.3 b/src/lib/libssl/man/SSL_SESSION_set1_id_context.3 index dd7595baca..24f1de4fda 100644 --- a/src/lib/libssl/man/SSL_SESSION_set1_id_context.3 +++ b/src/lib/libssl/man/SSL_SESSION_set1_id_context.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_SESSION_set1_id_context.3,v 1.4 2018/03/24 00:55:37 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_SESSION_set1_id_context.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: | 2 | .\" full merge up to: |
| 3 | .\" OpenSSL SSL_SESSION_get0_id_context b31db505 Mar 24 16:01:50 2017 | 3 | .\" OpenSSL SSL_SESSION_get0_id_context b31db505 Mar 24 16:01:50 2017 |
| 4 | .\" | 4 | .\" |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: March 24 2018 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_SESSION_SET1_ID_CONTEXT 3 | 53 | .Dt SSL_SESSION_SET1_ID_CONTEXT 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm SSL_SESSION_set1_id_context | 57 | .Nm SSL_SESSION_set1_id_context |
| 58 | .Nd get and set the SSL ID context associated with a session | 58 | .Nd get and set the SSL ID context associated with a session |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libssl libcrypto | ||
| 60 | .In openssl/ssl.h | 61 | .In openssl/ssl.h |
| 61 | .Ft const unsigned char * | 62 | .Ft const unsigned char * |
| 62 | .Fo SSL_SESSION_get0_id_context | 63 | .Fo SSL_SESSION_get0_id_context |
diff --git a/src/lib/libssl/man/SSL_accept.3 b/src/lib/libssl/man/SSL_accept.3 index fb1d89eb57..ecb757aaa5 100644 --- a/src/lib/libssl/man/SSL_accept.3 +++ b/src/lib/libssl/man/SSL_accept.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_accept.3,v 1.6 2019/06/08 15:25:43 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_accept.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -49,13 +49,14 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: June 8 2019 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_ACCEPT 3 | 53 | .Dt SSL_ACCEPT 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| 56 | .Nm SSL_accept | 56 | .Nm SSL_accept |
| 57 | .Nd wait for a TLS/SSL client to initiate a TLS/SSL handshake | 57 | .Nd wait for a TLS/SSL client to initiate a TLS/SSL handshake |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libssl libcrypto | ||
| 59 | .In openssl/ssl.h | 60 | .In openssl/ssl.h |
| 60 | .Ft int | 61 | .Ft int |
| 61 | .Fn SSL_accept "SSL *ssl" | 62 | .Fn SSL_accept "SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_alert_type_string.3 b/src/lib/libssl/man/SSL_alert_type_string.3 index 354865e546..0f051cc0a6 100644 --- a/src/lib/libssl/man/SSL_alert_type_string.3 +++ b/src/lib/libssl/man/SSL_alert_type_string.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_alert_type_string.3,v 1.7 2024/10/13 08:25:09 jsg Exp $ | 1 | .\" $OpenBSD: SSL_alert_type_string.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: October 13 2024 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_ALERT_TYPE_STRING 3 | 52 | .Dt SSL_ALERT_TYPE_STRING 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm SSL_alert_desc_string_long | 58 | .Nm SSL_alert_desc_string_long |
| 59 | .Nd get textual description of alert information | 59 | .Nd get textual description of alert information |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libssl libcrypto | ||
| 61 | .In openssl/ssl.h | 62 | .In openssl/ssl.h |
| 62 | .Ft const char * | 63 | .Ft const char * |
| 63 | .Fn SSL_alert_type_string "int value" | 64 | .Fn SSL_alert_type_string "int value" |
diff --git a/src/lib/libssl/man/SSL_clear.3 b/src/lib/libssl/man/SSL_clear.3 index 809c3b20f4..5e4da1257f 100644 --- a/src/lib/libssl/man/SSL_clear.3 +++ b/src/lib/libssl/man/SSL_clear.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_clear.3,v 1.5 2021/06/11 19:41:39 jmc Exp $ | 1 | .\" $OpenBSD: SSL_clear.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -49,13 +49,14 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: June 11 2021 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_CLEAR 3 | 53 | .Dt SSL_CLEAR 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| 56 | .Nm SSL_clear | 56 | .Nm SSL_clear |
| 57 | .Nd reset SSL object to allow another connection | 57 | .Nd reset SSL object to allow another connection |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libssl libcrypto | ||
| 59 | .In openssl/ssl.h | 60 | .In openssl/ssl.h |
| 60 | .Ft int | 61 | .Ft int |
| 61 | .Fn SSL_clear "SSL *ssl" | 62 | .Fn SSL_clear "SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_connect.3 b/src/lib/libssl/man/SSL_connect.3 index d5b962a480..a0cd8f8443 100644 --- a/src/lib/libssl/man/SSL_connect.3 +++ b/src/lib/libssl/man/SSL_connect.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_connect.3,v 1.6 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_connect.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -49,13 +49,14 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: March 27 2018 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_CONNECT 3 | 53 | .Dt SSL_CONNECT 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| 56 | .Nm SSL_connect | 56 | .Nm SSL_connect |
| 57 | .Nd initiate the TLS/SSL handshake with a TLS/SSL server | 57 | .Nd initiate the TLS/SSL handshake with a TLS/SSL server |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libssl libcrypto | ||
| 59 | .In openssl/ssl.h | 60 | .In openssl/ssl.h |
| 60 | .Ft int | 61 | .Ft int |
| 61 | .Fn SSL_connect "SSL *ssl" | 62 | .Fn SSL_connect "SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_copy_session_id.3 b/src/lib/libssl/man/SSL_copy_session_id.3 index a7a7a8aa99..75a52e8879 100644 --- a/src/lib/libssl/man/SSL_copy_session_id.3 +++ b/src/lib/libssl/man/SSL_copy_session_id.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_copy_session_id.3,v 1.7 2019/06/12 09:36:30 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_copy_session_id.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: June 12 2019 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt SSL_COPY_SESSION_ID 3 | 18 | .Dt SSL_COPY_SESSION_ID 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm SSL_copy_session_id | 21 | .Nm SSL_copy_session_id |
| 22 | .Nd copy session details between SSL objects | 22 | .Nd copy session details between SSL objects |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libssl libcrypto | ||
| 24 | .In openssl/ssl.h | 25 | .In openssl/ssl.h |
| 25 | .Ft int | 26 | .Ft int |
| 26 | .Fo SSL_copy_session_id | 27 | .Fo SSL_copy_session_id |
diff --git a/src/lib/libssl/man/SSL_do_handshake.3 b/src/lib/libssl/man/SSL_do_handshake.3 index e9327b4229..78b41db2f4 100644 --- a/src/lib/libssl/man/SSL_do_handshake.3 +++ b/src/lib/libssl/man/SSL_do_handshake.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_do_handshake.3,v 1.6 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_do_handshake.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Martin Sjoegren <martin@strakt.com>. | 4 | .\" This file was written by Martin Sjoegren <martin@strakt.com>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_DO_HANDSHAKE 3 | 52 | .Dt SSL_DO_HANDSHAKE 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_do_handshake | 55 | .Nm SSL_do_handshake |
| 56 | .Nd perform a TLS/SSL handshake | 56 | .Nd perform a TLS/SSL handshake |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/ssl.h | 59 | .In openssl/ssl.h |
| 59 | .Ft int | 60 | .Ft int |
| 60 | .Fn SSL_do_handshake "SSL *ssl" | 61 | .Fn SSL_do_handshake "SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_dup.3 b/src/lib/libssl/man/SSL_dup.3 index a83440b431..f7d999fb62 100644 --- a/src/lib/libssl/man/SSL_dup.3 +++ b/src/lib/libssl/man/SSL_dup.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_dup.3,v 1.5 2022/07/13 22:05:53 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_dup.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: July 13 2022 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt SSL_DUP 3 | 18 | .Dt SSL_DUP 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm SSL_dup | 21 | .Nm SSL_dup |
| 22 | .Nd deep copy of an SSL object | 22 | .Nd deep copy of an SSL object |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libssl libcrypto | ||
| 24 | .In openssl/ssl.h | 25 | .In openssl/ssl.h |
| 25 | .Ft SSL * | 26 | .Ft SSL * |
| 26 | .Fo SSL_dup | 27 | .Fo SSL_dup |
diff --git a/src/lib/libssl/man/SSL_dup_CA_list.3 b/src/lib/libssl/man/SSL_dup_CA_list.3 index d073b07176..553c03bd8c 100644 --- a/src/lib/libssl/man/SSL_dup_CA_list.3 +++ b/src/lib/libssl/man/SSL_dup_CA_list.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_dup_CA_list.3,v 1.6 2019/06/12 09:36:30 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_dup_CA_list.3,v 1.7 2025/06/08 22:47:20 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: June 12 2019 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt SSL_DUP_CA_LIST 3 | 18 | .Dt SSL_DUP_CA_LIST 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,8 @@ | |||
| 22 | .Nd deep copy of a stack of X.509 Name objects | 22 | .Nd deep copy of a stack of X.509 Name objects |
| 23 | .\" The capital "N" in "Name" is intentional (X.509 syntax). | 23 | .\" The capital "N" in "Name" is intentional (X.509 syntax). |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libssl libcrypto | ||
| 26 | .In openssl/ssl.h | ||
| 25 | .Ft STACK_OF(X509_NAME) * | 27 | .Ft STACK_OF(X509_NAME) * |
| 26 | .Fo SSL_dup_CA_list | 28 | .Fo SSL_dup_CA_list |
| 27 | .Fa "const STACK_OF(X509_NAME) *sk" | 29 | .Fa "const STACK_OF(X509_NAME) *sk" |
diff --git a/src/lib/libssl/man/SSL_export_keying_material.3 b/src/lib/libssl/man/SSL_export_keying_material.3 index e32a5c5d61..d3daa3a5a3 100644 --- a/src/lib/libssl/man/SSL_export_keying_material.3 +++ b/src/lib/libssl/man/SSL_export_keying_material.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_export_keying_material.3,v 1.3 2019/06/12 09:36:30 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_export_keying_material.3,v 1.4 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL a599574b Jun 28 17:18:27 2017 +0100 | 2 | .\" OpenSSL a599574b Jun 28 17:18:27 2017 +0100 |
| 3 | .\" OpenSSL 23cec1f4 Jun 21 13:55:02 2017 +0100 | 3 | .\" OpenSSL 23cec1f4 Jun 21 13:55:02 2017 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -49,13 +49,14 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: June 12 2019 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_EXPORT_KEYING_MATERIAL 3 | 53 | .Dt SSL_EXPORT_KEYING_MATERIAL 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| 56 | .Nm SSL_export_keying_material | 56 | .Nm SSL_export_keying_material |
| 57 | .Nd obtain keying material for application use | 57 | .Nd obtain keying material for application use |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libssl libcrypto | ||
| 59 | .In openssl/ssl.h | 60 | .In openssl/ssl.h |
| 60 | .Ft int | 61 | .Ft int |
| 61 | .Fo SSL_export_keying_material | 62 | .Fo SSL_export_keying_material |
diff --git a/src/lib/libssl/man/SSL_free.3 b/src/lib/libssl/man/SSL_free.3 index c713ded121..b630bc8a2e 100644 --- a/src/lib/libssl/man/SSL_free.3 +++ b/src/lib/libssl/man/SSL_free.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_free.3,v 1.6 2021/06/11 19:41:39 jmc Exp $ | 1 | .\" $OpenBSD: SSL_free.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 11 2021 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_FREE 3 | 52 | .Dt SSL_FREE 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_free | 55 | .Nm SSL_free |
| 56 | .Nd free an allocated SSL structure | 56 | .Nd free an allocated SSL structure |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/ssl.h | 59 | .In openssl/ssl.h |
| 59 | .Ft void | 60 | .Ft void |
| 60 | .Fn SSL_free "SSL *ssl" | 61 | .Fn SSL_free "SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_get_SSL_CTX.3 b/src/lib/libssl/man/SSL_get_SSL_CTX.3 index 60fda555bc..eaf1b6ff11 100644 --- a/src/lib/libssl/man/SSL_get_SSL_CTX.3 +++ b/src/lib/libssl/man/SSL_get_SSL_CTX.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_get_SSL_CTX.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_get_SSL_CTX.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_GET_SSL_CTX 3 | 52 | .Dt SSL_GET_SSL_CTX 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_get_SSL_CTX | 55 | .Nm SSL_get_SSL_CTX |
| 56 | .Nd get the SSL_CTX from which an SSL is created | 56 | .Nd get the SSL_CTX from which an SSL is created |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/ssl.h | 59 | .In openssl/ssl.h |
| 59 | .Ft SSL_CTX * | 60 | .Ft SSL_CTX * |
| 60 | .Fn SSL_get_SSL_CTX "const SSL *ssl" | 61 | .Fn SSL_get_SSL_CTX "const SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_get_certificate.3 b/src/lib/libssl/man/SSL_get_certificate.3 index eb53ea49bf..72ae7ec541 100644 --- a/src/lib/libssl/man/SSL_get_certificate.3 +++ b/src/lib/libssl/man/SSL_get_certificate.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_get_certificate.3,v 1.5 2019/06/12 09:36:30 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_get_certificate.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: June 12 2019 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt SSL_GET_CERTIFICATE 3 | 18 | .Dt SSL_GET_CERTIFICATE 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm SSL_get_privatekey | 22 | .Nm SSL_get_privatekey |
| 23 | .Nd get SSL certificate and private key | 23 | .Nd get SSL certificate and private key |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libssl libcrypto | ||
| 25 | .In openssl/ssl.h | 26 | .In openssl/ssl.h |
| 26 | .Ft X509 * | 27 | .Ft X509 * |
| 27 | .Fo SSL_get_certificate | 28 | .Fo SSL_get_certificate |
diff --git a/src/lib/libssl/man/SSL_get_ciphers.3 b/src/lib/libssl/man/SSL_get_ciphers.3 index 8030f0bbb1..d723f7959e 100644 --- a/src/lib/libssl/man/SSL_get_ciphers.3 +++ b/src/lib/libssl/man/SSL_get_ciphers.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_get_ciphers.3,v 1.11 2020/09/16 07:25:15 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_get_ciphers.3,v 1.12 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" selective merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 | 3 | .\" selective merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -69,7 +69,7 @@ | |||
| 69 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 69 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 70 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 70 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 71 | .\" | 71 | .\" |
| 72 | .Dd $Mdocdate: September 16 2020 $ | 72 | .Dd $Mdocdate: June 8 2025 $ |
| 73 | .Dt SSL_GET_CIPHERS 3 | 73 | .Dt SSL_GET_CIPHERS 3 |
| 74 | .Os | 74 | .Os |
| 75 | .Sh NAME | 75 | .Sh NAME |
| @@ -80,6 +80,7 @@ | |||
| 80 | .Nm SSL_get_cipher_list | 80 | .Nm SSL_get_cipher_list |
| 81 | .Nd get lists of available SSL_CIPHERs | 81 | .Nd get lists of available SSL_CIPHERs |
| 82 | .Sh SYNOPSIS | 82 | .Sh SYNOPSIS |
| 83 | .Lb libssl libcrypto | ||
| 83 | .In openssl/ssl.h | 84 | .In openssl/ssl.h |
| 84 | .Ft STACK_OF(SSL_CIPHER) * | 85 | .Ft STACK_OF(SSL_CIPHER) * |
| 85 | .Fn SSL_get_ciphers "const SSL *ssl" | 86 | .Fn SSL_get_ciphers "const SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_get_client_CA_list.3 b/src/lib/libssl/man/SSL_get_client_CA_list.3 index e80e5cb6f5..8be7020489 100644 --- a/src/lib/libssl/man/SSL_get_client_CA_list.3 +++ b/src/lib/libssl/man/SSL_get_client_CA_list.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_get_client_CA_list.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_get_client_CA_list.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: March 27 2018 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_GET_CLIENT_CA_LIST 3 | 53 | .Dt SSL_GET_CLIENT_CA_LIST 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm SSL_CTX_get_client_CA_list | 57 | .Nm SSL_CTX_get_client_CA_list |
| 58 | .Nd get list of client CAs | 58 | .Nd get list of client CAs |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libssl libcrypto | ||
| 60 | .In openssl/ssl.h | 61 | .In openssl/ssl.h |
| 61 | .Ft STACK_OF(X509_NAME) * | 62 | .Ft STACK_OF(X509_NAME) * |
| 62 | .Fn SSL_get_client_CA_list "const SSL *s" | 63 | .Fn SSL_get_client_CA_list "const SSL *s" |
diff --git a/src/lib/libssl/man/SSL_get_client_random.3 b/src/lib/libssl/man/SSL_get_client_random.3 index eda74db355..131972b688 100644 --- a/src/lib/libssl/man/SSL_get_client_random.3 +++ b/src/lib/libssl/man/SSL_get_client_random.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_get_client_random.3,v 1.2 2018/03/24 00:55:37 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_get_client_random.3,v 1.3 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 | 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Nick Mathewson <nickm@torproject.org> | 4 | .\" This file was written by Nick Mathewson <nickm@torproject.org> |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 24 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_GET_CLIENT_RANDOM 3 | 52 | .Dt SSL_GET_CLIENT_RANDOM 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm SSL_SESSION_get_master_key | 57 | .Nm SSL_SESSION_get_master_key |
| 58 | .Nd get internal TLS handshake random values and master key | 58 | .Nd get internal TLS handshake random values and master key |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libssl libcrypto | ||
| 60 | .In openssl/ssl.h | 61 | .In openssl/ssl.h |
| 61 | .Ft size_t | 62 | .Ft size_t |
| 62 | .Fo SSL_get_client_random | 63 | .Fo SSL_get_client_random |
diff --git a/src/lib/libssl/man/SSL_get_current_cipher.3 b/src/lib/libssl/man/SSL_get_current_cipher.3 index 6b951d03ca..37f6409023 100644 --- a/src/lib/libssl/man/SSL_get_current_cipher.3 +++ b/src/lib/libssl/man/SSL_get_current_cipher.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_get_current_cipher.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_get_current_cipher.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,17 +48,18 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_GET_CURRENT_CIPHER 3 | 52 | .Dt SSL_GET_CURRENT_CIPHER 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_get_current_cipher , | 55 | .Nm SSL_get_current_cipher , |
| 56 | .Nm SSL_get_cipher , | 56 | .Nm SSL_get_cipher , |
| 57 | .Nm SSL_get_cipher_name , | 57 | .Nm SSL_get_cipher_name , |
| 58 | .Nm SSL_get_cipher_bits , | 58 | .Nm SSL_get_cipher_bits , |
| 59 | .Nm SSL_get_cipher_version | 59 | .Nm SSL_get_cipher_version |
| 60 | .Nd get SSL_CIPHER of a connection | 60 | .Nd get SSL_CIPHER of a connection |
| 61 | .Sh SYNOPSIS | 61 | .Sh SYNOPSIS |
| 62 | .Lb libssl libcrypto | ||
| 62 | .In openssl/ssl.h | 63 | .In openssl/ssl.h |
| 63 | .Ft const SSL_CIPHER * | 64 | .Ft const SSL_CIPHER * |
| 64 | .Fn SSL_get_current_cipher "const SSL *ssl" | 65 | .Fn SSL_get_current_cipher "const SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_get_default_timeout.3 b/src/lib/libssl/man/SSL_get_default_timeout.3 index 47737d8ee0..ef119780a3 100644 --- a/src/lib/libssl/man/SSL_get_default_timeout.3 +++ b/src/lib/libssl/man/SSL_get_default_timeout.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_get_default_timeout.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_get_default_timeout.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_GET_DEFAULT_TIMEOUT 3 | 52 | .Dt SSL_GET_DEFAULT_TIMEOUT 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_get_default_timeout | 55 | .Nm SSL_get_default_timeout |
| 56 | .Nd get default session timeout value | 56 | .Nd get default session timeout value |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/ssl.h | 59 | .In openssl/ssl.h |
| 59 | .Ft long | 60 | .Ft long |
| 60 | .Fn SSL_get_default_timeout "const SSL *ssl" | 61 | .Fn SSL_get_default_timeout "const SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_get_error.3 b/src/lib/libssl/man/SSL_get_error.3 index 5d325b3f56..ba64b779ac 100644 --- a/src/lib/libssl/man/SSL_get_error.3 +++ b/src/lib/libssl/man/SSL_get_error.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_get_error.3,v 1.5 2018/04/29 07:37:01 guenther Exp $ | 1 | .\" $OpenBSD: SSL_get_error.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 | 2 | .\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Bodo Moeller <bodo@openssl.org>. | 4 | .\" This file was written by Bodo Moeller <bodo@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: April 29 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_GET_ERROR 3 | 52 | .Dt SSL_GET_ERROR 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_get_error | 55 | .Nm SSL_get_error |
| 56 | .Nd obtain result code for TLS/SSL I/O operation | 56 | .Nd obtain result code for TLS/SSL I/O operation |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/ssl.h | 59 | .In openssl/ssl.h |
| 59 | .Ft int | 60 | .Ft int |
| 60 | .Fn SSL_get_error "const SSL *ssl" "int ret" | 61 | .Fn SSL_get_error "const SSL *ssl" "int ret" |
diff --git a/src/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 b/src/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 index a249cda6ac..234034ac2d 100644 --- a/src/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 +++ b/src/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_get_ex_data_X509_STORE_CTX_idx.3,v 1.5 2022/02/06 00:29:02 jsg Exp $ | 1 | .\" $OpenBSD: SSL_get_ex_data_X509_STORE_CTX_idx.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 | 2 | .\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: February 6 2022 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_GET_EX_DATA_X509_STORE_CTX_IDX 3 | 52 | .Dt SSL_GET_EX_DATA_X509_STORE_CTX_IDX 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_get_ex_data_X509_STORE_CTX_idx | 55 | .Nm SSL_get_ex_data_X509_STORE_CTX_idx |
| 56 | .Nd get ex_data index to access SSL structure from X509_STORE_CTX | 56 | .Nd get ex_data index to access SSL structure from X509_STORE_CTX |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/ssl.h | 59 | .In openssl/ssl.h |
| 59 | .Ft int | 60 | .Ft int |
| 60 | .Fn SSL_get_ex_data_X509_STORE_CTX_idx void | 61 | .Fn SSL_get_ex_data_X509_STORE_CTX_idx void |
diff --git a/src/lib/libssl/man/SSL_get_ex_new_index.3 b/src/lib/libssl/man/SSL_get_ex_new_index.3 index cecd25fa44..811df94fc7 100644 --- a/src/lib/libssl/man/SSL_get_ex_new_index.3 +++ b/src/lib/libssl/man/SSL_get_ex_new_index.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_get_ex_new_index.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_get_ex_new_index.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 | 2 | .\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_GET_EX_NEW_INDEX 3 | 52 | .Dt SSL_GET_EX_NEW_INDEX 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm SSL_get_ex_data | 57 | .Nm SSL_get_ex_data |
| 58 | .Nd internal application specific data functions | 58 | .Nd internal application specific data functions |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libssl libcrypto | ||
| 60 | .In openssl/ssl.h | 61 | .In openssl/ssl.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fo SSL_get_ex_new_index | 63 | .Fo SSL_get_ex_new_index |
diff --git a/src/lib/libssl/man/SSL_get_fd.3 b/src/lib/libssl/man/SSL_get_fd.3 index 1e093424cb..3a7948d35f 100644 --- a/src/lib/libssl/man/SSL_get_fd.3 +++ b/src/lib/libssl/man/SSL_get_fd.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_get_fd.3,v 1.6 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_get_fd.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_GET_FD 3 | 52 | .Dt SSL_GET_FD 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm SSL_get_wfd | 57 | .Nm SSL_get_wfd |
| 58 | .Nd get file descriptor linked to an SSL object | 58 | .Nd get file descriptor linked to an SSL object |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libssl libcrypto | ||
| 60 | .In openssl/ssl.h | 61 | .In openssl/ssl.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fn SSL_get_fd "const SSL *ssl" | 63 | .Fn SSL_get_fd "const SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_get_finished.3 b/src/lib/libssl/man/SSL_get_finished.3 index 3cfb655ea0..e5c8a36cf6 100644 --- a/src/lib/libssl/man/SSL_get_finished.3 +++ b/src/lib/libssl/man/SSL_get_finished.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_get_finished.3,v 1.2 2021/01/30 10:48:15 tb Exp $ | 1 | .\" $OpenBSD: SSL_get_finished.3,v 1.3 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2020 Theo Buehler <tb@openbsd.org> | 3 | .\" Copyright (c) 2020 Theo Buehler <tb@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: January 30 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt SSL_GET_FINISHED 3 | 18 | .Dt SSL_GET_FINISHED 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -22,6 +22,7 @@ | |||
| 22 | .Nm SSL_get_peer_finished | 22 | .Nm SSL_get_peer_finished |
| 23 | .Nd get last sent or last expected finished message | 23 | .Nd get last sent or last expected finished message |
| 24 | .Sh SYNOPSIS | 24 | .Sh SYNOPSIS |
| 25 | .Lb libssl libcrypto | ||
| 25 | .In openssl/ssl.h | 26 | .In openssl/ssl.h |
| 26 | .Ft size_t | 27 | .Ft size_t |
| 27 | .Fn SSL_get_finished "const SSL *ssl" "void *buf" "size_t count" | 28 | .Fn SSL_get_finished "const SSL *ssl" "void *buf" "size_t count" |
diff --git a/src/lib/libssl/man/SSL_get_peer_cert_chain.3 b/src/lib/libssl/man/SSL_get_peer_cert_chain.3 index eb2ae53dc4..c4f778aac6 100644 --- a/src/lib/libssl/man/SSL_get_peer_cert_chain.3 +++ b/src/lib/libssl/man/SSL_get_peer_cert_chain.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_get_peer_cert_chain.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_get_peer_cert_chain.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL SSL_get_peer_cert_chain.pod 1f164c6f Jan 18 01:40:36 2017 +0100 | 2 | .\" OpenSSL SSL_get_peer_cert_chain.pod 1f164c6f Jan 18 01:40:36 2017 +0100 |
| 3 | .\" OpenSSL SSL_get_peer_cert_chain.pod 9b86974e Aug 17 15:21:33 2015 -0400 | 3 | .\" OpenSSL SSL_get_peer_cert_chain.pod 9b86974e Aug 17 15:21:33 2015 -0400 |
| 4 | .\" | 4 | .\" |
| @@ -50,13 +50,14 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: March 27 2018 $ | 53 | .Dd $Mdocdate: June 8 2025 $ |
| 54 | .Dt SSL_GET_PEER_CERT_CHAIN 3 | 54 | .Dt SSL_GET_PEER_CERT_CHAIN 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| 57 | .Nm SSL_get_peer_cert_chain | 57 | .Nm SSL_get_peer_cert_chain |
| 58 | .Nd get the X509 certificate chain sent by the peer | 58 | .Nd get the X509 certificate chain sent by the peer |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libssl libcrypto | ||
| 60 | .In openssl/ssl.h | 61 | .In openssl/ssl.h |
| 61 | .Ft STACK_OF(X509) * | 62 | .Ft STACK_OF(X509) * |
| 62 | .Fn SSL_get_peer_cert_chain "const SSL *ssl" | 63 | .Fn SSL_get_peer_cert_chain "const SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_get_peer_certificate.3 b/src/lib/libssl/man/SSL_get_peer_certificate.3 index 99f9330288..9ac35a607d 100644 --- a/src/lib/libssl/man/SSL_get_peer_certificate.3 +++ b/src/lib/libssl/man/SSL_get_peer_certificate.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_get_peer_certificate.3,v 1.6 2021/06/26 17:36:28 tb Exp $ | 1 | .\" $OpenBSD: SSL_get_peer_certificate.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 26 2021 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_GET_PEER_CERTIFICATE 3 | 52 | .Dt SSL_GET_PEER_CERTIFICATE 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_get_peer_certificate | 55 | .Nm SSL_get_peer_certificate |
| 56 | .Nd get the X509 certificate of the peer | 56 | .Nd get the X509 certificate of the peer |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/ssl.h | 59 | .In openssl/ssl.h |
| 59 | .Ft X509 * | 60 | .Ft X509 * |
| 60 | .Fn SSL_get_peer_certificate "const SSL *ssl" | 61 | .Fn SSL_get_peer_certificate "const SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_get_rbio.3 b/src/lib/libssl/man/SSL_get_rbio.3 index 38096fbecf..7179277f71 100644 --- a/src/lib/libssl/man/SSL_get_rbio.3 +++ b/src/lib/libssl/man/SSL_get_rbio.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_get_rbio.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_get_rbio.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_GET_RBIO 3 | 52 | .Dt SSL_GET_RBIO 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm SSL_get_wbio | 56 | .Nm SSL_get_wbio |
| 57 | .Nd get BIO linked to an SSL object | 57 | .Nd get BIO linked to an SSL object |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libssl libcrypto | ||
| 59 | .In openssl/ssl.h | 60 | .In openssl/ssl.h |
| 60 | .Ft BIO * | 61 | .Ft BIO * |
| 61 | .Fn SSL_get_rbio "SSL *ssl" | 62 | .Fn SSL_get_rbio "SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_get_server_tmp_key.3 b/src/lib/libssl/man/SSL_get_server_tmp_key.3 index aeeb358240..c55036d526 100644 --- a/src/lib/libssl/man/SSL_get_server_tmp_key.3 +++ b/src/lib/libssl/man/SSL_get_server_tmp_key.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_get_server_tmp_key.3,v 1.4 2019/06/12 09:36:30 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_get_server_tmp_key.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL SSL_get_server_tmp_key.pod 508fafd8 Apr 3 15:41:21 2017 +0100 | 2 | .\" OpenSSL SSL_get_server_tmp_key.pod 508fafd8 Apr 3 15:41:21 2017 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Matt Caswell <matt@openssl.org> | 4 | .\" This file was written by Matt Caswell <matt@openssl.org> |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 12 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_GET_SERVER_TMP_KEY 3 | 52 | .Dt SSL_GET_SERVER_TMP_KEY 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_get_server_tmp_key | 55 | .Nm SSL_get_server_tmp_key |
| 56 | .Nd temporary server key during a handshake | 56 | .Nd temporary server key during a handshake |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/ssl.h | 59 | .In openssl/ssl.h |
| 59 | .Ft long | 60 | .Ft long |
| 60 | .Fo SSL_get_server_tmp_key | 61 | .Fo SSL_get_server_tmp_key |
diff --git a/src/lib/libssl/man/SSL_get_session.3 b/src/lib/libssl/man/SSL_get_session.3 index 2ab43fdd3e..597888a0bd 100644 --- a/src/lib/libssl/man/SSL_get_session.3 +++ b/src/lib/libssl/man/SSL_get_session.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_get_session.3,v 1.8 2022/03/31 17:27:18 naddy Exp $ | 1 | .\" $OpenBSD: SSL_get_session.3,v 1.9 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: March 31 2022 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_GET_SESSION 3 | 53 | .Dt SSL_GET_SESSION 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -58,6 +58,7 @@ | |||
| 58 | .Nm SSL_get1_session | 58 | .Nm SSL_get1_session |
| 59 | .Nd retrieve TLS/SSL session data | 59 | .Nd retrieve TLS/SSL session data |
| 60 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libssl libcrypto | ||
| 61 | .In openssl/ssl.h | 62 | .In openssl/ssl.h |
| 62 | .Ft SSL_SESSION * | 63 | .Ft SSL_SESSION * |
| 63 | .Fn SSL_get_session "const SSL *ssl" | 64 | .Fn SSL_get_session "const SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_get_shared_ciphers.3 b/src/lib/libssl/man/SSL_get_shared_ciphers.3 index 207e8c42eb..9011780527 100644 --- a/src/lib/libssl/man/SSL_get_shared_ciphers.3 +++ b/src/lib/libssl/man/SSL_get_shared_ciphers.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_get_shared_ciphers.3,v 1.5 2021/01/09 10:50:02 tb Exp $ | 1 | .\" $OpenBSD: SSL_get_shared_ciphers.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: January 9 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt SSL_GET_SHARED_CIPHERS 3 | 18 | .Dt SSL_GET_SHARED_CIPHERS 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm SSL_get_shared_ciphers | 21 | .Nm SSL_get_shared_ciphers |
| 22 | .Nd ciphers supported by both client and server | 22 | .Nd ciphers supported by both client and server |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libssl libcrypto | ||
| 24 | .In openssl/ssl.h | 25 | .In openssl/ssl.h |
| 25 | .Ft char * | 26 | .Ft char * |
| 26 | .Fo SSL_get_shared_ciphers | 27 | .Fo SSL_get_shared_ciphers |
diff --git a/src/lib/libssl/man/SSL_get_state.3 b/src/lib/libssl/man/SSL_get_state.3 index 297bbce876..0e1a20e6f7 100644 --- a/src/lib/libssl/man/SSL_get_state.3 +++ b/src/lib/libssl/man/SSL_get_state.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_get_state.3,v 1.5 2019/06/12 09:36:30 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_get_state.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: June 12 2019 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt SSL_GET_STATE 3 | 18 | .Dt SSL_GET_STATE 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -27,6 +27,7 @@ | |||
| 27 | .Nm SSL_is_init_finished | 27 | .Nm SSL_is_init_finished |
| 28 | .Nd inspect the state of the SSL state machine | 28 | .Nd inspect the state of the SSL state machine |
| 29 | .Sh SYNOPSIS | 29 | .Sh SYNOPSIS |
| 30 | .Lb libssl libcrypto | ||
| 30 | .In openssl/ssl.h | 31 | .In openssl/ssl.h |
| 31 | .Ft int | 32 | .Ft int |
| 32 | .Fo SSL_get_state | 33 | .Fo SSL_get_state |
diff --git a/src/lib/libssl/man/SSL_get_verify_result.3 b/src/lib/libssl/man/SSL_get_verify_result.3 index 180cf1bb73..32a397f4a2 100644 --- a/src/lib/libssl/man/SSL_get_verify_result.3 +++ b/src/lib/libssl/man/SSL_get_verify_result.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_get_verify_result.3,v 1.6 2021/06/26 17:36:28 tb Exp $ | 1 | .\" $OpenBSD: SSL_get_verify_result.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 26 2021 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_GET_VERIFY_RESULT 3 | 52 | .Dt SSL_GET_VERIFY_RESULT 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_get_verify_result | 55 | .Nm SSL_get_verify_result |
| 56 | .Nd get result of peer certificate verification | 56 | .Nd get result of peer certificate verification |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/ssl.h | 59 | .In openssl/ssl.h |
| 59 | .Ft long | 60 | .Ft long |
| 60 | .Fn SSL_get_verify_result "const SSL *ssl" | 61 | .Fn SSL_get_verify_result "const SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_get_version.3 b/src/lib/libssl/man/SSL_get_version.3 index a6cefb055b..d32dd34e0e 100644 --- a/src/lib/libssl/man/SSL_get_version.3 +++ b/src/lib/libssl/man/SSL_get_version.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_get_version.3,v 1.9 2021/04/15 16:13:22 tb Exp $ | 1 | .\" $OpenBSD: SSL_get_version.3,v 1.10 2025/06/08 22:49:42 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL e417070c Jun 8 11:37:06 2016 -0400 | 2 | .\" full merge up to: OpenSSL e417070c Jun 8 11:37:06 2016 -0400 |
| 3 | .\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 | 3 | .\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -49,21 +49,16 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: April 15 2021 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_GET_VERSION 3 | 53 | .Dt SSL_GET_VERSION 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| 56 | .Nm SSL_get_version , | 56 | .Nm SSL_get_version , |
| 57 | .Nm SSL_is_dtls , | 57 | .Nm SSL_is_dtls , |
| 58 | .Nm SSL_version | 58 | .Nm SSL_version |
| 59 | .\" The following are intentionally undocumented because | ||
| 60 | .\" - the longer term plan is to remove them | ||
| 61 | .\" - nothing appears to be using them in the wild | ||
| 62 | .\" - and they have the wrong namespace prefix | ||
| 63 | .\" Nm TLS1_get_version | ||
| 64 | .\" Nm TLS1_get_client_version | ||
| 65 | .Nd get the protocol information of a connection | 59 | .Nd get the protocol information of a connection |
| 66 | .Sh SYNOPSIS | 60 | .Sh SYNOPSIS |
| 61 | .Lb libssl libcrypto | ||
| 67 | .In openssl/ssl.h | 62 | .In openssl/ssl.h |
| 68 | .Ft const char * | 63 | .Ft const char * |
| 69 | .Fn SSL_get_version "const SSL *ssl" | 64 | .Fn SSL_get_version "const SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_library_init.3 b/src/lib/libssl/man/SSL_library_init.3 index 053c1e6fcb..d25a248617 100644 --- a/src/lib/libssl/man/SSL_library_init.3 +++ b/src/lib/libssl/man/SSL_library_init.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_library_init.3,v 1.7 2019/06/14 13:41:31 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_library_init.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 14 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_LIBRARY_INIT 3 | 52 | .Dt SSL_LIBRARY_INIT 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm SSLeay_add_ssl_algorithms | 57 | .Nm SSLeay_add_ssl_algorithms |
| 58 | .Nd initialize SSL library by registering algorithms | 58 | .Nd initialize SSL library by registering algorithms |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libssl libcrypto | ||
| 60 | .In openssl/ssl.h | 61 | .In openssl/ssl.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fn SSL_library_init void | 63 | .Fn SSL_library_init void |
diff --git a/src/lib/libssl/man/SSL_load_client_CA_file.3 b/src/lib/libssl/man/SSL_load_client_CA_file.3 index f782d96dce..e57900c941 100644 --- a/src/lib/libssl/man/SSL_load_client_CA_file.3 +++ b/src/lib/libssl/man/SSL_load_client_CA_file.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_load_client_CA_file.3,v 1.9 2019/06/12 09:36:30 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_load_client_CA_file.3,v 1.10 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: June 12 2019 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt SSL_LOAD_CLIENT_CA_FILE 3 | 69 | .Dt SSL_LOAD_CLIENT_CA_FILE 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -74,6 +74,7 @@ | |||
| 74 | .Nm SSL_add_dir_cert_subjects_to_stack | 74 | .Nm SSL_add_dir_cert_subjects_to_stack |
| 75 | .Nd load certificate names from files | 75 | .Nd load certificate names from files |
| 76 | .Sh SYNOPSIS | 76 | .Sh SYNOPSIS |
| 77 | .Lb libssl libcrypto | ||
| 77 | .In openssl/ssl.h | 78 | .In openssl/ssl.h |
| 78 | .Ft STACK_OF(X509_NAME) * | 79 | .Ft STACK_OF(X509_NAME) * |
| 79 | .Fn SSL_load_client_CA_file "const char *file" | 80 | .Fn SSL_load_client_CA_file "const char *file" |
diff --git a/src/lib/libssl/man/SSL_new.3 b/src/lib/libssl/man/SSL_new.3 index 22c5dbf2db..3906a346d7 100644 --- a/src/lib/libssl/man/SSL_new.3 +++ b/src/lib/libssl/man/SSL_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_new.3,v 1.7 2022/07/13 22:05:53 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_new.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 1c7ae3dd Mar 29 19:17:55 2017 +1000 | 2 | .\" full merge up to: OpenSSL 1c7ae3dd Mar 29 19:17:55 2017 +1000 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Richard Levitte <levitte@openssl.org> | 4 | .\" This file was written by Richard Levitte <levitte@openssl.org> |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: July 13 2022 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_NEW 3 | 53 | .Dt SSL_NEW 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm SSL_up_ref | 57 | .Nm SSL_up_ref |
| 58 | .Nd create a new SSL structure for a connection | 58 | .Nd create a new SSL structure for a connection |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libssl libcrypto | ||
| 60 | .In openssl/ssl.h | 61 | .In openssl/ssl.h |
| 61 | .Ft SSL * | 62 | .Ft SSL * |
| 62 | .Fn SSL_new "SSL_CTX *ctx" | 63 | .Fn SSL_new "SSL_CTX *ctx" |
diff --git a/src/lib/libssl/man/SSL_num_renegotiations.3 b/src/lib/libssl/man/SSL_num_renegotiations.3 index 6a81b76a60..d366f97c4a 100644 --- a/src/lib/libssl/man/SSL_num_renegotiations.3 +++ b/src/lib/libssl/man/SSL_num_renegotiations.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_num_renegotiations.3,v 1.5 2019/06/12 09:36:30 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_num_renegotiations.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: June 12 2019 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt SSL_NUM_RENEGOTIATIONS 3 | 18 | .Dt SSL_NUM_RENEGOTIATIONS 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -23,6 +23,7 @@ | |||
| 23 | .Nm SSL_total_renegotiations | 23 | .Nm SSL_total_renegotiations |
| 24 | .Nd renegotiation counters | 24 | .Nd renegotiation counters |
| 25 | .Sh SYNOPSIS | 25 | .Sh SYNOPSIS |
| 26 | .Lb libssl libcrypto | ||
| 26 | .In openssl/ssl.h | 27 | .In openssl/ssl.h |
| 27 | .Ft long | 28 | .Ft long |
| 28 | .Fo SSL_num_renegotiations | 29 | .Fo SSL_num_renegotiations |
diff --git a/src/lib/libssl/man/SSL_pending.3 b/src/lib/libssl/man/SSL_pending.3 index bbc2e9bdd2..c304302ed8 100644 --- a/src/lib/libssl/man/SSL_pending.3 +++ b/src/lib/libssl/man/SSL_pending.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_pending.3,v 1.5 2020/01/23 03:40:18 beck Exp $ | 1 | .\" $OpenBSD: SSL_pending.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 | 2 | .\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>, | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>, |
| @@ -50,13 +50,14 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: January 23 2020 $ | 53 | .Dd $Mdocdate: June 8 2025 $ |
| 54 | .Dt SSL_PENDING 3 | 54 | .Dt SSL_PENDING 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| 57 | .Nm SSL_pending | 57 | .Nm SSL_pending |
| 58 | .Nd obtain number of readable bytes buffered in an SSL object | 58 | .Nd obtain number of readable bytes buffered in an SSL object |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libssl libcrypto | ||
| 60 | .In openssl/ssl.h | 61 | .In openssl/ssl.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fn SSL_pending "const SSL *ssl" | 63 | .Fn SSL_pending "const SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_read.3 b/src/lib/libssl/man/SSL_read.3 index bb72a8ed82..3d42fd8a90 100644 --- a/src/lib/libssl/man/SSL_read.3 +++ b/src/lib/libssl/man/SSL_read.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_read.3,v 1.8 2021/10/24 15:10:13 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_read.3,v 1.9 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL 5a2443ae Nov 14 11:37:36 2016 +0000 | 2 | .\" full merge up to: OpenSSL 5a2443ae Nov 14 11:37:36 2016 +0000 |
| 3 | .\" partial merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 | 3 | .\" partial merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -51,7 +51,7 @@ | |||
| 51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 53 | .\" | 53 | .\" |
| 54 | .Dd $Mdocdate: October 24 2021 $ | 54 | .Dd $Mdocdate: June 8 2025 $ |
| 55 | .Dt SSL_READ 3 | 55 | .Dt SSL_READ 3 |
| 56 | .Os | 56 | .Os |
| 57 | .Sh NAME | 57 | .Sh NAME |
| @@ -61,6 +61,7 @@ | |||
| 61 | .Nm SSL_peek | 61 | .Nm SSL_peek |
| 62 | .Nd read bytes from a TLS connection | 62 | .Nd read bytes from a TLS connection |
| 63 | .Sh SYNOPSIS | 63 | .Sh SYNOPSIS |
| 64 | .Lb libssl libcrypto | ||
| 64 | .In openssl/ssl.h | 65 | .In openssl/ssl.h |
| 65 | .Ft int | 66 | .Ft int |
| 66 | .Fn SSL_read_ex "SSL *ssl" "void *buf" "size_t num" "size_t *readbytes" | 67 | .Fn SSL_read_ex "SSL *ssl" "void *buf" "size_t num" "size_t *readbytes" |
diff --git a/src/lib/libssl/man/SSL_read_early_data.3 b/src/lib/libssl/man/SSL_read_early_data.3 index 1435c15935..d36b1e49f7 100644 --- a/src/lib/libssl/man/SSL_read_early_data.3 +++ b/src/lib/libssl/man/SSL_read_early_data.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_read_early_data.3,v 1.4 2021/11/26 13:48:22 jsg Exp $ | 1 | .\" $OpenBSD: SSL_read_early_data.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" content checked up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 | 2 | .\" content checked up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 |
| 3 | .\" | 3 | .\" |
| 4 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> | 4 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> |
| @@ -15,7 +15,7 @@ | |||
| 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 | .\" | 17 | .\" |
| 18 | .Dd $Mdocdate: November 26 2021 $ | 18 | .Dd $Mdocdate: June 8 2025 $ |
| 19 | .Dt SSL_READ_EARLY_DATA 3 | 19 | .Dt SSL_READ_EARLY_DATA 3 |
| 20 | .Os | 20 | .Os |
| 21 | .Sh NAME | 21 | .Sh NAME |
| @@ -30,6 +30,7 @@ | |||
| 30 | .Nm SSL_get_early_data_status | 30 | .Nm SSL_get_early_data_status |
| 31 | .Nd transmit application data during the handshake | 31 | .Nd transmit application data during the handshake |
| 32 | .Sh SYNOPSIS | 32 | .Sh SYNOPSIS |
| 33 | .Lb libssl libcrypto | ||
| 33 | .In openssl/ssl.h | 34 | .In openssl/ssl.h |
| 34 | .Ft int | 35 | .Ft int |
| 35 | .Fo SSL_CTX_set_max_early_data | 36 | .Fo SSL_CTX_set_max_early_data |
diff --git a/src/lib/libssl/man/SSL_renegotiate.3 b/src/lib/libssl/man/SSL_renegotiate.3 index 8188d37323..badfe8c6cb 100644 --- a/src/lib/libssl/man/SSL_renegotiate.3 +++ b/src/lib/libssl/man/SSL_renegotiate.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_renegotiate.3,v 1.9 2019/06/12 09:36:30 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_renegotiate.3,v 1.10 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL SSL_key_update.pod 4fbfe86a Feb 16 17:04:40 2017 +0000 | 2 | .\" OpenSSL SSL_key_update.pod 4fbfe86a Feb 16 17:04:40 2017 +0000 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: June 12 2019 $ | 68 | .Dd $Mdocdate: June 8 2025 $ |
| 69 | .Dt SSL_RENEGOTIATE 3 | 69 | .Dt SSL_RENEGOTIATE 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -74,6 +74,7 @@ | |||
| 74 | .Nm SSL_renegotiate_pending | 74 | .Nm SSL_renegotiate_pending |
| 75 | .Nd initiate a new TLS handshake | 75 | .Nd initiate a new TLS handshake |
| 76 | .Sh SYNOPSIS | 76 | .Sh SYNOPSIS |
| 77 | .Lb libssl libcrypto | ||
| 77 | .In openssl/ssl.h | 78 | .In openssl/ssl.h |
| 78 | .Ft int | 79 | .Ft int |
| 79 | .Fo SSL_renegotiate | 80 | .Fo SSL_renegotiate |
diff --git a/src/lib/libssl/man/SSL_rstate_string.3 b/src/lib/libssl/man/SSL_rstate_string.3 index 99613ba3c0..624c1b08ab 100644 --- a/src/lib/libssl/man/SSL_rstate_string.3 +++ b/src/lib/libssl/man/SSL_rstate_string.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_rstate_string.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_rstate_string.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_RSTATE_STRING 3 | 52 | .Dt SSL_RSTATE_STRING 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm SSL_rstate_string_long | 56 | .Nm SSL_rstate_string_long |
| 57 | .Nd get textual description of state of an SSL object during read operation | 57 | .Nd get textual description of state of an SSL object during read operation |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libssl libcrypto | ||
| 59 | .In openssl/ssl.h | 60 | .In openssl/ssl.h |
| 60 | .Ft const char * | 61 | .Ft const char * |
| 61 | .Fn SSL_rstate_string "SSL *ssl" | 62 | .Fn SSL_rstate_string "SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_session_reused.3 b/src/lib/libssl/man/SSL_session_reused.3 index add61a904b..3340144660 100644 --- a/src/lib/libssl/man/SSL_session_reused.3 +++ b/src/lib/libssl/man/SSL_session_reused.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_session_reused.3,v 1.6 2019/06/12 09:36:30 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_session_reused.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 12 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_SESSION_REUSED 3 | 52 | .Dt SSL_SESSION_REUSED 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_session_reused | 55 | .Nm SSL_session_reused |
| 56 | .Nd query whether a reused session was negotiated during handshake | 56 | .Nd query whether a reused session was negotiated during handshake |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/ssl.h | 59 | .In openssl/ssl.h |
| 59 | .Ft int | 60 | .Ft int |
| 60 | .Fn SSL_session_reused "SSL *ssl" | 61 | .Fn SSL_session_reused "SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_set1_host.3 b/src/lib/libssl/man/SSL_set1_host.3 index 2a3935c3f2..2c6cdbe5a1 100644 --- a/src/lib/libssl/man/SSL_set1_host.3 +++ b/src/lib/libssl/man/SSL_set1_host.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_set1_host.3,v 1.4 2021/03/31 16:56:46 tb Exp $ | 1 | .\" $OpenBSD: SSL_set1_host.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" selective merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 | 2 | .\" selective merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Viktor Dukhovni <viktor@openssl.org> | 4 | .\" This file was written by Viktor Dukhovni <viktor@openssl.org> |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 31 2021 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_SET1_HOST 3 | 52 | .Dt SSL_SET1_HOST 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm SSL_get0_peername | 57 | .Nm SSL_get0_peername |
| 58 | .Nd SSL server verification parameters | 58 | .Nd SSL server verification parameters |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libssl libcrypto | ||
| 60 | .In openssl/ssl.h | 61 | .In openssl/ssl.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fo SSL_set1_host | 63 | .Fo SSL_set1_host |
diff --git a/src/lib/libssl/man/SSL_set1_param.3 b/src/lib/libssl/man/SSL_set1_param.3 index cd8ad40ad0..2d255a0991 100644 --- a/src/lib/libssl/man/SSL_set1_param.3 +++ b/src/lib/libssl/man/SSL_set1_param.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_set1_param.3,v 1.6 2022/09/10 10:22:46 jsg Exp $ | 1 | .\" $OpenBSD: SSL_set1_param.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: | 2 | .\" full merge up to: |
| 3 | .\" OpenSSL man3/SSL_CTX_get0_param 99d63d46 Oct 26 13:56:48 2016 -0400 | 3 | .\" OpenSSL man3/SSL_CTX_get0_param 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 4 | .\" | 4 | .\" |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: September 10 2022 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_SET1_PARAM 3 | 53 | .Dt SSL_SET1_PARAM 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -59,6 +59,7 @@ | |||
| 59 | .Nm SSL_set1_param | 59 | .Nm SSL_set1_param |
| 60 | .Nd get and set verification parameters | 60 | .Nd get and set verification parameters |
| 61 | .Sh SYNOPSIS | 61 | .Sh SYNOPSIS |
| 62 | .Lb libssl libcrypto | ||
| 62 | .In openssl/ssl.h | 63 | .In openssl/ssl.h |
| 63 | .Ft X509_VERIFY_PARAM * | 64 | .Ft X509_VERIFY_PARAM * |
| 64 | .Fo SSL_CTX_get0_param | 65 | .Fo SSL_CTX_get0_param |
diff --git a/src/lib/libssl/man/SSL_set_SSL_CTX.3 b/src/lib/libssl/man/SSL_set_SSL_CTX.3 index 2abaefb292..3a909dabe6 100644 --- a/src/lib/libssl/man/SSL_set_SSL_CTX.3 +++ b/src/lib/libssl/man/SSL_set_SSL_CTX.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_set_SSL_CTX.3,v 1.4 2022/07/13 22:05:53 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_set_SSL_CTX.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: July 13 2022 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt SSL_SET_SSL_CTX 3 | 18 | .Dt SSL_SET_SSL_CTX 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm SSL_set_SSL_CTX | 21 | .Nm SSL_set_SSL_CTX |
| 22 | .Nd modify an SSL connection object to use another context | 22 | .Nd modify an SSL connection object to use another context |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libssl libcrypto | ||
| 24 | .In openssl/ssl.h | 25 | .In openssl/ssl.h |
| 25 | .Ft SSL_CTX * | 26 | .Ft SSL_CTX * |
| 26 | .Fo SSL_set_SSL_CTX | 27 | .Fo SSL_set_SSL_CTX |
diff --git a/src/lib/libssl/man/SSL_set_bio.3 b/src/lib/libssl/man/SSL_set_bio.3 index e727f442d6..98ce9a7080 100644 --- a/src/lib/libssl/man/SSL_set_bio.3 +++ b/src/lib/libssl/man/SSL_set_bio.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_set_bio.3,v 1.6 2020/10/08 18:21:30 tb Exp $ | 1 | .\" $OpenBSD: SSL_set_bio.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL acb5b343 Sep 16 16:00:38 2000 +0000 | 2 | .\" OpenSSL acb5b343 Sep 16 16:00:38 2000 +0000 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: October 8 2020 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_SET_BIO 3 | 52 | .Dt SSL_SET_BIO 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_set_bio | 55 | .Nm SSL_set_bio |
| 56 | .Nd connect the SSL object with a BIO | 56 | .Nd connect the SSL object with a BIO |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/ssl.h | 59 | .In openssl/ssl.h |
| 59 | .Ft void | 60 | .Ft void |
| 60 | .Fn SSL_set_bio "SSL *ssl" "BIO *rbio" "BIO *wbio" | 61 | .Fn SSL_set_bio "SSL *ssl" "BIO *rbio" "BIO *wbio" |
diff --git a/src/lib/libssl/man/SSL_set_connect_state.3 b/src/lib/libssl/man/SSL_set_connect_state.3 index c2072c4370..b7d126d046 100644 --- a/src/lib/libssl/man/SSL_set_connect_state.3 +++ b/src/lib/libssl/man/SSL_set_connect_state.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_set_connect_state.3,v 1.6 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_set_connect_state.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
| 3 | .\" selective merge up to: OpenSSL dbd007d7 Jul 28 13:31:27 2017 +0800 | 3 | .\" selective merge up to: OpenSSL dbd007d7 Jul 28 13:31:27 2017 +0800 |
| 4 | .\" | 4 | .\" |
| @@ -50,7 +50,7 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: March 27 2018 $ | 53 | .Dd $Mdocdate: June 8 2025 $ |
| 54 | .Dt SSL_SET_CONNECT_STATE 3 | 54 | .Dt SSL_SET_CONNECT_STATE 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| @@ -59,6 +59,7 @@ | |||
| 59 | .Nm SSL_is_server | 59 | .Nm SSL_is_server |
| 60 | .Nd prepare SSL object to work in client or server mode | 60 | .Nd prepare SSL object to work in client or server mode |
| 61 | .Sh SYNOPSIS | 61 | .Sh SYNOPSIS |
| 62 | .Lb libssl libcrypto | ||
| 62 | .In openssl/ssl.h | 63 | .In openssl/ssl.h |
| 63 | .Ft void | 64 | .Ft void |
| 64 | .Fn SSL_set_connect_state "SSL *ssl" | 65 | .Fn SSL_set_connect_state "SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_set_fd.3 b/src/lib/libssl/man/SSL_set_fd.3 index 7b9727e9ad..3c4441e677 100644 --- a/src/lib/libssl/man/SSL_set_fd.3 +++ b/src/lib/libssl/man/SSL_set_fd.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_set_fd.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_set_fd.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_SET_FD 3 | 52 | .Dt SSL_SET_FD 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm SSL_set_wfd | 57 | .Nm SSL_set_wfd |
| 58 | .Nd connect the SSL object with a file descriptor | 58 | .Nd connect the SSL object with a file descriptor |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libssl libcrypto | ||
| 60 | .In openssl/ssl.h | 61 | .In openssl/ssl.h |
| 61 | .Ft int | 62 | .Ft int |
| 62 | .Fn SSL_set_fd "SSL *ssl" "int fd" | 63 | .Fn SSL_set_fd "SSL *ssl" "int fd" |
diff --git a/src/lib/libssl/man/SSL_set_max_send_fragment.3 b/src/lib/libssl/man/SSL_set_max_send_fragment.3 index 7de087a743..d5265ebb74 100644 --- a/src/lib/libssl/man/SSL_set_max_send_fragment.3 +++ b/src/lib/libssl/man/SSL_set_max_send_fragment.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_set_max_send_fragment.3,v 1.5 2019/06/12 09:36:30 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_set_max_send_fragment.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL doc/man3/SSL_CTX_set_split_send_fragment.pod | 2 | .\" OpenSSL doc/man3/SSL_CTX_set_split_send_fragment.pod |
| 3 | .\" OpenSSL 6782e5fd Oct 21 16:16:20 2016 +0100 | 3 | .\" OpenSSL 6782e5fd Oct 21 16:16:20 2016 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: June 12 2019 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_SET_MAX_SEND_FRAGMENT 3 | 53 | .Dt SSL_SET_MAX_SEND_FRAGMENT 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -57,6 +57,7 @@ | |||
| 57 | .Nm SSL_set_max_send_fragment | 57 | .Nm SSL_set_max_send_fragment |
| 58 | .Nd control fragment sizes | 58 | .Nd control fragment sizes |
| 59 | .Sh SYNOPSIS | 59 | .Sh SYNOPSIS |
| 60 | .Lb libssl libcrypto | ||
| 60 | .In openssl/ssl.h | 61 | .In openssl/ssl.h |
| 61 | .Ft long | 62 | .Ft long |
| 62 | .Fo SSL_CTX_set_max_send_fragment | 63 | .Fo SSL_CTX_set_max_send_fragment |
diff --git a/src/lib/libssl/man/SSL_set_psk_use_session_callback.3 b/src/lib/libssl/man/SSL_set_psk_use_session_callback.3 index 7f2bfcc010..d53f5b97c9 100644 --- a/src/lib/libssl/man/SSL_set_psk_use_session_callback.3 +++ b/src/lib/libssl/man/SSL_set_psk_use_session_callback.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_set_psk_use_session_callback.3,v 1.1 2021/09/14 14:30:57 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_set_psk_use_session_callback.3,v 1.2 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL man3/SSL_CTX_set_psk_client_callback.pod | 2 | .\" OpenSSL man3/SSL_CTX_set_psk_client_callback.pod |
| 3 | .\" checked up to 24a535ea Sep 22 13:14:20 2020 +0100 | 3 | .\" checked up to 24a535ea Sep 22 13:14:20 2020 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -16,7 +16,7 @@ | |||
| 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 18 | .\" | 18 | .\" |
| 19 | .Dd $Mdocdate: September 14 2021 $ | 19 | .Dd $Mdocdate: June 8 2025 $ |
| 20 | .Dt SSL_SET_PSK_USE_SESSION_CALLBACK 3 | 20 | .Dt SSL_SET_PSK_USE_SESSION_CALLBACK 3 |
| 21 | .Os | 21 | .Os |
| 22 | .Sh NAME | 22 | .Sh NAME |
| @@ -24,6 +24,7 @@ | |||
| 24 | .Nm SSL_psk_use_session_cb_func | 24 | .Nm SSL_psk_use_session_cb_func |
| 25 | .Nd set TLS pre-shared key client callback | 25 | .Nd set TLS pre-shared key client callback |
| 26 | .Sh SYNOPSIS | 26 | .Sh SYNOPSIS |
| 27 | .Lb libssl libcrypto | ||
| 27 | .In openssl/ssl.h | 28 | .In openssl/ssl.h |
| 28 | .Ft typedef int | 29 | .Ft typedef int |
| 29 | .Fo (*SSL_psk_use_session_cb_func) | 30 | .Fo (*SSL_psk_use_session_cb_func) |
diff --git a/src/lib/libssl/man/SSL_set_session.3 b/src/lib/libssl/man/SSL_set_session.3 index 7d85f5ad0c..db3fc6a85c 100644 --- a/src/lib/libssl/man/SSL_set_session.3 +++ b/src/lib/libssl/man/SSL_set_session.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_set_session.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_set_session.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL 05ea606a May 20 20:52:46 2016 -0400 | 2 | .\" OpenSSL 05ea606a May 20 20:52:46 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_SET_SESSION 3 | 52 | .Dt SSL_SET_SESSION 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_set_session | 55 | .Nm SSL_set_session |
| 56 | .Nd set a TLS/SSL session to be used during TLS/SSL connect | 56 | .Nd set a TLS/SSL session to be used during TLS/SSL connect |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/ssl.h | 59 | .In openssl/ssl.h |
| 59 | .Ft int | 60 | .Ft int |
| 60 | .Fn SSL_set_session "SSL *ssl" "SSL_SESSION *session" | 61 | .Fn SSL_set_session "SSL *ssl" "SSL_SESSION *session" |
diff --git a/src/lib/libssl/man/SSL_set_shutdown.3 b/src/lib/libssl/man/SSL_set_shutdown.3 index ef8c004f76..1c1d59e927 100644 --- a/src/lib/libssl/man/SSL_set_shutdown.3 +++ b/src/lib/libssl/man/SSL_set_shutdown.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_set_shutdown.3,v 1.7 2024/12/19 06:45:21 jmc Exp $ | 1 | .\" $OpenBSD: SSL_set_shutdown.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: December 19 2024 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_SET_SHUTDOWN 3 | 52 | .Dt SSL_SET_SHUTDOWN 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm SSL_get_shutdown | 56 | .Nm SSL_get_shutdown |
| 57 | .Nd manipulate shutdown state of an SSL connection | 57 | .Nd manipulate shutdown state of an SSL connection |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libssl libcrypto | ||
| 59 | .In openssl/ssl.h | 60 | .In openssl/ssl.h |
| 60 | .Ft void | 61 | .Ft void |
| 61 | .Fn SSL_set_shutdown "SSL *ssl" "int mode" | 62 | .Fn SSL_set_shutdown "SSL *ssl" "int mode" |
diff --git a/src/lib/libssl/man/SSL_set_tmp_ecdh.3 b/src/lib/libssl/man/SSL_set_tmp_ecdh.3 index 8fd2d9fd5b..0794efdfb7 100644 --- a/src/lib/libssl/man/SSL_set_tmp_ecdh.3 +++ b/src/lib/libssl/man/SSL_set_tmp_ecdh.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_set_tmp_ecdh.3,v 1.6 2021/11/30 15:58:08 jsing Exp $ | 1 | .\" $OpenBSD: SSL_set_tmp_ecdh.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: November 30 2021 $ | 17 | .Dd $Mdocdate: June 8 2025 $ |
| 18 | .Dt SSL_SET_TMP_ECDH 3 | 18 | .Dt SSL_SET_TMP_ECDH 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -26,6 +26,7 @@ | |||
| 26 | .Nm SSL_CTX_set_tmp_ecdh_callback | 26 | .Nm SSL_CTX_set_tmp_ecdh_callback |
| 27 | .Nd select a curve for ECDH ephemeral key exchange | 27 | .Nd select a curve for ECDH ephemeral key exchange |
| 28 | .Sh SYNOPSIS | 28 | .Sh SYNOPSIS |
| 29 | .Lb libssl libcrypto | ||
| 29 | .In openssl/ssl.h | 30 | .In openssl/ssl.h |
| 30 | .Ft long | 31 | .Ft long |
| 31 | .Fo SSL_set_tmp_ecdh | 32 | .Fo SSL_set_tmp_ecdh |
diff --git a/src/lib/libssl/man/SSL_set_verify_result.3 b/src/lib/libssl/man/SSL_set_verify_result.3 index 4b7cc6ec3c..f43d375bc9 100644 --- a/src/lib/libssl/man/SSL_set_verify_result.3 +++ b/src/lib/libssl/man/SSL_set_verify_result.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_set_verify_result.3,v 1.5 2020/03/29 17:05:02 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_set_verify_result.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,13 +48,14 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 29 2020 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_SET_VERIFY_RESULT 3 | 52 | .Dt SSL_SET_VERIFY_RESULT 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| 55 | .Nm SSL_set_verify_result | 55 | .Nm SSL_set_verify_result |
| 56 | .Nd override result of peer certificate verification | 56 | .Nd override result of peer certificate verification |
| 57 | .Sh SYNOPSIS | 57 | .Sh SYNOPSIS |
| 58 | .Lb libssl libcrypto | ||
| 58 | .In openssl/ssl.h | 59 | .In openssl/ssl.h |
| 59 | .Ft void | 60 | .Ft void |
| 60 | .Fn SSL_set_verify_result "SSL *ssl" "long verify_result" | 61 | .Fn SSL_set_verify_result "SSL *ssl" "long verify_result" |
diff --git a/src/lib/libssl/man/SSL_shutdown.3 b/src/lib/libssl/man/SSL_shutdown.3 index bfb1e91ea7..ad49a47d8e 100644 --- a/src/lib/libssl/man/SSL_shutdown.3 +++ b/src/lib/libssl/man/SSL_shutdown.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_shutdown.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_shutdown.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -49,13 +49,14 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: March 27 2018 $ | 52 | .Dd $Mdocdate: June 8 2025 $ |
| 53 | .Dt SSL_SHUTDOWN 3 | 53 | .Dt SSL_SHUTDOWN 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| 56 | .Nm SSL_shutdown | 56 | .Nm SSL_shutdown |
| 57 | .Nd shut down a TLS/SSL connection | 57 | .Nd shut down a TLS/SSL connection |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libssl libcrypto | ||
| 59 | .In openssl/ssl.h | 60 | .In openssl/ssl.h |
| 60 | .Ft int | 61 | .Ft int |
| 61 | .Fn SSL_shutdown "SSL *ssl" | 62 | .Fn SSL_shutdown "SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_state_string.3 b/src/lib/libssl/man/SSL_state_string.3 index 1070335448..d202056eec 100644 --- a/src/lib/libssl/man/SSL_state_string.3 +++ b/src/lib/libssl/man/SSL_state_string.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_state_string.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_state_string.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_STATE_STRING 3 | 52 | .Dt SSL_STATE_STRING 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm SSL_state_string_long | 56 | .Nm SSL_state_string_long |
| 57 | .Nd get textual description of state of an SSL object | 57 | .Nd get textual description of state of an SSL object |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libssl libcrypto | ||
| 59 | .In openssl/ssl.h | 60 | .In openssl/ssl.h |
| 60 | .Ft const char * | 61 | .Ft const char * |
| 61 | .Fn SSL_state_string "const SSL *ssl" | 62 | .Fn SSL_state_string "const SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_want.3 b/src/lib/libssl/man/SSL_want.3 index 24e8645ba8..c7c2ee4885 100644 --- a/src/lib/libssl/man/SSL_want.3 +++ b/src/lib/libssl/man/SSL_want.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_want.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_want.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 | 2 | .\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt SSL_WANT 3 | 52 | .Dt SSL_WANT 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -59,6 +59,7 @@ | |||
| 59 | .Nm SSL_want_x509_lookup | 59 | .Nm SSL_want_x509_lookup |
| 60 | .Nd obtain state information TLS/SSL I/O operation | 60 | .Nd obtain state information TLS/SSL I/O operation |
| 61 | .Sh SYNOPSIS | 61 | .Sh SYNOPSIS |
| 62 | .Lb libssl libcrypto | ||
| 62 | .In openssl/ssl.h | 63 | .In openssl/ssl.h |
| 63 | .Ft int | 64 | .Ft int |
| 64 | .Fn SSL_want "const SSL *ssl" | 65 | .Fn SSL_want "const SSL *ssl" |
diff --git a/src/lib/libssl/man/SSL_write.3 b/src/lib/libssl/man/SSL_write.3 index 2c6fbcef08..54d0953e82 100644 --- a/src/lib/libssl/man/SSL_write.3 +++ b/src/lib/libssl/man/SSL_write.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: SSL_write.3,v 1.7 2021/10/24 15:10:13 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_write.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" partial merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 | 3 | .\" partial merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 |
| 4 | .\" | 4 | .\" |
| @@ -51,7 +51,7 @@ | |||
| 51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 53 | .\" | 53 | .\" |
| 54 | .Dd $Mdocdate: October 24 2021 $ | 54 | .Dd $Mdocdate: June 8 2025 $ |
| 55 | .Dt SSL_WRITE 3 | 55 | .Dt SSL_WRITE 3 |
| 56 | .Os | 56 | .Os |
| 57 | .Sh NAME | 57 | .Sh NAME |
| @@ -59,6 +59,7 @@ | |||
| 59 | .Nm SSL_write | 59 | .Nm SSL_write |
| 60 | .Nd write bytes to a TLS connection | 60 | .Nd write bytes to a TLS connection |
| 61 | .Sh SYNOPSIS | 61 | .Sh SYNOPSIS |
| 62 | .Lb libssl libcrypto | ||
| 62 | .In openssl/ssl.h | 63 | .In openssl/ssl.h |
| 63 | .Ft int | 64 | .Ft int |
| 64 | .Fn SSL_write_ex "SSL *ssl" "const void *buf" "size_t num" "size_t *written" | 65 | .Fn SSL_write_ex "SSL *ssl" "const void *buf" "size_t num" "size_t *written" |
diff --git a/src/lib/libssl/man/d2i_SSL_SESSION.3 b/src/lib/libssl/man/d2i_SSL_SESSION.3 index 7a2bc529ab..6b0dfc86b9 100644 --- a/src/lib/libssl/man/d2i_SSL_SESSION.3 +++ b/src/lib/libssl/man/d2i_SSL_SESSION.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_SSL_SESSION.3,v 1.7 2019/06/08 15:25:43 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_SSL_SESSION.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
| @@ -48,7 +48,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 50 | .\" |
| 51 | .Dd $Mdocdate: June 8 2019 $ | 51 | .Dd $Mdocdate: June 8 2025 $ |
| 52 | .Dt D2I_SSL_SESSION 3 | 52 | .Dt D2I_SSL_SESSION 3 |
| 53 | .Os | 53 | .Os |
| 54 | .Sh NAME | 54 | .Sh NAME |
| @@ -56,6 +56,7 @@ | |||
| 56 | .Nm i2d_SSL_SESSION | 56 | .Nm i2d_SSL_SESSION |
| 57 | .Nd convert SSL_SESSION object from/to ASN1 representation | 57 | .Nd convert SSL_SESSION object from/to ASN1 representation |
| 58 | .Sh SYNOPSIS | 58 | .Sh SYNOPSIS |
| 59 | .Lb libssl libcrypto | ||
| 59 | .In openssl/ssl.h | 60 | .In openssl/ssl.h |
| 60 | .Ft SSL_SESSION * | 61 | .Ft SSL_SESSION * |
| 61 | .Fn d2i_SSL_SESSION "SSL_SESSION **a" "const unsigned char **pp" "long length" | 62 | .Fn d2i_SSL_SESSION "SSL_SESSION **a" "const unsigned char **pp" "long length" |
diff --git a/src/lib/libssl/pqueue.c b/src/lib/libssl/pqueue.c index 602969deb0..aafd0a704e 100644 --- a/src/lib/libssl/pqueue.c +++ b/src/lib/libssl/pqueue.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pqueue.c,v 1.5 2014/06/12 15:49:31 deraadt Exp $ */ | 1 | /* $OpenBSD: pqueue.c,v 1.7 2025/05/04 10:53:38 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * DTLS implementation written by Nagendra Modadugu | 3 | * DTLS implementation written by Nagendra Modadugu |
| 4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. | 4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. |
| @@ -68,7 +68,7 @@ typedef struct _pqueue { | |||
| 68 | } pqueue_s; | 68 | } pqueue_s; |
| 69 | 69 | ||
| 70 | pitem * | 70 | pitem * |
| 71 | pitem_new(unsigned char *prio64be, void *data) | 71 | pitem_new(const unsigned char *prio64be, void *data) |
| 72 | { | 72 | { |
| 73 | pitem *item = malloc(sizeof(pitem)); | 73 | pitem *item = malloc(sizeof(pitem)); |
| 74 | 74 | ||
| @@ -154,7 +154,7 @@ pqueue_pop(pqueue_s *pq) | |||
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | pitem * | 156 | pitem * |
| 157 | pqueue_find(pqueue_s *pq, unsigned char *prio64be) | 157 | pqueue_find(pqueue_s *pq, const unsigned char *prio64be) |
| 158 | { | 158 | { |
| 159 | pitem *next; | 159 | pitem *next; |
| 160 | 160 | ||
diff --git a/src/lib/libssl/pqueue.h b/src/lib/libssl/pqueue.h index cdda4a3961..79ddf7a105 100644 --- a/src/lib/libssl/pqueue.h +++ b/src/lib/libssl/pqueue.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pqueue.h,v 1.4 2016/11/04 18:28:58 guenther Exp $ */ | 1 | /* $OpenBSD: pqueue.h,v 1.7 2025/05/04 10:53:38 tb Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * DTLS implementation written by Nagendra Modadugu | 4 | * DTLS implementation written by Nagendra Modadugu |
| @@ -61,7 +61,7 @@ | |||
| 61 | #ifndef HEADER_PQUEUE_H | 61 | #ifndef HEADER_PQUEUE_H |
| 62 | #define HEADER_PQUEUE_H | 62 | #define HEADER_PQUEUE_H |
| 63 | 63 | ||
| 64 | __BEGIN_HIDDEN_DECLS | 64 | __BEGIN_HIDDEN_DECLS |
| 65 | 65 | ||
| 66 | typedef struct _pqueue *pqueue; | 66 | typedef struct _pqueue *pqueue; |
| 67 | 67 | ||
| @@ -73,7 +73,7 @@ typedef struct _pitem { | |||
| 73 | 73 | ||
| 74 | typedef struct _pitem *piterator; | 74 | typedef struct _pitem *piterator; |
| 75 | 75 | ||
| 76 | pitem *pitem_new(unsigned char *prio64be, void *data); | 76 | pitem *pitem_new(const unsigned char *prio64be, void *data); |
| 77 | void pitem_free(pitem *item); | 77 | void pitem_free(pitem *item); |
| 78 | 78 | ||
| 79 | pqueue pqueue_new(void); | 79 | pqueue pqueue_new(void); |
| @@ -82,12 +82,12 @@ void pqueue_free(pqueue pq); | |||
| 82 | pitem *pqueue_insert(pqueue pq, pitem *item); | 82 | pitem *pqueue_insert(pqueue pq, pitem *item); |
| 83 | pitem *pqueue_peek(pqueue pq); | 83 | pitem *pqueue_peek(pqueue pq); |
| 84 | pitem *pqueue_pop(pqueue pq); | 84 | pitem *pqueue_pop(pqueue pq); |
| 85 | pitem *pqueue_find(pqueue pq, unsigned char *prio64be); | 85 | pitem *pqueue_find(pqueue pq, const unsigned char *prio64be); |
| 86 | pitem *pqueue_iterator(pqueue pq); | 86 | pitem *pqueue_iterator(pqueue pq); |
| 87 | pitem *pqueue_next(piterator *iter); | 87 | pitem *pqueue_next(piterator *iter); |
| 88 | 88 | ||
| 89 | int pqueue_size(pqueue pq); | 89 | int pqueue_size(pqueue pq); |
| 90 | 90 | ||
| 91 | __END_HIDDEN_DECLS | 91 | __END_HIDDEN_DECLS |
| 92 | 92 | ||
| 93 | #endif /* ! HEADER_PQUEUE_H */ | 93 | #endif /* ! HEADER_PQUEUE_H */ |
diff --git a/src/lib/libssl/s3_lib.c b/src/lib/libssl/s3_lib.c index 86b32aec15..bcf26bec40 100644 --- a/src/lib/libssl/s3_lib.c +++ b/src/lib/libssl/s3_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: s3_lib.c,v 1.257 2024/07/23 14:40:53 jsing Exp $ */ | 1 | /* $OpenBSD: s3_lib.c,v 1.258 2025/12/04 21:16:17 beck Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -1286,6 +1286,7 @@ ssl3_free(SSL *s) | |||
| 1286 | sk_X509_pop_free(s->s3->hs.peer_certs_no_leaf, X509_free); | 1286 | sk_X509_pop_free(s->s3->hs.peer_certs_no_leaf, X509_free); |
| 1287 | sk_X509_pop_free(s->s3->hs.verified_chain, X509_free); | 1287 | sk_X509_pop_free(s->s3->hs.verified_chain, X509_free); |
| 1288 | tls_key_share_free(s->s3->hs.key_share); | 1288 | tls_key_share_free(s->s3->hs.key_share); |
| 1289 | tls_key_share_free(s->s3->hs.tls13.key_share); | ||
| 1289 | 1290 | ||
| 1290 | tls13_secrets_destroy(s->s3->hs.tls13.secrets); | 1291 | tls13_secrets_destroy(s->s3->hs.tls13.secrets); |
| 1291 | freezero(s->s3->hs.tls13.cookie, s->s3->hs.tls13.cookie_len); | 1292 | freezero(s->s3->hs.tls13.cookie, s->s3->hs.tls13.cookie_len); |
| @@ -1337,6 +1338,8 @@ ssl3_clear(SSL *s) | |||
| 1337 | 1338 | ||
| 1338 | tls_key_share_free(s->s3->hs.key_share); | 1339 | tls_key_share_free(s->s3->hs.key_share); |
| 1339 | s->s3->hs.key_share = NULL; | 1340 | s->s3->hs.key_share = NULL; |
| 1341 | tls_key_share_free(s->s3->hs.tls13.key_share); | ||
| 1342 | s->s3->hs.tls13.key_share = NULL; | ||
| 1340 | 1343 | ||
| 1341 | tls13_secrets_destroy(s->s3->hs.tls13.secrets); | 1344 | tls13_secrets_destroy(s->s3->hs.tls13.secrets); |
| 1342 | s->s3->hs.tls13.secrets = NULL; | 1345 | s->s3->hs.tls13.secrets = NULL; |
diff --git a/src/lib/libssl/shlib_version b/src/lib/libssl/shlib_version index c2665004b4..dc886efa77 100644 --- a/src/lib/libssl/shlib_version +++ b/src/lib/libssl/shlib_version | |||
| @@ -1,3 +1,3 @@ | |||
| 1 | # Don't forget to give libtls the same type of bump! | 1 | # Don't forget to give libtls the same type of bump! |
| 2 | major=59 | 2 | major=60 |
| 3 | minor=1 | 3 | minor=2 |
diff --git a/src/lib/libssl/ssl.h b/src/lib/libssl/ssl.h index a1ed22b778..48cb6256df 100644 --- a/src/lib/libssl/ssl.h +++ b/src/lib/libssl/ssl.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl.h,v 1.247 2025/03/12 14:03:55 jsing Exp $ */ | 1 | /* $OpenBSD: ssl.h,v 1.249 2025/10/24 11:36:08 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -231,9 +231,9 @@ extern "C" { | |||
| 231 | #define SSL_TXT_kRSA "kRSA" | 231 | #define SSL_TXT_kRSA "kRSA" |
| 232 | #define SSL_TXT_kDHr "kDHr" /* no such ciphersuites supported! */ | 232 | #define SSL_TXT_kDHr "kDHr" /* no such ciphersuites supported! */ |
| 233 | #define SSL_TXT_kDHd "kDHd" /* no such ciphersuites supported! */ | 233 | #define SSL_TXT_kDHd "kDHd" /* no such ciphersuites supported! */ |
| 234 | #define SSL_TXT_kDH "kDH" /* no such ciphersuites supported! */ | 234 | #define SSL_TXT_kDH "kDH" /* no such ciphersuites supported! */ |
| 235 | #define SSL_TXT_kEDH "kEDH" | 235 | #define SSL_TXT_kEDH "kEDH" |
| 236 | #define SSL_TXT_kKRB5 "kKRB5" | 236 | #define SSL_TXT_kKRB5 "kKRB5" |
| 237 | #define SSL_TXT_kECDHr "kECDHr" | 237 | #define SSL_TXT_kECDHr "kECDHr" |
| 238 | #define SSL_TXT_kECDHe "kECDHe" | 238 | #define SSL_TXT_kECDHe "kECDHe" |
| 239 | #define SSL_TXT_kECDH "kECDH" | 239 | #define SSL_TXT_kECDH "kECDH" |
| @@ -245,7 +245,7 @@ extern "C" { | |||
| 245 | #define SSL_TXT_aDSS "aDSS" | 245 | #define SSL_TXT_aDSS "aDSS" |
| 246 | #define SSL_TXT_aDH "aDH" /* no such ciphersuites supported! */ | 246 | #define SSL_TXT_aDH "aDH" /* no such ciphersuites supported! */ |
| 247 | #define SSL_TXT_aECDH "aECDH" | 247 | #define SSL_TXT_aECDH "aECDH" |
| 248 | #define SSL_TXT_aKRB5 "aKRB5" | 248 | #define SSL_TXT_aKRB5 "aKRB5" |
| 249 | #define SSL_TXT_aECDSA "aECDSA" | 249 | #define SSL_TXT_aECDSA "aECDSA" |
| 250 | #define SSL_TXT_aPSK "aPSK" | 250 | #define SSL_TXT_aPSK "aPSK" |
| 251 | 251 | ||
| @@ -260,7 +260,7 @@ extern "C" { | |||
| 260 | #define SSL_TXT_EECDH "EECDH" /* previous name for ECDHE */ | 260 | #define SSL_TXT_EECDH "EECDH" /* previous name for ECDHE */ |
| 261 | #define SSL_TXT_AECDH "AECDH" | 261 | #define SSL_TXT_AECDH "AECDH" |
| 262 | #define SSL_TXT_ECDSA "ECDSA" | 262 | #define SSL_TXT_ECDSA "ECDSA" |
| 263 | #define SSL_TXT_KRB5 "KRB5" | 263 | #define SSL_TXT_KRB5 "KRB5" |
| 264 | #define SSL_TXT_PSK "PSK" | 264 | #define SSL_TXT_PSK "PSK" |
| 265 | #define SSL_TXT_SRP "SRP" | 265 | #define SSL_TXT_SRP "SRP" |
| 266 | 266 | ||
| @@ -1117,7 +1117,7 @@ const SSL_CIPHER *SSL_get_current_cipher(const SSL *s); | |||
| 1117 | int SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits); | 1117 | int SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits); |
| 1118 | const char * SSL_CIPHER_get_version(const SSL_CIPHER *c); | 1118 | const char * SSL_CIPHER_get_version(const SSL_CIPHER *c); |
| 1119 | const char * SSL_CIPHER_get_name(const SSL_CIPHER *c); | 1119 | const char * SSL_CIPHER_get_name(const SSL_CIPHER *c); |
| 1120 | unsigned long SSL_CIPHER_get_id(const SSL_CIPHER *c); | 1120 | unsigned long SSL_CIPHER_get_id(const SSL_CIPHER *c); |
| 1121 | uint16_t SSL_CIPHER_get_value(const SSL_CIPHER *c); | 1121 | uint16_t SSL_CIPHER_get_value(const SSL_CIPHER *c); |
| 1122 | const SSL_CIPHER *SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr); | 1122 | const SSL_CIPHER *SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr); |
| 1123 | int SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *c); | 1123 | int SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *c); |
| @@ -1199,6 +1199,7 @@ int SSL_SESSION_is_resumable(const SSL_SESSION *s); | |||
| 1199 | 1199 | ||
| 1200 | SSL_SESSION *SSL_SESSION_new(void); | 1200 | SSL_SESSION *SSL_SESSION_new(void); |
| 1201 | void SSL_SESSION_free(SSL_SESSION *ses); | 1201 | void SSL_SESSION_free(SSL_SESSION *ses); |
| 1202 | SSL_SESSION *SSL_SESSION_dup(const SSL_SESSION *src); | ||
| 1202 | int SSL_SESSION_up_ref(SSL_SESSION *ss); | 1203 | int SSL_SESSION_up_ref(SSL_SESSION *ss); |
| 1203 | const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *ss, | 1204 | const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *ss, |
| 1204 | unsigned int *len); | 1205 | unsigned int *len); |
| @@ -1272,16 +1273,16 @@ int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm); | |||
| 1272 | SSL *SSL_new(SSL_CTX *ctx); | 1273 | SSL *SSL_new(SSL_CTX *ctx); |
| 1273 | void SSL_free(SSL *ssl); | 1274 | void SSL_free(SSL *ssl); |
| 1274 | int SSL_up_ref(SSL *ssl); | 1275 | int SSL_up_ref(SSL *ssl); |
| 1275 | int SSL_accept(SSL *ssl); | 1276 | int SSL_accept(SSL *ssl); |
| 1276 | int SSL_connect(SSL *ssl); | 1277 | int SSL_connect(SSL *ssl); |
| 1277 | int SSL_is_dtls(const SSL *s); | 1278 | int SSL_is_dtls(const SSL *s); |
| 1278 | int SSL_is_server(const SSL *s); | 1279 | int SSL_is_server(const SSL *s); |
| 1279 | int SSL_read(SSL *ssl, void *buf, int num); | 1280 | int SSL_read(SSL *ssl, void *buf, int num); |
| 1280 | int SSL_peek(SSL *ssl, void *buf, int num); | 1281 | int SSL_peek(SSL *ssl, void *buf, int num); |
| 1281 | int SSL_write(SSL *ssl, const void *buf, int num); | 1282 | int SSL_write(SSL *ssl, const void *buf, int num); |
| 1282 | int SSL_read_ex(SSL *ssl, void *buf, size_t num, size_t *bytes_read); | 1283 | int SSL_read_ex(SSL *ssl, void *buf, size_t num, size_t *bytes_read); |
| 1283 | int SSL_peek_ex(SSL *ssl, void *buf, size_t num, size_t *bytes_peeked); | 1284 | int SSL_peek_ex(SSL *ssl, void *buf, size_t num, size_t *bytes_peeked); |
| 1284 | int SSL_write_ex(SSL *ssl, const void *buf, size_t num, size_t *bytes_written); | 1285 | int SSL_write_ex(SSL *ssl, const void *buf, size_t num, size_t *bytes_written); |
| 1285 | 1286 | ||
| 1286 | #if defined(LIBRESSL_HAS_TLS1_3) || defined(LIBRESSL_INTERNAL) | 1287 | #if defined(LIBRESSL_HAS_TLS1_3) || defined(LIBRESSL_INTERNAL) |
| 1287 | uint32_t SSL_CTX_get_max_early_data(const SSL_CTX *ctx); | 1288 | uint32_t SSL_CTX_get_max_early_data(const SSL_CTX *ctx); |
diff --git a/src/lib/libssl/ssl3.h b/src/lib/libssl/ssl3.h index 1b1110b4e9..03dda33530 100644 --- a/src/lib/libssl/ssl3.h +++ b/src/lib/libssl/ssl3.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl3.h,v 1.60 2024/03/02 11:47:41 tb Exp $ */ | 1 | /* $OpenBSD: ssl3.h,v 1.61 2025/04/18 07:34:01 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -134,7 +134,7 @@ extern "C" { | |||
| 134 | 134 | ||
| 135 | #define SSL3_CK_RSA_NULL_MD5 0x03000001 | 135 | #define SSL3_CK_RSA_NULL_MD5 0x03000001 |
| 136 | #define SSL3_CK_RSA_NULL_SHA 0x03000002 | 136 | #define SSL3_CK_RSA_NULL_SHA 0x03000002 |
| 137 | #define SSL3_CK_RSA_RC4_40_MD5 0x03000003 | 137 | #define SSL3_CK_RSA_RC4_40_MD5 0x03000003 |
| 138 | #define SSL3_CK_RSA_RC4_128_MD5 0x03000004 | 138 | #define SSL3_CK_RSA_RC4_128_MD5 0x03000004 |
| 139 | #define SSL3_CK_RSA_RC4_128_SHA 0x03000005 | 139 | #define SSL3_CK_RSA_RC4_128_SHA 0x03000005 |
| 140 | #define SSL3_CK_RSA_RC2_40_MD5 0x03000006 | 140 | #define SSL3_CK_RSA_RC2_40_MD5 0x03000006 |
| @@ -145,10 +145,10 @@ extern "C" { | |||
| 145 | 145 | ||
| 146 | #define SSL3_CK_DH_DSS_DES_40_CBC_SHA 0x0300000B | 146 | #define SSL3_CK_DH_DSS_DES_40_CBC_SHA 0x0300000B |
| 147 | #define SSL3_CK_DH_DSS_DES_64_CBC_SHA 0x0300000C | 147 | #define SSL3_CK_DH_DSS_DES_64_CBC_SHA 0x0300000C |
| 148 | #define SSL3_CK_DH_DSS_DES_192_CBC3_SHA 0x0300000D | 148 | #define SSL3_CK_DH_DSS_DES_192_CBC3_SHA 0x0300000D |
| 149 | #define SSL3_CK_DH_RSA_DES_40_CBC_SHA 0x0300000E | 149 | #define SSL3_CK_DH_RSA_DES_40_CBC_SHA 0x0300000E |
| 150 | #define SSL3_CK_DH_RSA_DES_64_CBC_SHA 0x0300000F | 150 | #define SSL3_CK_DH_RSA_DES_64_CBC_SHA 0x0300000F |
| 151 | #define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 0x03000010 | 151 | #define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 0x03000010 |
| 152 | 152 | ||
| 153 | #define SSL3_CK_EDH_DSS_DES_40_CBC_SHA 0x03000011 | 153 | #define SSL3_CK_EDH_DSS_DES_40_CBC_SHA 0x03000011 |
| 154 | #define SSL3_CK_EDH_DSS_DES_64_CBC_SHA 0x03000012 | 154 | #define SSL3_CK_EDH_DSS_DES_64_CBC_SHA 0x03000012 |
| @@ -168,22 +168,22 @@ extern "C" { | |||
| 168 | #define SSL3_CK_KRB5_DES_64_CBC_SHA 0x0300001E | 168 | #define SSL3_CK_KRB5_DES_64_CBC_SHA 0x0300001E |
| 169 | #define SSL3_CK_KRB5_DES_192_CBC3_SHA 0x0300001F | 169 | #define SSL3_CK_KRB5_DES_192_CBC3_SHA 0x0300001F |
| 170 | #define SSL3_CK_KRB5_RC4_128_SHA 0x03000020 | 170 | #define SSL3_CK_KRB5_RC4_128_SHA 0x03000020 |
| 171 | #define SSL3_CK_KRB5_IDEA_128_CBC_SHA 0x03000021 | 171 | #define SSL3_CK_KRB5_IDEA_128_CBC_SHA 0x03000021 |
| 172 | #define SSL3_CK_KRB5_DES_64_CBC_MD5 0x03000022 | 172 | #define SSL3_CK_KRB5_DES_64_CBC_MD5 0x03000022 |
| 173 | #define SSL3_CK_KRB5_DES_192_CBC3_MD5 0x03000023 | 173 | #define SSL3_CK_KRB5_DES_192_CBC3_MD5 0x03000023 |
| 174 | #define SSL3_CK_KRB5_RC4_128_MD5 0x03000024 | 174 | #define SSL3_CK_KRB5_RC4_128_MD5 0x03000024 |
| 175 | #define SSL3_CK_KRB5_IDEA_128_CBC_MD5 0x03000025 | 175 | #define SSL3_CK_KRB5_IDEA_128_CBC_MD5 0x03000025 |
| 176 | 176 | ||
| 177 | #define SSL3_CK_KRB5_DES_40_CBC_SHA 0x03000026 | 177 | #define SSL3_CK_KRB5_DES_40_CBC_SHA 0x03000026 |
| 178 | #define SSL3_CK_KRB5_RC2_40_CBC_SHA 0x03000027 | 178 | #define SSL3_CK_KRB5_RC2_40_CBC_SHA 0x03000027 |
| 179 | #define SSL3_CK_KRB5_RC4_40_SHA 0x03000028 | 179 | #define SSL3_CK_KRB5_RC4_40_SHA 0x03000028 |
| 180 | #define SSL3_CK_KRB5_DES_40_CBC_MD5 0x03000029 | 180 | #define SSL3_CK_KRB5_DES_40_CBC_MD5 0x03000029 |
| 181 | #define SSL3_CK_KRB5_RC2_40_CBC_MD5 0x0300002A | 181 | #define SSL3_CK_KRB5_RC2_40_CBC_MD5 0x0300002A |
| 182 | #define SSL3_CK_KRB5_RC4_40_MD5 0x0300002B | 182 | #define SSL3_CK_KRB5_RC4_40_MD5 0x0300002B |
| 183 | 183 | ||
| 184 | #define SSL3_TXT_RSA_NULL_MD5 "NULL-MD5" | 184 | #define SSL3_TXT_RSA_NULL_MD5 "NULL-MD5" |
| 185 | #define SSL3_TXT_RSA_NULL_SHA "NULL-SHA" | 185 | #define SSL3_TXT_RSA_NULL_SHA "NULL-SHA" |
| 186 | #define SSL3_TXT_RSA_RC4_40_MD5 "EXP-RC4-MD5" | 186 | #define SSL3_TXT_RSA_RC4_40_MD5 "EXP-RC4-MD5" |
| 187 | #define SSL3_TXT_RSA_RC4_128_MD5 "RC4-MD5" | 187 | #define SSL3_TXT_RSA_RC4_128_MD5 "RC4-MD5" |
| 188 | #define SSL3_TXT_RSA_RC4_128_SHA "RC4-SHA" | 188 | #define SSL3_TXT_RSA_RC4_128_SHA "RC4-SHA" |
| 189 | #define SSL3_TXT_RSA_RC2_40_MD5 "EXP-RC2-CBC-MD5" | 189 | #define SSL3_TXT_RSA_RC2_40_MD5 "EXP-RC2-CBC-MD5" |
| @@ -194,10 +194,10 @@ extern "C" { | |||
| 194 | 194 | ||
| 195 | #define SSL3_TXT_DH_DSS_DES_40_CBC_SHA "EXP-DH-DSS-DES-CBC-SHA" | 195 | #define SSL3_TXT_DH_DSS_DES_40_CBC_SHA "EXP-DH-DSS-DES-CBC-SHA" |
| 196 | #define SSL3_TXT_DH_DSS_DES_64_CBC_SHA "DH-DSS-DES-CBC-SHA" | 196 | #define SSL3_TXT_DH_DSS_DES_64_CBC_SHA "DH-DSS-DES-CBC-SHA" |
| 197 | #define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA "DH-DSS-DES-CBC3-SHA" | 197 | #define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA "DH-DSS-DES-CBC3-SHA" |
| 198 | #define SSL3_TXT_DH_RSA_DES_40_CBC_SHA "EXP-DH-RSA-DES-CBC-SHA" | 198 | #define SSL3_TXT_DH_RSA_DES_40_CBC_SHA "EXP-DH-RSA-DES-CBC-SHA" |
| 199 | #define SSL3_TXT_DH_RSA_DES_64_CBC_SHA "DH-RSA-DES-CBC-SHA" | 199 | #define SSL3_TXT_DH_RSA_DES_64_CBC_SHA "DH-RSA-DES-CBC-SHA" |
| 200 | #define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA "DH-RSA-DES-CBC3-SHA" | 200 | #define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA "DH-RSA-DES-CBC3-SHA" |
| 201 | 201 | ||
| 202 | #define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA "EXP-EDH-DSS-DES-CBC-SHA" | 202 | #define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA "EXP-EDH-DSS-DES-CBC-SHA" |
| 203 | #define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA "EDH-DSS-DES-CBC-SHA" | 203 | #define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA "EDH-DSS-DES-CBC-SHA" |
| @@ -215,18 +215,18 @@ extern "C" { | |||
| 215 | #define SSL3_TXT_KRB5_DES_64_CBC_SHA "KRB5-DES-CBC-SHA" | 215 | #define SSL3_TXT_KRB5_DES_64_CBC_SHA "KRB5-DES-CBC-SHA" |
| 216 | #define SSL3_TXT_KRB5_DES_192_CBC3_SHA "KRB5-DES-CBC3-SHA" | 216 | #define SSL3_TXT_KRB5_DES_192_CBC3_SHA "KRB5-DES-CBC3-SHA" |
| 217 | #define SSL3_TXT_KRB5_RC4_128_SHA "KRB5-RC4-SHA" | 217 | #define SSL3_TXT_KRB5_RC4_128_SHA "KRB5-RC4-SHA" |
| 218 | #define SSL3_TXT_KRB5_IDEA_128_CBC_SHA "KRB5-IDEA-CBC-SHA" | 218 | #define SSL3_TXT_KRB5_IDEA_128_CBC_SHA "KRB5-IDEA-CBC-SHA" |
| 219 | #define SSL3_TXT_KRB5_DES_64_CBC_MD5 "KRB5-DES-CBC-MD5" | 219 | #define SSL3_TXT_KRB5_DES_64_CBC_MD5 "KRB5-DES-CBC-MD5" |
| 220 | #define SSL3_TXT_KRB5_DES_192_CBC3_MD5 "KRB5-DES-CBC3-MD5" | 220 | #define SSL3_TXT_KRB5_DES_192_CBC3_MD5 "KRB5-DES-CBC3-MD5" |
| 221 | #define SSL3_TXT_KRB5_RC4_128_MD5 "KRB5-RC4-MD5" | 221 | #define SSL3_TXT_KRB5_RC4_128_MD5 "KRB5-RC4-MD5" |
| 222 | #define SSL3_TXT_KRB5_IDEA_128_CBC_MD5 "KRB5-IDEA-CBC-MD5" | 222 | #define SSL3_TXT_KRB5_IDEA_128_CBC_MD5 "KRB5-IDEA-CBC-MD5" |
| 223 | 223 | ||
| 224 | #define SSL3_TXT_KRB5_DES_40_CBC_SHA "EXP-KRB5-DES-CBC-SHA" | 224 | #define SSL3_TXT_KRB5_DES_40_CBC_SHA "EXP-KRB5-DES-CBC-SHA" |
| 225 | #define SSL3_TXT_KRB5_RC2_40_CBC_SHA "EXP-KRB5-RC2-CBC-SHA" | 225 | #define SSL3_TXT_KRB5_RC2_40_CBC_SHA "EXP-KRB5-RC2-CBC-SHA" |
| 226 | #define SSL3_TXT_KRB5_RC4_40_SHA "EXP-KRB5-RC4-SHA" | 226 | #define SSL3_TXT_KRB5_RC4_40_SHA "EXP-KRB5-RC4-SHA" |
| 227 | #define SSL3_TXT_KRB5_DES_40_CBC_MD5 "EXP-KRB5-DES-CBC-MD5" | 227 | #define SSL3_TXT_KRB5_DES_40_CBC_MD5 "EXP-KRB5-DES-CBC-MD5" |
| 228 | #define SSL3_TXT_KRB5_RC2_40_CBC_MD5 "EXP-KRB5-RC2-CBC-MD5" | 228 | #define SSL3_TXT_KRB5_RC2_40_CBC_MD5 "EXP-KRB5-RC2-CBC-MD5" |
| 229 | #define SSL3_TXT_KRB5_RC4_40_MD5 "EXP-KRB5-RC4-MD5" | 229 | #define SSL3_TXT_KRB5_RC4_40_MD5 "EXP-KRB5-RC4-MD5" |
| 230 | 230 | ||
| 231 | #define SSL3_SSL_SESSION_ID_LENGTH 32 | 231 | #define SSL3_SSL_SESSION_ID_LENGTH 32 |
| 232 | #define SSL3_MAX_SSL_SESSION_ID_LENGTH 32 | 232 | #define SSL3_MAX_SSL_SESSION_ID_LENGTH 32 |
diff --git a/src/lib/libssl/ssl_clnt.c b/src/lib/libssl/ssl_clnt.c index 0d3dcf78af..22469ce346 100644 --- a/src/lib/libssl/ssl_clnt.c +++ b/src/lib/libssl/ssl_clnt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_clnt.c,v 1.169 2025/03/09 15:53:36 tb Exp $ */ | 1 | /* $OpenBSD: ssl_clnt.c,v 1.170 2025/12/04 21:03:42 beck Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -1195,7 +1195,7 @@ ssl3_get_server_kex_dhe(SSL *s, CBS *cbs) | |||
| 1195 | } | 1195 | } |
| 1196 | goto err; | 1196 | goto err; |
| 1197 | } | 1197 | } |
| 1198 | if (!tls_key_share_peer_public(s->s3->hs.key_share, cbs, | 1198 | if (!tls_key_share_client_peer_public(s->s3->hs.key_share, cbs, |
| 1199 | &decode_error, &invalid_key)) { | 1199 | &decode_error, &invalid_key)) { |
| 1200 | if (decode_error) { | 1200 | if (decode_error) { |
| 1201 | SSLerror(s, SSL_R_BAD_PACKET_LENGTH); | 1201 | SSLerror(s, SSL_R_BAD_PACKET_LENGTH); |
| @@ -1264,7 +1264,7 @@ ssl3_get_server_kex_ecdhe(SSL *s, CBS *cbs) | |||
| 1264 | if ((s->s3->hs.key_share = tls_key_share_new(group_id)) == NULL) | 1264 | if ((s->s3->hs.key_share = tls_key_share_new(group_id)) == NULL) |
| 1265 | goto err; | 1265 | goto err; |
| 1266 | 1266 | ||
| 1267 | if (!tls_key_share_peer_public(s->s3->hs.key_share, &public, | 1267 | if (!tls_key_share_client_peer_public(s->s3->hs.key_share, &public, |
| 1268 | &decode_error, NULL)) { | 1268 | &decode_error, NULL)) { |
| 1269 | if (decode_error) | 1269 | if (decode_error) |
| 1270 | goto decode_err; | 1270 | goto decode_err; |
| @@ -1859,7 +1859,7 @@ ssl3_send_client_kex_dhe(SSL *s, CBB *cbb) | |||
| 1859 | goto err; | 1859 | goto err; |
| 1860 | } | 1860 | } |
| 1861 | 1861 | ||
| 1862 | if (!tls_key_share_generate(s->s3->hs.key_share)) | 1862 | if (!tls_key_share_client_generate(s->s3->hs.key_share)) |
| 1863 | goto err; | 1863 | goto err; |
| 1864 | if (!tls_key_share_public(s->s3->hs.key_share, cbb)) | 1864 | if (!tls_key_share_public(s->s3->hs.key_share, cbb)) |
| 1865 | goto err; | 1865 | goto err; |
| @@ -1898,7 +1898,7 @@ ssl3_send_client_kex_ecdhe(SSL *s, CBB *cbb) | |||
| 1898 | goto err; | 1898 | goto err; |
| 1899 | } | 1899 | } |
| 1900 | 1900 | ||
| 1901 | if (!tls_key_share_generate(s->s3->hs.key_share)) | 1901 | if (!tls_key_share_client_generate(s->s3->hs.key_share)) |
| 1902 | goto err; | 1902 | goto err; |
| 1903 | 1903 | ||
| 1904 | if (!CBB_add_u8_length_prefixed(cbb, &public)) | 1904 | if (!CBB_add_u8_length_prefixed(cbb, &public)) |
diff --git a/src/lib/libssl/ssl_err.c b/src/lib/libssl/ssl_err.c index eac2d9e61f..90822490e2 100644 --- a/src/lib/libssl/ssl_err.c +++ b/src/lib/libssl/ssl_err.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_err.c,v 1.53 2024/10/09 08:00:29 tb Exp $ */ | 1 | /* $OpenBSD: ssl_err.c,v 1.55 2025/05/10 05:49:21 tb Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -669,8 +669,7 @@ SSL_state_func_code(int state) { | |||
| 669 | } | 669 | } |
| 670 | 670 | ||
| 671 | void | 671 | void |
| 672 | SSL_error_internal(const SSL *s, int r, char *f, int l) | 672 | SSL_error_internal(const SSL *s, int r, const char *f, int l) |
| 673 | { | 673 | { |
| 674 | ERR_PUT_error(ERR_LIB_SSL, | 674 | ERR_PUT_error(ERR_LIB_SSL, SSL_state_func_code(s->s3->hs.state), r, f, l); |
| 675 | (SSL_state_func_code(s->s3->hs.state)), r, f, l); | ||
| 676 | } | 675 | } |
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c index ce68981493..630724e670 100644 --- a/src/lib/libssl/ssl_lib.c +++ b/src/lib/libssl/ssl_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_lib.c,v 1.331 2025/03/12 14:03:55 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_lib.c,v 1.333 2025/06/09 10:14:38 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -1298,7 +1298,7 @@ SSL_shutdown(SSL *s) | |||
| 1298 | return (-1); | 1298 | return (-1); |
| 1299 | } | 1299 | } |
| 1300 | 1300 | ||
| 1301 | if (s != NULL && !SSL_in_init(s)) | 1301 | if (!SSL_in_init(s)) |
| 1302 | return (s->method->ssl_shutdown(s)); | 1302 | return (s->method->ssl_shutdown(s)); |
| 1303 | 1303 | ||
| 1304 | return (1); | 1304 | return (1); |
| @@ -3008,8 +3008,9 @@ SSL_dup(SSL *s) | |||
| 3008 | 3008 | ||
| 3009 | /* Dup the client_CA list */ | 3009 | /* Dup the client_CA list */ |
| 3010 | if (s->client_CA != NULL) { | 3010 | if (s->client_CA != NULL) { |
| 3011 | if ((sk = sk_X509_NAME_dup(s->client_CA)) == NULL) goto err; | 3011 | if ((sk = sk_X509_NAME_dup(s->client_CA)) == NULL) |
| 3012 | ret->client_CA = sk; | 3012 | goto err; |
| 3013 | ret->client_CA = sk; | ||
| 3013 | for (i = 0; i < sk_X509_NAME_num(sk); i++) { | 3014 | for (i = 0; i < sk_X509_NAME_num(sk); i++) { |
| 3014 | xn = sk_X509_NAME_value(sk, i); | 3015 | xn = sk_X509_NAME_value(sk, i); |
| 3015 | if (sk_X509_NAME_set(sk, i, | 3016 | if (sk_X509_NAME_set(sk, i, |
diff --git a/src/lib/libssl/ssl_local.h b/src/lib/libssl/ssl_local.h index 6095940388..7942c36dbd 100644 --- a/src/lib/libssl/ssl_local.h +++ b/src/lib/libssl/ssl_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_local.h,v 1.27 2025/03/09 15:12:18 tb Exp $ */ | 1 | /* $OpenBSD: ssl_local.h,v 1.35 2025/12/04 21:16:17 beck Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -203,7 +203,7 @@ __BEGIN_HIDDEN_DECLS | |||
| 203 | /* Bits for algorithm_auth (server authentication) */ | 203 | /* Bits for algorithm_auth (server authentication) */ |
| 204 | #define SSL_aRSA 0x00000001L /* RSA auth */ | 204 | #define SSL_aRSA 0x00000001L /* RSA auth */ |
| 205 | #define SSL_aNULL 0x00000004L /* no auth (i.e. use ADH or AECDH) */ | 205 | #define SSL_aNULL 0x00000004L /* no auth (i.e. use ADH or AECDH) */ |
| 206 | #define SSL_aECDSA 0x00000040L /* ECDSA auth*/ | 206 | #define SSL_aECDSA 0x00000040L /* ECDSA auth*/ |
| 207 | #define SSL_aTLS1_3 0x00000400L /* TLSv1.3 authentication */ | 207 | #define SSL_aTLS1_3 0x00000400L /* TLSv1.3 authentication */ |
| 208 | 208 | ||
| 209 | /* Bits for algorithm_enc (symmetric encryption) */ | 209 | /* Bits for algorithm_enc (symmetric encryption) */ |
| @@ -289,12 +289,8 @@ __BEGIN_HIDDEN_DECLS | |||
| 289 | * SSL_aDSS <- DSA_SIGN | 289 | * SSL_aDSS <- DSA_SIGN |
| 290 | */ | 290 | */ |
| 291 | 291 | ||
| 292 | /* From ECC-TLS draft, used in encoding the curve type in | 292 | /* From RFC 4492, section 5.4. Only named curves are supported. */ |
| 293 | * ECParameters | 293 | #define NAMED_CURVE_TYPE 3 |
| 294 | */ | ||
| 295 | #define EXPLICIT_PRIME_CURVE_TYPE 1 | ||
| 296 | #define EXPLICIT_CHAR2_CURVE_TYPE 2 | ||
| 297 | #define NAMED_CURVE_TYPE 3 | ||
| 298 | 294 | ||
| 299 | typedef struct ssl_cert_pkey_st { | 295 | typedef struct ssl_cert_pkey_st { |
| 300 | X509 *x509; | 296 | X509 *x509; |
| @@ -396,7 +392,7 @@ struct ssl_method_st { | |||
| 396 | * PSK_identity_hint [ 7 ] EXPLICIT OCTET STRING, -- optional PSK identity hint | 392 | * PSK_identity_hint [ 7 ] EXPLICIT OCTET STRING, -- optional PSK identity hint |
| 397 | * PSK_identity [ 8 ] EXPLICIT OCTET STRING, -- optional PSK identity | 393 | * PSK_identity [ 8 ] EXPLICIT OCTET STRING, -- optional PSK identity |
| 398 | * Ticket_lifetime_hint [9] EXPLICIT INTEGER, -- server's lifetime hint for session ticket | 394 | * Ticket_lifetime_hint [9] EXPLICIT INTEGER, -- server's lifetime hint for session ticket |
| 399 | * Ticket [10] EXPLICIT OCTET STRING, -- session ticket (clients only) | 395 | * Ticket [10] EXPLICIT OCTET STRING, -- session ticket (clients only) |
| 400 | * Compression_meth [11] EXPLICIT OCTET STRING, -- optional compression method | 396 | * Compression_meth [11] EXPLICIT OCTET STRING, -- optional compression method |
| 401 | * SRP_username [ 12 ] EXPLICIT OCTET STRING -- optional SRP username | 397 | * SRP_username [ 12 ] EXPLICIT OCTET STRING -- optional SRP username |
| 402 | * } | 398 | * } |
| @@ -494,6 +490,9 @@ typedef struct ssl_handshake_tls13_st { | |||
| 494 | /* Certificate selected for use (static pointer). */ | 490 | /* Certificate selected for use (static pointer). */ |
| 495 | const SSL_CERT_PKEY *cpk; | 491 | const SSL_CERT_PKEY *cpk; |
| 496 | 492 | ||
| 493 | /* Client's extra predicted key share */ | ||
| 494 | struct tls_key_share *key_share; | ||
| 495 | |||
| 497 | /* Version proposed by peer server. */ | 496 | /* Version proposed by peer server. */ |
| 498 | uint16_t server_version; | 497 | uint16_t server_version; |
| 499 | 498 | ||
| @@ -1054,7 +1053,7 @@ struct ssl_st { | |||
| 1054 | 1053 | ||
| 1055 | int renegotiate;/* 1 if we are renegotiating. | 1054 | int renegotiate;/* 1 if we are renegotiating. |
| 1056 | * 2 if we are a server and are inside a handshake | 1055 | * 2 if we are a server and are inside a handshake |
| 1057 | * (i.e. not just sending a HelloRequest) */ | 1056 | * (i.e. not just sending a HelloRequest) */ |
| 1058 | 1057 | ||
| 1059 | int rstate; /* where we are when reading */ | 1058 | int rstate; /* where we are when reading */ |
| 1060 | 1059 | ||
| @@ -1078,7 +1077,7 @@ typedef struct ssl3_record_internal_st { | |||
| 1078 | 1077 | ||
| 1079 | typedef struct ssl3_buffer_internal_st { | 1078 | typedef struct ssl3_buffer_internal_st { |
| 1080 | unsigned char *buf; /* at least SSL3_RT_MAX_PACKET_SIZE bytes, | 1079 | unsigned char *buf; /* at least SSL3_RT_MAX_PACKET_SIZE bytes, |
| 1081 | * see ssl3_setup_buffers() */ | 1080 | * see ssl3_setup_buffers() */ |
| 1082 | size_t len; /* buffer size */ | 1081 | size_t len; /* buffer size */ |
| 1083 | int offset; /* where to 'copy from' */ | 1082 | int offset; /* where to 'copy from' */ |
| 1084 | int left; /* how many bytes left */ | 1083 | int left; /* how many bytes left */ |
| @@ -1244,7 +1243,7 @@ int ssl_security_cert_chain(const SSL *ssl, STACK_OF(X509) *sk, | |||
| 1244 | int ssl_security_shared_group(const SSL *ssl, uint16_t group_id); | 1243 | int ssl_security_shared_group(const SSL *ssl, uint16_t group_id); |
| 1245 | int ssl_security_supported_group(const SSL *ssl, uint16_t group_id); | 1244 | int ssl_security_supported_group(const SSL *ssl, uint16_t group_id); |
| 1246 | 1245 | ||
| 1247 | SSL_SESSION *ssl_session_dup(SSL_SESSION *src, int include_ticket); | 1246 | SSL_SESSION *ssl_session_dup(const SSL_SESSION *src, int include_ticket); |
| 1248 | int ssl_get_new_session(SSL *s, int session); | 1247 | int ssl_get_new_session(SSL *s, int session); |
| 1249 | int ssl_get_prev_session(SSL *s, CBS *session_id, CBS *ext_block, | 1248 | int ssl_get_prev_session(SSL *s, CBS *session_id, CBS *ext_block, |
| 1250 | int *alert); | 1249 | int *alert); |
| @@ -1443,9 +1442,10 @@ int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx, unsigned char *md_out, | |||
| 1443 | unsigned int mac_secret_length); | 1442 | unsigned int mac_secret_length); |
| 1444 | int SSL_state_func_code(int _state); | 1443 | int SSL_state_func_code(int _state); |
| 1445 | 1444 | ||
| 1446 | #define SSLerror(s, r) SSL_error_internal(s, r, OPENSSL_FILE, OPENSSL_LINE) | 1445 | void SSL_error_internal(const SSL *s, int r, const char *f, int l); |
| 1447 | #define SSLerrorx(r) ERR_PUT_error(ERR_LIB_SSL,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | 1446 | #define SSLerror(s, r) SSL_error_internal(s, r, OPENSSL_FILE, OPENSSL_LINE) |
| 1448 | void SSL_error_internal(const SSL *s, int r, char *f, int l); | 1447 | #define SSLerrorx(r) ERR_PUT_error(ERR_LIB_SSL,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) |
| 1448 | #define SYSerror(r) ERR_PUT_error(ERR_LIB_SYS,(0xfff),(r),OPENSSL_FILE,OPENSSL_LINE) | ||
| 1449 | 1449 | ||
| 1450 | #ifndef OPENSSL_NO_SRTP | 1450 | #ifndef OPENSSL_NO_SRTP |
| 1451 | 1451 | ||
diff --git a/src/lib/libssl/ssl_rsa.c b/src/lib/libssl/ssl_rsa.c index 6c8a2be3d3..1490e10ba4 100644 --- a/src/lib/libssl/ssl_rsa.c +++ b/src/lib/libssl/ssl_rsa.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_rsa.c,v 1.51 2023/12/30 06:25:56 tb Exp $ */ | 1 | /* $OpenBSD: ssl_rsa.c,v 1.53 2025/08/14 15:55:54 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
diff --git a/src/lib/libssl/ssl_sess.c b/src/lib/libssl/ssl_sess.c index a5cfc33c04..7f16061b48 100644 --- a/src/lib/libssl/ssl_sess.c +++ b/src/lib/libssl/ssl_sess.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_sess.c,v 1.129 2025/03/09 15:53:36 tb Exp $ */ | 1 | /* $OpenBSD: ssl_sess.c,v 1.131 2025/10/24 11:36:08 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -247,7 +247,7 @@ SSL_SESSION_new(void) | |||
| 247 | LSSL_ALIAS(SSL_SESSION_new); | 247 | LSSL_ALIAS(SSL_SESSION_new); |
| 248 | 248 | ||
| 249 | SSL_SESSION * | 249 | SSL_SESSION * |
| 250 | ssl_session_dup(SSL_SESSION *sess, int include_ticket) | 250 | ssl_session_dup(const SSL_SESSION *sess, int include_ticket) |
| 251 | { | 251 | { |
| 252 | SSL_SESSION *copy; | 252 | SSL_SESSION *copy; |
| 253 | CBS cbs; | 253 | CBS cbs; |
| @@ -313,7 +313,7 @@ ssl_session_dup(SSL_SESSION *sess, int include_ticket) | |||
| 313 | goto err; | 313 | goto err; |
| 314 | 314 | ||
| 315 | if (!CRYPTO_dup_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, ©->ex_data, | 315 | if (!CRYPTO_dup_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, ©->ex_data, |
| 316 | &sess->ex_data)) | 316 | (CRYPTO_EX_DATA *)&sess->ex_data)) |
| 317 | goto err; | 317 | goto err; |
| 318 | 318 | ||
| 319 | /* Omit prev/next: the new session gets its own slot in the cache. */ | 319 | /* Omit prev/next: the new session gets its own slot in the cache. */ |
| @@ -345,6 +345,13 @@ ssl_session_dup(SSL_SESSION *sess, int include_ticket) | |||
| 345 | return NULL; | 345 | return NULL; |
| 346 | } | 346 | } |
| 347 | 347 | ||
| 348 | SSL_SESSION * | ||
| 349 | SSL_SESSION_dup(const SSL_SESSION *src) | ||
| 350 | { | ||
| 351 | return ssl_session_dup(src, 1); | ||
| 352 | } | ||
| 353 | LSSL_ALIAS(SSL_SESSION_dup); | ||
| 354 | |||
| 348 | const unsigned char * | 355 | const unsigned char * |
| 349 | SSL_SESSION_get_id(const SSL_SESSION *ss, unsigned int *len) | 356 | SSL_SESSION_get_id(const SSL_SESSION *ss, unsigned int *len) |
| 350 | { | 357 | { |
diff --git a/src/lib/libssl/ssl_srvr.c b/src/lib/libssl/ssl_srvr.c index db4ba38b51..ef93e283de 100644 --- a/src/lib/libssl/ssl_srvr.c +++ b/src/lib/libssl/ssl_srvr.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_srvr.c,v 1.166 2025/03/09 15:53:36 tb Exp $ */ | 1 | /* $OpenBSD: ssl_srvr.c,v 1.167 2025/12/04 21:03:42 beck Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -1357,7 +1357,7 @@ ssl3_send_server_kex_dhe(SSL *s, CBB *cbb) | |||
| 1357 | goto err; | 1357 | goto err; |
| 1358 | } | 1358 | } |
| 1359 | 1359 | ||
| 1360 | if (!tls_key_share_generate(s->s3->hs.key_share)) | 1360 | if (!tls_key_share_server_generate(s->s3->hs.key_share)) |
| 1361 | goto err; | 1361 | goto err; |
| 1362 | 1362 | ||
| 1363 | if (!tls_key_share_params(s->s3->hs.key_share, cbb)) | 1363 | if (!tls_key_share_params(s->s3->hs.key_share, cbb)) |
| @@ -1393,7 +1393,7 @@ ssl3_send_server_kex_ecdhe(SSL *s, CBB *cbb) | |||
| 1393 | if ((s->s3->hs.key_share = tls_key_share_new_nid(nid)) == NULL) | 1393 | if ((s->s3->hs.key_share = tls_key_share_new_nid(nid)) == NULL) |
| 1394 | goto err; | 1394 | goto err; |
| 1395 | 1395 | ||
| 1396 | if (!tls_key_share_generate(s->s3->hs.key_share)) | 1396 | if (!tls_key_share_server_generate(s->s3->hs.key_share)) |
| 1397 | goto err; | 1397 | goto err; |
| 1398 | 1398 | ||
| 1399 | /* | 1399 | /* |
| @@ -1744,7 +1744,7 @@ ssl3_get_client_kex_dhe(SSL *s, CBS *cbs) | |||
| 1744 | goto err; | 1744 | goto err; |
| 1745 | } | 1745 | } |
| 1746 | 1746 | ||
| 1747 | if (!tls_key_share_peer_public(s->s3->hs.key_share, cbs, | 1747 | if (!tls_key_share_server_peer_public(s->s3->hs.key_share, cbs, |
| 1748 | &decode_error, &invalid_key)) { | 1748 | &decode_error, &invalid_key)) { |
| 1749 | if (decode_error) { | 1749 | if (decode_error) { |
| 1750 | SSLerror(s, SSL_R_BAD_PACKET_LENGTH); | 1750 | SSLerror(s, SSL_R_BAD_PACKET_LENGTH); |
| @@ -1792,7 +1792,7 @@ ssl3_get_client_kex_ecdhe(SSL *s, CBS *cbs) | |||
| 1792 | ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR); | 1792 | ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR); |
| 1793 | goto err; | 1793 | goto err; |
| 1794 | } | 1794 | } |
| 1795 | if (!tls_key_share_peer_public(s->s3->hs.key_share, &public, | 1795 | if (!tls_key_share_server_peer_public(s->s3->hs.key_share, &public, |
| 1796 | &decode_error, NULL)) { | 1796 | &decode_error, NULL)) { |
| 1797 | if (decode_error) { | 1797 | if (decode_error) { |
| 1798 | SSLerror(s, SSL_R_BAD_PACKET_LENGTH); | 1798 | SSLerror(s, SSL_R_BAD_PACKET_LENGTH); |
diff --git a/src/lib/libssl/ssl_stat.c b/src/lib/libssl/ssl_stat.c index b19944ca83..9966217ca3 100644 --- a/src/lib/libssl/ssl_stat.c +++ b/src/lib/libssl/ssl_stat.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_stat.c,v 1.23 2024/10/12 03:54:18 tb Exp $ */ | 1 | /* $OpenBSD: ssl_stat.c,v 1.24 2025/05/22 08:25:26 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -438,72 +438,7 @@ LSSL_ALIAS(SSL_alert_type_string); | |||
| 438 | const char * | 438 | const char * |
| 439 | SSL_alert_desc_string(int value) | 439 | SSL_alert_desc_string(int value) |
| 440 | { | 440 | { |
| 441 | switch (value & 0xff) { | 441 | return "!!"; |
| 442 | case SSL_AD_CLOSE_NOTIFY: | ||
| 443 | return "CN"; | ||
| 444 | case SSL_AD_UNEXPECTED_MESSAGE: | ||
| 445 | return "UM"; | ||
| 446 | case SSL_AD_BAD_RECORD_MAC: | ||
| 447 | return "BM"; | ||
| 448 | case SSL_AD_RECORD_OVERFLOW: | ||
| 449 | return "RO"; | ||
| 450 | case SSL_AD_DECOMPRESSION_FAILURE: | ||
| 451 | return "DF"; | ||
| 452 | case SSL_AD_HANDSHAKE_FAILURE: | ||
| 453 | return "HF"; | ||
| 454 | case SSL_AD_BAD_CERTIFICATE: | ||
| 455 | return "BC"; | ||
| 456 | case SSL_AD_UNSUPPORTED_CERTIFICATE: | ||
| 457 | return "UC"; | ||
| 458 | case SSL_AD_CERTIFICATE_REVOKED: | ||
| 459 | return "CR"; | ||
| 460 | case SSL_AD_CERTIFICATE_EXPIRED: | ||
| 461 | return "CE"; | ||
| 462 | case SSL_AD_CERTIFICATE_UNKNOWN: | ||
| 463 | return "CU"; | ||
| 464 | case SSL_AD_ILLEGAL_PARAMETER: | ||
| 465 | return "IP"; | ||
| 466 | case SSL_AD_UNKNOWN_CA: | ||
| 467 | return "CA"; | ||
| 468 | case SSL_AD_ACCESS_DENIED: | ||
| 469 | return "AD"; | ||
| 470 | case SSL_AD_DECODE_ERROR: | ||
| 471 | return "DE"; | ||
| 472 | case SSL_AD_DECRYPT_ERROR: | ||
| 473 | return "CY"; | ||
| 474 | case SSL_AD_PROTOCOL_VERSION: | ||
| 475 | return "PV"; | ||
| 476 | case SSL_AD_INSUFFICIENT_SECURITY: | ||
| 477 | return "IS"; | ||
| 478 | case SSL_AD_INTERNAL_ERROR: | ||
| 479 | return "IE"; | ||
| 480 | case SSL_AD_INAPPROPRIATE_FALLBACK: | ||
| 481 | return "IF"; | ||
| 482 | case SSL_AD_USER_CANCELLED: | ||
| 483 | return "US"; | ||
| 484 | case SSL_AD_NO_RENEGOTIATION: | ||
| 485 | return "NR"; | ||
| 486 | case SSL_AD_MISSING_EXTENSION: | ||
| 487 | return "ME"; | ||
| 488 | case SSL_AD_UNSUPPORTED_EXTENSION: | ||
| 489 | return "UE"; | ||
| 490 | case SSL_AD_CERTIFICATE_UNOBTAINABLE: | ||
| 491 | return "CO"; | ||
| 492 | case SSL_AD_UNRECOGNIZED_NAME: | ||
| 493 | return "UN"; | ||
| 494 | case SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE: | ||
| 495 | return "BR"; | ||
| 496 | case SSL_AD_BAD_CERTIFICATE_HASH_VALUE: | ||
| 497 | return "BH"; | ||
| 498 | case SSL_AD_UNKNOWN_PSK_IDENTITY: | ||
| 499 | return "UP"; | ||
| 500 | case SSL_AD_CERTIFICATE_REQUIRED: | ||
| 501 | return "CQ"; /* XXX */ | ||
| 502 | case SSL_AD_NO_APPLICATION_PROTOCOL: | ||
| 503 | return "AP"; | ||
| 504 | default: | ||
| 505 | return "UK"; | ||
| 506 | } | ||
| 507 | } | 442 | } |
| 508 | LSSL_ALIAS(SSL_alert_desc_string); | 443 | LSSL_ALIAS(SSL_alert_desc_string); |
| 509 | 444 | ||
diff --git a/src/lib/libssl/ssl_tlsext.c b/src/lib/libssl/ssl_tlsext.c index 08bf5593ec..d879b3304e 100644 --- a/src/lib/libssl/ssl_tlsext.c +++ b/src/lib/libssl/ssl_tlsext.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_tlsext.c,v 1.154 2024/07/09 12:27:27 beck Exp $ */ | 1 | /* $OpenBSD: ssl_tlsext.c,v 1.159 2025/12/04 21:16:17 beck Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org> |
| 4 | * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> | 4 | * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> |
| @@ -1445,7 +1445,7 @@ tlsext_keyshare_client_needs(SSL *s, uint16_t msg_type) | |||
| 1445 | static int | 1445 | static int |
| 1446 | tlsext_keyshare_client_build(SSL *s, uint16_t msg_type, CBB *cbb) | 1446 | tlsext_keyshare_client_build(SSL *s, uint16_t msg_type, CBB *cbb) |
| 1447 | { | 1447 | { |
| 1448 | CBB client_shares, key_exchange; | 1448 | CBB client_shares, key_exchange, key_exchange2; |
| 1449 | 1449 | ||
| 1450 | if (!CBB_add_u16_length_prefixed(cbb, &client_shares)) | 1450 | if (!CBB_add_u16_length_prefixed(cbb, &client_shares)) |
| 1451 | return 0; | 1451 | return 0; |
| @@ -1458,6 +1458,31 @@ tlsext_keyshare_client_build(SSL *s, uint16_t msg_type, CBB *cbb) | |||
| 1458 | if (!tls_key_share_public(s->s3->hs.key_share, &key_exchange)) | 1458 | if (!tls_key_share_public(s->s3->hs.key_share, &key_exchange)) |
| 1459 | return 0; | 1459 | return 0; |
| 1460 | 1460 | ||
| 1461 | /* | ||
| 1462 | * We wish to include a second key share prediction in a TLS 1.3 client | ||
| 1463 | * hello if we have more than one preferred group. We never wish to do | ||
| 1464 | * this in response to a server selected group (Either from a TLS 1.2 | ||
| 1465 | * server, or from a hello retry request after having negotiated TLS | ||
| 1466 | * 1.3). | ||
| 1467 | * | ||
| 1468 | * Therefore we only do this if we have not yet negotiated | ||
| 1469 | * a version, and our max version could negotiate TLS 1.3. | ||
| 1470 | */ | ||
| 1471 | if (s->s3->hs.negotiated_tls_version == 0 && | ||
| 1472 | s->s3->hs.our_max_tls_version >= TLS1_3_VERSION) { | ||
| 1473 | if (s->s3->hs.tls13.key_share != NULL) { | ||
| 1474 | if (!CBB_add_u16(&client_shares, | ||
| 1475 | tls_key_share_group(s->s3->hs.tls13.key_share))) | ||
| 1476 | return 0; | ||
| 1477 | if (!CBB_add_u16_length_prefixed(&client_shares, | ||
| 1478 | &key_exchange2)) | ||
| 1479 | return 0; | ||
| 1480 | if (!tls_key_share_public(s->s3->hs.tls13.key_share, | ||
| 1481 | &key_exchange2)) | ||
| 1482 | return 0; | ||
| 1483 | } | ||
| 1484 | } | ||
| 1485 | |||
| 1461 | if (!CBB_flush(cbb)) | 1486 | if (!CBB_flush(cbb)) |
| 1462 | return 0; | 1487 | return 0; |
| 1463 | 1488 | ||
| @@ -1523,7 +1548,7 @@ tlsext_keyshare_server_process(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) | |||
| 1523 | *alert = SSL_AD_INTERNAL_ERROR; | 1548 | *alert = SSL_AD_INTERNAL_ERROR; |
| 1524 | return 0; | 1549 | return 0; |
| 1525 | } | 1550 | } |
| 1526 | if (!tls_key_share_peer_public(s->s3->hs.key_share, | 1551 | if (!tls_key_share_server_peer_public(s->s3->hs.key_share, |
| 1527 | &key_exchange, &decode_error, NULL)) { | 1552 | &key_exchange, &decode_error, NULL)) { |
| 1528 | if (!decode_error) | 1553 | if (!decode_error) |
| 1529 | *alert = SSL_AD_INTERNAL_ERROR; | 1554 | *alert = SSL_AD_INTERNAL_ERROR; |
| @@ -1554,6 +1579,7 @@ tlsext_keyshare_server_process(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) | |||
| 1554 | for (j = 0; j < server_groups_len; j++) { | 1579 | for (j = 0; j < server_groups_len; j++) { |
| 1555 | if (server_groups[j] == client_groups[i]) { | 1580 | if (server_groups[j] == client_groups[i]) { |
| 1556 | client_preferred_group = client_groups[i]; | 1581 | client_preferred_group = client_groups[i]; |
| 1582 | s->s3->hs.tls13.server_group = client_preferred_group; | ||
| 1557 | preferred_group_found = 1; | 1583 | preferred_group_found = 1; |
| 1558 | break; | 1584 | break; |
| 1559 | } | 1585 | } |
| @@ -1613,7 +1639,7 @@ tlsext_keyshare_server_process(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) | |||
| 1613 | *alert = SSL_AD_INTERNAL_ERROR; | 1639 | *alert = SSL_AD_INTERNAL_ERROR; |
| 1614 | return 0; | 1640 | return 0; |
| 1615 | } | 1641 | } |
| 1616 | if (!tls_key_share_peer_public(s->s3->hs.key_share, | 1642 | if (!tls_key_share_server_peer_public(s->s3->hs.key_share, |
| 1617 | &key_exchange, &decode_error, NULL)) { | 1643 | &key_exchange, &decode_error, NULL)) { |
| 1618 | if (!decode_error) | 1644 | if (!decode_error) |
| 1619 | *alert = SSL_AD_INTERNAL_ERROR; | 1645 | *alert = SSL_AD_INTERNAL_ERROR; |
| @@ -1686,11 +1712,33 @@ tlsext_keyshare_client_process(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) | |||
| 1686 | *alert = SSL_AD_INTERNAL_ERROR; | 1712 | *alert = SSL_AD_INTERNAL_ERROR; |
| 1687 | return 0; | 1713 | return 0; |
| 1688 | } | 1714 | } |
| 1715 | |||
| 1716 | if (s->s3->hs.tls13.server_version >= TLS1_3_VERSION && | ||
| 1717 | tls_key_share_group(s->s3->hs.key_share) != group && | ||
| 1718 | s->s3->hs.tls13.key_share != NULL && | ||
| 1719 | tls_key_share_group(s->s3->hs.tls13.key_share) == group) { | ||
| 1720 | /* | ||
| 1721 | * Server chose our second key share prediction, switch to it, | ||
| 1722 | * and discard the first one. | ||
| 1723 | */ | ||
| 1724 | tls_key_share_free(s->s3->hs.key_share); | ||
| 1725 | s->s3->hs.key_share = s->s3->hs.tls13.key_share; | ||
| 1726 | s->s3->hs.tls13.key_share = NULL; | ||
| 1727 | } | ||
| 1728 | |||
| 1689 | if (tls_key_share_group(s->s3->hs.key_share) != group) { | 1729 | if (tls_key_share_group(s->s3->hs.key_share) != group) { |
| 1690 | *alert = SSL_AD_INTERNAL_ERROR; | 1730 | *alert = SSL_AD_INTERNAL_ERROR; |
| 1691 | return 0; | 1731 | return 0; |
| 1692 | } | 1732 | } |
| 1693 | if (!tls_key_share_peer_public(s->s3->hs.key_share, | 1733 | |
| 1734 | /* | ||
| 1735 | * Discard our now unused second key share prediction if we had made one | ||
| 1736 | * with our initial 1.3 client hello | ||
| 1737 | */ | ||
| 1738 | tls_key_share_free(s->s3->hs.tls13.key_share); | ||
| 1739 | s->s3->hs.tls13.key_share = NULL; | ||
| 1740 | |||
| 1741 | if (!tls_key_share_client_peer_public(s->s3->hs.key_share, | ||
| 1694 | &key_exchange, &decode_error, NULL)) { | 1742 | &key_exchange, &decode_error, NULL)) { |
| 1695 | if (!decode_error) | 1743 | if (!decode_error) |
| 1696 | *alert = SSL_AD_INTERNAL_ERROR; | 1744 | *alert = SSL_AD_INTERNAL_ERROR; |
| @@ -2410,13 +2458,12 @@ tlsext_randomize_build_order(SSL *s) | |||
| 2410 | { | 2458 | { |
| 2411 | const struct tls_extension *psk_ext; | 2459 | const struct tls_extension *psk_ext; |
| 2412 | size_t idx, new_idx; | 2460 | size_t idx, new_idx; |
| 2413 | size_t alpn_idx = 0, sni_idx = 0; | ||
| 2414 | 2461 | ||
| 2415 | free(s->tlsext_build_order); | 2462 | free(s->tlsext_build_order); |
| 2416 | s->tlsext_build_order_len = 0; | 2463 | s->tlsext_build_order_len = 0; |
| 2417 | 2464 | ||
| 2418 | if ((s->tlsext_build_order = calloc(sizeof(*s->tlsext_build_order), | 2465 | if ((s->tlsext_build_order = calloc(N_TLS_EXTENSIONS, |
| 2419 | N_TLS_EXTENSIONS)) == NULL) | 2466 | sizeof(*s->tlsext_build_order))) == NULL) |
| 2420 | return 0; | 2467 | return 0; |
| 2421 | s->tlsext_build_order_len = N_TLS_EXTENSIONS; | 2468 | s->tlsext_build_order_len = N_TLS_EXTENSIONS; |
| 2422 | 2469 | ||
| @@ -2433,28 +2480,6 @@ tlsext_randomize_build_order(SSL *s) | |||
| 2433 | s->tlsext_build_order[new_idx] = &tls_extensions[idx]; | 2480 | s->tlsext_build_order[new_idx] = &tls_extensions[idx]; |
| 2434 | } | 2481 | } |
| 2435 | 2482 | ||
| 2436 | /* | ||
| 2437 | * XXX - Apache2 special until year 2025: ensure that SNI precedes ALPN | ||
| 2438 | * for clients so that virtual host setups work correctly. | ||
| 2439 | */ | ||
| 2440 | |||
| 2441 | if (s->server) | ||
| 2442 | return 1; | ||
| 2443 | |||
| 2444 | for (idx = 0; idx < N_TLS_EXTENSIONS; idx++) { | ||
| 2445 | if (s->tlsext_build_order[idx]->type == TLSEXT_TYPE_alpn) | ||
| 2446 | alpn_idx = idx; | ||
| 2447 | if (s->tlsext_build_order[idx]->type == TLSEXT_TYPE_server_name) | ||
| 2448 | sni_idx = idx; | ||
| 2449 | } | ||
| 2450 | if (alpn_idx < sni_idx) { | ||
| 2451 | const struct tls_extension *tmp; | ||
| 2452 | |||
| 2453 | tmp = s->tlsext_build_order[alpn_idx]; | ||
| 2454 | s->tlsext_build_order[alpn_idx] = s->tlsext_build_order[sni_idx]; | ||
| 2455 | s->tlsext_build_order[sni_idx] = tmp; | ||
| 2456 | } | ||
| 2457 | |||
| 2458 | return 1; | 2483 | return 1; |
| 2459 | } | 2484 | } |
| 2460 | 2485 | ||
| @@ -2466,8 +2491,8 @@ tlsext_linearize_build_order(SSL *s) | |||
| 2466 | free(s->tlsext_build_order); | 2491 | free(s->tlsext_build_order); |
| 2467 | s->tlsext_build_order_len = 0; | 2492 | s->tlsext_build_order_len = 0; |
| 2468 | 2493 | ||
| 2469 | if ((s->tlsext_build_order = calloc(sizeof(*s->tlsext_build_order), | 2494 | if ((s->tlsext_build_order = calloc(N_TLS_EXTENSIONS, |
| 2470 | N_TLS_EXTENSIONS)) == NULL) | 2495 | sizeof(*s->tlsext_build_order))) == NULL) |
| 2471 | return 0; | 2496 | return 0; |
| 2472 | s->tlsext_build_order_len = N_TLS_EXTENSIONS; | 2497 | s->tlsext_build_order_len = N_TLS_EXTENSIONS; |
| 2473 | 2498 | ||
diff --git a/src/lib/libssl/t1_lib.c b/src/lib/libssl/t1_lib.c index b200f78098..912bea592a 100644 --- a/src/lib/libssl/t1_lib.c +++ b/src/lib/libssl/t1_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t1_lib.c,v 1.204 2025/01/18 14:17:05 tb Exp $ */ | 1 | /* $OpenBSD: t1_lib.c,v 1.207 2025/12/04 21:16:17 beck Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -151,6 +151,7 @@ tls1_clear(SSL *s) | |||
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | struct supported_group { | 153 | struct supported_group { |
| 154 | uint16_t group_id; | ||
| 154 | int nid; | 155 | int nid; |
| 155 | int bits; | 156 | int bits; |
| 156 | }; | 157 | }; |
| @@ -160,122 +161,156 @@ struct supported_group { | |||
| 160 | * https://www.iana.org/assignments/tls-parameters/#tls-parameters-8 | 161 | * https://www.iana.org/assignments/tls-parameters/#tls-parameters-8 |
| 161 | */ | 162 | */ |
| 162 | static const struct supported_group nid_list[] = { | 163 | static const struct supported_group nid_list[] = { |
| 163 | [1] = { | 164 | { |
| 165 | .group_id = 1, | ||
| 164 | .nid = NID_sect163k1, | 166 | .nid = NID_sect163k1, |
| 165 | .bits = 80, | 167 | .bits = 80, |
| 166 | }, | 168 | }, |
| 167 | [2] = { | 169 | { |
| 170 | .group_id = 2, | ||
| 168 | .nid = NID_sect163r1, | 171 | .nid = NID_sect163r1, |
| 169 | .bits = 80, | 172 | .bits = 80, |
| 170 | }, | 173 | }, |
| 171 | [3] = { | 174 | { |
| 175 | .group_id = 3, | ||
| 172 | .nid = NID_sect163r2, | 176 | .nid = NID_sect163r2, |
| 173 | .bits = 80, | 177 | .bits = 80, |
| 174 | }, | 178 | }, |
| 175 | [4] = { | 179 | { |
| 180 | .group_id = 4, | ||
| 176 | .nid = NID_sect193r1, | 181 | .nid = NID_sect193r1, |
| 177 | .bits = 80, | 182 | .bits = 80, |
| 178 | }, | 183 | }, |
| 179 | [5] = { | 184 | { |
| 185 | .group_id = 5, | ||
| 180 | .nid = NID_sect193r2, | 186 | .nid = NID_sect193r2, |
| 181 | .bits = 80, | 187 | .bits = 80, |
| 182 | }, | 188 | }, |
| 183 | [6] = { | 189 | { |
| 190 | .group_id = 6, | ||
| 184 | .nid = NID_sect233k1, | 191 | .nid = NID_sect233k1, |
| 185 | .bits = 112, | 192 | .bits = 112, |
| 186 | }, | 193 | }, |
| 187 | [7] = { | 194 | { |
| 195 | .group_id = 7, | ||
| 188 | .nid = NID_sect233r1, | 196 | .nid = NID_sect233r1, |
| 189 | .bits = 112, | 197 | .bits = 112, |
| 190 | }, | 198 | }, |
| 191 | [8] = { | 199 | { |
| 200 | .group_id = 8, | ||
| 192 | .nid = NID_sect239k1, | 201 | .nid = NID_sect239k1, |
| 193 | .bits = 112, | 202 | .bits = 112, |
| 194 | }, | 203 | }, |
| 195 | [9] = { | 204 | { |
| 205 | .group_id = 9, | ||
| 196 | .nid = NID_sect283k1, | 206 | .nid = NID_sect283k1, |
| 197 | .bits = 128, | 207 | .bits = 128, |
| 198 | }, | 208 | }, |
| 199 | [10] = { | 209 | { |
| 210 | .group_id = 10, | ||
| 200 | .nid = NID_sect283r1, | 211 | .nid = NID_sect283r1, |
| 201 | .bits = 128, | 212 | .bits = 128, |
| 202 | }, | 213 | }, |
| 203 | [11] = { | 214 | { |
| 215 | .group_id = 11, | ||
| 204 | .nid = NID_sect409k1, | 216 | .nid = NID_sect409k1, |
| 205 | .bits = 192, | 217 | .bits = 192, |
| 206 | }, | 218 | }, |
| 207 | [12] = { | 219 | { |
| 220 | .group_id = 12, | ||
| 208 | .nid = NID_sect409r1, | 221 | .nid = NID_sect409r1, |
| 209 | .bits = 192, | 222 | .bits = 192, |
| 210 | }, | 223 | }, |
| 211 | [13] = { | 224 | { |
| 225 | .group_id = 13, | ||
| 212 | .nid = NID_sect571k1, | 226 | .nid = NID_sect571k1, |
| 213 | .bits = 256, | 227 | .bits = 256, |
| 214 | }, | 228 | }, |
| 215 | [14] = { | 229 | { |
| 230 | .group_id = 14, | ||
| 216 | .nid = NID_sect571r1, | 231 | .nid = NID_sect571r1, |
| 217 | .bits = 256, | 232 | .bits = 256, |
| 218 | }, | 233 | }, |
| 219 | [15] = { | 234 | { |
| 235 | .group_id = 15, | ||
| 220 | .nid = NID_secp160k1, | 236 | .nid = NID_secp160k1, |
| 221 | .bits = 80, | 237 | .bits = 80, |
| 222 | }, | 238 | }, |
| 223 | [16] = { | 239 | { |
| 240 | .group_id = 16, | ||
| 224 | .nid = NID_secp160r1, | 241 | .nid = NID_secp160r1, |
| 225 | .bits = 80, | 242 | .bits = 80, |
| 226 | }, | 243 | }, |
| 227 | [17] = { | 244 | { |
| 245 | .group_id = 17, | ||
| 228 | .nid = NID_secp160r2, | 246 | .nid = NID_secp160r2, |
| 229 | .bits = 80, | 247 | .bits = 80, |
| 230 | }, | 248 | }, |
| 231 | [18] = { | 249 | { |
| 250 | .group_id = 18, | ||
| 232 | .nid = NID_secp192k1, | 251 | .nid = NID_secp192k1, |
| 233 | .bits = 80, | 252 | .bits = 80, |
| 234 | }, | 253 | }, |
| 235 | [19] = { | 254 | { |
| 255 | .group_id = 19, | ||
| 236 | .nid = NID_X9_62_prime192v1, /* aka secp192r1 */ | 256 | .nid = NID_X9_62_prime192v1, /* aka secp192r1 */ |
| 237 | .bits = 80, | 257 | .bits = 80, |
| 238 | }, | 258 | }, |
| 239 | [20] = { | 259 | { |
| 260 | .group_id = 20, | ||
| 240 | .nid = NID_secp224k1, | 261 | .nid = NID_secp224k1, |
| 241 | .bits = 112, | 262 | .bits = 112, |
| 242 | }, | 263 | }, |
| 243 | [21] = { | 264 | { |
| 265 | .group_id = 21, | ||
| 244 | .nid = NID_secp224r1, | 266 | .nid = NID_secp224r1, |
| 245 | .bits = 112, | 267 | .bits = 112, |
| 246 | }, | 268 | }, |
| 247 | [22] = { | 269 | { |
| 270 | .group_id = 22, | ||
| 248 | .nid = NID_secp256k1, | 271 | .nid = NID_secp256k1, |
| 249 | .bits = 128, | 272 | .bits = 128, |
| 250 | }, | 273 | }, |
| 251 | [23] = { | 274 | { |
| 275 | .group_id = 23, | ||
| 252 | .nid = NID_X9_62_prime256v1, /* aka secp256r1 */ | 276 | .nid = NID_X9_62_prime256v1, /* aka secp256r1 */ |
| 253 | .bits = 128, | 277 | .bits = 128, |
| 254 | }, | 278 | }, |
| 255 | [24] = { | 279 | { |
| 280 | .group_id = 24, | ||
| 256 | .nid = NID_secp384r1, | 281 | .nid = NID_secp384r1, |
| 257 | .bits = 192, | 282 | .bits = 192, |
| 258 | }, | 283 | }, |
| 259 | [25] = { | 284 | { |
| 285 | .group_id = 25, | ||
| 260 | .nid = NID_secp521r1, | 286 | .nid = NID_secp521r1, |
| 261 | .bits = 256, | 287 | .bits = 256, |
| 262 | }, | 288 | }, |
| 263 | [26] = { | 289 | { |
| 290 | .group_id = 26, | ||
| 264 | .nid = NID_brainpoolP256r1, | 291 | .nid = NID_brainpoolP256r1, |
| 265 | .bits = 128, | 292 | .bits = 128, |
| 266 | }, | 293 | }, |
| 267 | [27] = { | 294 | { |
| 295 | .group_id = 27, | ||
| 268 | .nid = NID_brainpoolP384r1, | 296 | .nid = NID_brainpoolP384r1, |
| 269 | .bits = 192, | 297 | .bits = 192, |
| 270 | }, | 298 | }, |
| 271 | [28] = { | 299 | { |
| 300 | .group_id = 28, | ||
| 272 | .nid = NID_brainpoolP512r1, | 301 | .nid = NID_brainpoolP512r1, |
| 273 | .bits = 256, | 302 | .bits = 256, |
| 274 | }, | 303 | }, |
| 275 | [29] = { | 304 | { |
| 305 | .group_id = 29, | ||
| 276 | .nid = NID_X25519, | 306 | .nid = NID_X25519, |
| 277 | .bits = 128, | 307 | .bits = 128, |
| 278 | }, | 308 | }, |
| 309 | { | ||
| 310 | .group_id = 4588, | ||
| 311 | .nid = NID_X25519MLKEM768, | ||
| 312 | .bits = 128, | ||
| 313 | }, | ||
| 279 | }; | 314 | }; |
| 280 | 315 | ||
| 281 | #define NID_LIST_LEN (sizeof(nid_list) / sizeof(nid_list[0])) | 316 | #define NID_LIST_LEN (sizeof(nid_list) / sizeof(nid_list[0])) |
| @@ -292,41 +327,21 @@ static const uint8_t ecformats_default[] = { | |||
| 292 | TLSEXT_ECPOINTFORMAT_uncompressed, | 327 | TLSEXT_ECPOINTFORMAT_uncompressed, |
| 293 | }; | 328 | }; |
| 294 | 329 | ||
| 295 | #if 0 | 330 | static const uint16_t ecgroups_tls12_client_default[] = { |
| 296 | static const uint16_t ecgroups_list[] = { | ||
| 297 | 29, /* X25519 (29) */ | 331 | 29, /* X25519 (29) */ |
| 298 | 14, /* sect571r1 (14) */ | 332 | 23, /* secp256r1 (23) */ |
| 299 | 13, /* sect571k1 (13) */ | ||
| 300 | 25, /* secp521r1 (25) */ | ||
| 301 | 28, /* brainpoolP512r1 (28) */ | ||
| 302 | 11, /* sect409k1 (11) */ | ||
| 303 | 12, /* sect409r1 (12) */ | ||
| 304 | 27, /* brainpoolP384r1 (27) */ | ||
| 305 | 24, /* secp384r1 (24) */ | 333 | 24, /* secp384r1 (24) */ |
| 306 | 9, /* sect283k1 (9) */ | 334 | 25, /* secp521r1 (25) */ |
| 307 | 10, /* sect283r1 (10) */ | 335 | }; |
| 308 | 26, /* brainpoolP256r1 (26) */ | 336 | |
| 309 | 22, /* secp256k1 (22) */ | 337 | static const uint16_t ecgroups_tls12_server_default[] = { |
| 338 | 29, /* X25519 (29) */ | ||
| 310 | 23, /* secp256r1 (23) */ | 339 | 23, /* secp256r1 (23) */ |
| 311 | 8, /* sect239k1 (8) */ | 340 | 24, /* secp384r1 (24) */ |
| 312 | 6, /* sect233k1 (6) */ | ||
| 313 | 7, /* sect233r1 (7) */ | ||
| 314 | 20, /* secp224k1 (20) */ | ||
| 315 | 21, /* secp224r1 (21) */ | ||
| 316 | 4, /* sect193r1 (4) */ | ||
| 317 | 5, /* sect193r2 (5) */ | ||
| 318 | 18, /* secp192k1 (18) */ | ||
| 319 | 19, /* secp192r1 (19) */ | ||
| 320 | 1, /* sect163k1 (1) */ | ||
| 321 | 2, /* sect163r1 (2) */ | ||
| 322 | 3, /* sect163r2 (3) */ | ||
| 323 | 15, /* secp160k1 (15) */ | ||
| 324 | 16, /* secp160r1 (16) */ | ||
| 325 | 17, /* secp160r2 (17) */ | ||
| 326 | }; | 341 | }; |
| 327 | #endif | ||
| 328 | 342 | ||
| 329 | static const uint16_t ecgroups_client_default[] = { | 343 | static const uint16_t ecgroups_client_default[] = { |
| 344 | 4588, /* X25519MLKEM768 (4588) */ | ||
| 330 | 29, /* X25519 (29) */ | 345 | 29, /* X25519 (29) */ |
| 331 | 23, /* secp256r1 (23) */ | 346 | 23, /* secp256r1 (23) */ |
| 332 | 24, /* secp384r1 (24) */ | 347 | 24, /* secp384r1 (24) */ |
| @@ -334,23 +349,47 @@ static const uint16_t ecgroups_client_default[] = { | |||
| 334 | }; | 349 | }; |
| 335 | 350 | ||
| 336 | static const uint16_t ecgroups_server_default[] = { | 351 | static const uint16_t ecgroups_server_default[] = { |
| 352 | 4588, /* X25519MLKEM768 (4588) */ | ||
| 337 | 29, /* X25519 (29) */ | 353 | 29, /* X25519 (29) */ |
| 338 | 23, /* secp256r1 (23) */ | 354 | 23, /* secp256r1 (23) */ |
| 339 | 24, /* secp384r1 (24) */ | 355 | 24, /* secp384r1 (24) */ |
| 340 | }; | 356 | }; |
| 341 | 357 | ||
| 358 | static const struct supported_group * | ||
| 359 | tls1_supported_group_by_id(uint16_t group_id) | ||
| 360 | { | ||
| 361 | int i; | ||
| 362 | |||
| 363 | for (i = 0; i < NID_LIST_LEN; i++) { | ||
| 364 | if (group_id == nid_list[i].group_id) | ||
| 365 | return &nid_list[i]; | ||
| 366 | } | ||
| 367 | |||
| 368 | return NULL; | ||
| 369 | } | ||
| 370 | |||
| 371 | static const struct supported_group * | ||
| 372 | tls1_supported_group_by_nid(int nid) | ||
| 373 | { | ||
| 374 | int i; | ||
| 375 | |||
| 376 | for (i = 0; i < NID_LIST_LEN; i++) { | ||
| 377 | if (nid == nid_list[i].nid) | ||
| 378 | return &nid_list[i]; | ||
| 379 | } | ||
| 380 | |||
| 381 | return NULL; | ||
| 382 | } | ||
| 383 | |||
| 342 | int | 384 | int |
| 343 | tls1_ec_group_id2nid(uint16_t group_id, int *out_nid) | 385 | tls1_ec_group_id2nid(uint16_t group_id, int *out_nid) |
| 344 | { | 386 | { |
| 345 | int nid; | 387 | const struct supported_group *sg; |
| 346 | |||
| 347 | if (group_id >= NID_LIST_LEN) | ||
| 348 | return 0; | ||
| 349 | 388 | ||
| 350 | if ((nid = nid_list[group_id].nid) == 0) | 389 | if ((sg = tls1_supported_group_by_id(group_id)) == NULL) |
| 351 | return 0; | 390 | return 0; |
| 352 | 391 | ||
| 353 | *out_nid = nid; | 392 | *out_nid = sg->nid; |
| 354 | 393 | ||
| 355 | return 1; | 394 | return 1; |
| 356 | } | 395 | } |
| @@ -358,15 +397,12 @@ tls1_ec_group_id2nid(uint16_t group_id, int *out_nid) | |||
| 358 | int | 397 | int |
| 359 | tls1_ec_group_id2bits(uint16_t group_id, int *out_bits) | 398 | tls1_ec_group_id2bits(uint16_t group_id, int *out_bits) |
| 360 | { | 399 | { |
| 361 | int bits; | 400 | const struct supported_group *sg; |
| 362 | 401 | ||
| 363 | if (group_id >= NID_LIST_LEN) | 402 | if ((sg = tls1_supported_group_by_id(group_id)) == NULL) |
| 364 | return 0; | 403 | return 0; |
| 365 | 404 | ||
| 366 | if ((bits = nid_list[group_id].bits) == 0) | 405 | *out_bits = sg->bits; |
| 367 | return 0; | ||
| 368 | |||
| 369 | *out_bits = bits; | ||
| 370 | 406 | ||
| 371 | return 1; | 407 | return 1; |
| 372 | } | 408 | } |
| @@ -374,19 +410,14 @@ tls1_ec_group_id2bits(uint16_t group_id, int *out_bits) | |||
| 374 | int | 410 | int |
| 375 | tls1_ec_nid2group_id(int nid, uint16_t *out_group_id) | 411 | tls1_ec_nid2group_id(int nid, uint16_t *out_group_id) |
| 376 | { | 412 | { |
| 377 | uint16_t group_id; | 413 | const struct supported_group *sg; |
| 378 | 414 | ||
| 379 | if (nid == 0) | 415 | if ((sg = tls1_supported_group_by_nid(nid)) == NULL) |
| 380 | return 0; | 416 | return 0; |
| 381 | 417 | ||
| 382 | for (group_id = 0; group_id < NID_LIST_LEN; group_id++) { | 418 | *out_group_id = sg->group_id; |
| 383 | if (nid_list[group_id].nid == nid) { | ||
| 384 | *out_group_id = group_id; | ||
| 385 | return 1; | ||
| 386 | } | ||
| 387 | } | ||
| 388 | 419 | ||
| 389 | return 0; | 420 | return 1; |
| 390 | } | 421 | } |
| 391 | 422 | ||
| 392 | /* | 423 | /* |
| @@ -433,11 +464,21 @@ tls1_get_group_list(const SSL *s, int client_groups, const uint16_t **pgroups, | |||
| 433 | return; | 464 | return; |
| 434 | 465 | ||
| 435 | if (!s->server) { | 466 | if (!s->server) { |
| 436 | *pgroups = ecgroups_client_default; | 467 | if (s->s3->hs.our_max_tls_version >= TLS1_3_VERSION) { |
| 437 | *pgroupslen = sizeof(ecgroups_client_default) / 2; | 468 | *pgroups = ecgroups_client_default; |
| 469 | *pgroupslen = sizeof(ecgroups_client_default) / 2; | ||
| 470 | } else { | ||
| 471 | *pgroups = ecgroups_tls12_client_default; | ||
| 472 | *pgroupslen = sizeof(ecgroups_tls12_client_default) / 2; | ||
| 473 | } | ||
| 438 | } else { | 474 | } else { |
| 439 | *pgroups = ecgroups_server_default; | 475 | if (s->s3->hs.our_max_tls_version >= TLS1_3_VERSION) { |
| 440 | *pgroupslen = sizeof(ecgroups_server_default) / 2; | 476 | *pgroups = ecgroups_server_default; |
| 477 | *pgroupslen = sizeof(ecgroups_server_default) / 2; | ||
| 478 | } else { | ||
| 479 | *pgroups = ecgroups_tls12_server_default; | ||
| 480 | *pgroupslen = sizeof(ecgroups_tls12_server_default) / 2; | ||
| 481 | } | ||
| 441 | } | 482 | } |
| 442 | } | 483 | } |
| 443 | 484 | ||
diff --git a/src/lib/libssl/tls1.h b/src/lib/libssl/tls1.h index d018fced5c..2d5dffc6cf 100644 --- a/src/lib/libssl/tls1.h +++ b/src/lib/libssl/tls1.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls1.h,v 1.60 2024/10/23 01:57:19 jsg Exp $ */ | 1 | /* $OpenBSD: tls1.h,v 1.61 2025/04/18 07:34:01 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -197,7 +197,7 @@ extern "C" { | |||
| 197 | /* Codes 110-114 from RFC 3546. */ | 197 | /* Codes 110-114 from RFC 3546. */ |
| 198 | #define TLS1_AD_UNSUPPORTED_EXTENSION 110 | 198 | #define TLS1_AD_UNSUPPORTED_EXTENSION 110 |
| 199 | #define TLS1_AD_CERTIFICATE_UNOBTAINABLE 111 | 199 | #define TLS1_AD_CERTIFICATE_UNOBTAINABLE 111 |
| 200 | #define TLS1_AD_UNRECOGNIZED_NAME 112 | 200 | #define TLS1_AD_UNRECOGNIZED_NAME 112 |
| 201 | #define TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE 113 | 201 | #define TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE 113 |
| 202 | #define TLS1_AD_BAD_CERTIFICATE_HASH_VALUE 114 | 202 | #define TLS1_AD_BAD_CERTIFICATE_HASH_VALUE 114 |
| 203 | /* Code 115 from RFC 4279. */ | 203 | /* Code 115 from RFC 4279. */ |
| @@ -455,7 +455,7 @@ SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,(void (*)(void))cb) | |||
| 455 | #define TLS1_CK_DH_RSA_WITH_SEED_SHA 0x03000098 | 455 | #define TLS1_CK_DH_RSA_WITH_SEED_SHA 0x03000098 |
| 456 | #define TLS1_CK_DHE_DSS_WITH_SEED_SHA 0x03000099 | 456 | #define TLS1_CK_DHE_DSS_WITH_SEED_SHA 0x03000099 |
| 457 | #define TLS1_CK_DHE_RSA_WITH_SEED_SHA 0x0300009A | 457 | #define TLS1_CK_DHE_RSA_WITH_SEED_SHA 0x0300009A |
| 458 | #define TLS1_CK_ADH_WITH_SEED_SHA 0x0300009B | 458 | #define TLS1_CK_ADH_WITH_SEED_SHA 0x0300009B |
| 459 | 459 | ||
| 460 | /* TLS v1.2 GCM ciphersuites from RFC 5288. */ | 460 | /* TLS v1.2 GCM ciphersuites from RFC 5288. */ |
| 461 | #define TLS1_CK_RSA_WITH_AES_128_GCM_SHA256 0x0300009C | 461 | #define TLS1_CK_RSA_WITH_AES_128_GCM_SHA256 0x0300009C |
diff --git a/src/lib/libssl/tls13_client.c b/src/lib/libssl/tls13_client.c index 901b38f860..21d3960796 100644 --- a/src/lib/libssl/tls13_client.c +++ b/src/lib/libssl/tls13_client.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls13_client.c,v 1.104 2024/07/22 14:47:15 jsing Exp $ */ | 1 | /* $OpenBSD: tls13_client.c,v 1.106 2025/12/04 21:16:17 beck Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -53,9 +53,21 @@ tls13_client_init(struct tls13_ctx *ctx) | |||
| 53 | return 0; | 53 | return 0; |
| 54 | if ((ctx->hs->key_share = tls_key_share_new(groups[0])) == NULL) | 54 | if ((ctx->hs->key_share = tls_key_share_new(groups[0])) == NULL) |
| 55 | return 0; | 55 | return 0; |
| 56 | if (!tls_key_share_generate(ctx->hs->key_share)) | 56 | if (!tls_key_share_client_generate(ctx->hs->key_share)) |
| 57 | return 0; | 57 | return 0; |
| 58 | 58 | ||
| 59 | /* | ||
| 60 | * Generate a second key share prediction if we have another | ||
| 61 | * supported group | ||
| 62 | */ | ||
| 63 | if (groups_len > 1) { | ||
| 64 | if ((ctx->hs->tls13.key_share = tls_key_share_new(groups[1])) == | ||
| 65 | NULL) | ||
| 66 | return 0; | ||
| 67 | if (!tls_key_share_client_generate(ctx->hs->tls13.key_share)) | ||
| 68 | return 0; | ||
| 69 | } | ||
| 70 | |||
| 59 | arc4random_buf(s->s3->client_random, SSL3_RANDOM_SIZE); | 71 | arc4random_buf(s->s3->client_random, SSL3_RANDOM_SIZE); |
| 60 | 72 | ||
| 61 | /* | 73 | /* |
| @@ -450,7 +462,7 @@ tls13_client_hello_retry_send(struct tls13_ctx *ctx, CBB *cbb) | |||
| 450 | if ((ctx->hs->key_share = | 462 | if ((ctx->hs->key_share = |
| 451 | tls_key_share_new(ctx->hs->tls13.server_group)) == NULL) | 463 | tls_key_share_new(ctx->hs->tls13.server_group)) == NULL) |
| 452 | return 0; | 464 | return 0; |
| 453 | if (!tls_key_share_generate(ctx->hs->key_share)) | 465 | if (!tls_key_share_client_generate(ctx->hs->key_share)) |
| 454 | return 0; | 466 | return 0; |
| 455 | 467 | ||
| 456 | if (!tls13_client_hello_build(ctx, cbb)) | 468 | if (!tls13_client_hello_build(ctx, cbb)) |
diff --git a/src/lib/libssl/tls13_lib.c b/src/lib/libssl/tls13_lib.c index 331a3ad1a7..c3470b2931 100644 --- a/src/lib/libssl/tls13_lib.c +++ b/src/lib/libssl/tls13_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls13_lib.c,v 1.77 2024/01/27 14:23:51 jsing Exp $ */ | 1 | /* $OpenBSD: tls13_lib.c,v 1.78 2025/06/07 10:25:12 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> |
| 4 | * Copyright (c) 2019 Bob Beck <beck@openbsd.org> | 4 | * Copyright (c) 2019 Bob Beck <beck@openbsd.org> |
| @@ -538,7 +538,7 @@ tls13_ctx_new(int mode, SSL *ssl) | |||
| 538 | { | 538 | { |
| 539 | struct tls13_ctx *ctx = NULL; | 539 | struct tls13_ctx *ctx = NULL; |
| 540 | 540 | ||
| 541 | if ((ctx = calloc(sizeof(struct tls13_ctx), 1)) == NULL) | 541 | if ((ctx = calloc(1, sizeof(*ctx))) == NULL) |
| 542 | goto err; | 542 | goto err; |
| 543 | 543 | ||
| 544 | ctx->hs = &ssl->s3->hs; | 544 | ctx->hs = &ssl->s3->hs; |
diff --git a/src/lib/libssl/tls13_server.c b/src/lib/libssl/tls13_server.c index 63b7d92093..604dab4cba 100644 --- a/src/lib/libssl/tls13_server.c +++ b/src/lib/libssl/tls13_server.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls13_server.c,v 1.109 2024/07/22 14:47:15 jsing Exp $ */ | 1 | /* $OpenBSD: tls13_server.c,v 1.112 2025/12/04 21:03:42 beck Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2019, 2020 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2019, 2020 Joel Sing <jsing@openbsd.org> |
| 4 | * Copyright (c) 2020 Bob Beck <beck@openbsd.org> | 4 | * Copyright (c) 2020 Bob Beck <beck@openbsd.org> |
| @@ -327,7 +327,7 @@ tls13_client_hello_recv(struct tls13_ctx *ctx, CBS *cbs) | |||
| 327 | } | 327 | } |
| 328 | 328 | ||
| 329 | static int | 329 | static int |
| 330 | tls13_server_hello_build(struct tls13_ctx *ctx, CBB *cbb, int hrr) | 330 | tls13_server_hello_build(struct tls13_ctx *ctx, CBB *cbb) |
| 331 | { | 331 | { |
| 332 | uint16_t tlsext_msg_type = SSL_TLSEXT_MSG_SH; | 332 | uint16_t tlsext_msg_type = SSL_TLSEXT_MSG_SH; |
| 333 | const uint8_t *server_random; | 333 | const uint8_t *server_random; |
| @@ -338,7 +338,7 @@ tls13_server_hello_build(struct tls13_ctx *ctx, CBB *cbb, int hrr) | |||
| 338 | cipher = SSL_CIPHER_get_value(ctx->hs->cipher); | 338 | cipher = SSL_CIPHER_get_value(ctx->hs->cipher); |
| 339 | server_random = s->s3->server_random; | 339 | server_random = s->s3->server_random; |
| 340 | 340 | ||
| 341 | if (hrr) { | 341 | if (ctx->hs->tls13.hrr) { |
| 342 | server_random = tls13_hello_retry_request_hash; | 342 | server_random = tls13_hello_retry_request_hash; |
| 343 | tlsext_msg_type = SSL_TLSEXT_MSG_HRR; | 343 | tlsext_msg_type = SSL_TLSEXT_MSG_HRR; |
| 344 | } | 344 | } |
| @@ -437,8 +437,6 @@ tls13_server_engage_record_protection(struct tls13_ctx *ctx) | |||
| 437 | int | 437 | int |
| 438 | tls13_server_hello_retry_request_send(struct tls13_ctx *ctx, CBB *cbb) | 438 | tls13_server_hello_retry_request_send(struct tls13_ctx *ctx, CBB *cbb) |
| 439 | { | 439 | { |
| 440 | int nid; | ||
| 441 | |||
| 442 | ctx->hs->tls13.hrr = 1; | 440 | ctx->hs->tls13.hrr = 1; |
| 443 | 441 | ||
| 444 | if (!tls13_synthetic_handshake_message(ctx)) | 442 | if (!tls13_synthetic_handshake_message(ctx)) |
| @@ -446,12 +444,10 @@ tls13_server_hello_retry_request_send(struct tls13_ctx *ctx, CBB *cbb) | |||
| 446 | 444 | ||
| 447 | if (ctx->hs->key_share != NULL) | 445 | if (ctx->hs->key_share != NULL) |
| 448 | return 0; | 446 | return 0; |
| 449 | if (!tls1_get_supported_group(ctx->ssl, &nid)) | 447 | if (ctx->hs->tls13.server_group == 0) |
| 450 | return 0; | ||
| 451 | if (!tls1_ec_nid2group_id(nid, &ctx->hs->tls13.server_group)) | ||
| 452 | return 0; | 448 | return 0; |
| 453 | 449 | ||
| 454 | if (!tls13_server_hello_build(ctx, cbb, 1)) | 450 | if (!tls13_server_hello_build(ctx, cbb)) |
| 455 | return 0; | 451 | return 0; |
| 456 | 452 | ||
| 457 | return 1; | 453 | return 1; |
| @@ -506,14 +502,12 @@ tls13_server_hello_send(struct tls13_ctx *ctx, CBB *cbb) | |||
| 506 | { | 502 | { |
| 507 | if (ctx->hs->key_share == NULL) | 503 | if (ctx->hs->key_share == NULL) |
| 508 | return 0; | 504 | return 0; |
| 509 | if (!tls_key_share_generate(ctx->hs->key_share)) | 505 | if (!tls_key_share_server_generate(ctx->hs->key_share)) |
| 510 | return 0; | 506 | return 0; |
| 511 | if (!tls13_servername_process(ctx)) | 507 | if (!tls13_servername_process(ctx)) |
| 512 | return 0; | 508 | return 0; |
| 513 | 509 | ||
| 514 | ctx->hs->tls13.server_group = 0; | 510 | if (!tls13_server_hello_build(ctx, cbb)) |
| 515 | |||
| 516 | if (!tls13_server_hello_build(ctx, cbb, 0)) | ||
| 517 | return 0; | 511 | return 0; |
| 518 | 512 | ||
| 519 | return 1; | 513 | return 1; |
diff --git a/src/lib/libssl/tls_internal.h b/src/lib/libssl/tls_internal.h index 84edde8474..3d8d6aa940 100644 --- a/src/lib/libssl/tls_internal.h +++ b/src/lib/libssl/tls_internal.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls_internal.h,v 1.10 2022/11/10 18:06:37 jsing Exp $ */ | 1 | /* $OpenBSD: tls_internal.h,v 1.11 2025/12/04 21:03:42 beck Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2018, 2019, 2021 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2018, 2019, 2021 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -85,12 +85,15 @@ int tls_key_share_nid(struct tls_key_share *ks); | |||
| 85 | void tls_key_share_set_key_bits(struct tls_key_share *ks, size_t key_bits); | 85 | void tls_key_share_set_key_bits(struct tls_key_share *ks, size_t key_bits); |
| 86 | int tls_key_share_set_dh_params(struct tls_key_share *ks, DH *dh_params); | 86 | int tls_key_share_set_dh_params(struct tls_key_share *ks, DH *dh_params); |
| 87 | int tls_key_share_peer_pkey(struct tls_key_share *ks, EVP_PKEY *pkey); | 87 | int tls_key_share_peer_pkey(struct tls_key_share *ks, EVP_PKEY *pkey); |
| 88 | int tls_key_share_generate(struct tls_key_share *ks); | 88 | int tls_key_share_client_generate(struct tls_key_share *ks); |
| 89 | int tls_key_share_server_generate(struct tls_key_share *ks); | ||
| 89 | int tls_key_share_params(struct tls_key_share *ks, CBB *cbb); | 90 | int tls_key_share_params(struct tls_key_share *ks, CBB *cbb); |
| 90 | int tls_key_share_public(struct tls_key_share *ks, CBB *cbb); | 91 | int tls_key_share_public(struct tls_key_share *ks, CBB *cbb); |
| 91 | int tls_key_share_peer_params(struct tls_key_share *ks, CBS *cbs, | 92 | int tls_key_share_peer_params(struct tls_key_share *ks, CBS *cbs, |
| 92 | int *decode_error, int *invalid_params); | 93 | int *decode_error, int *invalid_params); |
| 93 | int tls_key_share_peer_public(struct tls_key_share *ks, CBS *cbs, | 94 | int tls_key_share_server_peer_public(struct tls_key_share *ks, CBS *cbs, |
| 95 | int *decode_error, int *invalid_key); | ||
| 96 | int tls_key_share_client_peer_public(struct tls_key_share *ks, CBS *cbs, | ||
| 94 | int *decode_error, int *invalid_key); | 97 | int *decode_error, int *invalid_key); |
| 95 | int tls_key_share_derive(struct tls_key_share *ks, uint8_t **shared_key, | 98 | int tls_key_share_derive(struct tls_key_share *ks, uint8_t **shared_key, |
| 96 | size_t *shared_key_len); | 99 | size_t *shared_key_len); |
diff --git a/src/lib/libssl/tls_key_share.c b/src/lib/libssl/tls_key_share.c index cf7b1da262..9e04cb7b75 100644 --- a/src/lib/libssl/tls_key_share.c +++ b/src/lib/libssl/tls_key_share.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls_key_share.c,v 1.8 2022/11/26 16:08:56 tb Exp $ */ | 1 | /* $OpenBSD: tls_key_share.c,v 1.10 2026/01/01 12:47:52 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2020, 2021 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2020, 2021 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <openssl/dh.h> | 21 | #include <openssl/dh.h> |
| 22 | #include <openssl/ec.h> | 22 | #include <openssl/ec.h> |
| 23 | #include <openssl/evp.h> | 23 | #include <openssl/evp.h> |
| 24 | #include <openssl/mlkem.h> | ||
| 24 | 25 | ||
| 25 | #include "bytestring.h" | 26 | #include "bytestring.h" |
| 26 | #include "ssl_local.h" | 27 | #include "ssl_local.h" |
| @@ -40,6 +41,19 @@ struct tls_key_share { | |||
| 40 | uint8_t *x25519_public; | 41 | uint8_t *x25519_public; |
| 41 | uint8_t *x25519_private; | 42 | uint8_t *x25519_private; |
| 42 | uint8_t *x25519_peer_public; | 43 | uint8_t *x25519_peer_public; |
| 44 | |||
| 45 | uint8_t *mlkem_public; | ||
| 46 | size_t mlkem_public_len; | ||
| 47 | MLKEM_private_key *mlkem_private; | ||
| 48 | MLKEM_public_key *mlkem_peer_public; | ||
| 49 | |||
| 50 | /* The ciphertext from MLKEM_encap. */ | ||
| 51 | uint8_t *mlkem_encap; | ||
| 52 | size_t mlkem_encap_len; | ||
| 53 | |||
| 54 | /* The shared secret from an ML-KEM encapsulation. */ | ||
| 55 | uint8_t *mlkem_shared_secret; | ||
| 56 | size_t mlkem_shared_secret_len; | ||
| 43 | }; | 57 | }; |
| 44 | 58 | ||
| 45 | static struct tls_key_share * | 59 | static struct tls_key_share * |
| @@ -96,6 +110,12 @@ tls_key_share_free(struct tls_key_share *ks) | |||
| 96 | freezero(ks->x25519_private, X25519_KEY_LENGTH); | 110 | freezero(ks->x25519_private, X25519_KEY_LENGTH); |
| 97 | freezero(ks->x25519_peer_public, X25519_KEY_LENGTH); | 111 | freezero(ks->x25519_peer_public, X25519_KEY_LENGTH); |
| 98 | 112 | ||
| 113 | freezero(ks->mlkem_public, ks->mlkem_public_len); | ||
| 114 | MLKEM_private_key_free(ks->mlkem_private); | ||
| 115 | MLKEM_public_key_free(ks->mlkem_peer_public); | ||
| 116 | freezero(ks->mlkem_encap, ks->mlkem_encap_len); | ||
| 117 | freezero(ks->mlkem_shared_secret, ks->mlkem_shared_secret_len); | ||
| 118 | |||
| 99 | freezero(ks, sizeof(*ks)); | 119 | freezero(ks, sizeof(*ks)); |
| 100 | } | 120 | } |
| 101 | 121 | ||
| @@ -230,7 +250,73 @@ tls_key_share_generate_x25519(struct tls_key_share *ks) | |||
| 230 | return ret; | 250 | return ret; |
| 231 | } | 251 | } |
| 232 | 252 | ||
| 233 | int | 253 | static int |
| 254 | tls_key_share_generate_mlkem(struct tls_key_share *ks, int rank) | ||
| 255 | { | ||
| 256 | MLKEM_private_key *private = NULL; | ||
| 257 | uint8_t *public = NULL; | ||
| 258 | size_t p_len = 0; | ||
| 259 | int ret = 0; | ||
| 260 | |||
| 261 | if (ks->mlkem_public != NULL || ks->mlkem_private != NULL) | ||
| 262 | goto err; | ||
| 263 | |||
| 264 | if ((private = MLKEM_private_key_new(rank)) == NULL) | ||
| 265 | goto err; | ||
| 266 | |||
| 267 | if (!MLKEM_generate_key(private, &public, &p_len, NULL, NULL)) | ||
| 268 | goto err; | ||
| 269 | |||
| 270 | ks->mlkem_public = public; | ||
| 271 | ks->mlkem_public_len = p_len; | ||
| 272 | ks->mlkem_private = private; | ||
| 273 | public = NULL; | ||
| 274 | private = NULL; | ||
| 275 | |||
| 276 | ret = 1; | ||
| 277 | |||
| 278 | err: | ||
| 279 | freezero(public, p_len); | ||
| 280 | MLKEM_private_key_free(private); | ||
| 281 | |||
| 282 | return ret; | ||
| 283 | } | ||
| 284 | |||
| 285 | static int | ||
| 286 | tls_key_share_client_generate_mlkem768x25519(struct tls_key_share *ks) | ||
| 287 | { | ||
| 288 | if (!tls_key_share_generate_mlkem(ks, MLKEM768_RANK)) | ||
| 289 | return 0; | ||
| 290 | |||
| 291 | if (!tls_key_share_generate_x25519(ks)) | ||
| 292 | return 0; | ||
| 293 | |||
| 294 | return 1; | ||
| 295 | } | ||
| 296 | |||
| 297 | static int | ||
| 298 | tls_key_share_server_generate_mlkem768x25519(struct tls_key_share *ks) | ||
| 299 | { | ||
| 300 | if (ks->mlkem_private != NULL) | ||
| 301 | return 0; | ||
| 302 | |||
| 303 | /* The server side needs the client's parsed share */ | ||
| 304 | |||
| 305 | if (ks->x25519_peer_public == NULL) | ||
| 306 | return 0; | ||
| 307 | |||
| 308 | if (ks->mlkem_peer_public == NULL) | ||
| 309 | return 0; | ||
| 310 | |||
| 311 | if (!tls_key_share_generate_x25519(ks)) | ||
| 312 | return 0; | ||
| 313 | |||
| 314 | return MLKEM_encap(ks->mlkem_peer_public, &ks->mlkem_encap, | ||
| 315 | &ks->mlkem_encap_len, &ks->mlkem_shared_secret, | ||
| 316 | &ks->mlkem_shared_secret_len); | ||
| 317 | } | ||
| 318 | |||
| 319 | static int | ||
| 234 | tls_key_share_generate(struct tls_key_share *ks) | 320 | tls_key_share_generate(struct tls_key_share *ks) |
| 235 | { | 321 | { |
| 236 | if (ks->nid == NID_dhKeyAgreement) | 322 | if (ks->nid == NID_dhKeyAgreement) |
| @@ -242,6 +328,24 @@ tls_key_share_generate(struct tls_key_share *ks) | |||
| 242 | return tls_key_share_generate_ecdhe_ecp(ks); | 328 | return tls_key_share_generate_ecdhe_ecp(ks); |
| 243 | } | 329 | } |
| 244 | 330 | ||
| 331 | int | ||
| 332 | tls_key_share_client_generate(struct tls_key_share *ks) | ||
| 333 | { | ||
| 334 | if (ks->nid == NID_X25519MLKEM768) | ||
| 335 | return tls_key_share_client_generate_mlkem768x25519(ks); | ||
| 336 | |||
| 337 | return tls_key_share_generate(ks); | ||
| 338 | } | ||
| 339 | |||
| 340 | int | ||
| 341 | tls_key_share_server_generate(struct tls_key_share *ks) | ||
| 342 | { | ||
| 343 | if (ks->nid == NID_X25519MLKEM768) | ||
| 344 | return tls_key_share_server_generate_mlkem768x25519(ks); | ||
| 345 | |||
| 346 | return tls_key_share_generate(ks); | ||
| 347 | } | ||
| 348 | |||
| 245 | static int | 349 | static int |
| 246 | tls_key_share_params_dhe(struct tls_key_share *ks, CBB *cbb) | 350 | tls_key_share_params_dhe(struct tls_key_share *ks, CBB *cbb) |
| 247 | { | 351 | { |
| @@ -287,6 +391,47 @@ tls_key_share_public_x25519(struct tls_key_share *ks, CBB *cbb) | |||
| 287 | return CBB_add_bytes(cbb, ks->x25519_public, X25519_KEY_LENGTH); | 391 | return CBB_add_bytes(cbb, ks->x25519_public, X25519_KEY_LENGTH); |
| 288 | } | 392 | } |
| 289 | 393 | ||
| 394 | static int | ||
| 395 | tls_key_share_public_mlkem768x25519(struct tls_key_share *ks, CBB *cbb) | ||
| 396 | { | ||
| 397 | uint8_t *mlkem_part; | ||
| 398 | size_t mlkem_part_len; | ||
| 399 | |||
| 400 | if (ks->x25519_public == NULL) | ||
| 401 | return 0; | ||
| 402 | |||
| 403 | /* | ||
| 404 | * https://datatracker.ietf.org/doc/draft-ietf-tls-ecdhe-mlkem/ | ||
| 405 | * Section 3.1.2: | ||
| 406 | * The server's key exchange value is the concatenation of an | ||
| 407 | * ML-KEM ciphertext returned from encapsulation to the client's | ||
| 408 | * encapsulation key, and the server's ephemeral X25519 share. | ||
| 409 | */ | ||
| 410 | mlkem_part = ks->mlkem_encap; | ||
| 411 | mlkem_part_len = ks->mlkem_encap_len; | ||
| 412 | |||
| 413 | /* | ||
| 414 | * https://datatracker.ietf.org/doc/draft-ietf-tls-ecdhe-mlkem/ | ||
| 415 | * Section 3.1.1: | ||
| 416 | * The client's key_exchange value is the concatenation of the | ||
| 417 | * client's ML-KEM-768 encapsulation key and the client's X25519 | ||
| 418 | * ephemeral share. | ||
| 419 | */ | ||
| 420 | if (mlkem_part == NULL) { | ||
| 421 | mlkem_part = ks->mlkem_public; | ||
| 422 | mlkem_part_len = ks->mlkem_public_len; | ||
| 423 | } | ||
| 424 | |||
| 425 | if (mlkem_part == NULL) | ||
| 426 | return 0; | ||
| 427 | |||
| 428 | if (!CBB_add_bytes(cbb, mlkem_part, mlkem_part_len)) | ||
| 429 | return 0; | ||
| 430 | |||
| 431 | /* Both the client and server send their x25519 public keys. */ | ||
| 432 | return CBB_add_bytes(cbb, ks->x25519_public, X25519_KEY_LENGTH); | ||
| 433 | } | ||
| 434 | |||
| 290 | int | 435 | int |
| 291 | tls_key_share_public(struct tls_key_share *ks, CBB *cbb) | 436 | tls_key_share_public(struct tls_key_share *ks, CBB *cbb) |
| 292 | { | 437 | { |
| @@ -296,6 +441,9 @@ tls_key_share_public(struct tls_key_share *ks, CBB *cbb) | |||
| 296 | if (ks->nid == NID_X25519) | 441 | if (ks->nid == NID_X25519) |
| 297 | return tls_key_share_public_x25519(ks, cbb); | 442 | return tls_key_share_public_x25519(ks, cbb); |
| 298 | 443 | ||
| 444 | if (ks->nid == NID_X25519MLKEM768) | ||
| 445 | return tls_key_share_public_mlkem768x25519(ks, cbb); | ||
| 446 | |||
| 299 | return tls_key_share_public_ecdhe_ecp(ks, cbb); | 447 | return tls_key_share_public_ecdhe_ecp(ks, cbb); |
| 300 | } | 448 | } |
| 301 | 449 | ||
| @@ -325,7 +473,7 @@ tls_key_share_peer_params(struct tls_key_share *ks, CBS *cbs, | |||
| 325 | return 0; | 473 | return 0; |
| 326 | 474 | ||
| 327 | return tls_key_share_peer_params_dhe(ks, cbs, decode_error, | 475 | return tls_key_share_peer_params_dhe(ks, cbs, decode_error, |
| 328 | invalid_params); | 476 | invalid_params); |
| 329 | } | 477 | } |
| 330 | 478 | ||
| 331 | static int | 479 | static int |
| @@ -383,7 +531,91 @@ tls_key_share_peer_public_x25519(struct tls_key_share *ks, CBS *cbs, | |||
| 383 | return CBS_stow(cbs, &ks->x25519_peer_public, &out_len); | 531 | return CBS_stow(cbs, &ks->x25519_peer_public, &out_len); |
| 384 | } | 532 | } |
| 385 | 533 | ||
| 386 | int | 534 | static int |
| 535 | tls_key_share_client_peer_public_mlkem768x25519(struct tls_key_share *ks, | ||
| 536 | CBS *cbs, int *decode_error) | ||
| 537 | { | ||
| 538 | CBS x25519_cbs, mlkem_ciphertext_cbs; | ||
| 539 | size_t out_len; | ||
| 540 | |||
| 541 | if (ks->mlkem_shared_secret != NULL) | ||
| 542 | return 0; | ||
| 543 | |||
| 544 | if (ks->mlkem_private == NULL) | ||
| 545 | return 0; | ||
| 546 | |||
| 547 | if (!CBS_get_bytes(cbs, &mlkem_ciphertext_cbs, | ||
| 548 | MLKEM_private_key_ciphertext_length(ks->mlkem_private))) | ||
| 549 | return 0; | ||
| 550 | |||
| 551 | if (!CBS_get_bytes(cbs, &x25519_cbs, X25519_KEY_LENGTH)) | ||
| 552 | return 0; | ||
| 553 | |||
| 554 | if (CBS_len(cbs) != 0) | ||
| 555 | return 0; | ||
| 556 | |||
| 557 | if (!CBS_stow(&x25519_cbs, &ks->x25519_peer_public, &out_len)) | ||
| 558 | return 0; | ||
| 559 | |||
| 560 | if (!CBS_stow(&mlkem_ciphertext_cbs, &ks->mlkem_encap, &ks->mlkem_encap_len)) | ||
| 561 | return 0; | ||
| 562 | |||
| 563 | return 1; | ||
| 564 | } | ||
| 565 | |||
| 566 | static int | ||
| 567 | tls_key_share_server_peer_public_mlkem768x25519(struct tls_key_share *ks, | ||
| 568 | CBS *cbs, int *decode_error) | ||
| 569 | { | ||
| 570 | CBS x25519_cbs, mlkem768_cbs; | ||
| 571 | size_t out_len; | ||
| 572 | |||
| 573 | *decode_error = 0; | ||
| 574 | |||
| 575 | /* The server should not have an mlkem private key */ | ||
| 576 | if (ks->mlkem_private != NULL) | ||
| 577 | return 0; | ||
| 578 | |||
| 579 | if (ks->mlkem_shared_secret != NULL) | ||
| 580 | return 0; | ||
| 581 | |||
| 582 | if (ks->mlkem_peer_public != NULL) | ||
| 583 | return 0; | ||
| 584 | |||
| 585 | if (ks->x25519_peer_public != NULL) | ||
| 586 | return 0; | ||
| 587 | |||
| 588 | /* Nein, ist nur normal (1024 ist gigantisch) */ | ||
| 589 | if ((ks->mlkem_peer_public = MLKEM_public_key_new(MLKEM768_RANK)) == NULL) | ||
| 590 | goto err; | ||
| 591 | |||
| 592 | if (!CBS_get_bytes(cbs, &mlkem768_cbs, | ||
| 593 | MLKEM_public_key_encoded_length(ks->mlkem_peer_public))) | ||
| 594 | goto err; | ||
| 595 | |||
| 596 | if (!CBS_get_bytes(cbs, &x25519_cbs, X25519_KEY_LENGTH)) | ||
| 597 | goto err; | ||
| 598 | |||
| 599 | if (CBS_len(cbs) != 0) | ||
| 600 | goto err; | ||
| 601 | |||
| 602 | if (!CBS_stow(&x25519_cbs, &ks->x25519_peer_public, &out_len)) | ||
| 603 | goto err; | ||
| 604 | |||
| 605 | /* Poetische */ | ||
| 606 | if (!MLKEM_parse_public_key(ks->mlkem_peer_public, | ||
| 607 | CBS_data(&mlkem768_cbs), CBS_len(&mlkem768_cbs))) | ||
| 608 | goto err; | ||
| 609 | |||
| 610 | return 1; | ||
| 611 | |||
| 612 | err: | ||
| 613 | *decode_error = 1; | ||
| 614 | |||
| 615 | return 0; | ||
| 616 | } | ||
| 617 | |||
| 618 | static int | ||
| 387 | tls_key_share_peer_public(struct tls_key_share *ks, CBS *cbs, int *decode_error, | 619 | tls_key_share_peer_public(struct tls_key_share *ks, CBS *cbs, int *decode_error, |
| 388 | int *invalid_key) | 620 | int *invalid_key) |
| 389 | { | 621 | { |
| @@ -402,6 +634,30 @@ tls_key_share_peer_public(struct tls_key_share *ks, CBS *cbs, int *decode_error, | |||
| 402 | return tls_key_share_peer_public_ecdhe_ecp(ks, cbs); | 634 | return tls_key_share_peer_public_ecdhe_ecp(ks, cbs); |
| 403 | } | 635 | } |
| 404 | 636 | ||
| 637 | /* Called from client to process a server peer */ | ||
| 638 | int | ||
| 639 | tls_key_share_client_peer_public(struct tls_key_share *ks, CBS *cbs, | ||
| 640 | int *decode_error, int *invalid_key) | ||
| 641 | { | ||
| 642 | if (ks->nid == NID_X25519MLKEM768) | ||
| 643 | return tls_key_share_client_peer_public_mlkem768x25519(ks, cbs, | ||
| 644 | decode_error); | ||
| 645 | |||
| 646 | return tls_key_share_peer_public(ks, cbs, decode_error, invalid_key); | ||
| 647 | } | ||
| 648 | |||
| 649 | /* Called from server to process a client peer */ | ||
| 650 | int | ||
| 651 | tls_key_share_server_peer_public(struct tls_key_share *ks, CBS *cbs, | ||
| 652 | int *decode_error, int *invalid_key) | ||
| 653 | { | ||
| 654 | if (ks->nid == NID_X25519MLKEM768) | ||
| 655 | return tls_key_share_server_peer_public_mlkem768x25519(ks, cbs, | ||
| 656 | decode_error); | ||
| 657 | |||
| 658 | return tls_key_share_peer_public(ks, cbs, decode_error, invalid_key); | ||
| 659 | } | ||
| 660 | |||
| 405 | static int | 661 | static int |
| 406 | tls_key_share_derive_dhe(struct tls_key_share *ks, | 662 | tls_key_share_derive_dhe(struct tls_key_share *ks, |
| 407 | uint8_t **shared_key, size_t *shared_key_len) | 663 | uint8_t **shared_key, size_t *shared_key_len) |
| @@ -451,6 +707,65 @@ tls_key_share_derive_x25519(struct tls_key_share *ks, | |||
| 451 | return ret; | 707 | return ret; |
| 452 | } | 708 | } |
| 453 | 709 | ||
| 710 | /* | ||
| 711 | * https://datatracker.ietf.org/doc/draft-ietf-tls-ecdhe-mlkem/ | ||
| 712 | * Section 3.1.3: | ||
| 713 | * For X25519MLKEM768, the shared secret is the concatenation of the ML-KEM | ||
| 714 | * shared secret and the X25519 shared secret. | ||
| 715 | */ | ||
| 716 | static int | ||
| 717 | tls_key_share_derive_mlkem768x25519(struct tls_key_share *ks, | ||
| 718 | uint8_t **out_shared_key, size_t *out_shared_key_len) | ||
| 719 | { | ||
| 720 | uint8_t *x25519_shared_key; | ||
| 721 | CBB cbb; | ||
| 722 | |||
| 723 | memset(&cbb, 0, sizeof(cbb)); | ||
| 724 | |||
| 725 | if (ks->x25519_private == NULL) | ||
| 726 | goto err; | ||
| 727 | |||
| 728 | if (ks->x25519_peer_public == NULL) | ||
| 729 | goto err; | ||
| 730 | |||
| 731 | if (ks->mlkem_shared_secret == NULL) { | ||
| 732 | if (ks->mlkem_private == NULL) | ||
| 733 | goto err; | ||
| 734 | |||
| 735 | if (ks->mlkem_encap == NULL) | ||
| 736 | goto err; | ||
| 737 | |||
| 738 | if (!MLKEM_decap(ks->mlkem_private, ks->mlkem_encap, | ||
| 739 | MLKEM_private_key_ciphertext_length(ks->mlkem_private), | ||
| 740 | &ks->mlkem_shared_secret, &ks->mlkem_shared_secret_len)) | ||
| 741 | goto err; | ||
| 742 | } | ||
| 743 | |||
| 744 | if (!CBB_init(&cbb, ks->mlkem_shared_secret_len + X25519_KEY_LENGTH)) | ||
| 745 | goto err; | ||
| 746 | |||
| 747 | if (!CBB_add_bytes(&cbb, ks->mlkem_shared_secret, | ||
| 748 | ks->mlkem_shared_secret_len)) | ||
| 749 | goto err; | ||
| 750 | |||
| 751 | if (!CBB_add_space(&cbb, &x25519_shared_key, X25519_KEY_LENGTH)) | ||
| 752 | goto err; | ||
| 753 | |||
| 754 | if (!X25519(x25519_shared_key, ks->x25519_private, | ||
| 755 | ks->x25519_peer_public)) | ||
| 756 | goto err; | ||
| 757 | |||
| 758 | if (!CBB_finish(&cbb, out_shared_key, out_shared_key_len)) | ||
| 759 | goto err; | ||
| 760 | |||
| 761 | return 1; | ||
| 762 | |||
| 763 | err: | ||
| 764 | CBB_cleanup(&cbb); | ||
| 765 | |||
| 766 | return 0; | ||
| 767 | } | ||
| 768 | |||
| 454 | int | 769 | int |
| 455 | tls_key_share_derive(struct tls_key_share *ks, uint8_t **shared_key, | 770 | tls_key_share_derive(struct tls_key_share *ks, uint8_t **shared_key, |
| 456 | size_t *shared_key_len) | 771 | size_t *shared_key_len) |
| @@ -468,6 +783,10 @@ tls_key_share_derive(struct tls_key_share *ks, uint8_t **shared_key, | |||
| 468 | return tls_key_share_derive_x25519(ks, shared_key, | 783 | return tls_key_share_derive_x25519(ks, shared_key, |
| 469 | shared_key_len); | 784 | shared_key_len); |
| 470 | 785 | ||
| 786 | if (ks->nid == NID_X25519MLKEM768) | ||
| 787 | return tls_key_share_derive_mlkem768x25519(ks, shared_key, | ||
| 788 | shared_key_len); | ||
| 789 | |||
| 471 | return tls_key_share_derive_ecdhe_ecp(ks, shared_key, | 790 | return tls_key_share_derive_ecdhe_ecp(ks, shared_key, |
| 472 | shared_key_len); | 791 | shared_key_len); |
| 473 | } | 792 | } |
diff --git a/src/lib/libtls/man/tls_accept_socket.3 b/src/lib/libtls/man/tls_accept_socket.3 index 931b9346ec..8922708e0f 100644 --- a/src/lib/libtls/man/tls_accept_socket.3 +++ b/src/lib/libtls/man/tls_accept_socket.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: tls_accept_socket.3,v 1.4 2018/05/26 12:35:26 schwarze Exp $ | 1 | .\" $OpenBSD: tls_accept_socket.3,v 1.5 2025/07/07 10:54:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2015 Ted Unangst <tedu@openbsd.org> | 3 | .\" Copyright (c) 2015 Ted Unangst <tedu@openbsd.org> |
| 4 | .\" Copyright (c) 2015 Joel Sing <jsing@openbsd.org> | 4 | .\" Copyright (c) 2015 Joel Sing <jsing@openbsd.org> |
| @@ -16,7 +16,7 @@ | |||
| 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 18 | .\" | 18 | .\" |
| 19 | .Dd $Mdocdate: May 26 2018 $ | 19 | .Dd $Mdocdate: July 7 2025 $ |
| 20 | .Dt TLS_ACCEPT_SOCKET 3 | 20 | .Dt TLS_ACCEPT_SOCKET 3 |
| 21 | .Os | 21 | .Os |
| 22 | .Sh NAME | 22 | .Sh NAME |
| @@ -25,6 +25,7 @@ | |||
| 25 | .Nm tls_accept_cbs | 25 | .Nm tls_accept_cbs |
| 26 | .Nd accept an incoming client connection in a TLS server | 26 | .Nd accept an incoming client connection in a TLS server |
| 27 | .Sh SYNOPSIS | 27 | .Sh SYNOPSIS |
| 28 | .Lb libtls libssl libcrypto | ||
| 28 | .In tls.h | 29 | .In tls.h |
| 29 | .Ft int | 30 | .Ft int |
| 30 | .Fo tls_accept_socket | 31 | .Fo tls_accept_socket |
diff --git a/src/lib/libtls/man/tls_client.3 b/src/lib/libtls/man/tls_client.3 index 98f58d4c20..235c779519 100644 --- a/src/lib/libtls/man/tls_client.3 +++ b/src/lib/libtls/man/tls_client.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: tls_client.3,v 1.4 2017/08/12 03:41:48 jsing Exp $ | 1 | .\" $OpenBSD: tls_client.3,v 1.5 2025/07/07 10:54:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> | 3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: August 12 2017 $ | 17 | .Dd $Mdocdate: July 7 2025 $ |
| 18 | .Dt TLS_CLIENT 3 | 18 | .Dt TLS_CLIENT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -25,6 +25,7 @@ | |||
| 25 | .Nm tls_free | 25 | .Nm tls_free |
| 26 | .Nd configure a TLS connection | 26 | .Nd configure a TLS connection |
| 27 | .Sh SYNOPSIS | 27 | .Sh SYNOPSIS |
| 28 | .Lb libtls libssl libcrypto | ||
| 28 | .In tls.h | 29 | .In tls.h |
| 29 | .Ft struct tls * | 30 | .Ft struct tls * |
| 30 | .Fn tls_client void | 31 | .Fn tls_client void |
diff --git a/src/lib/libtls/man/tls_config_ocsp_require_stapling.3 b/src/lib/libtls/man/tls_config_ocsp_require_stapling.3 index a0694d304f..d776b61ad6 100644 --- a/src/lib/libtls/man/tls_config_ocsp_require_stapling.3 +++ b/src/lib/libtls/man/tls_config_ocsp_require_stapling.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: tls_config_ocsp_require_stapling.3,v 1.5 2017/01/31 20:53:50 jmc Exp $ | 1 | .\" $OpenBSD: tls_config_ocsp_require_stapling.3,v 1.6 2025/07/07 10:54:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Bob Beck <beck@openbsd.org> | 3 | .\" Copyright (c) 2016 Bob Beck <beck@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,13 +14,14 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: January 31 2017 $ | 17 | .Dd $Mdocdate: July 7 2025 $ |
| 18 | .Dt TLS_CONFIG_OCSP_REQUIRE_STAPLING 3 | 18 | .Dt TLS_CONFIG_OCSP_REQUIRE_STAPLING 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| 21 | .Nm tls_config_ocsp_require_stapling | 21 | .Nm tls_config_ocsp_require_stapling |
| 22 | .Nd OCSP configuration for libtls | 22 | .Nd OCSP configuration for libtls |
| 23 | .Sh SYNOPSIS | 23 | .Sh SYNOPSIS |
| 24 | .Lb libtls libssl libcrypto | ||
| 24 | .In tls.h | 25 | .In tls.h |
| 25 | .Ft void | 26 | .Ft void |
| 26 | .Fn tls_config_ocsp_require_stapling "struct tls_config *config" | 27 | .Fn tls_config_ocsp_require_stapling "struct tls_config *config" |
diff --git a/src/lib/libtls/man/tls_config_set_protocols.3 b/src/lib/libtls/man/tls_config_set_protocols.3 index 32b8cce757..403bc10b82 100644 --- a/src/lib/libtls/man/tls_config_set_protocols.3 +++ b/src/lib/libtls/man/tls_config_set_protocols.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: tls_config_set_protocols.3,v 1.12 2023/07/02 06:37:27 beck Exp $ | 1 | .\" $OpenBSD: tls_config_set_protocols.3,v 1.13 2025/07/07 10:54:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> | 3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> |
| 4 | .\" Copyright (c) 2015, 2016 Joel Sing <jsing@openbsd.org> | 4 | .\" Copyright (c) 2015, 2016 Joel Sing <jsing@openbsd.org> |
| @@ -16,7 +16,7 @@ | |||
| 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 18 | .\" | 18 | .\" |
| 19 | .Dd $Mdocdate: July 2 2023 $ | 19 | .Dd $Mdocdate: July 7 2025 $ |
| 20 | .Dt TLS_CONFIG_SET_PROTOCOLS 3 | 20 | .Dt TLS_CONFIG_SET_PROTOCOLS 3 |
| 21 | .Os | 21 | .Os |
| 22 | .Sh NAME | 22 | .Sh NAME |
| @@ -26,10 +26,12 @@ | |||
| 26 | .Nm tls_config_set_ciphers , | 26 | .Nm tls_config_set_ciphers , |
| 27 | .Nm tls_config_set_dheparams , | 27 | .Nm tls_config_set_dheparams , |
| 28 | .Nm tls_config_set_ecdhecurves , | 28 | .Nm tls_config_set_ecdhecurves , |
| 29 | .\" .Nm tls_config_set_ecdhecurve is intentionally undocumented. | ||
| 29 | .Nm tls_config_prefer_ciphers_client , | 30 | .Nm tls_config_prefer_ciphers_client , |
| 30 | .Nm tls_config_prefer_ciphers_server | 31 | .Nm tls_config_prefer_ciphers_server |
| 31 | .Nd TLS protocol and cipher selection | 32 | .Nd TLS protocol and cipher selection |
| 32 | .Sh SYNOPSIS | 33 | .Sh SYNOPSIS |
| 34 | .Lb libtls libssl libcrypto | ||
| 33 | .In tls.h | 35 | .In tls.h |
| 34 | .Ft int | 36 | .Ft int |
| 35 | .Fo tls_config_set_protocols | 37 | .Fo tls_config_set_protocols |
diff --git a/src/lib/libtls/man/tls_config_set_session_id.3 b/src/lib/libtls/man/tls_config_set_session_id.3 index d969e01e33..a869b3f24c 100644 --- a/src/lib/libtls/man/tls_config_set_session_id.3 +++ b/src/lib/libtls/man/tls_config_set_session_id.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: tls_config_set_session_id.3,v 1.5 2018/02/10 06:07:43 jsing Exp $ | 1 | .\" $OpenBSD: tls_config_set_session_id.3,v 1.6 2025/07/07 10:54:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2017 Claudio Jeker <claudio@openbsd.org> | 3 | .\" Copyright (c) 2017 Claudio Jeker <claudio@openbsd.org> |
| 4 | .\" Copyright (c) 2018 Joel Sing <jsing@openbsd.org> | 4 | .\" Copyright (c) 2018 Joel Sing <jsing@openbsd.org> |
| @@ -15,7 +15,7 @@ | |||
| 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 | .\" | 17 | .\" |
| 18 | .Dd $Mdocdate: February 10 2018 $ | 18 | .Dd $Mdocdate: July 7 2025 $ |
| 19 | .Dt TLS_CONFIG_SET_SESSION_ID 3 | 19 | .Dt TLS_CONFIG_SET_SESSION_ID 3 |
| 20 | .Os | 20 | .Os |
| 21 | .Sh NAME | 21 | .Sh NAME |
| @@ -25,6 +25,7 @@ | |||
| 25 | .Nm tls_config_add_ticket_key | 25 | .Nm tls_config_add_ticket_key |
| 26 | .Nd configure resuming of TLS handshakes | 26 | .Nd configure resuming of TLS handshakes |
| 27 | .Sh SYNOPSIS | 27 | .Sh SYNOPSIS |
| 28 | .Lb libtls libssl libcrypto | ||
| 28 | .In tls.h | 29 | .In tls.h |
| 29 | .Ft int | 30 | .Ft int |
| 30 | .Fo tls_config_set_session_fd | 31 | .Fo tls_config_set_session_fd |
diff --git a/src/lib/libtls/man/tls_config_verify.3 b/src/lib/libtls/man/tls_config_verify.3 index 4a43c834d7..d5b29e858e 100644 --- a/src/lib/libtls/man/tls_config_verify.3 +++ b/src/lib/libtls/man/tls_config_verify.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: tls_config_verify.3,v 1.4 2017/03/02 11:05:50 jmc Exp $ | 1 | .\" $OpenBSD: tls_config_verify.3,v 1.5 2025/07/07 10:54:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> | 3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> |
| 4 | .\" Copyright (c) 2015 Joel Sing <jsing@openbsd.org> | 4 | .\" Copyright (c) 2015 Joel Sing <jsing@openbsd.org> |
| @@ -15,7 +15,7 @@ | |||
| 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 | .\" | 17 | .\" |
| 18 | .Dd $Mdocdate: March 2 2017 $ | 18 | .Dd $Mdocdate: July 7 2025 $ |
| 19 | .Dt TLS_CONFIG_VERIFY 3 | 19 | .Dt TLS_CONFIG_VERIFY 3 |
| 20 | .Os | 20 | .Os |
| 21 | .Sh NAME | 21 | .Sh NAME |
| @@ -25,6 +25,7 @@ | |||
| 25 | .Nm tls_config_insecure_noverifytime | 25 | .Nm tls_config_insecure_noverifytime |
| 26 | .Nd insecure TLS configuration | 26 | .Nd insecure TLS configuration |
| 27 | .Sh SYNOPSIS | 27 | .Sh SYNOPSIS |
| 28 | .Lb libtls libssl libcrypto | ||
| 28 | .In tls.h | 29 | .In tls.h |
| 29 | .Ft void | 30 | .Ft void |
| 30 | .Fn tls_config_verify "struct tls_config *config" | 31 | .Fn tls_config_verify "struct tls_config *config" |
diff --git a/src/lib/libtls/man/tls_conn_version.3 b/src/lib/libtls/man/tls_conn_version.3 index 8fb30624d7..3a386cf11f 100644 --- a/src/lib/libtls/man/tls_conn_version.3 +++ b/src/lib/libtls/man/tls_conn_version.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: tls_conn_version.3,v 1.11 2024/12/10 08:42:12 tb Exp $ | 1 | .\" $OpenBSD: tls_conn_version.3,v 1.12 2025/07/07 10:54:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2015 Bob Beck <beck@openbsd.org> | 3 | .\" Copyright (c) 2015 Bob Beck <beck@openbsd.org> |
| 4 | .\" Copyright (c) 2016, 2018 Joel Sing <jsing@openbsd.org> | 4 | .\" Copyright (c) 2016, 2018 Joel Sing <jsing@openbsd.org> |
| @@ -15,7 +15,7 @@ | |||
| 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 | .\" | 17 | .\" |
| 18 | .Dd $Mdocdate: December 10 2024 $ | 18 | .Dd $Mdocdate: July 7 2025 $ |
| 19 | .Dt TLS_CONN_VERSION 3 | 19 | .Dt TLS_CONN_VERSION 3 |
| 20 | .Os | 20 | .Os |
| 21 | .Sh NAME | 21 | .Sh NAME |
| @@ -36,6 +36,7 @@ | |||
| 36 | .Nm tls_peer_cert_notafter | 36 | .Nm tls_peer_cert_notafter |
| 37 | .Nd inspect an established TLS connection | 37 | .Nd inspect an established TLS connection |
| 38 | .Sh SYNOPSIS | 38 | .Sh SYNOPSIS |
| 39 | .Lb libtls libssl libcrypto | ||
| 39 | .In tls.h | 40 | .In tls.h |
| 40 | .Ft const char * | 41 | .Ft const char * |
| 41 | .Fn tls_conn_version "struct tls *ctx" | 42 | .Fn tls_conn_version "struct tls *ctx" |
diff --git a/src/lib/libtls/man/tls_connect.3 b/src/lib/libtls/man/tls_connect.3 index 4c4f01c256..95a18864b2 100644 --- a/src/lib/libtls/man/tls_connect.3 +++ b/src/lib/libtls/man/tls_connect.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: tls_connect.3,v 1.4 2018/07/09 19:51:18 tb Exp $ | 1 | .\" $OpenBSD: tls_connect.3,v 1.5 2025/07/07 10:54:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> | 3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> |
| 4 | .\" Copyright (c) 2014, 2015 Joel Sing <jsing@openbsd.org> | 4 | .\" Copyright (c) 2014, 2015 Joel Sing <jsing@openbsd.org> |
| @@ -16,7 +16,7 @@ | |||
| 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 18 | .\" | 18 | .\" |
| 19 | .Dd $Mdocdate: July 9 2018 $ | 19 | .Dd $Mdocdate: July 7 2025 $ |
| 20 | .Dt TLS_CONNECT 3 | 20 | .Dt TLS_CONNECT 3 |
| 21 | .Os | 21 | .Os |
| 22 | .Sh NAME | 22 | .Sh NAME |
| @@ -27,6 +27,7 @@ | |||
| 27 | .Nm tls_connect_cbs | 27 | .Nm tls_connect_cbs |
| 28 | .Nd instruct a TLS client to establish a connection | 28 | .Nd instruct a TLS client to establish a connection |
| 29 | .Sh SYNOPSIS | 29 | .Sh SYNOPSIS |
| 30 | .Lb libtls libssl libcrypto | ||
| 30 | .In tls.h | 31 | .In tls.h |
| 31 | .Ft int | 32 | .Ft int |
| 32 | .Fo tls_connect | 33 | .Fo tls_connect |
diff --git a/src/lib/libtls/man/tls_init.3 b/src/lib/libtls/man/tls_init.3 index 557998107c..69879c04c7 100644 --- a/src/lib/libtls/man/tls_init.3 +++ b/src/lib/libtls/man/tls_init.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: tls_init.3,v 1.13 2018/07/09 19:47:20 tb Exp $ | 1 | .\" $OpenBSD: tls_init.3,v 1.14 2025/07/07 10:54:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> | 3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> |
| 4 | .\" Copyright (c) 2016 Joel Sing <jsing@openbsd.org> | 4 | .\" Copyright (c) 2016 Joel Sing <jsing@openbsd.org> |
| @@ -16,7 +16,7 @@ | |||
| 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 18 | .\" | 18 | .\" |
| 19 | .Dd $Mdocdate: July 9 2018 $ | 19 | .Dd $Mdocdate: July 7 2025 $ |
| 20 | .Dt TLS_INIT 3 | 20 | .Dt TLS_INIT 3 |
| 21 | .Os | 21 | .Os |
| 22 | .Sh NAME | 22 | .Sh NAME |
| @@ -26,6 +26,7 @@ | |||
| 26 | .Nm tls_config_error | 26 | .Nm tls_config_error |
| 27 | .Nd initialize TLS client and server API | 27 | .Nd initialize TLS client and server API |
| 28 | .Sh SYNOPSIS | 28 | .Sh SYNOPSIS |
| 29 | .Lb libtls libssl libcrypto | ||
| 29 | .In tls.h | 30 | .In tls.h |
| 30 | .Ft int | 31 | .Ft int |
| 31 | .Fn tls_init void | 32 | .Fn tls_init void |
diff --git a/src/lib/libtls/man/tls_load_file.3 b/src/lib/libtls/man/tls_load_file.3 index cf33b575ef..33f486d530 100644 --- a/src/lib/libtls/man/tls_load_file.3 +++ b/src/lib/libtls/man/tls_load_file.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: tls_load_file.3,v 1.14 2022/01/01 02:18:28 jsg Exp $ | 1 | .\" $OpenBSD: tls_load_file.3,v 1.15 2025/07/07 10:54:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> | 3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> |
| 4 | .\" Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org> | 4 | .\" Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org> |
| @@ -17,7 +17,7 @@ | |||
| 17 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 17 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 18 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 18 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 19 | .\" | 19 | .\" |
| 20 | .Dd $Mdocdate: January 1 2022 $ | 20 | .Dd $Mdocdate: July 7 2025 $ |
| 21 | .Dt TLS_LOAD_FILE 3 | 21 | .Dt TLS_LOAD_FILE 3 |
| 22 | .Os | 22 | .Os |
| 23 | .Sh NAME | 23 | .Sh NAME |
| @@ -49,6 +49,7 @@ | |||
| 49 | .Nm tls_default_ca_cert_file | 49 | .Nm tls_default_ca_cert_file |
| 50 | .Nd TLS certificate and key configuration | 50 | .Nd TLS certificate and key configuration |
| 51 | .Sh SYNOPSIS | 51 | .Sh SYNOPSIS |
| 52 | .Lb libtls libssl libcrypto | ||
| 52 | .In tls.h | 53 | .In tls.h |
| 53 | .Ft uint8_t * | 54 | .Ft uint8_t * |
| 54 | .Fo tls_load_file | 55 | .Fo tls_load_file |
diff --git a/src/lib/libtls/man/tls_ocsp_process_response.3 b/src/lib/libtls/man/tls_ocsp_process_response.3 index 6e3aa4aecc..e7b57a6827 100644 --- a/src/lib/libtls/man/tls_ocsp_process_response.3 +++ b/src/lib/libtls/man/tls_ocsp_process_response.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: tls_ocsp_process_response.3,v 1.6 2018/07/24 02:01:34 tb Exp $ | 1 | .\" $OpenBSD: tls_ocsp_process_response.3,v 1.7 2025/07/07 10:54:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Bob Beck <beck@openbsd.org> | 3 | .\" Copyright (c) 2016 Bob Beck <beck@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: July 24 2018 $ | 17 | .Dd $Mdocdate: July 7 2025 $ |
| 18 | .Dt TLS_OCSP_PROCESS_RESPONSE 3 | 18 | .Dt TLS_OCSP_PROCESS_RESPONSE 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -29,6 +29,7 @@ | |||
| 29 | .Nm tls_peer_ocsp_next_update | 29 | .Nm tls_peer_ocsp_next_update |
| 30 | .Nd inspect an OCSP response | 30 | .Nd inspect an OCSP response |
| 31 | .Sh SYNOPSIS | 31 | .Sh SYNOPSIS |
| 32 | .Lb libtls libssl libcrypto | ||
| 32 | .In tls.h | 33 | .In tls.h |
| 33 | .Ft int | 34 | .Ft int |
| 34 | .Fo tls_ocsp_process_response | 35 | .Fo tls_ocsp_process_response |
diff --git a/src/lib/libtls/man/tls_read.3 b/src/lib/libtls/man/tls_read.3 index f9d949eef5..f72e63cf63 100644 --- a/src/lib/libtls/man/tls_read.3 +++ b/src/lib/libtls/man/tls_read.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: tls_read.3,v 1.8 2023/09/18 17:25:15 schwarze Exp $ | 1 | .\" $OpenBSD: tls_read.3,v 1.9 2025/07/07 10:54:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2014, 2015 Ted Unangst <tedu@openbsd.org> | 3 | .\" Copyright (c) 2014, 2015 Ted Unangst <tedu@openbsd.org> |
| 4 | .\" Copyright (c) 2015 Doug Hogan <doug@openbsd.org> | 4 | .\" Copyright (c) 2015 Doug Hogan <doug@openbsd.org> |
| @@ -18,7 +18,7 @@ | |||
| 18 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 18 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 19 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 19 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 20 | .\" | 20 | .\" |
| 21 | .Dd $Mdocdate: September 18 2023 $ | 21 | .Dd $Mdocdate: July 7 2025 $ |
| 22 | .Dt TLS_READ 3 | 22 | .Dt TLS_READ 3 |
| 23 | .Os | 23 | .Os |
| 24 | .Sh NAME | 24 | .Sh NAME |
| @@ -29,6 +29,7 @@ | |||
| 29 | .Nm tls_close | 29 | .Nm tls_close |
| 30 | .Nd use a TLS connection | 30 | .Nd use a TLS connection |
| 31 | .Sh SYNOPSIS | 31 | .Sh SYNOPSIS |
| 32 | .Lb libtls libssl libcrypto | ||
| 32 | .In tls.h | 33 | .In tls.h |
| 33 | .Ft ssize_t | 34 | .Ft ssize_t |
| 34 | .Fo tls_read | 35 | .Fo tls_read |
diff --git a/src/lib/libtls/shlib_version b/src/lib/libtls/shlib_version index 3040494c17..715847ed94 100644 --- a/src/lib/libtls/shlib_version +++ b/src/lib/libtls/shlib_version | |||
| @@ -1,2 +1,2 @@ | |||
| 1 | major=32 | 1 | major=33 |
| 2 | minor=1 | 2 | minor=2 |
diff --git a/src/lib/libtls/tls_server.c b/src/lib/libtls/tls_server.c index a94b4221ed..42a697327a 100644 --- a/src/lib/libtls/tls_server.c +++ b/src/lib/libtls/tls_server.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls_server.c,v 1.51 2024/03/26 08:54:48 joshua Exp $ */ | 1 | /* $OpenBSD: tls_server.c,v 1.52 2025/06/04 10:25:30 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -75,7 +75,7 @@ tls_server_alpn_cb(SSL *ssl, const unsigned char **out, unsigned char *outlen, | |||
| 75 | OPENSSL_NPN_NEGOTIATED) | 75 | OPENSSL_NPN_NEGOTIATED) |
| 76 | return (SSL_TLSEXT_ERR_OK); | 76 | return (SSL_TLSEXT_ERR_OK); |
| 77 | 77 | ||
| 78 | return (SSL_TLSEXT_ERR_NOACK); | 78 | return (SSL_TLSEXT_ERR_ALERT_FATAL); |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | static int | 81 | static int |
diff --git a/src/regress/lib/libc/Makefile b/src/regress/lib/libc/Makefile index 81d8779db0..7a8db225ef 100644 --- a/src/regress/lib/libc/Makefile +++ b/src/regress/lib/libc/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.60 2025/04/14 17:33:48 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.62 2025/08/04 06:10:40 tb Exp $ |
| 2 | 2 | ||
| 3 | SUBDIR+= _setjmp | 3 | SUBDIR+= _setjmp |
| 4 | SUBDIR+= alloca arc4random-fork atexit | 4 | SUBDIR+= alloca arc4random-fork atexit |
| @@ -11,7 +11,7 @@ SUBDIR+= ffs fmemopen fnmatch fpclassify fread | |||
| 11 | SUBDIR+= gcvt getaddrinfo getcap getopt getopt_long glob | 11 | SUBDIR+= gcvt getaddrinfo getcap getopt getopt_long glob |
| 12 | SUBDIR+= hash | 12 | SUBDIR+= hash |
| 13 | SUBDIR+= hsearch | 13 | SUBDIR+= hsearch |
| 14 | SUBDIR+= ieeefp ifnameindex | 14 | SUBDIR+= ieeefp ifnameindex illumos |
| 15 | SUBDIR+= ldexp locale longjmp | 15 | SUBDIR+= ldexp locale longjmp |
| 16 | SUBDIR+= malloc mkstemp modf | 16 | SUBDIR+= malloc mkstemp modf |
| 17 | SUBDIR+= netdb | 17 | SUBDIR+= netdb |
| @@ -19,9 +19,9 @@ SUBDIR+= open_memstream orientation | |||
| 19 | SUBDIR+= popen printf | 19 | SUBDIR+= popen printf |
| 20 | SUBDIR+= qsort | 20 | SUBDIR+= qsort |
| 21 | SUBDIR+= regex | 21 | SUBDIR+= regex |
| 22 | SUBDIR+= setjmp setjmp-signal sigsetjmp sigthr sleep sprintf stdio_threading | 22 | SUBDIR+= setjmp setjmp-signal sigsetjmp sigthr sleep sprintf stdio |
| 23 | SUBDIR+= stpncpy strchr strerror strlcat strlcpy strnlen strtod strtol strtonum | 23 | SUBDIR+= stdio_threading stpncpy strchr strerror strlcat strlcpy strnlen |
| 24 | SUBDIR+= sys | 24 | SUBDIR+= strtod strtol strtonum sys |
| 25 | SUBDIR+= telldir time timingsafe | 25 | SUBDIR+= telldir time timingsafe |
| 26 | SUBDIR+= uuid | 26 | SUBDIR+= uuid |
| 27 | SUBDIR+= vis | 27 | SUBDIR+= vis |
diff --git a/src/regress/lib/libc/elf_aux_info/elf_aux_info.c b/src/regress/lib/libc/elf_aux_info/elf_aux_info.c index 14870e253c..e78d282283 100644 --- a/src/regress/lib/libc/elf_aux_info/elf_aux_info.c +++ b/src/regress/lib/libc/elf_aux_info/elf_aux_info.c | |||
| @@ -9,6 +9,7 @@ main(void) | |||
| 9 | int ret = 0; | 9 | int ret = 0; |
| 10 | int a; | 10 | int a; |
| 11 | unsigned long b; | 11 | unsigned long b; |
| 12 | unsigned long long c; | ||
| 12 | 13 | ||
| 13 | /* Should always succeed */ | 14 | /* Should always succeed */ |
| 14 | if (elf_aux_info(AT_PAGESZ, &a, sizeof(a))) | 15 | if (elf_aux_info(AT_PAGESZ, &a, sizeof(a))) |
| @@ -17,7 +18,7 @@ main(void) | |||
| 17 | fprintf(stderr, "AT_PAGESZ %d\n", a); | 18 | fprintf(stderr, "AT_PAGESZ %d\n", a); |
| 18 | 19 | ||
| 19 | /* Wrong size */ | 20 | /* Wrong size */ |
| 20 | if (elf_aux_info(AT_PAGESZ, &b, sizeof(b)) != EINVAL) | 21 | if (elf_aux_info(AT_PAGESZ, &c, sizeof(c)) != EINVAL) |
| 21 | ret |= 2; | 22 | ret |= 2; |
| 22 | 23 | ||
| 23 | /* Invalid request */ | 24 | /* Invalid request */ |
diff --git a/src/regress/lib/libc/explicit_bzero/explicit_bzero.c b/src/regress/lib/libc/explicit_bzero/explicit_bzero.c index 496bafb208..30c86290e8 100644 --- a/src/regress/lib/libc/explicit_bzero/explicit_bzero.c +++ b/src/regress/lib/libc/explicit_bzero/explicit_bzero.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: explicit_bzero.c,v 1.9 2022/02/10 08:39:32 tb Exp $ */ | 1 | /* $OpenBSD: explicit_bzero.c,v 1.10 2025/05/31 15:31:40 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014 Google Inc. | 3 | * Copyright (c) 2014 Google Inc. |
| 4 | * | 4 | * |
| @@ -28,9 +28,11 @@ | |||
| 28 | 28 | ||
| 29 | #if defined(__has_feature) | 29 | #if defined(__has_feature) |
| 30 | #if __has_feature(address_sanitizer) | 30 | #if __has_feature(address_sanitizer) |
| 31 | #ifndef __SANITIZE_ADDRESS__ | ||
| 31 | #define __SANITIZE_ADDRESS__ | 32 | #define __SANITIZE_ADDRESS__ |
| 32 | #endif | 33 | #endif |
| 33 | #endif | 34 | #endif |
| 35 | #endif | ||
| 34 | #ifdef __SANITIZE_ADDRESS__ | 36 | #ifdef __SANITIZE_ADDRESS__ |
| 35 | #define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address)) | 37 | #define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address)) |
| 36 | #else | 38 | #else |
diff --git a/src/regress/lib/libc/hash/Makefile b/src/regress/lib/libc/hash/Makefile index 54e4baace8..9bd69bf8df 100644 --- a/src/regress/lib/libc/hash/Makefile +++ b/src/regress/lib/libc/hash/Makefile | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.2 2025/04/14 18:33:56 tb Exp $ | ||
| 2 | |||
| 1 | PROG = hash_test | 3 | PROG = hash_test |
| 2 | 4 | ||
| 3 | .include <bsd.regress.mk> | 5 | .include <bsd.regress.mk> |
diff --git a/src/regress/lib/libc/hash/hash_test.c b/src/regress/lib/libc/hash/hash_test.c index 67b1f380ed..c04a0458fe 100644 --- a/src/regress/lib/libc/hash/hash_test.c +++ b/src/regress/lib/libc/hash/hash_test.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: hash_test.c,v 1.1.1.1 2025/04/14 17:32:05 tb Exp $ */ | 1 | /* $OpenBSD: hash_test.c,v 1.3 2025/08/02 06:05:13 tb Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (c) 2025 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2025 Theo Buehler <tb@openbsd.org> |
| @@ -25,8 +25,6 @@ | |||
| 25 | #include <stdio.h> | 25 | #include <stdio.h> |
| 26 | #include <string.h> | 26 | #include <string.h> |
| 27 | 27 | ||
| 28 | #define ALL_HASHES_ALLOW_NULL 0 | ||
| 29 | |||
| 30 | #define MAX_DIGEST_LENGTH SHA512_DIGEST_LENGTH | 28 | #define MAX_DIGEST_LENGTH SHA512_DIGEST_LENGTH |
| 31 | 29 | ||
| 32 | struct hash_test_case { | 30 | struct hash_test_case { |
| @@ -48,14 +46,12 @@ enum { | |||
| 48 | 46 | ||
| 49 | /* RFC 1321, Appendix A.5 */ | 47 | /* RFC 1321, Appendix A.5 */ |
| 50 | static const struct hash_test_case md5_tests[] = { | 48 | static const struct hash_test_case md5_tests[] = { |
| 51 | #if ALL_HASHES_ALLOW_NULL | ||
| 52 | { | 49 | { |
| 53 | .out = { | 50 | .out = { |
| 54 | 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04, | 51 | 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04, |
| 55 | 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e, | 52 | 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e, |
| 56 | }, | 53 | }, |
| 57 | }, | 54 | }, |
| 58 | #endif | ||
| 59 | { | 55 | { |
| 60 | .in = "", | 56 | .in = "", |
| 61 | .out = { | 57 | .out = { |
| @@ -131,7 +127,6 @@ md5_final(void *digest, void *ctx) | |||
| 131 | 127 | ||
| 132 | /* https://homes.esat.kuleuven.be/~bosselae/ripemd160.html */ | 128 | /* https://homes.esat.kuleuven.be/~bosselae/ripemd160.html */ |
| 133 | static const struct hash_test_case rmd160_tests[] = { | 129 | static const struct hash_test_case rmd160_tests[] = { |
| 134 | #if ALL_HASHES_ALLOW_NULL | ||
| 135 | { | 130 | { |
| 136 | .out = { | 131 | .out = { |
| 137 | 0x9c, 0x11, 0x85, 0xa5, 0xc5, 0xe9, 0xfc, 0x54, | 132 | 0x9c, 0x11, 0x85, 0xa5, 0xc5, 0xe9, 0xfc, 0x54, |
| @@ -139,7 +134,6 @@ static const struct hash_test_case rmd160_tests[] = { | |||
| 139 | 0xb2, 0x25, 0x8d, 0x31, | 134 | 0xb2, 0x25, 0x8d, 0x31, |
| 140 | }, | 135 | }, |
| 141 | }, | 136 | }, |
| 142 | #endif | ||
| 143 | { | 137 | { |
| 144 | .in = "", | 138 | .in = "", |
| 145 | .out = { | 139 | .out = { |
| @@ -231,7 +225,6 @@ rmd160_final(void *digest, void *ctx) | |||
| 231 | 225 | ||
| 232 | /* RFC 3174 - Appendix A (plus two zero-length tests) */ | 226 | /* RFC 3174 - Appendix A (plus two zero-length tests) */ |
| 233 | static const struct hash_test_case sha1_tests[] = { | 227 | static const struct hash_test_case sha1_tests[] = { |
| 234 | #if ALL_HASHES_ALLOW_NULL | ||
| 235 | { | 228 | { |
| 236 | .out = { | 229 | .out = { |
| 237 | 0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d, | 230 | 0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d, |
| @@ -239,7 +232,6 @@ static const struct hash_test_case sha1_tests[] = { | |||
| 239 | 0xaf, 0xd8, 0x07, 0x09, | 232 | 0xaf, 0xd8, 0x07, 0x09, |
| 240 | }, | 233 | }, |
| 241 | }, | 234 | }, |
| 242 | #endif | ||
| 243 | { | 235 | { |
| 244 | .in = "", | 236 | .in = "", |
| 245 | .out = { | 237 | .out = { |
| @@ -765,7 +757,7 @@ struct hash_ctx { | |||
| 765 | void *ctx; | 757 | void *ctx; |
| 766 | void (*init)(void *); | 758 | void (*init)(void *); |
| 767 | void (*update)(void *, const uint8_t *, size_t); | 759 | void (*update)(void *, const uint8_t *, size_t); |
| 768 | void (*final)(void *, void *final); | 760 | void (*final)(void *, void *); |
| 769 | }; | 761 | }; |
| 770 | 762 | ||
| 771 | static const struct hash_tests { | 763 | static const struct hash_tests { |
| @@ -822,7 +814,7 @@ hash_test_case(struct hash_ctx *ctx, const struct hash_test_case *tc, | |||
| 822 | size_t in_len = tc->in != NULL ? strlen(tc->in) : 0; | 814 | size_t in_len = tc->in != NULL ? strlen(tc->in) : 0; |
| 823 | 815 | ||
| 824 | ctx->init(ctx->ctx); | 816 | ctx->init(ctx->ctx); |
| 825 | ctx->update(ctx->ctx, (uint8_t *)tc->in, in_len); | 817 | ctx->update(ctx->ctx, (const uint8_t *)tc->in, in_len); |
| 826 | ctx->final(ctx->digest, ctx->ctx); | 818 | ctx->final(ctx->digest, ctx->ctx); |
| 827 | 819 | ||
| 828 | if (memcmp(tc->out, ctx->digest, ctx->digest_len) != 0) { | 820 | if (memcmp(tc->out, ctx->digest, ctx->digest_len) != 0) { |
diff --git a/src/regress/lib/libc/illumos/Makefile b/src/regress/lib/libc/illumos/Makefile new file mode 100644 index 0000000000..cf2d22eb44 --- /dev/null +++ b/src/regress/lib/libc/illumos/Makefile | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.1.1.1 2025/08/02 06:16:34 tb Exp $ | ||
| 2 | |||
| 3 | SUBDIR += oclo | ||
| 4 | |||
| 5 | install: | ||
| 6 | |||
| 7 | .include <bsd.subdir.mk> | ||
diff --git a/src/regress/lib/libc/illumos/Makefile.inc b/src/regress/lib/libc/illumos/Makefile.inc new file mode 100644 index 0000000000..4296b6e690 --- /dev/null +++ b/src/regress/lib/libc/illumos/Makefile.inc | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | # $OpenBSD: Makefile.inc,v 1.1.1.1 2025/08/02 06:16:34 tb Exp $ | ||
| 2 | |||
| 3 | ILLUMOS_OS_TESTDIR = /usr/local/share/illumos-os-tests | ||
| 4 | |||
| 5 | .if !exists(${ILLUMOS_OS_TESTDIR}) | ||
| 6 | regress: | ||
| 7 | @echo package illumos-os-tests is required for this regress | ||
| 8 | @echo SKIPPED | ||
| 9 | .endif | ||
diff --git a/src/regress/lib/libc/illumos/oclo/Makefile b/src/regress/lib/libc/illumos/oclo/Makefile new file mode 100644 index 0000000000..284e49dc73 --- /dev/null +++ b/src/regress/lib/libc/illumos/oclo/Makefile | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.2 2025/08/09 18:17:42 anton Exp $ | ||
| 2 | |||
| 3 | .if exists(/usr/local/share/illumos-os-tests) | ||
| 4 | |||
| 5 | PROGS = oclo | ||
| 6 | PROGS += oclo_errors | ||
| 7 | PROGS += ocloexec_verify | ||
| 8 | |||
| 9 | LDADD_ocloexec_verify = -lkvm | ||
| 10 | |||
| 11 | WARNINGS = yes | ||
| 12 | |||
| 13 | regress: ${PROGS} | ||
| 14 | |||
| 15 | .PATH: /usr/local/share/illumos-os-tests/tests/oclo | ||
| 16 | .endif | ||
| 17 | |||
| 18 | .include <bsd.regress.mk> | ||
diff --git a/src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c b/src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c index 486c247f0d..57d799f49d 100644 --- a/src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c +++ b/src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: malloc_errs.c,v 1.5 2024/04/14 17:47:41 otto Exp $ */ | 1 | /* $OpenBSD: malloc_errs.c,v 1.6 2025/05/24 06:40:29 otto Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Otto Moerbeek <otto@drijf.net> | 3 | * Copyright (c) 2023 Otto Moerbeek <otto@drijf.net> |
| 4 | * | 4 | * |
| @@ -286,11 +286,10 @@ int main(int argc, char *argv[]) | |||
| 286 | int i, status; | 286 | int i, status; |
| 287 | pid_t pid; | 287 | pid_t pid; |
| 288 | char num[10]; | 288 | char num[10]; |
| 289 | char options[10]; | 289 | char options[40]; |
| 290 | extern char* malloc_options; | 290 | char const *env[2]; |
| 291 | 291 | ||
| 292 | if (argc == 3) { | 292 | if (argc == 2) { |
| 293 | malloc_options = argv[2]; | ||
| 294 | /* prevent coredumps */ | 293 | /* prevent coredumps */ |
| 295 | setrlimit(RLIMIT_CORE, &lim); | 294 | setrlimit(RLIMIT_CORE, &lim); |
| 296 | i = atoi(argv[1]); | 295 | i = atoi(argv[1]); |
| @@ -303,9 +302,11 @@ int main(int argc, char *argv[]) | |||
| 303 | pid = fork(); | 302 | pid = fork(); |
| 304 | switch (pid) { | 303 | switch (pid) { |
| 305 | case 0: | 304 | case 0: |
| 306 | snprintf(options, sizeof(options), "us%s", tests[i].flags); | 305 | snprintf(options, sizeof(options), "MALLOC_OPTIONS=us%s", tests[i].flags); |
| 307 | snprintf(num, sizeof(num), "%d", i); | 306 | snprintf(num, sizeof(num), "%d", i); |
| 308 | execl(argv[0], argv[0], num, options, NULL); | 307 | env[0] = options; |
| 308 | env[1] = NULL; | ||
| 309 | execle(argv[0], argv[0], num, NULL, env); | ||
| 309 | err(1, "exec"); | 310 | err(1, "exec"); |
| 310 | break; | 311 | break; |
| 311 | case -1: | 312 | case -1: |
diff --git a/src/regress/lib/libc/malloc/malloc_general/malloc_general.c b/src/regress/lib/libc/malloc/malloc_general/malloc_general.c index b243787bcf..b0387ce64e 100644 --- a/src/regress/lib/libc/malloc/malloc_general/malloc_general.c +++ b/src/regress/lib/libc/malloc/malloc_general/malloc_general.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: malloc_general.c,v 1.7 2022/01/09 07:18:50 otto Exp $ */ | 1 | /* $OpenBSD: malloc_general.c,v 1.8 2025/10/26 21:25:12 miod Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2017 Otto Moerbeek <otto@drijf.net> | 3 | * Copyright (c) 2017 Otto Moerbeek <otto@drijf.net> |
| 4 | * | 4 | * |
| @@ -24,6 +24,12 @@ | |||
| 24 | 24 | ||
| 25 | #define N 1000 | 25 | #define N 1000 |
| 26 | 26 | ||
| 27 | #if defined(_LP64) | ||
| 28 | #define COUNT 800000 | ||
| 29 | #else | ||
| 30 | #define COUNT 20000 | ||
| 31 | #endif | ||
| 32 | |||
| 27 | size_t | 33 | size_t |
| 28 | size(void) | 34 | size(void) |
| 29 | { | 35 | { |
| @@ -59,7 +65,7 @@ main(int argc, char *argv[]) | |||
| 59 | void * q; | 65 | void * q; |
| 60 | size_t sz; | 66 | size_t sz; |
| 61 | 67 | ||
| 62 | for (count = 0; count < 800000; count++) { | 68 | for (count = 0; count < COUNT; count++) { |
| 63 | if (count % 10000 == 0) { | 69 | if (count % 10000 == 0) { |
| 64 | printf("."); | 70 | printf("."); |
| 65 | fflush(stdout); | 71 | fflush(stdout); |
diff --git a/src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c b/src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c index 799d2b9117..7e53c32dbc 100644 --- a/src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c +++ b/src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: malloc_ulimit1.c,v 1.5 2019/06/12 11:31:36 bluhm Exp $ */ | 1 | /* $OpenBSD: malloc_ulimit1.c,v 1.6 2025/05/24 06:47:27 otto Exp $ */ |
| 2 | 2 | ||
| 3 | /* Public Domain, 2006, Otto Moerbeek <otto@drijf.net> */ | 3 | /* Public Domain, 2006, Otto Moerbeek <otto@drijf.net> */ |
| 4 | 4 | ||
| @@ -23,7 +23,7 @@ | |||
| 23 | #define FACTOR 1024 | 23 | #define FACTOR 1024 |
| 24 | 24 | ||
| 25 | /* This test takes forever with junking turned on. */ | 25 | /* This test takes forever with junking turned on. */ |
| 26 | char *malloc_options = "jj"; | 26 | const char * const malloc_options = "jj"; |
| 27 | 27 | ||
| 28 | int | 28 | int |
| 29 | main() | 29 | main() |
diff --git a/src/regress/lib/libc/stdio/Makefile b/src/regress/lib/libc/stdio/Makefile new file mode 100644 index 0000000000..f1e980f688 --- /dev/null +++ b/src/regress/lib/libc/stdio/Makefile | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.4 2025/06/03 14:35:27 yasuoka Exp $ | ||
| 2 | |||
| 3 | PROGS= test_fflush | ||
| 4 | CLEANFILES= test_fflush.tmp | ||
| 5 | |||
| 6 | PROGS+= test_ungetwc | ||
| 7 | CLEANFILES+= test_ungetwc.tmp | ||
| 8 | |||
| 9 | PROGS+= test___freading | ||
| 10 | CLEANFILES+= test___freading.tmp | ||
| 11 | |||
| 12 | PROGS+= test___fwriting | ||
| 13 | CLEANFILES+= test___fwriting.tmp | ||
| 14 | |||
| 15 | PROGS+= test___fpending | ||
| 16 | CLEANFILES+= test___fpending.tmp | ||
| 17 | |||
| 18 | PROGS+= test___freadahead | ||
| 19 | CLEANFILES+= test___freadahead.tmp | ||
| 20 | |||
| 21 | PROGS+= test___freadptr | ||
| 22 | CLEANFILES+= test___freadptr.tmp | ||
| 23 | |||
| 24 | PROGS+= test___fseterr | ||
| 25 | CLEANFILES+= test___fseterr.tmp | ||
| 26 | |||
| 27 | WARNINGS= yes | ||
| 28 | |||
| 29 | .include <bsd.regress.mk> | ||
diff --git a/src/regress/lib/libc/stdio/test___fpending.c b/src/regress/lib/libc/stdio/test___fpending.c new file mode 100644 index 0000000000..96ace2e481 --- /dev/null +++ b/src/regress/lib/libc/stdio/test___fpending.c | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | /* $OpenBSD: test___fpending.c,v 1.1 2025/05/25 00:20:54 yasuoka Exp $ */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net> | ||
| 5 | * | ||
| 6 | * Permission to use, copy, modify, and distribute this software for any | ||
| 7 | * purpose with or without fee is hereby granted, provided that the above | ||
| 8 | * copyright notice and this permission notice appear in all copies. | ||
| 9 | * | ||
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <assert.h> | ||
| 20 | #include <stdio.h> | ||
| 21 | #include <stdio_ext.h> | ||
| 22 | #include <stdlib.h> | ||
| 23 | |||
| 24 | /* we use assert() */ | ||
| 25 | #undef NDEBUG | ||
| 26 | |||
| 27 | #define TMPFILENAME "test___fpending.tmp" | ||
| 28 | |||
| 29 | void test___fpending0(void); | ||
| 30 | |||
| 31 | void | ||
| 32 | test___fpending0(void) | ||
| 33 | { | ||
| 34 | FILE *fp; | ||
| 35 | int r; | ||
| 36 | size_t s; | ||
| 37 | |||
| 38 | fp = fopen(TMPFILENAME, "w"); | ||
| 39 | assert(fp != NULL); | ||
| 40 | r = fputs("Hello world", fp); | ||
| 41 | assert(r >= 0); | ||
| 42 | s = __fpending(fp); | ||
| 43 | assert(s > 0); /* assume buffered */ | ||
| 44 | r = fflush(fp); | ||
| 45 | assert(r == 0); | ||
| 46 | s = __fpending(fp); | ||
| 47 | assert(s == 0); /* buffer must be 0 */ | ||
| 48 | r = fclose(fp); | ||
| 49 | assert(r == 0); | ||
| 50 | } | ||
| 51 | |||
| 52 | int | ||
| 53 | main(int argc, char *argv[]) | ||
| 54 | { | ||
| 55 | test___fpending0(); | ||
| 56 | |||
| 57 | exit(0); | ||
| 58 | } | ||
diff --git a/src/regress/lib/libc/stdio/test___freadahead.c b/src/regress/lib/libc/stdio/test___freadahead.c new file mode 100644 index 0000000000..66d5e3492a --- /dev/null +++ b/src/regress/lib/libc/stdio/test___freadahead.c | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | /* $OpenBSD: test___freadahead.c,v 1.2 2025/06/03 14:35:27 yasuoka Exp $ */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net> | ||
| 5 | * | ||
| 6 | * Permission to use, copy, modify, and distribute this software for any | ||
| 7 | * purpose with or without fee is hereby granted, provided that the above | ||
| 8 | * copyright notice and this permission notice appear in all copies. | ||
| 9 | * | ||
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <assert.h> | ||
| 20 | #include <errno.h> | ||
| 21 | #include <stdio.h> | ||
| 22 | #include <stdio_ext.h> | ||
| 23 | #include <stdlib.h> | ||
| 24 | |||
| 25 | /* we use assert() */ | ||
| 26 | #undef NDEBUG | ||
| 27 | |||
| 28 | #define TMPFILENAME "test___freadahead.tmp" | ||
| 29 | |||
| 30 | void test___freadahead0(void); | ||
| 31 | |||
| 32 | void | ||
| 33 | test___freadahead0(void) | ||
| 34 | { | ||
| 35 | FILE *fp; | ||
| 36 | int r; | ||
| 37 | size_t s; | ||
| 38 | |||
| 39 | fp = fopen(TMPFILENAME, "w"); | ||
| 40 | assert(fp != NULL); | ||
| 41 | r = fputs("Hello world", fp); | ||
| 42 | assert(r >= 0); | ||
| 43 | r = fclose(fp); | ||
| 44 | |||
| 45 | fp = fopen(TMPFILENAME, "r"); | ||
| 46 | s = __freadahead(fp); | ||
| 47 | assert(s == 0); | ||
| 48 | assert(fgetc(fp) == 'H'); | ||
| 49 | s = __freadahead(fp); | ||
| 50 | assert(s == 10); | ||
| 51 | r = fflush(fp); | ||
| 52 | #if 0 | ||
| 53 | /* fflush() to reading file is not supported (yet) */ | ||
| 54 | assert(errno == EBADF); | ||
| 55 | #else | ||
| 56 | assert(r == 0); | ||
| 57 | s = __freadahead(fp); | ||
| 58 | assert(s == 0); | ||
| 59 | #endif | ||
| 60 | |||
| 61 | r = fclose(fp); | ||
| 62 | assert(r == 0); | ||
| 63 | } | ||
| 64 | |||
| 65 | int | ||
| 66 | main(int argc, char *argv[]) | ||
| 67 | { | ||
| 68 | test___freadahead0(); | ||
| 69 | |||
| 70 | exit(0); | ||
| 71 | } | ||
diff --git a/src/regress/lib/libc/stdio/test___freading.c b/src/regress/lib/libc/stdio/test___freading.c new file mode 100644 index 0000000000..f74eb78d35 --- /dev/null +++ b/src/regress/lib/libc/stdio/test___freading.c | |||
| @@ -0,0 +1,125 @@ | |||
| 1 | /* $OpenBSD: test___freading.c,v 1.2 2025/06/12 07:39:26 yasuoka Exp $ */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net> | ||
| 5 | * | ||
| 6 | * Permission to use, copy, modify, and distribute this software for any | ||
| 7 | * purpose with or without fee is hereby granted, provided that the above | ||
| 8 | * copyright notice and this permission notice appear in all copies. | ||
| 9 | * | ||
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <assert.h> | ||
| 20 | #include <stdio.h> | ||
| 21 | #include <stdio_ext.h> | ||
| 22 | #include <stdlib.h> | ||
| 23 | #include <string.h> | ||
| 24 | #include <unistd.h> | ||
| 25 | |||
| 26 | /* we use assert() */ | ||
| 27 | #undef NDEBUG | ||
| 28 | |||
| 29 | #define TMPFILENAME "test___freading.tmp" | ||
| 30 | |||
| 31 | void setup(void); | ||
| 32 | |||
| 33 | void test___freading0(void); | ||
| 34 | void test___freading1(void); | ||
| 35 | void test___freading2(void); | ||
| 36 | |||
| 37 | void | ||
| 38 | setup(void) | ||
| 39 | { | ||
| 40 | FILE *fp; | ||
| 41 | |||
| 42 | /* common setup */ | ||
| 43 | unlink(TMPFILENAME); | ||
| 44 | fp = fopen(TMPFILENAME, "w+"); | ||
| 45 | assert(fp != NULL); | ||
| 46 | fputs("Hello world\n", fp); | ||
| 47 | fclose(fp); | ||
| 48 | } | ||
| 49 | |||
| 50 | void | ||
| 51 | test___freading0(void) | ||
| 52 | { | ||
| 53 | FILE *fp; | ||
| 54 | int r; | ||
| 55 | char buf[80]; | ||
| 56 | |||
| 57 | fp = popen("echo Hello world", "r"); | ||
| 58 | assert(fp != NULL); | ||
| 59 | assert(__freading(fp) != 0); | ||
| 60 | assert(fgets(buf, sizeof(buf), fp) != NULL); | ||
| 61 | assert(strcmp(buf, "Hello world\n") == 0); | ||
| 62 | r = pclose(fp); | ||
| 63 | assert(r == 0); | ||
| 64 | } | ||
| 65 | |||
| 66 | void | ||
| 67 | test___freading1(void) | ||
| 68 | { | ||
| 69 | FILE *fp; | ||
| 70 | int r; | ||
| 71 | |||
| 72 | /* when the last operaiton is read, __freading() returns true */ | ||
| 73 | fp = fopen(TMPFILENAME, "w+"); | ||
| 74 | assert(fp != NULL); | ||
| 75 | assert(__freading(fp) == 0); | ||
| 76 | r = fputs("Hello world\n", fp); | ||
| 77 | assert(r >= 0); | ||
| 78 | assert(__freading(fp) == 0); | ||
| 79 | rewind(fp); | ||
| 80 | assert(fgetc(fp) == 'H'); | ||
| 81 | assert(__freading(fp) != 0); | ||
| 82 | /* write */ | ||
| 83 | fseek(fp, 0, SEEK_END); | ||
| 84 | r = fputs("\n", fp); | ||
| 85 | assert(__freading(fp) == 0); | ||
| 86 | /* ungetc */ | ||
| 87 | rewind(fp); | ||
| 88 | assert(ungetc('X', fp) != 0); | ||
| 89 | assert(__freading(fp) != 0); /* reading */ | ||
| 90 | |||
| 91 | r = fclose(fp); | ||
| 92 | assert(r == 0); | ||
| 93 | } | ||
| 94 | |||
| 95 | void | ||
| 96 | test___freading2(void) | ||
| 97 | { | ||
| 98 | int r; | ||
| 99 | FILE *fp; | ||
| 100 | |||
| 101 | /* | ||
| 102 | * until v1.10 of fpurge.c mistakenly enables the writing buffer | ||
| 103 | * without _SRD flag set. | ||
| 104 | */ | ||
| 105 | fp = fopen(TMPFILENAME, "r+"); | ||
| 106 | assert(fp != NULL); | ||
| 107 | assert(fgetc(fp) == 'H'); | ||
| 108 | fpurge(fp); | ||
| 109 | fseek(fp, 0, SEEK_CUR); | ||
| 110 | assert(fputc('X', fp) == 'X'); | ||
| 111 | assert(__freading(fp) == 0); | ||
| 112 | |||
| 113 | r = fclose(fp); | ||
| 114 | assert(r == 0); | ||
| 115 | } | ||
| 116 | |||
| 117 | int | ||
| 118 | main(int argc, char *argv[]) | ||
| 119 | { | ||
| 120 | test___freading0(); | ||
| 121 | test___freading1(); | ||
| 122 | test___freading2(); | ||
| 123 | |||
| 124 | exit(0); | ||
| 125 | } | ||
diff --git a/src/regress/lib/libc/stdio/test___freadptr.c b/src/regress/lib/libc/stdio/test___freadptr.c new file mode 100644 index 0000000000..cce362f2ae --- /dev/null +++ b/src/regress/lib/libc/stdio/test___freadptr.c | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | /* $OpenBSD: test___freadptr.c,v 1.1 2025/05/25 00:20:54 yasuoka Exp $ */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net> | ||
| 5 | * | ||
| 6 | * Permission to use, copy, modify, and distribute this software for any | ||
| 7 | * purpose with or without fee is hereby granted, provided that the above | ||
| 8 | * copyright notice and this permission notice appear in all copies. | ||
| 9 | * | ||
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <sys/types.h> | ||
| 20 | #include <assert.h> | ||
| 21 | #include <stdio.h> | ||
| 22 | #include <stdio_ext.h> | ||
| 23 | #include <stdlib.h> | ||
| 24 | #include <string.h> | ||
| 25 | |||
| 26 | /* we use assert() */ | ||
| 27 | #undef NDEBUG | ||
| 28 | |||
| 29 | #define TMPFILENAME "test___freadptr.tmp" | ||
| 30 | |||
| 31 | void test___freadptr0(void); | ||
| 32 | |||
| 33 | /* test __freadptr() and __freadptrinc() */ | ||
| 34 | void | ||
| 35 | test___freadptr0(void) | ||
| 36 | { | ||
| 37 | FILE *fp; | ||
| 38 | int r; | ||
| 39 | ssize_t s; | ||
| 40 | const char *p; | ||
| 41 | |||
| 42 | fp = fopen(TMPFILENAME, "w"); | ||
| 43 | assert(fp != NULL); | ||
| 44 | r = fputs("Hello world", fp); | ||
| 45 | assert(r >= 0); | ||
| 46 | r = fclose(fp); | ||
| 47 | |||
| 48 | fp = fopen(TMPFILENAME, "r"); | ||
| 49 | assert(fgetc(fp) == 'H'); | ||
| 50 | p = __freadptr(fp, &s); | ||
| 51 | assert(p != NULL); | ||
| 52 | assert(s > 4); /* this test assume this (not by the spec) */ | ||
| 53 | assert(*p == 'e'); | ||
| 54 | assert(strncmp(p, "ello world", s) == 0); | ||
| 55 | |||
| 56 | __freadptrinc(fp, 4); | ||
| 57 | assert(fgetc(fp) == ' '); | ||
| 58 | |||
| 59 | ungetc('A', fp); | ||
| 60 | ungetc('A', fp); | ||
| 61 | ungetc('A', fp); | ||
| 62 | p = __freadptr(fp, &s); | ||
| 63 | assert(s > 0); | ||
| 64 | assert(*p == 'A'); | ||
| 65 | /* ptr will contains only the pushback buffer */ | ||
| 66 | assert(strncmp(p, "AAAworld", s) == 0); | ||
| 67 | |||
| 68 | r = fclose(fp); | ||
| 69 | assert(r == 0); | ||
| 70 | } | ||
| 71 | |||
| 72 | int | ||
| 73 | main(int argc, char *argv[]) | ||
| 74 | { | ||
| 75 | test___freadptr0(); | ||
| 76 | |||
| 77 | exit(0); | ||
| 78 | } | ||
diff --git a/src/regress/lib/libc/stdio/test___fseterr.c b/src/regress/lib/libc/stdio/test___fseterr.c new file mode 100644 index 0000000000..70fb491c6c --- /dev/null +++ b/src/regress/lib/libc/stdio/test___fseterr.c | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | /* $OpenBSD: test___fseterr.c,v 1.1 2025/05/25 00:20:54 yasuoka Exp $ */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net> | ||
| 5 | * | ||
| 6 | * Permission to use, copy, modify, and distribute this software for any | ||
| 7 | * purpose with or without fee is hereby granted, provided that the above | ||
| 8 | * copyright notice and this permission notice appear in all copies. | ||
| 9 | * | ||
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <assert.h> | ||
| 20 | #include <stdio.h> | ||
| 21 | #include <stdio_ext.h> | ||
| 22 | #include <stdlib.h> | ||
| 23 | |||
| 24 | /* we use assert() */ | ||
| 25 | #undef NDEBUG | ||
| 26 | |||
| 27 | #define TMPFILENAME "test___fseterr.tmp" | ||
| 28 | |||
| 29 | void test___fseterr0(void); | ||
| 30 | |||
| 31 | void | ||
| 32 | test___fseterr0(void) | ||
| 33 | { | ||
| 34 | FILE *fp; | ||
| 35 | int r; | ||
| 36 | |||
| 37 | fp = fopen(TMPFILENAME, "w+"); | ||
| 38 | assert(fp != NULL); | ||
| 39 | |||
| 40 | assert(!ferror(fp)); | ||
| 41 | |||
| 42 | r = fprintf(fp, "hello world\n"); | ||
| 43 | assert(r > 0); | ||
| 44 | |||
| 45 | __fseterr(fp); | ||
| 46 | assert(ferror(fp)); | ||
| 47 | |||
| 48 | r = fprintf(fp, "hello world\n"); | ||
| 49 | assert(r == -1); | ||
| 50 | |||
| 51 | fclose(fp); | ||
| 52 | } | ||
| 53 | |||
| 54 | int | ||
| 55 | main(int argc, char *argv[]) | ||
| 56 | { | ||
| 57 | test___fseterr0(); | ||
| 58 | |||
| 59 | exit(0); | ||
| 60 | } | ||
diff --git a/src/regress/lib/libc/stdio/test___fwriting.c b/src/regress/lib/libc/stdio/test___fwriting.c new file mode 100644 index 0000000000..eb4671d3cf --- /dev/null +++ b/src/regress/lib/libc/stdio/test___fwriting.c | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | /* $OpenBSD: test___fwriting.c,v 1.1 2025/05/25 00:20:54 yasuoka Exp $ */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net> | ||
| 5 | * | ||
| 6 | * Permission to use, copy, modify, and distribute this software for any | ||
| 7 | * purpose with or without fee is hereby granted, provided that the above | ||
| 8 | * copyright notice and this permission notice appear in all copies. | ||
| 9 | * | ||
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <assert.h> | ||
| 20 | #include <stdio.h> | ||
| 21 | #include <stdio_ext.h> | ||
| 22 | #include <stdlib.h> | ||
| 23 | |||
| 24 | /* we use assert() */ | ||
| 25 | #undef NDEBUG | ||
| 26 | |||
| 27 | #define TMPFILENAME "test___fwriting.tmp" | ||
| 28 | |||
| 29 | void test___fwriting0(void); | ||
| 30 | void test___fwriting1(void); | ||
| 31 | |||
| 32 | void | ||
| 33 | test___fwriting0(void) | ||
| 34 | { | ||
| 35 | FILE *fp; | ||
| 36 | int r; | ||
| 37 | |||
| 38 | fp = fopen(TMPFILENAME, "w"); /* write only */ | ||
| 39 | assert(fp != NULL); | ||
| 40 | assert(__fwriting(fp) != 0); /* writing is true immediately */ | ||
| 41 | r = fputs("Hello world\n", fp); | ||
| 42 | assert(r >= 0); | ||
| 43 | r = fclose(fp); | ||
| 44 | assert(r == 0); | ||
| 45 | |||
| 46 | fp = fopen(TMPFILENAME, "a"); /* append only */ | ||
| 47 | assert(fp != NULL); | ||
| 48 | assert(__fwriting(fp) != 0); /* writing immediately */ | ||
| 49 | r = fclose(fp); | ||
| 50 | assert(r == 0); | ||
| 51 | } | ||
| 52 | |||
| 53 | void | ||
| 54 | test___fwriting1(void) | ||
| 55 | { | ||
| 56 | FILE *fp; | ||
| 57 | int r; | ||
| 58 | |||
| 59 | fp = fopen(TMPFILENAME, "w+"); /* read / write */ | ||
| 60 | assert(fp != NULL); | ||
| 61 | r = fputs("Hello world\n", fp); | ||
| 62 | assert(r >= 0); | ||
| 63 | assert(__fwriting(fp) != 0); | ||
| 64 | rewind(fp); | ||
| 65 | assert(fgetc(fp) == 'H'); /* read */ | ||
| 66 | assert(__fwriting(fp) == 0); /* writing becomes false */ | ||
| 67 | fputc('e', fp); | ||
| 68 | assert(__fwriting(fp) != 0); /* writing becomes true */ | ||
| 69 | ungetc('e', fp); | ||
| 70 | assert(__fwriting(fp) == 0); /* ungetc -> writing becomes false */ | ||
| 71 | |||
| 72 | r = fclose(fp); | ||
| 73 | assert(r == 0); | ||
| 74 | } | ||
| 75 | |||
| 76 | int | ||
| 77 | main(int argc, char *argv[]) | ||
| 78 | { | ||
| 79 | test___fwriting0(); | ||
| 80 | test___fwriting1(); | ||
| 81 | |||
| 82 | exit(0); | ||
| 83 | } | ||
diff --git a/src/regress/lib/libc/stdio/test_fflush.c b/src/regress/lib/libc/stdio/test_fflush.c new file mode 100644 index 0000000000..a0586b7d14 --- /dev/null +++ b/src/regress/lib/libc/stdio/test_fflush.c | |||
| @@ -0,0 +1,345 @@ | |||
| 1 | /* $OpenBSD: test_fflush.c,v 1.3 2025/06/08 08:53:53 yasuoka Exp $ */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net> | ||
| 5 | * | ||
| 6 | * Permission to use, copy, modify, and distribute this software for any | ||
| 7 | * purpose with or without fee is hereby granted, provided that the above | ||
| 8 | * copyright notice and this permission notice appear in all copies. | ||
| 9 | * | ||
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <assert.h> | ||
| 20 | #include <locale.h> | ||
| 21 | #include <stdio.h> | ||
| 22 | #include <stdlib.h> | ||
| 23 | #include <string.h> | ||
| 24 | #include <unistd.h> | ||
| 25 | #include <wchar.h> | ||
| 26 | |||
| 27 | /* we use assert() */ | ||
| 28 | #undef NDEBUG | ||
| 29 | |||
| 30 | #define TMPFILENAME "test_fflush.tmp" | ||
| 31 | |||
| 32 | void setup(void); | ||
| 33 | |||
| 34 | void test_fflush_read0(void); | ||
| 35 | void test_fflush_read1(void); | ||
| 36 | void test_fflush_read2(void); | ||
| 37 | void test_fflush_read3(void); | ||
| 38 | void test_fflush_read4(void); | ||
| 39 | void setupw(void); | ||
| 40 | void test_fflush_read5(void); | ||
| 41 | void test_fflush_read6(void); | ||
| 42 | |||
| 43 | void | ||
| 44 | setup(void) | ||
| 45 | { | ||
| 46 | FILE *fp; | ||
| 47 | |||
| 48 | /* common setup */ | ||
| 49 | unlink(TMPFILENAME); | ||
| 50 | fp = fopen(TMPFILENAME, "w+"); | ||
| 51 | assert(fp != NULL); | ||
| 52 | fputs("Hello world\n", fp); | ||
| 53 | fclose(fp); | ||
| 54 | } | ||
| 55 | |||
| 56 | /* fflush work with reading file and seekable */ | ||
| 57 | void | ||
| 58 | test_fflush_read0(void) | ||
| 59 | { | ||
| 60 | int r; | ||
| 61 | char buf[80]; | ||
| 62 | FILE *fp; | ||
| 63 | |||
| 64 | setup(); | ||
| 65 | |||
| 66 | /* In POSIX 2008, fflush() must work with the file object for reading */ | ||
| 67 | fp = fopen(TMPFILENAME, "r"); | ||
| 68 | assert(fp != NULL); | ||
| 69 | assert(fgetc(fp) == 'H'); | ||
| 70 | r = fflush(fp); | ||
| 71 | assert(r == 0); | ||
| 72 | |||
| 73 | /* the position is moved to 1 */ | ||
| 74 | assert(ftell(fp) == 1); | ||
| 75 | |||
| 76 | /* can read rest of that */ | ||
| 77 | fgets(buf, sizeof(buf), fp); | ||
| 78 | assert(strcmp(buf, "ello world\n") == 0); | ||
| 79 | r = fclose(fp); | ||
| 80 | assert(r == 0); | ||
| 81 | } | ||
| 82 | |||
| 83 | /* fflush work with reading file and seekable + unget */ | ||
| 84 | void | ||
| 85 | test_fflush_read1(void) | ||
| 86 | { | ||
| 87 | int r; | ||
| 88 | char buf[80]; | ||
| 89 | FILE *fp; | ||
| 90 | |||
| 91 | setup(); | ||
| 92 | |||
| 93 | fp = fopen(TMPFILENAME, "r"); | ||
| 94 | assert(fp != NULL); | ||
| 95 | assert(fgetc(fp) == 'H'); | ||
| 96 | assert(fgetc(fp) == 'e'); | ||
| 97 | assert(fgetc(fp) == 'l'); | ||
| 98 | assert(fgetc(fp) == 'l'); | ||
| 99 | assert(fgetc(fp) == 'o'); | ||
| 100 | |||
| 101 | /* push the 'AAAA' back */ | ||
| 102 | ungetc('A', fp); | ||
| 103 | ungetc('A', fp); | ||
| 104 | ungetc('A', fp); | ||
| 105 | ungetc('A', fp); | ||
| 106 | |||
| 107 | /* can read rest of that */ | ||
| 108 | fgets(buf, sizeof(buf), fp); | ||
| 109 | assert(strcmp(buf, "AAAA world\n") == 0); | ||
| 110 | r = fclose(fp); | ||
| 111 | assert(r == 0); | ||
| 112 | |||
| 113 | /* do the same thing + fflush */ | ||
| 114 | |||
| 115 | fp = fopen(TMPFILENAME, "r"); | ||
| 116 | assert(fp != NULL); | ||
| 117 | assert(fgetc(fp) == 'H'); | ||
| 118 | assert(fgetc(fp) == 'e'); | ||
| 119 | assert(fgetc(fp) == 'l'); | ||
| 120 | assert(fgetc(fp) == 'l'); | ||
| 121 | assert(fgetc(fp) == 'o'); | ||
| 122 | |||
| 123 | /* push 'AAAA' back */ | ||
| 124 | ungetc('A', fp); | ||
| 125 | ungetc('A', fp); | ||
| 126 | ungetc('A', fp); | ||
| 127 | ungetc('A', fp); | ||
| 128 | |||
| 129 | /* then fflush */ | ||
| 130 | r = fflush(fp); | ||
| 131 | assert(r == 0); | ||
| 132 | |||
| 133 | /* fllush() clears the all pushed back chars */ | ||
| 134 | |||
| 135 | /* can read rest of that */ | ||
| 136 | fgets(buf, sizeof(buf), fp); | ||
| 137 | assert(strcmp(buf, " world\n") == 0); | ||
| 138 | r = fclose(fp); | ||
| 139 | assert(r == 0); | ||
| 140 | } | ||
| 141 | |||
| 142 | /* fflush() to reading and non-seekable stream */ | ||
| 143 | void | ||
| 144 | test_fflush_read2(void) | ||
| 145 | { | ||
| 146 | int r; | ||
| 147 | FILE *fp; | ||
| 148 | char buf[80]; | ||
| 149 | |||
| 150 | /* In POSIX-2008, fflush() must work with the file object for reading */ | ||
| 151 | fp = popen("echo Hello world", "r"); | ||
| 152 | assert(fp != NULL); | ||
| 153 | assert(fgetc(fp) == 'H'); | ||
| 154 | r = fflush(fp); | ||
| 155 | assert(r == 0); | ||
| 156 | |||
| 157 | /* | ||
| 158 | * FILE object for read and NOT seekable. In that case, fflush does | ||
| 159 | * nothing, but must keep the buffer. | ||
| 160 | */ | ||
| 161 | |||
| 162 | /* can read rest of that */ | ||
| 163 | fgets(buf, sizeof(buf), fp); | ||
| 164 | assert(strcmp(buf, "ello world\n") == 0); | ||
| 165 | r = pclose(fp); | ||
| 166 | assert(r == 0); | ||
| 167 | } | ||
| 168 | |||
| 169 | /* fflush() to the file which doesn't have any buffer */ | ||
| 170 | void | ||
| 171 | test_fflush_read3(void) | ||
| 172 | { | ||
| 173 | int r; | ||
| 174 | FILE *fp; | ||
| 175 | |||
| 176 | setup(); | ||
| 177 | |||
| 178 | /* In POSIX-2008, fflush() must work with the file object for reading */ | ||
| 179 | fp = fopen(TMPFILENAME, "r"); | ||
| 180 | assert(fp != NULL); | ||
| 181 | r = fflush(fp); | ||
| 182 | assert(r == 0); | ||
| 183 | r = fclose(fp); | ||
| 184 | assert(r == 0); | ||
| 185 | } | ||
| 186 | |||
| 187 | /* freopen() should call fflush() internal */ | ||
| 188 | void | ||
| 189 | test_fflush_read4(void) | ||
| 190 | { | ||
| 191 | int r; | ||
| 192 | FILE *fp; | ||
| 193 | off_t pos; | ||
| 194 | char buf[80]; | ||
| 195 | |||
| 196 | setup(); | ||
| 197 | |||
| 198 | /* In POSIX-2008, fflush() must work with the file object for reading */ | ||
| 199 | fp = fopen(TMPFILENAME, "r"); | ||
| 200 | assert(fp != NULL); | ||
| 201 | |||
| 202 | assert(fgetc(fp) == 'H'); /* read 1 */ | ||
| 203 | |||
| 204 | pos = lseek(fileno(fp), 0, SEEK_CUR); | ||
| 205 | assert(pos >= 1); | ||
| 206 | assert(pos > 1); /* this test assume the buffer is used */ | ||
| 207 | |||
| 208 | /* freopen() should call fflush() internal */ | ||
| 209 | fp = freopen(TMPFILENAME, "r", fp); | ||
| 210 | assert(fp != NULL); | ||
| 211 | |||
| 212 | /* can read rest of that on fp */ | ||
| 213 | fgets(buf, sizeof(buf), fp); | ||
| 214 | assert(strcmp(buf, "Hello world\n") == 0); | ||
| 215 | |||
| 216 | r = fclose(fp); | ||
| 217 | assert(r == 0); | ||
| 218 | } | ||
| 219 | |||
| 220 | void | ||
| 221 | setupw(void) | ||
| 222 | { | ||
| 223 | FILE *fp; | ||
| 224 | |||
| 225 | /* common setup */ | ||
| 226 | unlink(TMPFILENAME); | ||
| 227 | fp = fopen(TMPFILENAME, "w+"); | ||
| 228 | assert(fp != NULL); | ||
| 229 | /* Konnitiwa Sekai(in Kanji) */ | ||
| 230 | fputws(L"\u3053\u3093\u306b\u3061\u308f \u4e16\u754c\n", fp); | ||
| 231 | fclose(fp); | ||
| 232 | } | ||
| 233 | |||
| 234 | /* fflush work with reading file and seekable + ungetwc */ | ||
| 235 | void | ||
| 236 | test_fflush_read5(void) | ||
| 237 | { | ||
| 238 | int r; | ||
| 239 | wchar_t buf[80]; | ||
| 240 | FILE *fp; | ||
| 241 | |||
| 242 | setupw(); | ||
| 243 | |||
| 244 | fp = fopen(TMPFILENAME, "r"); | ||
| 245 | |||
| 246 | assert(fp != NULL); | ||
| 247 | assert(fgetwc(fp) == L'\u3053'); /* Ko */ | ||
| 248 | assert(fgetwc(fp) == L'\u3093'); /* N */ | ||
| 249 | assert(fgetwc(fp) == L'\u306b'); /* Ni */ | ||
| 250 | assert(fgetwc(fp) == L'\u3061'); /* Ti */ | ||
| 251 | assert(fgetwc(fp) == L'\u308f'); /* Wa */ | ||
| 252 | |||
| 253 | /* push 263A(smile) back */ | ||
| 254 | assert(ungetwc(L'\u263a', fp)); | ||
| 255 | |||
| 256 | /* we support 1 push back wchar_t */ | ||
| 257 | assert(fgetwc(fp) == L'\u263a'); | ||
| 258 | |||
| 259 | /* can read reset of that */ | ||
| 260 | fgetws(buf, sizeof(buf), fp); | ||
| 261 | assert(wcscmp(buf, L" \u4e16\u754c\n") == 0); | ||
| 262 | |||
| 263 | r = fclose(fp); | ||
| 264 | assert(r == 0); | ||
| 265 | |||
| 266 | /* do the same thing + fflush */ | ||
| 267 | fp = fopen(TMPFILENAME, "r"); | ||
| 268 | |||
| 269 | assert(fp != NULL); | ||
| 270 | assert(fgetwc(fp) == L'\u3053'); /* Ko */ | ||
| 271 | assert(fgetwc(fp) == L'\u3093'); /* N */ | ||
| 272 | assert(fgetwc(fp) == L'\u306b'); /* Ni */ | ||
| 273 | assert(fgetwc(fp) == L'\u3061'); /* Ti */ | ||
| 274 | assert(fgetwc(fp) == L'\u308f'); /* Wa */ | ||
| 275 | |||
| 276 | /* push 263A(smile) back */ | ||
| 277 | assert(ungetwc(L'\u263a', fp)); | ||
| 278 | |||
| 279 | /* we support 1 push back wchar_t */ | ||
| 280 | assert(fgetwc(fp) == L'\u263a'); | ||
| 281 | |||
| 282 | /* then fflush */ | ||
| 283 | r = fflush(fp); | ||
| 284 | assert(r == 0); | ||
| 285 | |||
| 286 | /* fllush() clears the all pushed back chars */ | ||
| 287 | |||
| 288 | /* can read rest of that */ | ||
| 289 | fgetws(buf, sizeof(buf), fp); | ||
| 290 | assert(wcscmp(buf, L" \u4e16\u754c\n") == 0); | ||
| 291 | r = fclose(fp); | ||
| 292 | assert(r == 0); | ||
| 293 | } | ||
| 294 | |||
| 295 | void | ||
| 296 | test_fflush_read6(void) | ||
| 297 | { | ||
| 298 | int r, c; | ||
| 299 | FILE *fp; | ||
| 300 | |||
| 301 | setup(); | ||
| 302 | fp = fopen(TMPFILENAME, "r"); | ||
| 303 | assert(fp != NULL); | ||
| 304 | |||
| 305 | /* | ||
| 306 | * https://pubs.opengroup.org/onlinepubs/9699919799/functions/fflush.html | ||
| 307 | * .. any characters pushed back onto the stream by ungetc() or ungetwc() | ||
| 308 | * that have not subsequently been read from the stream shall be discarded | ||
| 309 | * (without further changing the file offset). | ||
| 310 | */ | ||
| 311 | |||
| 312 | assert(fgetc(fp) == 'H'); | ||
| 313 | c = getc(fp); | ||
| 314 | ungetc(c, fp); /* push back the character has been read */ | ||
| 315 | r = fflush(fp); | ||
| 316 | assert(r == 0); | ||
| 317 | assert(getc(fp) == c); | ||
| 318 | |||
| 319 | fseek(fp, 0, SEEK_SET); | ||
| 320 | assert(fgetc(fp) == 'H'); | ||
| 321 | c = getc(fp); | ||
| 322 | ungetc('X', fp); /* push back the character has not been read */ | ||
| 323 | r = fflush(fp); | ||
| 324 | assert(r == 0); | ||
| 325 | assert(getc(fp) == 'l'); | ||
| 326 | |||
| 327 | r = fclose(fp); | ||
| 328 | assert(r == 0); | ||
| 329 | } | ||
| 330 | |||
| 331 | int | ||
| 332 | main(int argc, char *argv[]) | ||
| 333 | { | ||
| 334 | setlocale(LC_ALL, "C.UTF-8"); | ||
| 335 | |||
| 336 | test_fflush_read0(); | ||
| 337 | test_fflush_read1(); | ||
| 338 | test_fflush_read2(); | ||
| 339 | test_fflush_read3(); | ||
| 340 | test_fflush_read4(); | ||
| 341 | test_fflush_read5(); | ||
| 342 | test_fflush_read6(); | ||
| 343 | |||
| 344 | exit(0); | ||
| 345 | } | ||
diff --git a/src/regress/lib/libc/stdio/test_ungetwc.c b/src/regress/lib/libc/stdio/test_ungetwc.c new file mode 100644 index 0000000000..bb4e853020 --- /dev/null +++ b/src/regress/lib/libc/stdio/test_ungetwc.c | |||
| @@ -0,0 +1,90 @@ | |||
| 1 | /* $OpenBSD: test_ungetwc.c,v 1.1 2025/05/25 05:32:45 yasuoka Exp $ */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net> | ||
| 5 | * | ||
| 6 | * Permission to use, copy, modify, and distribute this software for any | ||
| 7 | * purpose with or without fee is hereby granted, provided that the above | ||
| 8 | * copyright notice and this permission notice appear in all copies. | ||
| 9 | * | ||
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <assert.h> | ||
| 20 | #include <stdio.h> | ||
| 21 | #include <stdlib.h> | ||
| 22 | #include <string.h> | ||
| 23 | #include <unistd.h> | ||
| 24 | #include <locale.h> | ||
| 25 | #include <wchar.h> | ||
| 26 | |||
| 27 | /* we use assert() */ | ||
| 28 | #undef NDEBUG | ||
| 29 | |||
| 30 | #define TMPFILENAME "test_ungetwc.tmp" | ||
| 31 | |||
| 32 | void setupw(void); | ||
| 33 | void test_fflush_ungetwc0(void); | ||
| 34 | |||
| 35 | void | ||
| 36 | setupw(void) | ||
| 37 | { | ||
| 38 | FILE *fp; | ||
| 39 | |||
| 40 | /* common setup */ | ||
| 41 | unlink(TMPFILENAME); | ||
| 42 | fp = fopen(TMPFILENAME, "w+"); | ||
| 43 | assert(fp != NULL); | ||
| 44 | /* Konnitiwa Sekai(in Kanji) */ | ||
| 45 | fputws(L"\u3053\u3093\u306b\u3061\u308f \u4e16\u754c\n", fp); | ||
| 46 | fclose(fp); | ||
| 47 | } | ||
| 48 | |||
| 49 | /* fflush work with reading file and seekable + ungetwc */ | ||
| 50 | void | ||
| 51 | test_fflush_ungetwc0(void) | ||
| 52 | { | ||
| 53 | int r; | ||
| 54 | wchar_t buf[80]; | ||
| 55 | FILE *fp; | ||
| 56 | |||
| 57 | setupw(); | ||
| 58 | |||
| 59 | fp = fopen(TMPFILENAME, "r"); | ||
| 60 | |||
| 61 | assert(fp != NULL); | ||
| 62 | assert(fgetwc(fp) == L'\u3053'); /* Ko */ | ||
| 63 | assert(fgetwc(fp) == L'\u3093'); /* N */ | ||
| 64 | assert(fgetwc(fp) == L'\u306b'); /* Ni */ | ||
| 65 | assert(fgetwc(fp) == L'\u3061'); /* Ti */ | ||
| 66 | assert(fgetwc(fp) == L'\u308f'); /* Wa */ | ||
| 67 | |||
| 68 | /* push 263A(smile) back */ | ||
| 69 | assert(ungetwc(L'\u263a', fp)); | ||
| 70 | |||
| 71 | /* we support 1 push back wchar_t */ | ||
| 72 | assert(fgetwc(fp) == L'\u263a'); | ||
| 73 | |||
| 74 | /* can read reset of that */ | ||
| 75 | fgetws(buf, sizeof(buf), fp); | ||
| 76 | assert(wcscmp(buf, L" \u4e16\u754c\n") == 0); | ||
| 77 | |||
| 78 | r = fclose(fp); | ||
| 79 | assert(r == 0); | ||
| 80 | } | ||
| 81 | |||
| 82 | int | ||
| 83 | main(int argc, char *argv[]) | ||
| 84 | { | ||
| 85 | setlocale(LC_ALL, "C.UTF-8"); | ||
| 86 | |||
| 87 | test_fflush_ungetwc0(); | ||
| 88 | |||
| 89 | exit(0); | ||
| 90 | } | ||
diff --git a/src/regress/lib/libc/sys/t_fork.c b/src/regress/lib/libc/sys/t_fork.c index b55b557824..1084855aee 100644 --- a/src/regress/lib/libc/sys/t_fork.c +++ b/src/regress/lib/libc/sys/t_fork.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_fork.c,v 1.5 2021/12/13 16:56:48 deraadt Exp $ */ | 1 | /* $OpenBSD: t_fork.c,v 1.6 2025/10/31 17:14:46 miod Exp $ */ |
| 2 | /* $NetBSD: t_fork.c,v 1.4 2019/04/06 15:41:54 kamil Exp $ */ | 2 | /* $NetBSD: t_fork.c,v 1.4 2019/04/06 15:41:54 kamil Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| @@ -28,7 +28,7 @@ | |||
| 28 | */ | 28 | */ |
| 29 | #include "macros.h" | 29 | #include "macros.h" |
| 30 | 30 | ||
| 31 | #include <sys/types.h> | 31 | #include <sys/param.h> /* for MACHINE_STACK_GROWS_UP */ |
| 32 | #include <sys/signal.h> | 32 | #include <sys/signal.h> |
| 33 | #ifdef __OpenBSD__ | 33 | #ifdef __OpenBSD__ |
| 34 | #include <sys/proc.h> | 34 | #include <sys/proc.h> |
| @@ -282,7 +282,7 @@ nested_raw(const char *fn, volatile int flags) | |||
| 282 | stack = malloc(stack_size); | 282 | stack = malloc(stack_size); |
| 283 | ATF_REQUIRE(stack != NULL); | 283 | ATF_REQUIRE(stack != NULL); |
| 284 | 284 | ||
| 285 | #ifdef __MACHINE_STACK_GROWS_UP | 285 | #ifdef MACHINE_STACK_GROWS_UP |
| 286 | stack_base = stack; | 286 | stack_base = stack; |
| 287 | #else | 287 | #else |
| 288 | stack_base = (char *)stack + stack_size; | 288 | stack_base = (char *)stack + stack_size; |
diff --git a/src/regress/lib/libc/sys/t_getrusage.c b/src/regress/lib/libc/sys/t_getrusage.c index 1a9e3d139c..04ad7e4e87 100644 --- a/src/regress/lib/libc/sys/t_getrusage.c +++ b/src/regress/lib/libc/sys/t_getrusage.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_getrusage.c,v 1.3 2021/12/13 16:56:48 deraadt Exp $ */ | 1 | /* $OpenBSD: t_getrusage.c,v 1.4 2025/11/06 12:56:58 miod Exp $ */ |
| 2 | /* $NetBSD: t_getrusage.c,v 1.8 2018/05/09 08:45:03 mrg Exp $ */ | 2 | /* $NetBSD: t_getrusage.c,v 1.8 2018/05/09 08:45:03 mrg Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| @@ -68,6 +68,8 @@ work(void) | |||
| 68 | asm volatile("l.nop"); /* Do something. */ | 68 | asm volatile("l.nop"); /* Do something. */ |
| 69 | #elif defined(__ia64__) | 69 | #elif defined(__ia64__) |
| 70 | asm volatile("nop 0"); /* Do something. */ | 70 | asm volatile("nop 0"); /* Do something. */ |
| 71 | #elif defined(__m88k) | ||
| 72 | asm volatile("or %r0, %r0, %r0"); /* Do something. */ | ||
| 71 | #else | 73 | #else |
| 72 | asm volatile("nop"); /* Do something. */ | 74 | asm volatile("nop"); /* Do something. */ |
| 73 | #endif | 75 | #endif |
diff --git a/src/regress/lib/libc/time/time_conversion/timetest.c b/src/regress/lib/libc/time/time_conversion/timetest.c index 0706704ee1..1405f1c6a5 100644 --- a/src/regress/lib/libc/time/time_conversion/timetest.c +++ b/src/regress/lib/libc/time/time_conversion/timetest.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: timetest.c,v 1.4 2023/04/13 11:32:06 mbuhl Exp $ */ | 1 | /* $OpenBSD: timetest.c,v 1.5 2025/08/17 08:43:03 phessler Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (c) 2022 Bob Beck <beck@openbsd.org> | 4 | * Copyright (c) 2022 Bob Beck <beck@openbsd.org> |
| @@ -79,12 +79,12 @@ struct timetest timetests[] = { | |||
| 79 | .tm_yday=171, | 79 | .tm_yday=171, |
| 80 | .tm_isdst=0, | 80 | .tm_isdst=0, |
| 81 | .tm_gmtoff=0, | 81 | .tm_gmtoff=0, |
| 82 | .tm_zone="GMT" | 82 | .tm_zone="UTC" |
| 83 | }, | 83 | }, |
| 84 | }, | 84 | }, |
| 85 | { | 85 | { |
| 86 | .descr="moon", | 86 | .descr="moon", |
| 87 | .timezone="right/UTC", | 87 | .timezone="right/GMT", |
| 88 | .time=-16751025, | 88 | .time=-16751025, |
| 89 | .local_tm= { | 89 | .local_tm= { |
| 90 | .tm_year=69, | 90 | .tm_year=69, |
| @@ -97,7 +97,7 @@ struct timetest timetests[] = { | |||
| 97 | .tm_yday=171, | 97 | .tm_yday=171, |
| 98 | .tm_isdst=0, | 98 | .tm_isdst=0, |
| 99 | .tm_gmtoff=0, | 99 | .tm_gmtoff=0, |
| 100 | .tm_zone="UTC" | 100 | .tm_zone="GMT" |
| 101 | }, | 101 | }, |
| 102 | .gmt_tm= { | 102 | .gmt_tm= { |
| 103 | .tm_year=69, | 103 | .tm_year=69, |
| @@ -110,7 +110,7 @@ struct timetest timetests[] = { | |||
| 110 | .tm_yday=171, | 110 | .tm_yday=171, |
| 111 | .tm_isdst=0, | 111 | .tm_isdst=0, |
| 112 | .tm_gmtoff=0, | 112 | .tm_gmtoff=0, |
| 113 | .tm_zone="GMT" | 113 | .tm_zone="UTC" |
| 114 | }, | 114 | }, |
| 115 | }, | 115 | }, |
| 116 | { | 116 | { |
| @@ -141,7 +141,7 @@ struct timetest timetests[] = { | |||
| 141 | .tm_yday=171, | 141 | .tm_yday=171, |
| 142 | .tm_isdst=0, | 142 | .tm_isdst=0, |
| 143 | .tm_gmtoff=0, | 143 | .tm_gmtoff=0, |
| 144 | .tm_zone="GMT" | 144 | .tm_zone="UTC" |
| 145 | }, | 145 | }, |
| 146 | }, | 146 | }, |
| 147 | { | 147 | { |
| @@ -172,12 +172,12 @@ struct timetest timetests[] = { | |||
| 172 | .tm_yday=0, | 172 | .tm_yday=0, |
| 173 | .tm_isdst=0, | 173 | .tm_isdst=0, |
| 174 | .tm_gmtoff=0, | 174 | .tm_gmtoff=0, |
| 175 | .tm_zone="GMT" | 175 | .tm_zone="UTC" |
| 176 | }, | 176 | }, |
| 177 | }, | 177 | }, |
| 178 | { | 178 | { |
| 179 | .descr="epoch", | 179 | .descr="epoch", |
| 180 | .timezone="right/UTC", | 180 | .timezone="right/GMT", |
| 181 | .time=0, | 181 | .time=0, |
| 182 | .local_tm= { | 182 | .local_tm= { |
| 183 | .tm_year=70, | 183 | .tm_year=70, |
| @@ -190,7 +190,7 @@ struct timetest timetests[] = { | |||
| 190 | .tm_yday=0, | 190 | .tm_yday=0, |
| 191 | .tm_isdst=0, | 191 | .tm_isdst=0, |
| 192 | .tm_gmtoff=0, | 192 | .tm_gmtoff=0, |
| 193 | .tm_zone="UTC" | 193 | .tm_zone="GMT" |
| 194 | }, | 194 | }, |
| 195 | .gmt_tm= { | 195 | .gmt_tm= { |
| 196 | .tm_year=70, | 196 | .tm_year=70, |
| @@ -203,7 +203,7 @@ struct timetest timetests[] = { | |||
| 203 | .tm_yday=0, | 203 | .tm_yday=0, |
| 204 | .tm_isdst=0, | 204 | .tm_isdst=0, |
| 205 | .tm_gmtoff=0, | 205 | .tm_gmtoff=0, |
| 206 | .tm_zone="GMT" | 206 | .tm_zone="UTC" |
| 207 | }, | 207 | }, |
| 208 | }, | 208 | }, |
| 209 | { | 209 | { |
| @@ -234,7 +234,7 @@ struct timetest timetests[] = { | |||
| 234 | .tm_yday=0, | 234 | .tm_yday=0, |
| 235 | .tm_isdst=0, | 235 | .tm_isdst=0, |
| 236 | .tm_gmtoff=0, | 236 | .tm_gmtoff=0, |
| 237 | .tm_zone="GMT" | 237 | .tm_zone="UTC" |
| 238 | }, | 238 | }, |
| 239 | }, | 239 | }, |
| 240 | { | 240 | { |
| @@ -265,12 +265,12 @@ struct timetest timetests[] = { | |||
| 265 | .tm_yday=364, | 265 | .tm_yday=364, |
| 266 | .tm_isdst=0, | 266 | .tm_isdst=0, |
| 267 | .tm_gmtoff=0, | 267 | .tm_gmtoff=0, |
| 268 | .tm_zone="GMT" | 268 | .tm_zone="UTC" |
| 269 | }, | 269 | }, |
| 270 | }, | 270 | }, |
| 271 | { | 271 | { |
| 272 | .descr="epoch - 1", | 272 | .descr="epoch - 1", |
| 273 | .timezone="right/UTC", | 273 | .timezone="right/GMT", |
| 274 | .time=-1, | 274 | .time=-1, |
| 275 | .local_tm= { | 275 | .local_tm= { |
| 276 | .tm_year=69, | 276 | .tm_year=69, |
| @@ -283,7 +283,7 @@ struct timetest timetests[] = { | |||
| 283 | .tm_yday=364, | 283 | .tm_yday=364, |
| 284 | .tm_isdst=0, | 284 | .tm_isdst=0, |
| 285 | .tm_gmtoff=0, | 285 | .tm_gmtoff=0, |
| 286 | .tm_zone="UTC" | 286 | .tm_zone="GMT" |
| 287 | }, | 287 | }, |
| 288 | .gmt_tm= { | 288 | .gmt_tm= { |
| 289 | .tm_year=69, | 289 | .tm_year=69, |
| @@ -296,7 +296,7 @@ struct timetest timetests[] = { | |||
| 296 | .tm_yday=364, | 296 | .tm_yday=364, |
| 297 | .tm_isdst=0, | 297 | .tm_isdst=0, |
| 298 | .tm_gmtoff=0, | 298 | .tm_gmtoff=0, |
| 299 | .tm_zone="GMT" | 299 | .tm_zone="UTC" |
| 300 | }, | 300 | }, |
| 301 | }, | 301 | }, |
| 302 | { | 302 | { |
| @@ -327,7 +327,7 @@ struct timetest timetests[] = { | |||
| 327 | .tm_yday=364, | 327 | .tm_yday=364, |
| 328 | .tm_isdst=0, | 328 | .tm_isdst=0, |
| 329 | .tm_gmtoff=0, | 329 | .tm_gmtoff=0, |
| 330 | .tm_zone="GMT" | 330 | .tm_zone="UTC" |
| 331 | }, | 331 | }, |
| 332 | }, | 332 | }, |
| 333 | { | 333 | { |
| @@ -358,12 +358,12 @@ struct timetest timetests[] = { | |||
| 358 | .tm_yday=346, | 358 | .tm_yday=346, |
| 359 | .tm_isdst=0, | 359 | .tm_isdst=0, |
| 360 | .tm_gmtoff=0, | 360 | .tm_gmtoff=0, |
| 361 | .tm_zone="GMT" | 361 | .tm_zone="UTC" |
| 362 | }, | 362 | }, |
| 363 | }, | 363 | }, |
| 364 | { | 364 | { |
| 365 | .descr="legacy min", | 365 | .descr="legacy min", |
| 366 | .timezone="right/UTC", | 366 | .timezone="right/GMT", |
| 367 | .time=-2147483648, | 367 | .time=-2147483648, |
| 368 | .local_tm= { | 368 | .local_tm= { |
| 369 | .tm_year=1, | 369 | .tm_year=1, |
| @@ -376,7 +376,7 @@ struct timetest timetests[] = { | |||
| 376 | .tm_yday=346, | 376 | .tm_yday=346, |
| 377 | .tm_isdst=0, | 377 | .tm_isdst=0, |
| 378 | .tm_gmtoff=0, | 378 | .tm_gmtoff=0, |
| 379 | .tm_zone="UTC" | 379 | .tm_zone="GMT" |
| 380 | }, | 380 | }, |
| 381 | .gmt_tm= { | 381 | .gmt_tm= { |
| 382 | .tm_year=1, | 382 | .tm_year=1, |
| @@ -389,7 +389,7 @@ struct timetest timetests[] = { | |||
| 389 | .tm_yday=346, | 389 | .tm_yday=346, |
| 390 | .tm_isdst=0, | 390 | .tm_isdst=0, |
| 391 | .tm_gmtoff=0, | 391 | .tm_gmtoff=0, |
| 392 | .tm_zone="GMT" | 392 | .tm_zone="UTC" |
| 393 | }, | 393 | }, |
| 394 | }, | 394 | }, |
| 395 | { | 395 | { |
| @@ -420,12 +420,12 @@ struct timetest timetests[] = { | |||
| 420 | .tm_yday=346, | 420 | .tm_yday=346, |
| 421 | .tm_isdst=0, | 421 | .tm_isdst=0, |
| 422 | .tm_gmtoff=0, | 422 | .tm_gmtoff=0, |
| 423 | .tm_zone="GMT" | 423 | .tm_zone="UTC" |
| 424 | }, | 424 | }, |
| 425 | }, | 425 | }, |
| 426 | { | 426 | { |
| 427 | .descr="legacy min - 1", | 427 | .descr="legacy min - 1", |
| 428 | .timezone="right/UTC", | 428 | .timezone="right/GMT", |
| 429 | .time=-2147483649, | 429 | .time=-2147483649, |
| 430 | .local_tm= { | 430 | .local_tm= { |
| 431 | .tm_year=1, | 431 | .tm_year=1, |
| @@ -438,7 +438,7 @@ struct timetest timetests[] = { | |||
| 438 | .tm_yday=346, | 438 | .tm_yday=346, |
| 439 | .tm_isdst=0, | 439 | .tm_isdst=0, |
| 440 | .tm_gmtoff=0, | 440 | .tm_gmtoff=0, |
| 441 | .tm_zone="UTC" | 441 | .tm_zone="GMT" |
| 442 | }, | 442 | }, |
| 443 | .gmt_tm= { | 443 | .gmt_tm= { |
| 444 | .tm_year=1, | 444 | .tm_year=1, |
| @@ -451,7 +451,7 @@ struct timetest timetests[] = { | |||
| 451 | .tm_yday=346, | 451 | .tm_yday=346, |
| 452 | .tm_isdst=0, | 452 | .tm_isdst=0, |
| 453 | .tm_gmtoff=0, | 453 | .tm_gmtoff=0, |
| 454 | .tm_zone="GMT" | 454 | .tm_zone="UTC" |
| 455 | }, | 455 | }, |
| 456 | }, | 456 | }, |
| 457 | { | 457 | { |
| @@ -482,12 +482,12 @@ struct timetest timetests[] = { | |||
| 482 | .tm_yday=18, | 482 | .tm_yday=18, |
| 483 | .tm_isdst=0, | 483 | .tm_isdst=0, |
| 484 | .tm_gmtoff=0, | 484 | .tm_gmtoff=0, |
| 485 | .tm_zone="GMT" | 485 | .tm_zone="UTC" |
| 486 | }, | 486 | }, |
| 487 | }, | 487 | }, |
| 488 | { | 488 | { |
| 489 | .descr="legacy max", | 489 | .descr="legacy max", |
| 490 | .timezone="right/UTC", | 490 | .timezone="right/GMT", |
| 491 | .time=2147483647, | 491 | .time=2147483647, |
| 492 | .local_tm= { | 492 | .local_tm= { |
| 493 | .tm_year=138, | 493 | .tm_year=138, |
| @@ -500,7 +500,7 @@ struct timetest timetests[] = { | |||
| 500 | .tm_yday=18, | 500 | .tm_yday=18, |
| 501 | .tm_isdst=0, | 501 | .tm_isdst=0, |
| 502 | .tm_gmtoff=0, | 502 | .tm_gmtoff=0, |
| 503 | .tm_zone="UTC" | 503 | .tm_zone="GMT" |
| 504 | }, | 504 | }, |
| 505 | .gmt_tm= { | 505 | .gmt_tm= { |
| 506 | .tm_year=138, | 506 | .tm_year=138, |
| @@ -513,7 +513,7 @@ struct timetest timetests[] = { | |||
| 513 | .tm_yday=18, | 513 | .tm_yday=18, |
| 514 | .tm_isdst=0, | 514 | .tm_isdst=0, |
| 515 | .tm_gmtoff=0, | 515 | .tm_gmtoff=0, |
| 516 | .tm_zone="GMT" | 516 | .tm_zone="UTC" |
| 517 | }, | 517 | }, |
| 518 | }, | 518 | }, |
| 519 | { | 519 | { |
| @@ -544,12 +544,12 @@ struct timetest timetests[] = { | |||
| 544 | .tm_yday=18, | 544 | .tm_yday=18, |
| 545 | .tm_isdst=0, | 545 | .tm_isdst=0, |
| 546 | .tm_gmtoff=0, | 546 | .tm_gmtoff=0, |
| 547 | .tm_zone="GMT" | 547 | .tm_zone="UTC" |
| 548 | }, | 548 | }, |
| 549 | }, | 549 | }, |
| 550 | { | 550 | { |
| 551 | .descr="legacy max + 1", | 551 | .descr="legacy max + 1", |
| 552 | .timezone="right/UTC", | 552 | .timezone="right/GMT", |
| 553 | .time=2147483648, | 553 | .time=2147483648, |
| 554 | .local_tm= { | 554 | .local_tm= { |
| 555 | .tm_year=138, | 555 | .tm_year=138, |
| @@ -562,7 +562,7 @@ struct timetest timetests[] = { | |||
| 562 | .tm_yday=18, | 562 | .tm_yday=18, |
| 563 | .tm_isdst=0, | 563 | .tm_isdst=0, |
| 564 | .tm_gmtoff=0, | 564 | .tm_gmtoff=0, |
| 565 | .tm_zone="UTC" | 565 | .tm_zone="GMT" |
| 566 | }, | 566 | }, |
| 567 | .gmt_tm= { | 567 | .gmt_tm= { |
| 568 | .tm_year=138, | 568 | .tm_year=138, |
| @@ -575,7 +575,7 @@ struct timetest timetests[] = { | |||
| 575 | .tm_yday=18, | 575 | .tm_yday=18, |
| 576 | .tm_isdst=0, | 576 | .tm_isdst=0, |
| 577 | .tm_gmtoff=0, | 577 | .tm_gmtoff=0, |
| 578 | .tm_zone="GMT" | 578 | .tm_zone="UTC" |
| 579 | }, | 579 | }, |
| 580 | }, | 580 | }, |
| 581 | { | 581 | { |
| @@ -611,7 +611,7 @@ struct timetest timetests[] = { | |||
| 611 | }, | 611 | }, |
| 612 | { | 612 | { |
| 613 | .descr="min", | 613 | .descr="min", |
| 614 | .timezone="right/UTC", | 614 | .timezone="right/GMT", |
| 615 | .time=INT64_MIN, | 615 | .time=INT64_MIN, |
| 616 | .local_tm= { | 616 | .local_tm= { |
| 617 | .tm_year=0, | 617 | .tm_year=0, |
| @@ -704,7 +704,7 @@ struct timetest timetests[] = { | |||
| 704 | }, | 704 | }, |
| 705 | { | 705 | { |
| 706 | .descr="max", | 706 | .descr="max", |
| 707 | .timezone="right/UTC", | 707 | .timezone="right/GMT", |
| 708 | .time=9223372036854775807, | 708 | .time=9223372036854775807, |
| 709 | .local_tm= { | 709 | .local_tm= { |
| 710 | .tm_year=0, | 710 | .tm_year=0, |
| @@ -792,7 +792,7 @@ struct timetest timetests[] = { | |||
| 792 | .tm_yday=30, | 792 | .tm_yday=30, |
| 793 | .tm_isdst=0, | 793 | .tm_isdst=0, |
| 794 | .tm_gmtoff=0, | 794 | .tm_gmtoff=0, |
| 795 | .tm_zone="GMT" | 795 | .tm_zone="UTC" |
| 796 | }, | 796 | }, |
| 797 | }, | 797 | }, |
| 798 | { | 798 | { |
| @@ -823,12 +823,12 @@ struct timetest timetests[] = { | |||
| 823 | .tm_yday=30, | 823 | .tm_yday=30, |
| 824 | .tm_isdst=0, | 824 | .tm_isdst=0, |
| 825 | .tm_gmtoff=0, | 825 | .tm_gmtoff=0, |
| 826 | .tm_zone="GMT" | 826 | .tm_zone="UTC" |
| 827 | }, | 827 | }, |
| 828 | }, | 828 | }, |
| 829 | { | 829 | { |
| 830 | .descr="maxint struct tm", | 830 | .descr="maxint struct tm", |
| 831 | .timezone="right/UTC", | 831 | .timezone="right/GMT", |
| 832 | .time=67767976204675199, | 832 | .time=67767976204675199, |
| 833 | .local_tm= { | 833 | .local_tm= { |
| 834 | .tm_year=2147481747, | 834 | .tm_year=2147481747, |
| @@ -841,7 +841,7 @@ struct timetest timetests[] = { | |||
| 841 | .tm_yday=30, | 841 | .tm_yday=30, |
| 842 | .tm_isdst=0, | 842 | .tm_isdst=0, |
| 843 | .tm_gmtoff=0, | 843 | .tm_gmtoff=0, |
| 844 | .tm_zone="UTC" | 844 | .tm_zone="GMT" |
| 845 | }, | 845 | }, |
| 846 | .gmt_tm= { | 846 | .gmt_tm= { |
| 847 | .tm_year=2147481747, | 847 | .tm_year=2147481747, |
| @@ -854,12 +854,12 @@ struct timetest timetests[] = { | |||
| 854 | .tm_yday=30, | 854 | .tm_yday=30, |
| 855 | .tm_isdst=0, | 855 | .tm_isdst=0, |
| 856 | .tm_gmtoff=0, | 856 | .tm_gmtoff=0, |
| 857 | .tm_zone="GMT" | 857 | .tm_zone="UTC" |
| 858 | }, | 858 | }, |
| 859 | }, | 859 | }, |
| 860 | { | 860 | { |
| 861 | .descr="minint struct tm", | 861 | .descr="minint struct tm", |
| 862 | .timezone="right/UTC", | 862 | .timezone="right/GMT", |
| 863 | .time=-67768038398073601, | 863 | .time=-67768038398073601, |
| 864 | .local_tm= { | 864 | .local_tm= { |
| 865 | .tm_year=-2147483578, | 865 | .tm_year=-2147483578, |
| @@ -872,7 +872,7 @@ struct timetest timetests[] = { | |||
| 872 | .tm_yday=30, | 872 | .tm_yday=30, |
| 873 | .tm_isdst=0, | 873 | .tm_isdst=0, |
| 874 | .tm_gmtoff=0, | 874 | .tm_gmtoff=0, |
| 875 | .tm_zone="UTC" | 875 | .tm_zone="GMT" |
| 876 | }, | 876 | }, |
| 877 | .gmt_tm= { | 877 | .gmt_tm= { |
| 878 | .tm_year=-2147483578, | 878 | .tm_year=-2147483578, |
| @@ -885,7 +885,7 @@ struct timetest timetests[] = { | |||
| 885 | .tm_yday=30, | 885 | .tm_yday=30, |
| 886 | .tm_isdst=0, | 886 | .tm_isdst=0, |
| 887 | .tm_gmtoff=0, | 887 | .tm_gmtoff=0, |
| 888 | .tm_zone="GMT" | 888 | .tm_zone="UTC" |
| 889 | }, | 889 | }, |
| 890 | }, | 890 | }, |
| 891 | { | 891 | { |
| @@ -916,12 +916,12 @@ struct timetest timetests[] = { | |||
| 916 | .tm_yday=0, | 916 | .tm_yday=0, |
| 917 | .tm_isdst=0, | 917 | .tm_isdst=0, |
| 918 | .tm_gmtoff=0, | 918 | .tm_gmtoff=0, |
| 919 | .tm_zone="GMT" | 919 | .tm_zone="UTC" |
| 920 | }, | 920 | }, |
| 921 | }, | 921 | }, |
| 922 | { | 922 | { |
| 923 | .descr="0000", | 923 | .descr="0000", |
| 924 | .timezone="right/UTC", | 924 | .timezone="right/GMT", |
| 925 | .time=-62167219200, | 925 | .time=-62167219200, |
| 926 | .local_tm= { | 926 | .local_tm= { |
| 927 | .tm_year=-1900, | 927 | .tm_year=-1900, |
| @@ -934,7 +934,7 @@ struct timetest timetests[] = { | |||
| 934 | .tm_yday=0, | 934 | .tm_yday=0, |
| 935 | .tm_isdst=0, | 935 | .tm_isdst=0, |
| 936 | .tm_gmtoff=0, | 936 | .tm_gmtoff=0, |
| 937 | .tm_zone="UTC" | 937 | .tm_zone="GMT" |
| 938 | }, | 938 | }, |
| 939 | .gmt_tm= { | 939 | .gmt_tm= { |
| 940 | .tm_year=-1900, | 940 | .tm_year=-1900, |
| @@ -947,7 +947,7 @@ struct timetest timetests[] = { | |||
| 947 | .tm_yday=0, | 947 | .tm_yday=0, |
| 948 | .tm_isdst=0, | 948 | .tm_isdst=0, |
| 949 | .tm_gmtoff=0, | 949 | .tm_gmtoff=0, |
| 950 | .tm_zone="GMT" | 950 | .tm_zone="UTC" |
| 951 | }, | 951 | }, |
| 952 | }, | 952 | }, |
| 953 | { | 953 | { |
| @@ -978,7 +978,7 @@ struct timetest timetests[] = { | |||
| 978 | .tm_yday=0, | 978 | .tm_yday=0, |
| 979 | .tm_isdst=0, | 979 | .tm_isdst=0, |
| 980 | .tm_gmtoff=0, | 980 | .tm_gmtoff=0, |
| 981 | .tm_zone="GMT" | 981 | .tm_zone="UTC" |
| 982 | }, | 982 | }, |
| 983 | }, | 983 | }, |
| 984 | { | 984 | { |
| @@ -1009,12 +1009,12 @@ struct timetest timetests[] = { | |||
| 1009 | .tm_yday=364, | 1009 | .tm_yday=364, |
| 1010 | .tm_isdst=0, | 1010 | .tm_isdst=0, |
| 1011 | .tm_gmtoff=0, | 1011 | .tm_gmtoff=0, |
| 1012 | .tm_zone="GMT" | 1012 | .tm_zone="UTC" |
| 1013 | }, | 1013 | }, |
| 1014 | }, | 1014 | }, |
| 1015 | { | 1015 | { |
| 1016 | .descr="9999", | 1016 | .descr="9999", |
| 1017 | .timezone="right/UTC", | 1017 | .timezone="right/GMT", |
| 1018 | .time=253402300799, | 1018 | .time=253402300799, |
| 1019 | .local_tm= { | 1019 | .local_tm= { |
| 1020 | .tm_year=8099, | 1020 | .tm_year=8099, |
| @@ -1027,7 +1027,7 @@ struct timetest timetests[] = { | |||
| 1027 | .tm_yday=364, | 1027 | .tm_yday=364, |
| 1028 | .tm_isdst=0, | 1028 | .tm_isdst=0, |
| 1029 | .tm_gmtoff=0, | 1029 | .tm_gmtoff=0, |
| 1030 | .tm_zone="UTC" | 1030 | .tm_zone="GMT" |
| 1031 | }, | 1031 | }, |
| 1032 | .gmt_tm= { | 1032 | .gmt_tm= { |
| 1033 | .tm_year=8099, | 1033 | .tm_year=8099, |
| @@ -1040,7 +1040,7 @@ struct timetest timetests[] = { | |||
| 1040 | .tm_yday=364, | 1040 | .tm_yday=364, |
| 1041 | .tm_isdst=0, | 1041 | .tm_isdst=0, |
| 1042 | .tm_gmtoff=0, | 1042 | .tm_gmtoff=0, |
| 1043 | .tm_zone="GMT" | 1043 | .tm_zone="UTC" |
| 1044 | }, | 1044 | }, |
| 1045 | }, | 1045 | }, |
| 1046 | { | 1046 | { |
| @@ -1071,7 +1071,7 @@ struct timetest timetests[] = { | |||
| 1071 | .tm_yday=364, | 1071 | .tm_yday=364, |
| 1072 | .tm_isdst=0, | 1072 | .tm_isdst=0, |
| 1073 | .tm_gmtoff=0, | 1073 | .tm_gmtoff=0, |
| 1074 | .tm_zone="GMT" | 1074 | .tm_zone="UTC" |
| 1075 | }, | 1075 | }, |
| 1076 | }, | 1076 | }, |
| 1077 | { | 1077 | { |
| @@ -1102,7 +1102,7 @@ struct timetest timetests[] = { | |||
| 1102 | .tm_yday=0, | 1102 | .tm_yday=0, |
| 1103 | .tm_isdst=0, | 1103 | .tm_isdst=0, |
| 1104 | .tm_gmtoff=0, | 1104 | .tm_gmtoff=0, |
| 1105 | .tm_zone="GMT" | 1105 | .tm_zone="UTC" |
| 1106 | }, | 1106 | }, |
| 1107 | }, | 1107 | }, |
| 1108 | { | 1108 | { |
| @@ -1133,7 +1133,7 @@ struct timetest timetests[] = { | |||
| 1133 | .tm_yday=0, | 1133 | .tm_yday=0, |
| 1134 | .tm_isdst=0, | 1134 | .tm_isdst=0, |
| 1135 | .tm_gmtoff=0, | 1135 | .tm_gmtoff=0, |
| 1136 | .tm_zone="GMT" | 1136 | .tm_zone="UTC" |
| 1137 | }, | 1137 | }, |
| 1138 | }, | 1138 | }, |
| 1139 | { | 1139 | { |
| @@ -1164,12 +1164,12 @@ struct timetest timetests[] = { | |||
| 1164 | .tm_yday=0, | 1164 | .tm_yday=0, |
| 1165 | .tm_isdst=0, | 1165 | .tm_isdst=0, |
| 1166 | .tm_gmtoff=0, | 1166 | .tm_gmtoff=0, |
| 1167 | .tm_zone="GMT" | 1167 | .tm_zone="UTC" |
| 1168 | }, | 1168 | }, |
| 1169 | }, | 1169 | }, |
| 1170 | { | 1170 | { |
| 1171 | .descr="leap second - 1", | 1171 | .descr="leap second - 1", |
| 1172 | .timezone="right/UTC", | 1172 | .timezone="right/GMT", |
| 1173 | .time=1483228825, | 1173 | .time=1483228825, |
| 1174 | .local_tm= { | 1174 | .local_tm= { |
| 1175 | .tm_year=116, | 1175 | .tm_year=116, |
| @@ -1182,7 +1182,7 @@ struct timetest timetests[] = { | |||
| 1182 | .tm_yday=365, | 1182 | .tm_yday=365, |
| 1183 | .tm_isdst=0, | 1183 | .tm_isdst=0, |
| 1184 | .tm_gmtoff=0, | 1184 | .tm_gmtoff=0, |
| 1185 | .tm_zone="UTC" | 1185 | .tm_zone="GMT" |
| 1186 | }, | 1186 | }, |
| 1187 | .gmt_tm= { | 1187 | .gmt_tm= { |
| 1188 | .tm_year=117, | 1188 | .tm_year=117, |
| @@ -1195,12 +1195,12 @@ struct timetest timetests[] = { | |||
| 1195 | .tm_yday=0, | 1195 | .tm_yday=0, |
| 1196 | .tm_isdst=0, | 1196 | .tm_isdst=0, |
| 1197 | .tm_gmtoff=0, | 1197 | .tm_gmtoff=0, |
| 1198 | .tm_zone="GMT" | 1198 | .tm_zone="UTC" |
| 1199 | }, | 1199 | }, |
| 1200 | }, | 1200 | }, |
| 1201 | { | 1201 | { |
| 1202 | .descr="leap second", | 1202 | .descr="leap second", |
| 1203 | .timezone="right/UTC", | 1203 | .timezone="right/GMT", |
| 1204 | .time=1483228826, | 1204 | .time=1483228826, |
| 1205 | .local_tm= { | 1205 | .local_tm= { |
| 1206 | .tm_year=116, | 1206 | .tm_year=116, |
| @@ -1213,7 +1213,7 @@ struct timetest timetests[] = { | |||
| 1213 | .tm_yday=365, | 1213 | .tm_yday=365, |
| 1214 | .tm_isdst=0, | 1214 | .tm_isdst=0, |
| 1215 | .tm_gmtoff=0, | 1215 | .tm_gmtoff=0, |
| 1216 | .tm_zone="UTC" | 1216 | .tm_zone="GMT" |
| 1217 | }, | 1217 | }, |
| 1218 | .gmt_tm= { | 1218 | .gmt_tm= { |
| 1219 | .tm_year=117, | 1219 | .tm_year=117, |
| @@ -1226,12 +1226,12 @@ struct timetest timetests[] = { | |||
| 1226 | .tm_yday=0, | 1226 | .tm_yday=0, |
| 1227 | .tm_isdst=0, | 1227 | .tm_isdst=0, |
| 1228 | .tm_gmtoff=0, | 1228 | .tm_gmtoff=0, |
| 1229 | .tm_zone="GMT" | 1229 | .tm_zone="UTC" |
| 1230 | }, | 1230 | }, |
| 1231 | }, | 1231 | }, |
| 1232 | { | 1232 | { |
| 1233 | .descr="leap second + 1", | 1233 | .descr="leap second + 1", |
| 1234 | .timezone="right/UTC", | 1234 | .timezone="right/GMT", |
| 1235 | .time=1483228827, | 1235 | .time=1483228827, |
| 1236 | .local_tm= { | 1236 | .local_tm= { |
| 1237 | .tm_year=117, | 1237 | .tm_year=117, |
| @@ -1244,7 +1244,7 @@ struct timetest timetests[] = { | |||
| 1244 | .tm_yday=0, | 1244 | .tm_yday=0, |
| 1245 | .tm_isdst=0, | 1245 | .tm_isdst=0, |
| 1246 | .tm_gmtoff=0, | 1246 | .tm_gmtoff=0, |
| 1247 | .tm_zone="UTC" | 1247 | .tm_zone="GMT" |
| 1248 | }, | 1248 | }, |
| 1249 | .gmt_tm= { | 1249 | .gmt_tm= { |
| 1250 | .tm_year=117, | 1250 | .tm_year=117, |
| @@ -1257,7 +1257,7 @@ struct timetest timetests[] = { | |||
| 1257 | .tm_yday=0, | 1257 | .tm_yday=0, |
| 1258 | .tm_isdst=0, | 1258 | .tm_isdst=0, |
| 1259 | .tm_gmtoff=0, | 1259 | .tm_gmtoff=0, |
| 1260 | .tm_zone="GMT" | 1260 | .tm_zone="UTC" |
| 1261 | }, | 1261 | }, |
| 1262 | }, | 1262 | }, |
| 1263 | { | 1263 | { |
| @@ -1288,7 +1288,7 @@ struct timetest timetests[] = { | |||
| 1288 | .tm_yday=0, | 1288 | .tm_yday=0, |
| 1289 | .tm_isdst=0, | 1289 | .tm_isdst=0, |
| 1290 | .tm_gmtoff=0, | 1290 | .tm_gmtoff=0, |
| 1291 | .tm_zone="GMT" | 1291 | .tm_zone="UTC" |
| 1292 | }, | 1292 | }, |
| 1293 | }, | 1293 | }, |
| 1294 | { | 1294 | { |
| @@ -1319,7 +1319,7 @@ struct timetest timetests[] = { | |||
| 1319 | .tm_yday=0, | 1319 | .tm_yday=0, |
| 1320 | .tm_isdst=0, | 1320 | .tm_isdst=0, |
| 1321 | .tm_gmtoff=0, | 1321 | .tm_gmtoff=0, |
| 1322 | .tm_zone="GMT" | 1322 | .tm_zone="UTC" |
| 1323 | }, | 1323 | }, |
| 1324 | }, | 1324 | }, |
| 1325 | { | 1325 | { |
| @@ -1350,7 +1350,7 @@ struct timetest timetests[] = { | |||
| 1350 | .tm_yday=0, | 1350 | .tm_yday=0, |
| 1351 | .tm_isdst=0, | 1351 | .tm_isdst=0, |
| 1352 | .tm_gmtoff=0, | 1352 | .tm_gmtoff=0, |
| 1353 | .tm_zone="GMT" | 1353 | .tm_zone="UTC" |
| 1354 | }, | 1354 | }, |
| 1355 | }, | 1355 | }, |
| 1356 | { | 1356 | { |
| @@ -1381,7 +1381,7 @@ struct timetest timetests[] = { | |||
| 1381 | .tm_yday=72, | 1381 | .tm_yday=72, |
| 1382 | .tm_isdst=0, | 1382 | .tm_isdst=0, |
| 1383 | .tm_gmtoff=0, | 1383 | .tm_gmtoff=0, |
| 1384 | .tm_zone="GMT" | 1384 | .tm_zone="UTC" |
| 1385 | }, | 1385 | }, |
| 1386 | }, | 1386 | }, |
| 1387 | { | 1387 | { |
| @@ -1412,7 +1412,7 @@ struct timetest timetests[] = { | |||
| 1412 | .tm_yday=72, | 1412 | .tm_yday=72, |
| 1413 | .tm_isdst=0, | 1413 | .tm_isdst=0, |
| 1414 | .tm_gmtoff=0, | 1414 | .tm_gmtoff=0, |
| 1415 | .tm_zone="GMT" | 1415 | .tm_zone="UTC" |
| 1416 | }, | 1416 | }, |
| 1417 | }, | 1417 | }, |
| 1418 | { | 1418 | { |
| @@ -1443,7 +1443,7 @@ struct timetest timetests[] = { | |||
| 1443 | .tm_yday=72, | 1443 | .tm_yday=72, |
| 1444 | .tm_isdst=0, | 1444 | .tm_isdst=0, |
| 1445 | .tm_gmtoff=0, | 1445 | .tm_gmtoff=0, |
| 1446 | .tm_zone="GMT" | 1446 | .tm_zone="UTC" |
| 1447 | }, | 1447 | }, |
| 1448 | }, | 1448 | }, |
| 1449 | { | 1449 | { |
| @@ -1474,7 +1474,7 @@ struct timetest timetests[] = { | |||
| 1474 | .tm_yday=72, | 1474 | .tm_yday=72, |
| 1475 | .tm_isdst=0, | 1475 | .tm_isdst=0, |
| 1476 | .tm_gmtoff=0, | 1476 | .tm_gmtoff=0, |
| 1477 | .tm_zone="GMT" | 1477 | .tm_zone="UTC" |
| 1478 | }, | 1478 | }, |
| 1479 | }, | 1479 | }, |
| 1480 | { | 1480 | { |
| @@ -1505,7 +1505,7 @@ struct timetest timetests[] = { | |||
| 1505 | .tm_yday=72, | 1505 | .tm_yday=72, |
| 1506 | .tm_isdst=0, | 1506 | .tm_isdst=0, |
| 1507 | .tm_gmtoff=0, | 1507 | .tm_gmtoff=0, |
| 1508 | .tm_zone="GMT" | 1508 | .tm_zone="UTC" |
| 1509 | }, | 1509 | }, |
| 1510 | }, | 1510 | }, |
| 1511 | { | 1511 | { |
| @@ -1536,7 +1536,7 @@ struct timetest timetests[] = { | |||
| 1536 | .tm_yday=72, | 1536 | .tm_yday=72, |
| 1537 | .tm_isdst=0, | 1537 | .tm_isdst=0, |
| 1538 | .tm_gmtoff=0, | 1538 | .tm_gmtoff=0, |
| 1539 | .tm_zone="GMT" | 1539 | .tm_zone="UTC" |
| 1540 | }, | 1540 | }, |
| 1541 | }, | 1541 | }, |
| 1542 | { | 1542 | { |
| @@ -1567,7 +1567,7 @@ struct timetest timetests[] = { | |||
| 1567 | .tm_yday=310, | 1567 | .tm_yday=310, |
| 1568 | .tm_isdst=0, | 1568 | .tm_isdst=0, |
| 1569 | .tm_gmtoff=0, | 1569 | .tm_gmtoff=0, |
| 1570 | .tm_zone="GMT" | 1570 | .tm_zone="UTC" |
| 1571 | }, | 1571 | }, |
| 1572 | }, | 1572 | }, |
| 1573 | { | 1573 | { |
| @@ -1598,7 +1598,7 @@ struct timetest timetests[] = { | |||
| 1598 | .tm_yday=310, | 1598 | .tm_yday=310, |
| 1599 | .tm_isdst=0, | 1599 | .tm_isdst=0, |
| 1600 | .tm_gmtoff=0, | 1600 | .tm_gmtoff=0, |
| 1601 | .tm_zone="GMT" | 1601 | .tm_zone="UTC" |
| 1602 | }, | 1602 | }, |
| 1603 | }, | 1603 | }, |
| 1604 | { | 1604 | { |
| @@ -1629,7 +1629,7 @@ struct timetest timetests[] = { | |||
| 1629 | .tm_yday=310, | 1629 | .tm_yday=310, |
| 1630 | .tm_isdst=0, | 1630 | .tm_isdst=0, |
| 1631 | .tm_gmtoff=0, | 1631 | .tm_gmtoff=0, |
| 1632 | .tm_zone="GMT" | 1632 | .tm_zone="UTC" |
| 1633 | }, | 1633 | }, |
| 1634 | }, | 1634 | }, |
| 1635 | { | 1635 | { |
| @@ -1660,7 +1660,7 @@ struct timetest timetests[] = { | |||
| 1660 | .tm_yday=310, | 1660 | .tm_yday=310, |
| 1661 | .tm_isdst=0, | 1661 | .tm_isdst=0, |
| 1662 | .tm_gmtoff=0, | 1662 | .tm_gmtoff=0, |
| 1663 | .tm_zone="GMT" | 1663 | .tm_zone="UTC" |
| 1664 | }, | 1664 | }, |
| 1665 | }, | 1665 | }, |
| 1666 | { | 1666 | { |
| @@ -1691,7 +1691,7 @@ struct timetest timetests[] = { | |||
| 1691 | .tm_yday=310, | 1691 | .tm_yday=310, |
| 1692 | .tm_isdst=0, | 1692 | .tm_isdst=0, |
| 1693 | .tm_gmtoff=0, | 1693 | .tm_gmtoff=0, |
| 1694 | .tm_zone="GMT" | 1694 | .tm_zone="UTC" |
| 1695 | }, | 1695 | }, |
| 1696 | }, | 1696 | }, |
| 1697 | { | 1697 | { |
| @@ -1722,7 +1722,7 @@ struct timetest timetests[] = { | |||
| 1722 | .tm_yday=310, | 1722 | .tm_yday=310, |
| 1723 | .tm_isdst=0, | 1723 | .tm_isdst=0, |
| 1724 | .tm_gmtoff=0, | 1724 | .tm_gmtoff=0, |
| 1725 | .tm_zone="GMT" | 1725 | .tm_zone="UTC" |
| 1726 | }, | 1726 | }, |
| 1727 | }, | 1727 | }, |
| 1728 | { | 1728 | { |
diff --git a/src/regress/lib/libcrypto/aes/aes_test.c b/src/regress/lib/libcrypto/aes/aes_test.c index 37bee05ca7..8d5947a031 100644 --- a/src/regress/lib/libcrypto/aes/aes_test.c +++ b/src/regress/lib/libcrypto/aes/aes_test.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: aes_test.c,v 1.3 2023/09/28 08:21:43 tb Exp $ */ | 1 | /* $OpenBSD: aes_test.c,v 1.5 2025/07/05 14:32:47 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2022 Joshua Sing <joshua@hypera.dev> | 3 | * Copyright (c) 2022 Joshua Sing <joshua@hypera.dev> |
| 4 | * | 4 | * |
| @@ -524,6 +524,161 @@ static const struct aes_test aes_tests[] = { | |||
| 524 | }, | 524 | }, |
| 525 | .out_len = 64, | 525 | .out_len = 64, |
| 526 | }, | 526 | }, |
| 527 | |||
| 528 | /* XTS128 - Test vectors from NIST SP 800-38A */ | ||
| 529 | { | ||
| 530 | /* XTSGenAES128 1 */ | ||
| 531 | .mode = NID_aes_128_xts, | ||
| 532 | .key = { | ||
| 533 | 0xa1, 0xb9, 0x0c, 0xba, 0x3f, 0x06, 0xac, 0x35, | ||
| 534 | 0x3b, 0x2c, 0x34, 0x38, 0x76, 0x08, 0x17, 0x62, | ||
| 535 | 0x09, 0x09, 0x23, 0x02, 0x6e, 0x91, 0x77, 0x18, | ||
| 536 | 0x15, 0xf2, 0x9d, 0xab, 0x01, 0x93, 0x2f, 0x2f, | ||
| 537 | }, | ||
| 538 | .iv = { | ||
| 539 | 0x4f, 0xae, 0xf7, 0x11, 0x7c, 0xda, 0x59, 0xc6, | ||
| 540 | 0x6e, 0x4b, 0x92, 0x01, 0x3e, 0x76, 0x8a, 0xd5, | ||
| 541 | }, | ||
| 542 | .iv_len = 16, | ||
| 543 | .in = { | ||
| 544 | 0xeb, 0xab, 0xce, 0x95, 0xb1, 0x4d, 0x3c, 0x8d, | ||
| 545 | 0x6f, 0xb3, 0x50, 0x39, 0x07, 0x90, 0x31, 0x1c, | ||
| 546 | }, | ||
| 547 | .in_len = 16, | ||
| 548 | .out = { | ||
| 549 | 0x77, 0x8a, 0xe8, 0xb4, 0x3c, 0xb9, 0x8d, 0x5a, | ||
| 550 | 0x82, 0x50, 0x81, 0xd5, 0xbe, 0x47, 0x1c, 0x63, | ||
| 551 | }, | ||
| 552 | .out_len = 16, | ||
| 553 | }, | ||
| 554 | { | ||
| 555 | /* XTSGenAES128 385 */ | ||
| 556 | .mode = NID_aes_128_xts, | ||
| 557 | .key = { | ||
| 558 | 0xb8, 0xdb, 0x0b, 0x9e, 0x63, 0xf5, 0xf0, 0xe6, | ||
| 559 | 0x60, 0x97, 0x98, 0xa6, 0xcb, 0x42, 0xbb, 0x5b, | ||
| 560 | 0x5d, 0x71, 0x39, 0xbb, 0x95, 0x57, 0x99, 0xf5, | ||
| 561 | 0x2a, 0x7c, 0x58, 0x1f, 0x84, 0x63, 0x31, 0x76, | ||
| 562 | }, | ||
| 563 | .iv = { | ||
| 564 | 0x8d, 0x46, 0xf9, 0x67, 0x01, 0x16, 0x7a, 0x1d, | ||
| 565 | 0x77, 0xcd, 0x1e, 0x44, 0xda, 0x92, 0xf3, 0xa8, | ||
| 566 | }, | ||
| 567 | .iv_len = 16, | ||
| 568 | .in = { | ||
| 569 | 0xb4, 0x64, 0x4d, 0xc1, 0xb3, 0x8d, 0xd5, 0x98, | ||
| 570 | 0xca, 0x84, 0x0a, 0x82, 0xd4, 0xd9, 0xc0, 0x65, | ||
| 571 | 0x67, 0x23, 0xb1, 0x58, 0x01, 0xaa, 0x18, 0xe6, | ||
| 572 | 0x6e, | ||
| 573 | }, | ||
| 574 | .in_len = 25, | ||
| 575 | .out = { | ||
| 576 | 0x09, 0x28, 0x8c, 0xf5, 0x1f, 0x1e, 0xb4, 0xad, | ||
| 577 | 0xb8, 0x54, 0x23, 0xd0, 0xe0, 0xd6, 0xe9, 0x58, | ||
| 578 | 0x18, 0x87, 0x06, 0xaf, 0x26, 0x0e, 0x24, 0x67, | ||
| 579 | 0x4e, | ||
| 580 | }, | ||
| 581 | .out_len = 25, | ||
| 582 | }, | ||
| 583 | { | ||
| 584 | /* XTSGenAES128 404 */ | ||
| 585 | .mode = NID_aes_128_xts, | ||
| 586 | .key = { | ||
| 587 | 0xbe, 0x5c, 0xf1, 0xf9, 0x9d, 0x51, 0x59, 0xf2, | ||
| 588 | 0x11, 0xdb, 0xc4, 0xc1, 0x47, 0xf7, 0x9c, 0x55, | ||
| 589 | 0x6b, 0x2d, 0xa5, 0xc6, 0x91, 0xde, 0xed, 0x74, | ||
| 590 | 0x0d, 0x01, 0x57, 0xea, 0xb8, 0xc9, 0xc8, 0x9a, | ||
| 591 | }, | ||
| 592 | .iv = { | ||
| 593 | 0x89, 0x24, 0x86, 0x24, 0xb6, 0x96, 0xcf, 0x9c, | ||
| 594 | 0xb1, 0xb5, 0x77, 0x9c, 0xdc, 0xbc, 0xfe, 0x1c, | ||
| 595 | }, | ||
| 596 | .iv_len = 16, | ||
| 597 | .in = { | ||
| 598 | 0x3b, 0x80, 0xf8, 0x22, 0xc4, 0xee, 0xe1, 0x31, | ||
| 599 | 0x3f, 0x79, 0xca, 0x3d, 0xb1, 0x34, 0xd9, 0xca, | ||
| 600 | 0x8b, 0x09, 0xa3, 0x53, 0x4d, 0x4e, 0x18, 0xe6, | ||
| 601 | 0x43, 0x9e, 0x1c, 0xdb, 0x86, 0x18, 0x2a, 0x4f, | ||
| 602 | }, | ||
| 603 | .in_len = 32, | ||
| 604 | .out = { | ||
| 605 | 0x4b, 0x6a, 0xf4, 0x3a, 0x88, 0xb6, 0x33, 0xeb, | ||
| 606 | 0xd1, 0xe1, 0x27, 0xc1, 0xec, 0x90, 0xcc, 0x47, | ||
| 607 | 0xa2, 0xf1, 0x6e, 0x3b, 0xc7, 0x9f, 0x88, 0x45, | ||
| 608 | 0xe3, 0xbd, 0x00, 0x25, 0xda, 0x87, 0x26, 0x45, | ||
| 609 | }, | ||
| 610 | .out_len = 32, | ||
| 611 | }, | ||
| 612 | { | ||
| 613 | /* XTSGenAES256 1 */ | ||
| 614 | .mode = NID_aes_256_xts, | ||
| 615 | .key = { | ||
| 616 | 0x1e, 0xa6, 0x61, 0xc5, 0x8d, 0x94, 0x3a, 0x0e, | ||
| 617 | 0x48, 0x01, 0xe4, 0x2f, 0x4b, 0x09, 0x47, 0x14, | ||
| 618 | 0x9e, 0x7f, 0x9f, 0x8e, 0x3e, 0x68, 0xd0, 0xc7, | ||
| 619 | 0x50, 0x52, 0x10, 0xbd, 0x31, 0x1a, 0x0e, 0x7c, | ||
| 620 | 0xd6, 0xe1, 0x3f, 0xfd, 0xf2, 0x41, 0x8d, 0x8d, | ||
| 621 | 0x19, 0x11, 0xc0, 0x04, 0xcd, 0xa5, 0x8d, 0xa3, | ||
| 622 | 0xd6, 0x19, 0xb7, 0xe2, 0xb9, 0x14, 0x1e, 0x58, | ||
| 623 | 0x31, 0x8e, 0xea, 0x39, 0x2c, 0xf4, 0x1b, 0x08, | ||
| 624 | }, | ||
| 625 | .iv = { | ||
| 626 | 0xad, 0xf8, 0xd9, 0x26, 0x27, 0x46, 0x4a, 0xd2, | ||
| 627 | 0xf0, 0x42, 0x8e, 0x84, 0xa9, 0xf8, 0x75, 0x64, | ||
| 628 | }, | ||
| 629 | .iv_len = 16, | ||
| 630 | .in = { | ||
| 631 | 0x2e, 0xed, 0xea, 0x52, 0xcd, 0x82, 0x15, 0xe1, | ||
| 632 | 0xac, 0xc6, 0x47, 0xe8, 0x10, 0xbb, 0xc3, 0x64, | ||
| 633 | 0x2e, 0x87, 0x28, 0x7f, 0x8d, 0x2e, 0x57, 0xe3, | ||
| 634 | 0x6c, 0x0a, 0x24, 0xfb, 0xc1, 0x2a, 0x20, 0x2e, | ||
| 635 | }, | ||
| 636 | .in_len = 32, | ||
| 637 | .out = { | ||
| 638 | 0xcb, 0xaa, 0xd0, 0xe2, 0xf6, 0xce, 0xa3, 0xf5, | ||
| 639 | 0x0b, 0x37, 0xf9, 0x34, 0xd4, 0x6a, 0x9b, 0x13, | ||
| 640 | 0x0b, 0x9d, 0x54, 0xf0, 0x7e, 0x34, 0xf3, 0x6a, | ||
| 641 | 0xf7, 0x93, 0xe8, 0x6f, 0x73, 0xc6, 0xd7, 0xdb, | ||
| 642 | }, | ||
| 643 | .out_len = 32, | ||
| 644 | }, | ||
| 645 | { | ||
| 646 | /* XTSGenAES256 172 */ | ||
| 647 | .mode = NID_aes_256_xts, | ||
| 648 | .key= { | ||
| 649 | 0x5c, 0x7f, 0x7a, 0x36, 0x08, 0x01, 0x78, 0x43, | ||
| 650 | 0x00, 0x83, 0xff, 0x54, 0x92, 0xef, 0x77, 0x26, | ||
| 651 | 0x0f, 0x68, 0x0a, 0x15, 0xa7, 0x66, 0x24, 0xb8, | ||
| 652 | 0x9e, 0x85, 0x4c, 0x94, 0xf0, 0x48, 0x8a, 0x9e, | ||
| 653 | 0x7d, 0xaa, 0x4f, 0x33, 0x01, 0x1f, 0x91, 0xdf, | ||
| 654 | 0x5e, 0x33, 0x80, 0x53, 0xf4, 0x6c, 0xee, 0x65, | ||
| 655 | 0x0f, 0xb0, 0xee, 0x69, 0xf8, 0xc2, 0x15, 0x75, | ||
| 656 | 0x5a, 0x4a, 0x63, 0xcd, 0x42, 0x28, 0xc2, 0x19, | ||
| 657 | }, | ||
| 658 | .iv = { | ||
| 659 | 0xa4, 0x01, 0xd7, 0x3c, 0x88, 0x75, 0xe7, 0x59, | ||
| 660 | 0xaa, 0x3e, 0xef, 0x53, 0xe0, 0xfb, 0x62, 0x63, | ||
| 661 | }, | ||
| 662 | .iv_len = 16, | ||
| 663 | .in = { | ||
| 664 | 0xb1, 0xe6, 0x29, 0xa6, 0x2a, 0x03, 0xca, 0x96, | ||
| 665 | 0x9b, 0x16, 0x91, 0x52, 0x02, 0xbc, 0xaa, 0x09, | ||
| 666 | 0xe7, 0x8a, 0xe1, 0x85, 0x1b, 0xc8, 0x85, 0x81, | ||
| 667 | 0x16, 0x49, 0x68, 0xa5, 0x65, 0x6c, 0x82, 0xc0, | ||
| 668 | 0xe5, 0xc4, 0x03, 0xba, 0x54, 0xb9, 0xb5, 0xed, | ||
| 669 | 0x9b, 0xab, 0xe8, 0xb0, 0x75, 0x1d, 0x1b, 0x34, | ||
| 670 | }, | ||
| 671 | .in_len = 48, | ||
| 672 | .out = { | ||
| 673 | 0xf5, 0xbc, 0xa6, 0x0f, 0xb9, 0x35, 0x2b, 0x1d, | ||
| 674 | 0xe0, 0x4d, 0x71, 0x29, 0x40, 0x56, 0x26, 0xb3, | ||
| 675 | 0xa4, 0x74, 0xa2, 0x64, 0xfb, 0xac, 0x2d, 0x6b, | ||
| 676 | 0xe1, 0x19, 0xe1, 0xd5, 0x7a, 0xa9, 0x98, 0xd0, | ||
| 677 | 0xe0, 0xe4, 0xd9, 0xf9, 0xc9, 0x76, 0x21, 0x0d, | ||
| 678 | 0x93, 0xc4, 0x65, 0xa3, 0xe3, 0x60, 0xcd, 0x92, | ||
| 679 | }, | ||
| 680 | .out_len = 48, | ||
| 681 | }, | ||
| 527 | }; | 682 | }; |
| 528 | 683 | ||
| 529 | #define N_AES_TESTS (sizeof(aes_tests) / sizeof(aes_tests[0])) | 684 | #define N_AES_TESTS (sizeof(aes_tests) / sizeof(aes_tests[0])) |
| @@ -542,7 +697,10 @@ aes_ecb_test(size_t test_number, const char *label, int key_bits, | |||
| 542 | 697 | ||
| 543 | /* Encryption */ | 698 | /* Encryption */ |
| 544 | memset(out, 0, sizeof(out)); | 699 | memset(out, 0, sizeof(out)); |
| 545 | AES_set_encrypt_key(at->key, key_bits, &key); | 700 | if (AES_set_encrypt_key(at->key, key_bits, &key) != 0) { |
| 701 | fprintf(stderr, "FAIL (%s:%zu): AES_set_encrypt_key failed\n", label, test_number); | ||
| 702 | return 0; | ||
| 703 | } | ||
| 546 | AES_ecb_encrypt(at->in, out, &key, 1); | 704 | AES_ecb_encrypt(at->in, out, &key, 1); |
| 547 | 705 | ||
| 548 | if (memcmp(at->out, out, at->out_len) != 0) { | 706 | if (memcmp(at->out, out, at->out_len) != 0) { |
| @@ -553,7 +711,10 @@ aes_ecb_test(size_t test_number, const char *label, int key_bits, | |||
| 553 | 711 | ||
| 554 | /* Decryption */ | 712 | /* Decryption */ |
| 555 | memset(out, 0, sizeof(out)); | 713 | memset(out, 0, sizeof(out)); |
| 556 | AES_set_decrypt_key(at->key, key_bits, &key); | 714 | if (AES_set_decrypt_key(at->key, key_bits, &key) != 0) { |
| 715 | fprintf(stderr, "FAIL (%s:%zu): AES_set_decrypt_key failed\n", label, test_number); | ||
| 716 | return 0; | ||
| 717 | } | ||
| 557 | AES_ecb_encrypt(at->out, out, &key, 0); | 718 | AES_ecb_encrypt(at->out, out, &key, 0); |
| 558 | 719 | ||
| 559 | if (memcmp(at->in, out, at->in_len) != 0) { | 720 | if (memcmp(at->in, out, at->in_len) != 0) { |
| @@ -582,7 +743,10 @@ aes_cbc_test(size_t test_number, const char *label, int key_bits, | |||
| 582 | /* Encryption */ | 743 | /* Encryption */ |
| 583 | memset(out, 0, sizeof(out)); | 744 | memset(out, 0, sizeof(out)); |
| 584 | memcpy(iv, at->iv, at->iv_len); | 745 | memcpy(iv, at->iv, at->iv_len); |
| 585 | AES_set_encrypt_key(at->key, key_bits, &key); | 746 | if (AES_set_encrypt_key(at->key, key_bits, &key) != 0) { |
| 747 | fprintf(stderr, "FAIL (%s:%zu): AES_set_encrypt_key failed\n", label, test_number); | ||
| 748 | return 0; | ||
| 749 | } | ||
| 586 | AES_cbc_encrypt(at->in, out, at->in_len, &key, iv, 1); | 750 | AES_cbc_encrypt(at->in, out, at->in_len, &key, iv, 1); |
| 587 | 751 | ||
| 588 | if (memcmp(at->out, out, at->out_len) != 0) { | 752 | if (memcmp(at->out, out, at->out_len) != 0) { |
| @@ -594,7 +758,10 @@ aes_cbc_test(size_t test_number, const char *label, int key_bits, | |||
| 594 | /* Decryption */ | 758 | /* Decryption */ |
| 595 | memset(out, 0, sizeof(out)); | 759 | memset(out, 0, sizeof(out)); |
| 596 | memcpy(iv, at->iv, at->iv_len); | 760 | memcpy(iv, at->iv, at->iv_len); |
| 597 | AES_set_decrypt_key(at->key, key_bits, &key); | 761 | if (AES_set_decrypt_key(at->key, key_bits, &key) != 0) { |
| 762 | fprintf(stderr, "FAIL (%s:%zu): AES_set_decrypt_key failed\n", label, test_number); | ||
| 763 | return 0; | ||
| 764 | } | ||
| 598 | AES_cbc_encrypt(at->out, out, at->out_len, &key, iv, 0); | 765 | AES_cbc_encrypt(at->out, out, at->out_len, &key, iv, 0); |
| 599 | 766 | ||
| 600 | if (memcmp(at->in, out, at->in_len) != 0) { | 767 | if (memcmp(at->in, out, at->in_len) != 0) { |
| @@ -607,6 +774,96 @@ aes_cbc_test(size_t test_number, const char *label, int key_bits, | |||
| 607 | } | 774 | } |
| 608 | 775 | ||
| 609 | static int | 776 | static int |
| 777 | aes_cfb128_test(size_t test_number, const char *label, int key_bits, | ||
| 778 | const struct aes_test *at) | ||
| 779 | { | ||
| 780 | AES_KEY key; | ||
| 781 | uint8_t out[64]; | ||
| 782 | uint8_t iv[16]; | ||
| 783 | int num = 0; | ||
| 784 | |||
| 785 | /* CFB mode has no padding */ | ||
| 786 | |||
| 787 | /* Encryption */ | ||
| 788 | memset(out, 0, sizeof(out)); | ||
| 789 | memcpy(iv, at->iv, at->iv_len); | ||
| 790 | if (AES_set_encrypt_key(at->key, key_bits, &key) != 0) { | ||
| 791 | fprintf(stderr, "FAIL (%s:%zu): AES_set_encrypt_key failed\n", label, test_number); | ||
| 792 | return 0; | ||
| 793 | } | ||
| 794 | AES_cfb128_encrypt(at->in, out, at->in_len, &key, iv, &num, AES_ENCRYPT); | ||
| 795 | |||
| 796 | if (memcmp(at->out, out, at->out_len) != 0) { | ||
| 797 | fprintf(stderr, "FAIL (%s:%zu): encryption mismatch\n", | ||
| 798 | label, test_number); | ||
| 799 | return 0; | ||
| 800 | } | ||
| 801 | |||
| 802 | /* Decryption */ | ||
| 803 | memset(out, 0, sizeof(out)); | ||
| 804 | memcpy(iv, at->iv, at->iv_len); | ||
| 805 | num = 0; | ||
| 806 | if (AES_set_encrypt_key(at->key, key_bits, &key) != 0) { | ||
| 807 | fprintf(stderr, "FAIL (%s:%zu): AES_set_encrypt_key failed\n", label, test_number); | ||
| 808 | return 0; | ||
| 809 | } | ||
| 810 | AES_cfb128_encrypt(at->out, out, at->out_len, &key, iv, &num, AES_DECRYPT); | ||
| 811 | |||
| 812 | if (memcmp(at->in, out, at->in_len) != 0) { | ||
| 813 | fprintf(stderr, "FAIL (%s:%zu): decryption mismatch\n", | ||
| 814 | label, test_number); | ||
| 815 | return 0; | ||
| 816 | } | ||
| 817 | |||
| 818 | return 1; | ||
| 819 | } | ||
| 820 | |||
| 821 | static int | ||
| 822 | aes_ofb128_test(size_t test_number, const char *label, int key_bits, | ||
| 823 | const struct aes_test *at) | ||
| 824 | { | ||
| 825 | AES_KEY key; | ||
| 826 | uint8_t out[64]; | ||
| 827 | uint8_t iv[16]; | ||
| 828 | int num = 0; | ||
| 829 | |||
| 830 | /* OFB mode has no padding */ | ||
| 831 | |||
| 832 | /* Encryption */ | ||
| 833 | memset(out, 0, sizeof(out)); | ||
| 834 | memcpy(iv, at->iv, at->iv_len); | ||
| 835 | if (AES_set_encrypt_key(at->key, key_bits, &key) != 0) { | ||
| 836 | fprintf(stderr, "FAIL (%s:%zu): AES_set_encrypt_key failed\n", label, test_number); | ||
| 837 | return 0; | ||
| 838 | } | ||
| 839 | AES_ofb128_encrypt(at->in, out, at->in_len, &key, iv, &num); | ||
| 840 | |||
| 841 | if (memcmp(at->out, out, at->out_len) != 0) { | ||
| 842 | fprintf(stderr, "FAIL (%s:%zu): encryption mismatch\n", | ||
| 843 | label, test_number); | ||
| 844 | return 0; | ||
| 845 | } | ||
| 846 | |||
| 847 | /* Decryption */ | ||
| 848 | memset(out, 0, sizeof(out)); | ||
| 849 | memcpy(iv, at->iv, at->iv_len); | ||
| 850 | num = 0; | ||
| 851 | if (AES_set_encrypt_key(at->key, key_bits, &key) != 0) { | ||
| 852 | fprintf(stderr, "FAIL (%s:%zu): AES_set_encrypt_key failed\n", label, test_number); | ||
| 853 | return 0; | ||
| 854 | } | ||
| 855 | AES_ofb128_encrypt(at->out, out, at->out_len, &key, iv, &num); | ||
| 856 | |||
| 857 | if (memcmp(at->in, out, at->in_len) != 0) { | ||
| 858 | fprintf(stderr, "FAIL (%s:%zu): decryption mismatch\n", | ||
| 859 | label, test_number); | ||
| 860 | return 0; | ||
| 861 | } | ||
| 862 | |||
| 863 | return 1; | ||
| 864 | } | ||
| 865 | |||
| 866 | static int | ||
| 610 | aes_evp_test(size_t test_number, const struct aes_test *at, const char *label, | 867 | aes_evp_test(size_t test_number, const struct aes_test *at, const char *label, |
| 611 | int key_bits, const EVP_CIPHER *cipher) | 868 | int key_bits, const EVP_CIPHER *cipher) |
| 612 | { | 869 | { |
| @@ -649,6 +906,10 @@ aes_evp_test(size_t test_number, const struct aes_test *at, const char *label, | |||
| 649 | if (in_len > at->in_len - i) | 906 | if (in_len > at->in_len - i) |
| 650 | in_len = at->in_len - i; | 907 | in_len = at->in_len - i; |
| 651 | 908 | ||
| 909 | /* XTS needs to be single shot. */ | ||
| 910 | if (EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_XTS_MODE) | ||
| 911 | in_len = at->in_len; | ||
| 912 | |||
| 652 | if (!EVP_EncryptUpdate(ctx, out + total_len, &out_len, | 913 | if (!EVP_EncryptUpdate(ctx, out + total_len, &out_len, |
| 653 | at->in + i, in_len)) { | 914 | at->in + i, in_len)) { |
| 654 | fprintf(stderr, | 915 | fprintf(stderr, |
| @@ -715,6 +976,10 @@ aes_evp_test(size_t test_number, const struct aes_test *at, const char *label, | |||
| 715 | if (in_len > at->out_len - i) | 976 | if (in_len > at->out_len - i) |
| 716 | in_len = at->out_len - i; | 977 | in_len = at->out_len - i; |
| 717 | 978 | ||
| 979 | /* XTS needs to be single shot. */ | ||
| 980 | if (EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_XTS_MODE) | ||
| 981 | in_len = at->in_len; | ||
| 982 | |||
| 718 | if (!EVP_DecryptUpdate(ctx, out + total_len, &out_len, | 983 | if (!EVP_DecryptUpdate(ctx, out + total_len, &out_len, |
| 719 | at->out + i, in_len)) { | 984 | at->out + i, in_len)) { |
| 720 | fprintf(stderr, | 985 | fprintf(stderr, |
| @@ -881,6 +1146,16 @@ aes_cipher_from_nid(int nid, const char **out_label, | |||
| 881 | *out_cipher = EVP_aes_256_ccm(); | 1146 | *out_cipher = EVP_aes_256_ccm(); |
| 882 | break; | 1147 | break; |
| 883 | 1148 | ||
| 1149 | /* XTS */ | ||
| 1150 | case NID_aes_128_xts: | ||
| 1151 | *out_label = SN_aes_128_xts; | ||
| 1152 | *out_cipher = EVP_aes_128_xts(); | ||
| 1153 | break; | ||
| 1154 | case NID_aes_256_xts: | ||
| 1155 | *out_label = SN_aes_256_xts; | ||
| 1156 | *out_cipher = EVP_aes_256_xts(); | ||
| 1157 | break; | ||
| 1158 | |||
| 884 | /* Unknown */ | 1159 | /* Unknown */ |
| 885 | default: | 1160 | default: |
| 886 | return 0; | 1161 | return 0; |
| @@ -902,8 +1177,10 @@ aes_test(void) | |||
| 902 | for (i = 0; i < N_AES_TESTS; i++) { | 1177 | for (i = 0; i < N_AES_TESTS; i++) { |
| 903 | at = &aes_tests[i]; | 1178 | at = &aes_tests[i]; |
| 904 | key_bits = aes_key_bits_from_nid(at->mode); | 1179 | key_bits = aes_key_bits_from_nid(at->mode); |
| 905 | if (!aes_cipher_from_nid(at->mode, &label, &cipher)) | 1180 | if (!aes_cipher_from_nid(at->mode, &label, &cipher)) { |
| 1181 | fprintf(stderr, "unknown cipher\n"); | ||
| 906 | goto failed; | 1182 | goto failed; |
| 1183 | } | ||
| 907 | 1184 | ||
| 908 | switch (at->mode) { | 1185 | switch (at->mode) { |
| 909 | /* ECB */ | 1186 | /* ECB */ |
| @@ -926,14 +1203,16 @@ aes_test(void) | |||
| 926 | case NID_aes_128_cfb128: | 1203 | case NID_aes_128_cfb128: |
| 927 | case NID_aes_192_cfb128: | 1204 | case NID_aes_192_cfb128: |
| 928 | case NID_aes_256_cfb128: | 1205 | case NID_aes_256_cfb128: |
| 929 | /* XXX - CFB128 non-EVP tests */ | 1206 | if (!aes_cfb128_test(i, label, key_bits, at)) |
| 1207 | goto failed; | ||
| 930 | break; | 1208 | break; |
| 931 | 1209 | ||
| 932 | /* OFB128 */ | 1210 | /* OFB128 */ |
| 933 | case NID_aes_128_ofb128: | 1211 | case NID_aes_128_ofb128: |
| 934 | case NID_aes_192_ofb128: | 1212 | case NID_aes_192_ofb128: |
| 935 | case NID_aes_256_ofb128: | 1213 | case NID_aes_256_ofb128: |
| 936 | /* XXX - OFB128 non-EVP tests */ | 1214 | if (!aes_ofb128_test(i, label, key_bits, at)) |
| 1215 | goto failed; | ||
| 937 | break; | 1216 | break; |
| 938 | 1217 | ||
| 939 | /* GCM */ | 1218 | /* GCM */ |
| @@ -947,7 +1226,13 @@ aes_test(void) | |||
| 947 | case NID_aes_128_ccm: | 1226 | case NID_aes_128_ccm: |
| 948 | case NID_aes_192_ccm: | 1227 | case NID_aes_192_ccm: |
| 949 | case NID_aes_256_ccm: | 1228 | case NID_aes_256_ccm: |
| 950 | /* XXX - CCM non-EVP tests */ | 1229 | /* CCM is EVP-only */ |
| 1230 | break; | ||
| 1231 | |||
| 1232 | /* XTS */ | ||
| 1233 | case NID_aes_128_xts: | ||
| 1234 | case NID_aes_256_xts: | ||
| 1235 | /* XTS is EVP-only */ | ||
| 951 | break; | 1236 | break; |
| 952 | 1237 | ||
| 953 | /* Unknown */ | 1238 | /* Unknown */ |
diff --git a/src/regress/lib/libcrypto/asn1/Makefile b/src/regress/lib/libcrypto/asn1/Makefile index 1ba2fecf23..23a01ab600 100644 --- a/src/regress/lib/libcrypto/asn1/Makefile +++ b/src/regress/lib/libcrypto/asn1/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.28 2024/02/29 20:03:47 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.30 2026/01/04 09:51:42 tb Exp $ |
| 2 | 2 | ||
| 3 | PROGS = \ | 3 | PROGS = \ |
| 4 | asn1api \ | 4 | asn1api \ |
diff --git a/src/regress/lib/libcrypto/asn1/asn1basic.c b/src/regress/lib/libcrypto/asn1/asn1basic.c index 1a873bf25d..0666e5b061 100644 --- a/src/regress/lib/libcrypto/asn1/asn1basic.c +++ b/src/regress/lib/libcrypto/asn1/asn1basic.c | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* $OpenBSD: asn1basic.c,v 1.16 2024/02/04 13:07:02 tb Exp $ */ | 1 | /* $OpenBSD: asn1basic.c,v 1.20 2026/01/04 09:43:52 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2017, 2021 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2017, 2021 Joel Sing <jsing@openbsd.org> |
| 4 | * Copyright (c) 2021 Google, Inc | ||
| 4 | * Copyright (c) 2023 Theo Buehler <tb@openbsd.org> | 5 | * Copyright (c) 2023 Theo Buehler <tb@openbsd.org> |
| 5 | * | 6 | * |
| 6 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any |
| @@ -65,6 +66,14 @@ const uint8_t asn1_bit_string_primitive[] = { | |||
| 65 | 0x04, 0x0a, 0x3b, 0x5f, 0x29, 0x1c, 0xd0, | 66 | 0x04, 0x0a, 0x3b, 0x5f, 0x29, 0x1c, 0xd0, |
| 66 | }; | 67 | }; |
| 67 | 68 | ||
| 69 | static const uint8_t asn1_bit_string_trailing_zeroes[] = { | ||
| 70 | 0x04, 0x00 | ||
| 71 | }; | ||
| 72 | |||
| 73 | static const uint8_t asn1_bit_string_trailing_zeroes_encoded[] = { | ||
| 74 | 0x03, 0x02, 0x02, 0x04, | ||
| 75 | }; | ||
| 76 | |||
| 68 | static int | 77 | static int |
| 69 | asn1_bit_string_test(void) | 78 | asn1_bit_string_test(void) |
| 70 | { | 79 | { |
| @@ -165,6 +174,35 @@ asn1_bit_string_test(void) | |||
| 165 | sizeof(asn1_bit_string_primitive))) | 174 | sizeof(asn1_bit_string_primitive))) |
| 166 | goto failed; | 175 | goto failed; |
| 167 | 176 | ||
| 177 | /* | ||
| 178 | * ASN1_STRING_set() truncates and determines unused bits | ||
| 179 | */ | ||
| 180 | |||
| 181 | ASN1_BIT_STRING_free(abs); | ||
| 182 | abs = NULL; | ||
| 183 | if ((abs = ASN1_BIT_STRING_new()) == NULL) { | ||
| 184 | fprintf(stderr, "FAIL: ASN1_BIT_STRING_new\n"); | ||
| 185 | goto failed; | ||
| 186 | } | ||
| 187 | |||
| 188 | if (!ASN1_STRING_set(abs, asn1_bit_string_trailing_zeroes, | ||
| 189 | sizeof(asn1_bit_string_trailing_zeroes))) { | ||
| 190 | fprintf(stderr, "FAIL: BIT STRING ASN1_BIT_STRING_set trailing zeroes\n"); | ||
| 191 | goto failed; | ||
| 192 | } | ||
| 193 | |||
| 194 | freezero(p, len); | ||
| 195 | p = NULL; | ||
| 196 | if ((len = i2d_ASN1_BIT_STRING(abs, &p)) <= 0) { | ||
| 197 | fprintf(stderr, "FAIL: i2d_ASN1_BIT_STRING\n"); | ||
| 198 | len = 0; | ||
| 199 | goto failed; | ||
| 200 | } | ||
| 201 | if (!asn1_compare_bytes("BIT STRING trailing zeroes", p, len, | ||
| 202 | asn1_bit_string_trailing_zeroes_encoded, | ||
| 203 | sizeof(asn1_bit_string_trailing_zeroes_encoded))) | ||
| 204 | goto failed; | ||
| 205 | |||
| 168 | failed = 0; | 206 | failed = 0; |
| 169 | 207 | ||
| 170 | failed: | 208 | failed: |
| @@ -174,6 +212,459 @@ asn1_bit_string_test(void) | |||
| 174 | return failed; | 212 | return failed; |
| 175 | } | 213 | } |
| 176 | 214 | ||
| 215 | static const uint8_t asn1_bit_string_empty[] = { | ||
| 216 | 0x03, 0x01, 0x00, | ||
| 217 | }; | ||
| 218 | |||
| 219 | static const uint8_t asn1_bit_string_1101[] = { | ||
| 220 | 0x03, 0x02, 0x04, 0xd0, | ||
| 221 | }; | ||
| 222 | |||
| 223 | static const uint8_t asn1_bit_string_1001[] = { | ||
| 224 | 0x03, 0x02, 0x04, 0x90, | ||
| 225 | }; | ||
| 226 | |||
| 227 | static const uint8_t asn1_bit_string_1[] = { | ||
| 228 | 0x03, 0x02, 0x07, 0x80, | ||
| 229 | }; | ||
| 230 | |||
| 231 | static const uint8_t asn1_bit_string_1zeroes1[] = { | ||
| 232 | 0x03, 0x09, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, | ||
| 233 | 0x00, 0x00, 0x01, | ||
| 234 | }; | ||
| 235 | |||
| 236 | static const uint8_t asn1_bit_string_10010[] = { | ||
| 237 | 0x03, 0x02, 0x03, 0x90, | ||
| 238 | }; | ||
| 239 | |||
| 240 | static const uint8_t asn1_bit_string_zeroes[64] = { 0 }; | ||
| 241 | |||
| 242 | static int | ||
| 243 | asn1_bit_string_set_bit_test(void) | ||
| 244 | { | ||
| 245 | ASN1_BIT_STRING *abs; | ||
| 246 | const unsigned char *p; | ||
| 247 | unsigned char *der = NULL; | ||
| 248 | int der_len = 0; | ||
| 249 | int p_len; | ||
| 250 | int got; | ||
| 251 | int failed = 1; | ||
| 252 | |||
| 253 | /* | ||
| 254 | * A new ASN1_BIT_STRING serializes to the empty BIT STRING | ||
| 255 | */ | ||
| 256 | |||
| 257 | if ((abs = ASN1_BIT_STRING_new()) == NULL) { | ||
| 258 | fprintf(stderr, "FAIL: ASN1_BIT_STRING_new()\n"); | ||
| 259 | goto failed; | ||
| 260 | } | ||
| 261 | |||
| 262 | freezero(der, der_len); | ||
| 263 | der = NULL; | ||
| 264 | if ((der_len = i2d_ASN1_BIT_STRING(abs, &der)) <= 0) { | ||
| 265 | fprintf(stderr, "FAIL: i2d_ASN1_BIT_STRING\n"); | ||
| 266 | der_len = 0; | ||
| 267 | goto failed; | ||
| 268 | } | ||
| 269 | if (!asn1_compare_bytes("new BIT STRING", der, der_len, | ||
| 270 | asn1_bit_string_empty, sizeof(asn1_bit_string_empty))) | ||
| 271 | goto failed; | ||
| 272 | |||
| 273 | if ((got = ASN1_BIT_STRING_get_bit(abs, 0)) != 0) { | ||
| 274 | fprintf(stderr, "FAIL: new BIT STRING bit 0: want %d, got %d\n", | ||
| 275 | 0, got); | ||
| 276 | goto failed; | ||
| 277 | } | ||
| 278 | if ((got = ASN1_BIT_STRING_get_bit(abs, 100)) != 0) { | ||
| 279 | fprintf(stderr, "FAIL: new BIT STRING bit 100: want %d, got %d\n", | ||
| 280 | 0, got); | ||
| 281 | goto failed; | ||
| 282 | } | ||
| 283 | |||
| 284 | /* | ||
| 285 | * Now set a few bits via ASN1_BIT_STRING_set_bit() | ||
| 286 | */ | ||
| 287 | |||
| 288 | if (!ASN1_BIT_STRING_set_bit(abs, 0, 1) || | ||
| 289 | !ASN1_BIT_STRING_set_bit(abs, 1, 1) || | ||
| 290 | !ASN1_BIT_STRING_set_bit(abs, 2, 0) || | ||
| 291 | !ASN1_BIT_STRING_set_bit(abs, 3, 1)) { | ||
| 292 | fprintf(stderr, "FAIL: BIT STRING 1101 ASN1_BIT_STRING_set_bit\n"); | ||
| 293 | goto failed; | ||
| 294 | } | ||
| 295 | |||
| 296 | freezero(der, der_len); | ||
| 297 | der = NULL; | ||
| 298 | if ((der_len = i2d_ASN1_BIT_STRING(abs, &der)) <= 0) { | ||
| 299 | fprintf(stderr, "FAIL: i2d_ASN1_BIT_STRING\n"); | ||
| 300 | der_len = 0; | ||
| 301 | goto failed; | ||
| 302 | } | ||
| 303 | if (!asn1_compare_bytes("BIT STRING 1101", der, der_len, | ||
| 304 | asn1_bit_string_1101, sizeof(asn1_bit_string_1101))) | ||
| 305 | goto failed; | ||
| 306 | |||
| 307 | if ((got = ASN1_BIT_STRING_get_bit(abs, 0)) != 1) { | ||
| 308 | fprintf(stderr, "FAIL: BIT STRING 1101 bit 0: want %d, got %d\n", | ||
| 309 | 1, got); | ||
| 310 | goto failed; | ||
| 311 | } | ||
| 312 | if ((got = ASN1_BIT_STRING_get_bit(abs, 1)) != 1) { | ||
| 313 | fprintf(stderr, "FAIL: BIT STRING 1101 bit 1: want %d, got %d\n", | ||
| 314 | 1, got); | ||
| 315 | goto failed; | ||
| 316 | } | ||
| 317 | if ((got = ASN1_BIT_STRING_get_bit(abs, 2)) != 0) { | ||
| 318 | fprintf(stderr, "FAIL: BIT STRING 1101 bit 2: want %d, got %d\n", | ||
| 319 | 0, got); | ||
| 320 | goto failed; | ||
| 321 | } | ||
| 322 | if ((got = ASN1_BIT_STRING_get_bit(abs, 3)) != 1) { | ||
| 323 | fprintf(stderr, "FAIL: BIT STRING 1101 bit 3: want %d, got %d\n", | ||
| 324 | 1, got); | ||
| 325 | goto failed; | ||
| 326 | } | ||
| 327 | if ((got = ASN1_BIT_STRING_get_bit(abs, 4)) != 0) { | ||
| 328 | fprintf(stderr, "FAIL: BIT STRING 1101 bit 4: want %d, got %d\n", | ||
| 329 | 0, got); | ||
| 330 | goto failed; | ||
| 331 | } | ||
| 332 | |||
| 333 | /* | ||
| 334 | * Bits that were set may be cleared. | ||
| 335 | */ | ||
| 336 | |||
| 337 | if (!ASN1_BIT_STRING_set_bit(abs, 1, 0)) { | ||
| 338 | fprintf(stderr, "FAIL: BIT STRING 1101, clear bit 1\n"); | ||
| 339 | goto failed; | ||
| 340 | } | ||
| 341 | |||
| 342 | freezero(der, der_len); | ||
| 343 | der = NULL; | ||
| 344 | if ((der_len = i2d_ASN1_BIT_STRING(abs, &der)) <= 0) { | ||
| 345 | fprintf(stderr, "FAIL: i2d_ASN1_BIT_STRING\n"); | ||
| 346 | der_len = 0; | ||
| 347 | goto failed; | ||
| 348 | } | ||
| 349 | if (!asn1_compare_bytes("BIT STRING 1001", der, der_len, | ||
| 350 | asn1_bit_string_1001, sizeof(asn1_bit_string_1001))) | ||
| 351 | goto failed; | ||
| 352 | |||
| 353 | if ((got = ASN1_BIT_STRING_get_bit(abs, 0)) != 1) { | ||
| 354 | fprintf(stderr, "FAIL: BIT STRING 1001 bit 0: want %d, got %d\n", | ||
| 355 | 1, got); | ||
| 356 | goto failed; | ||
| 357 | } | ||
| 358 | if ((got = ASN1_BIT_STRING_get_bit(abs, 1)) != 0) { | ||
| 359 | fprintf(stderr, "FAIL: BIT STRING 1001 bit 1: want %d, got %d\n", | ||
| 360 | 0, got); | ||
| 361 | goto failed; | ||
| 362 | } | ||
| 363 | if ((got = ASN1_BIT_STRING_get_bit(abs, 2)) != 0) { | ||
| 364 | fprintf(stderr, "FAIL: BIT STRING 1001 bit 2: want %d, got %d\n", | ||
| 365 | 0, got); | ||
| 366 | goto failed; | ||
| 367 | } | ||
| 368 | if ((got = ASN1_BIT_STRING_get_bit(abs, 3)) != 1) { | ||
| 369 | fprintf(stderr, "FAIL: BIT STRING 1001 bit 3: want %d, got %d\n", | ||
| 370 | 1, got); | ||
| 371 | goto failed; | ||
| 372 | } | ||
| 373 | if ((got = ASN1_BIT_STRING_get_bit(abs, 4)) != 0) { | ||
| 374 | fprintf(stderr, "FAIL: BIT STRING 1001 bit 4: want %d, got %d\n", | ||
| 375 | 0, got); | ||
| 376 | goto failed; | ||
| 377 | } | ||
| 378 | |||
| 379 | /* | ||
| 380 | * Clearing trailing bits truncates the string. | ||
| 381 | */ | ||
| 382 | |||
| 383 | if (!ASN1_BIT_STRING_set_bit(abs, 3, 0)) { | ||
| 384 | fprintf(stderr, "FAIL: BIT STRING 1001, clear bit 3\n"); | ||
| 385 | goto failed; | ||
| 386 | } | ||
| 387 | |||
| 388 | freezero(der, der_len); | ||
| 389 | der = NULL; | ||
| 390 | if ((der_len = i2d_ASN1_BIT_STRING(abs, &der)) <= 0) { | ||
| 391 | fprintf(stderr, "FAIL: i2d_ASN1_BIT_STRING\n"); | ||
| 392 | der_len = 0; | ||
| 393 | goto failed; | ||
| 394 | } | ||
| 395 | if (!asn1_compare_bytes("BIT STRING 1", der, der_len, | ||
| 396 | asn1_bit_string_1, sizeof(asn1_bit_string_1))) | ||
| 397 | goto failed; | ||
| 398 | |||
| 399 | if ((got = ASN1_BIT_STRING_get_bit(abs, 0)) != 1) { | ||
| 400 | fprintf(stderr, "FAIL: BIT STRING 1 bit 0: want %d, got %d\n", | ||
| 401 | 1, got); | ||
| 402 | goto failed; | ||
| 403 | } | ||
| 404 | if ((got = ASN1_BIT_STRING_get_bit(abs, 1)) != 0) { | ||
| 405 | fprintf(stderr, "FAIL: BIT STRING 1 bit 1: want %d, got %d\n", | ||
| 406 | 0, got); | ||
| 407 | goto failed; | ||
| 408 | } | ||
| 409 | if ((got = ASN1_BIT_STRING_get_bit(abs, 2)) != 0) { | ||
| 410 | fprintf(stderr, "FAIL: BIT STRING 1 bit 2: want %d, got %d\n", | ||
| 411 | 0, got); | ||
| 412 | goto failed; | ||
| 413 | } | ||
| 414 | if ((got = ASN1_BIT_STRING_get_bit(abs, 3)) != 0) { | ||
| 415 | fprintf(stderr, "FAIL: BIT STRING 1 bit 3: want %d, got %d\n", | ||
| 416 | 0, got); | ||
| 417 | goto failed; | ||
| 418 | } | ||
| 419 | if ((got = ASN1_BIT_STRING_get_bit(abs, 4)) != 0) { | ||
| 420 | fprintf(stderr, "FAIL: BIT STRING 1 bit 4: want %d, got %d\n", | ||
| 421 | 0, got); | ||
| 422 | goto failed; | ||
| 423 | } | ||
| 424 | |||
| 425 | /* | ||
| 426 | * Bits may be set beyond the end of the string. | ||
| 427 | */ | ||
| 428 | |||
| 429 | if (!ASN1_BIT_STRING_set_bit(abs, 63, 1)) { | ||
| 430 | fprintf(stderr, "FAIL: BIT STRING 1 set bit 63\n"); | ||
| 431 | goto failed; | ||
| 432 | } | ||
| 433 | |||
| 434 | freezero(der, der_len); | ||
| 435 | der = NULL; | ||
| 436 | if ((der_len = i2d_ASN1_BIT_STRING(abs, &der)) <= 0) { | ||
| 437 | fprintf(stderr, "FAIL: i2d_ASN1_BIT_STRING\n"); | ||
| 438 | der_len = 0; | ||
| 439 | goto failed; | ||
| 440 | } | ||
| 441 | if (!asn1_compare_bytes("BIT STRING 1zeroes1", der, der_len, | ||
| 442 | asn1_bit_string_1zeroes1, sizeof(asn1_bit_string_1zeroes1))) | ||
| 443 | goto failed; | ||
| 444 | |||
| 445 | if ((got = ASN1_BIT_STRING_get_bit(abs, 0)) != 1) { | ||
| 446 | fprintf(stderr, "FAIL: BIT STRING 1zeroes1 bit 0: want %d, got %d\n", | ||
| 447 | 1, got); | ||
| 448 | goto failed; | ||
| 449 | } | ||
| 450 | if ((got = ASN1_BIT_STRING_get_bit(abs, 1)) != 0) { | ||
| 451 | fprintf(stderr, "FAIL: BIT STRING 1zeroes1 bit 1: want %d, got %d\n", | ||
| 452 | 0, got); | ||
| 453 | goto failed; | ||
| 454 | } | ||
| 455 | if ((got = ASN1_BIT_STRING_get_bit(abs, 62)) != 0) { | ||
| 456 | fprintf(stderr, "FAIL: BIT STRING 1zeroes1 bit 62: want %d, got %d\n", | ||
| 457 | 0, got); | ||
| 458 | goto failed; | ||
| 459 | } | ||
| 460 | if ((got = ASN1_BIT_STRING_get_bit(abs, 63)) != 1) { | ||
| 461 | fprintf(stderr, "FAIL: BIT STRING 1zeroes1 bit 63: want %d, got %d\n", | ||
| 462 | 1, got); | ||
| 463 | goto failed; | ||
| 464 | } | ||
| 465 | if ((got = ASN1_BIT_STRING_get_bit(abs, 64)) != 0) { | ||
| 466 | fprintf(stderr, "FAIL: BIT STRING 1zeroes1 bit 64: want %d, got %d\n", | ||
| 467 | 0, got); | ||
| 468 | goto failed; | ||
| 469 | } | ||
| 470 | |||
| 471 | /* | ||
| 472 | * We can truncate the string back down again. | ||
| 473 | */ | ||
| 474 | |||
| 475 | if (!ASN1_BIT_STRING_set_bit(abs, 63, 0)) { | ||
| 476 | fprintf(stderr, "FAIL: BIT STRING 1zeroes1, clear bit 63\n"); | ||
| 477 | goto failed; | ||
| 478 | } | ||
| 479 | |||
| 480 | freezero(der, der_len); | ||
| 481 | der = NULL; | ||
| 482 | if ((der_len = i2d_ASN1_BIT_STRING(abs, &der)) <= 0) { | ||
| 483 | fprintf(stderr, "FAIL: i2d_ASN1_BIT_STRING\n"); | ||
| 484 | der_len = 0; | ||
| 485 | goto failed; | ||
| 486 | } | ||
| 487 | if (!asn1_compare_bytes("BIT STRING 1zeroes", der, der_len, | ||
| 488 | asn1_bit_string_1, sizeof(asn1_bit_string_1))) | ||
| 489 | goto failed; | ||
| 490 | |||
| 491 | if ((got = ASN1_BIT_STRING_get_bit(abs, 0)) != 1) { | ||
| 492 | fprintf(stderr, "FAIL: BIT STRING 1zeroes bit 0: want %d, got %d\n", | ||
| 493 | 1, got); | ||
| 494 | goto failed; | ||
| 495 | } | ||
| 496 | if ((got = ASN1_BIT_STRING_get_bit(abs, 1)) != 0) { | ||
| 497 | fprintf(stderr, "FAIL: BIT STRING 1zeroes bit 1: want %d, got %d\n", | ||
| 498 | 0, got); | ||
| 499 | goto failed; | ||
| 500 | } | ||
| 501 | if ((got = ASN1_BIT_STRING_get_bit(abs, 62)) != 0) { | ||
| 502 | fprintf(stderr, "FAIL: BIT STRING 1zeroes bit 62: want %d, got %d\n", | ||
| 503 | 0, got); | ||
| 504 | goto failed; | ||
| 505 | } | ||
| 506 | if ((got = ASN1_BIT_STRING_get_bit(abs, 63)) != 0) { | ||
| 507 | fprintf(stderr, "FAIL: BIT STRING 1zeroes bit 63: want %d, got %d\n", | ||
| 508 | 0, got); | ||
| 509 | goto failed; | ||
| 510 | } | ||
| 511 | if ((got = ASN1_BIT_STRING_get_bit(abs, 64)) != 0) { | ||
| 512 | fprintf(stderr, "FAIL: BIT STRING 1zeroes bit 64: want %d, got %d\n", | ||
| 513 | 0, got); | ||
| 514 | goto failed; | ||
| 515 | } | ||
| 516 | |||
| 517 | /* | ||
| 518 | * ASN1_BIT_STRING_set_bit() truncation also happens for a parsed string. | ||
| 519 | */ | ||
| 520 | |||
| 521 | ASN1_BIT_STRING_free(abs); | ||
| 522 | abs = NULL; | ||
| 523 | |||
| 524 | p = asn1_bit_string_1zeroes1; | ||
| 525 | p_len = sizeof(asn1_bit_string_1zeroes1); | ||
| 526 | if ((abs = d2i_ASN1_BIT_STRING(NULL, &p, p_len)) == NULL) { | ||
| 527 | fprintf(stderr, "FAIL: BIT STRING 1zereos1 d2i_ASN1_BIT_STRING\n"); | ||
| 528 | goto failed; | ||
| 529 | } | ||
| 530 | |||
| 531 | freezero(der, der_len); | ||
| 532 | der = NULL; | ||
| 533 | if ((der_len = i2d_ASN1_BIT_STRING(abs, &der)) <= 0) { | ||
| 534 | fprintf(stderr, "FAIL: i2d_ASN1_BIT_STRING\n"); | ||
| 535 | der_len = 0; | ||
| 536 | goto failed; | ||
| 537 | } | ||
| 538 | if (!asn1_compare_bytes("BIT STRING 1zeroes1 (after d2i)", der, der_len, | ||
| 539 | asn1_bit_string_1zeroes1, sizeof(asn1_bit_string_1zeroes1))) | ||
| 540 | goto failed; | ||
| 541 | |||
| 542 | if (!ASN1_BIT_STRING_set_bit(abs, 63, 0)) { | ||
| 543 | fprintf(stderr, "FAIL: BIT STRING 1zeroes1 (after d2i), clear bit 63\n"); | ||
| 544 | goto failed; | ||
| 545 | } | ||
| 546 | |||
| 547 | freezero(der, der_len); | ||
| 548 | der = NULL; | ||
| 549 | if ((der_len = i2d_ASN1_BIT_STRING(abs, &der)) <= 0) { | ||
| 550 | fprintf(stderr, "FAIL: i2d_ASN1_BIT_STRING\n"); | ||
| 551 | der_len = 0; | ||
| 552 | goto failed; | ||
| 553 | } | ||
| 554 | if (!asn1_compare_bytes("BIT STRING 1zeroes (after d2i)", der, der_len, | ||
| 555 | asn1_bit_string_1, sizeof(asn1_bit_string_1))) | ||
| 556 | goto failed; | ||
| 557 | |||
| 558 | if ((got = ASN1_BIT_STRING_get_bit(abs, 0)) != 1) { | ||
| 559 | fprintf(stderr, "FAIL: BIT STRING 1zeroes (after d2i) bit 0: want %d, got %d\n", | ||
| 560 | 1, got); | ||
| 561 | goto failed; | ||
| 562 | } | ||
| 563 | if ((got = ASN1_BIT_STRING_get_bit(abs, 1)) != 0) { | ||
| 564 | fprintf(stderr, "FAIL: BIT STRING 1zeroes (after d2i) bit 1: want %d, got %d\n", | ||
| 565 | 0, got); | ||
| 566 | goto failed; | ||
| 567 | } | ||
| 568 | if ((got = ASN1_BIT_STRING_get_bit(abs, 62)) != 0) { | ||
| 569 | fprintf(stderr, "FAIL: BIT STRING 1zeroes (after d2i) bit 62: want %d, got %d\n", | ||
| 570 | 0, got); | ||
| 571 | goto failed; | ||
| 572 | } | ||
| 573 | if ((got = ASN1_BIT_STRING_get_bit(abs, 63)) != 0) { | ||
| 574 | fprintf(stderr, "FAIL: BIT STRING 1zeroes (after d2i) bit 63: want %d, got %d\n", | ||
| 575 | 0, got); | ||
| 576 | goto failed; | ||
| 577 | } | ||
| 578 | if ((got = ASN1_BIT_STRING_get_bit(abs, 64)) != 0) { | ||
| 579 | fprintf(stderr, "FAIL: BIT STRING 1zeroes (after d2i) bit 64: want %d, got %d\n", | ||
| 580 | 0, got); | ||
| 581 | goto failed; | ||
| 582 | } | ||
| 583 | |||
| 584 | /* | ||
| 585 | * A parsed bit string keeps its trailing zero bits. | ||
| 586 | */ | ||
| 587 | |||
| 588 | ASN1_BIT_STRING_free(abs); | ||
| 589 | abs = NULL; | ||
| 590 | |||
| 591 | p = asn1_bit_string_10010; | ||
| 592 | p_len = sizeof(asn1_bit_string_10010); | ||
| 593 | if ((abs = d2i_ASN1_BIT_STRING(NULL, &p, p_len)) == NULL) { | ||
| 594 | fprintf(stderr, "FAIL: BIT STRING 10010 d2i_ASN1_BIT_STRING\n"); | ||
| 595 | goto failed; | ||
| 596 | } | ||
| 597 | |||
| 598 | freezero(der, der_len); | ||
| 599 | der = NULL; | ||
| 600 | if ((der_len = i2d_ASN1_BIT_STRING(abs, &der)) <= 0) { | ||
| 601 | fprintf(stderr, "FAIL: i2d_ASN1_BIT_STRING\n"); | ||
| 602 | der_len = 0; | ||
| 603 | goto failed; | ||
| 604 | } | ||
| 605 | if (!asn1_compare_bytes("BIT STRING 10010", der, der_len, | ||
| 606 | asn1_bit_string_10010, sizeof(asn1_bit_string_10010))) | ||
| 607 | goto failed; | ||
| 608 | |||
| 609 | /* | ||
| 610 | * Of course, ASN1_BIT_STRING_set_bit() still truncates, even if it's | ||
| 611 | * a noop. | ||
| 612 | */ | ||
| 613 | |||
| 614 | if (!ASN1_BIT_STRING_set_bit(abs, 0, 1)) { | ||
| 615 | fprintf(stderr, "FAIL: BIT STRING 10010 set bit 0 to 1\n"); | ||
| 616 | goto failed; | ||
| 617 | } | ||
| 618 | |||
| 619 | freezero(der, der_len); | ||
| 620 | der = NULL; | ||
| 621 | if ((der_len = i2d_ASN1_BIT_STRING(abs, &der)) <= 0) { | ||
| 622 | fprintf(stderr, "FAIL: i2d_ASN1_BIT_STRING\n"); | ||
| 623 | der_len = 0; | ||
| 624 | goto failed; | ||
| 625 | } | ||
| 626 | if (!asn1_compare_bytes("BIT STRING 10010 after set bit", der, der_len, | ||
| 627 | asn1_bit_string_1001, sizeof(asn1_bit_string_1001))) | ||
| 628 | goto failed; | ||
| 629 | |||
| 630 | /* | ||
| 631 | * ASN1_BIT_STRING_set() also truncates | ||
| 632 | */ | ||
| 633 | |||
| 634 | ASN1_BIT_STRING_free(abs); | ||
| 635 | abs = NULL; | ||
| 636 | |||
| 637 | if ((abs = ASN1_BIT_STRING_new()) == NULL) { | ||
| 638 | fprintf(stderr, "FAIL: ASN1_BIT_STRING_new\n"); | ||
| 639 | goto failed; | ||
| 640 | } | ||
| 641 | |||
| 642 | if (!ASN1_STRING_set(abs, asn1_bit_string_zeroes, | ||
| 643 | sizeof(asn1_bit_string_zeroes))) { | ||
| 644 | fprintf(stderr, "FAIL: ASN1_BIT_STRING_set zeroes\n"); | ||
| 645 | goto failed; | ||
| 646 | } | ||
| 647 | |||
| 648 | freezero(der, der_len); | ||
| 649 | der = NULL; | ||
| 650 | if ((der_len = i2d_ASN1_BIT_STRING(abs, &der)) <= 0) { | ||
| 651 | fprintf(stderr, "FAIL: i2d_ASN1_BIT_STRING\n"); | ||
| 652 | der_len = 0; | ||
| 653 | goto failed; | ||
| 654 | } | ||
| 655 | if (!asn1_compare_bytes("BIT STRING all zeroes", der, der_len, | ||
| 656 | asn1_bit_string_empty, sizeof(asn1_bit_string_empty))) | ||
| 657 | goto failed; | ||
| 658 | |||
| 659 | failed = 0; | ||
| 660 | |||
| 661 | failed: | ||
| 662 | ASN1_BIT_STRING_free(abs); | ||
| 663 | freezero(der, der_len); | ||
| 664 | |||
| 665 | return failed; | ||
| 666 | } | ||
| 667 | |||
| 177 | const uint8_t asn1_boolean_false[] = { | 668 | const uint8_t asn1_boolean_false[] = { |
| 178 | 0x01, 0x01, 0x00, | 669 | 0x01, 0x01, 0x00, |
| 179 | }; | 670 | }; |
| @@ -1129,6 +1620,7 @@ main(int argc, char **argv) | |||
| 1129 | int failed = 0; | 1620 | int failed = 0; |
| 1130 | 1621 | ||
| 1131 | failed |= asn1_bit_string_test(); | 1622 | failed |= asn1_bit_string_test(); |
| 1623 | failed |= asn1_bit_string_set_bit_test(); | ||
| 1132 | failed |= asn1_boolean_test(); | 1624 | failed |= asn1_boolean_test(); |
| 1133 | failed |= asn1_integer_test(); | 1625 | failed |= asn1_integer_test(); |
| 1134 | failed |= asn1_string_test(); | 1626 | failed |= asn1_string_test(); |
diff --git a/src/regress/lib/libcrypto/asn1/asn1complex.c b/src/regress/lib/libcrypto/asn1/asn1complex.c index 6f34154b7f..0e2f50212c 100644 --- a/src/regress/lib/libcrypto/asn1/asn1complex.c +++ b/src/regress/lib/libcrypto/asn1/asn1complex.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: asn1complex.c,v 1.4 2022/09/05 21:06:31 tb Exp $ */ | 1 | /* $OpenBSD: asn1complex.c,v 1.5 2025/12/07 09:35:20 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2017, 2021 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2017, 2021 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -190,7 +190,7 @@ do_asn1_constructed_test(const struct asn1_constructed_test *act) | |||
| 190 | ERR_print_errors_fp(stderr); | 190 | ERR_print_errors_fp(stderr); |
| 191 | goto failed; | 191 | goto failed; |
| 192 | } | 192 | } |
| 193 | if (!asn1_compare_bytes(act->name, ASN1_STRING_data(aos), | 193 | if (!asn1_compare_bytes(act->name, ASN1_STRING_get0_data(aos), |
| 194 | ASN1_STRING_length(aos), act->want, act->want_len)) | 194 | ASN1_STRING_length(aos), act->want, act->want_len)) |
| 195 | goto failed; | 195 | goto failed; |
| 196 | 196 | ||
| @@ -285,7 +285,7 @@ do_asn1_sequence_string_tests(void) | |||
| 285 | goto failed; | 285 | goto failed; |
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | if (!asn1_compare_bytes("sequence", ASN1_STRING_data(astr), | 288 | if (!asn1_compare_bytes("sequence", ASN1_STRING_get0_data(astr), |
| 289 | ASN1_STRING_length(astr), asn1_sequence_content, | 289 | ASN1_STRING_length(astr), asn1_sequence_content, |
| 290 | sizeof(asn1_sequence_content))) | 290 | sizeof(asn1_sequence_content))) |
| 291 | goto failed; | 291 | goto failed; |
| @@ -299,7 +299,7 @@ do_asn1_sequence_string_tests(void) | |||
| 299 | goto failed; | 299 | goto failed; |
| 300 | } | 300 | } |
| 301 | 301 | ||
| 302 | if (!asn1_compare_bytes("sequence indefinite", ASN1_STRING_data(astr), | 302 | if (!asn1_compare_bytes("sequence indefinite", ASN1_STRING_get0_data(astr), |
| 303 | ASN1_STRING_length(astr), asn1_sequence_indefinite_content, | 303 | ASN1_STRING_length(astr), asn1_sequence_indefinite_content, |
| 304 | sizeof(asn1_sequence_indefinite_content))) | 304 | sizeof(asn1_sequence_indefinite_content))) |
| 305 | goto failed; | 305 | goto failed; |
diff --git a/src/regress/lib/libcrypto/asn1/asn1time.c b/src/regress/lib/libcrypto/asn1/asn1time.c index 7223ad9c9b..e0e5139808 100644 --- a/src/regress/lib/libcrypto/asn1/asn1time.c +++ b/src/regress/lib/libcrypto/asn1/asn1time.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: asn1time.c,v 1.30 2024/07/21 13:25:11 tb Exp $ */ | 1 | /* $OpenBSD: asn1time.c,v 1.31 2025/05/22 04:54:14 joshua Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> |
| 4 | * Copyright (c) 2024 Google Inc. | 4 | * Copyright (c) 2024 Google Inc. |
| @@ -33,6 +33,7 @@ struct asn1_time_test { | |||
| 33 | const char *data; | 33 | const char *data; |
| 34 | const unsigned char der[32]; | 34 | const unsigned char der[32]; |
| 35 | time_t time; | 35 | time_t time; |
| 36 | int generalized_time; | ||
| 36 | }; | 37 | }; |
| 37 | 38 | ||
| 38 | static const struct asn1_time_test asn1_invtime_tests[] = { | 39 | static const struct asn1_time_test asn1_invtime_tests[] = { |
| @@ -73,20 +74,19 @@ static const struct asn1_time_test asn1_invtime_tests[] = { | |||
| 73 | { | 74 | { |
| 74 | .str = "aaaaaaaaaaaaaaZ", | 75 | .str = "aaaaaaaaaaaaaaZ", |
| 75 | }, | 76 | }, |
| 76 | /* utc time with omitted seconds, should fail */ | ||
| 77 | { | 77 | { |
| 78 | /* UTC time with omitted seconds, should fail */ | ||
| 78 | .str = "1609082343Z", | 79 | .str = "1609082343Z", |
| 79 | }, | 80 | }, |
| 80 | }; | ||
| 81 | |||
| 82 | static const struct asn1_time_test asn1_invgentime_tests[] = { | ||
| 83 | /* Generalized time with omitted seconds, should fail */ | ||
| 84 | { | 81 | { |
| 82 | /* Generalized time with omitted seconds, should fail */ | ||
| 85 | .str = "201612081934Z", | 83 | .str = "201612081934Z", |
| 84 | .generalized_time = 1, | ||
| 86 | }, | 85 | }, |
| 87 | /* Valid UTC time, should fail as a generalized time */ | ||
| 88 | { | 86 | { |
| 87 | /* Valid UTC time, should fail as a generalized time */ | ||
| 89 | .str = "160908234300Z", | 88 | .str = "160908234300Z", |
| 89 | .generalized_time = 1, | ||
| 90 | }, | 90 | }, |
| 91 | }; | 91 | }; |
| 92 | 92 | ||
| @@ -235,7 +235,7 @@ asn1_compare_str(int test_no, const struct asn1_string_st *asn1str, | |||
| 235 | } | 235 | } |
| 236 | 236 | ||
| 237 | static int | 237 | static int |
| 238 | asn1_invtime_test(int test_no, const struct asn1_time_test *att, int gen) | 238 | asn1_invtime_test(int test_no, const struct asn1_time_test *att) |
| 239 | { | 239 | { |
| 240 | ASN1_GENERALIZEDTIME *gt = NULL; | 240 | ASN1_GENERALIZEDTIME *gt = NULL; |
| 241 | ASN1_UTCTIME *ut = NULL; | 241 | ASN1_UTCTIME *ut = NULL; |
| @@ -255,7 +255,7 @@ asn1_invtime_test(int test_no, const struct asn1_time_test *att, int gen) | |||
| 255 | goto done; | 255 | goto done; |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | if (gen) { | 258 | if (att->generalized_time) { |
| 259 | failure = 0; | 259 | failure = 0; |
| 260 | goto done; | 260 | goto done; |
| 261 | } | 261 | } |
| @@ -842,13 +842,7 @@ main(int argc, char **argv) | |||
| 842 | fprintf(stderr, "Invalid time tests...\n"); | 842 | fprintf(stderr, "Invalid time tests...\n"); |
| 843 | for (i = 0; i < N_INVTIME_TESTS; i++) { | 843 | for (i = 0; i < N_INVTIME_TESTS; i++) { |
| 844 | att = &asn1_invtime_tests[i]; | 844 | att = &asn1_invtime_tests[i]; |
| 845 | failed |= asn1_invtime_test(i, att, 0); | 845 | failed |= asn1_invtime_test(i, att); |
| 846 | } | ||
| 847 | |||
| 848 | fprintf(stderr, "Invalid generalized time tests...\n"); | ||
| 849 | for (i = 0; i < N_INVGENTIME_TESTS; i++) { | ||
| 850 | att = &asn1_invgentime_tests[i]; | ||
| 851 | failed |= asn1_invtime_test(i, att, 1); | ||
| 852 | } | 846 | } |
| 853 | 847 | ||
| 854 | fprintf(stderr, "GENERALIZEDTIME tests...\n"); | 848 | fprintf(stderr, "GENERALIZEDTIME tests...\n"); |
diff --git a/src/regress/lib/libcrypto/bio/bio_dump.c b/src/regress/lib/libcrypto/bio/bio_dump.c index 22db80fa3d..fd2bb285fb 100644 --- a/src/regress/lib/libcrypto/bio/bio_dump.c +++ b/src/regress/lib/libcrypto/bio/bio_dump.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bio_dump.c,v 1.4 2024/02/09 12:48:32 tb Exp $ */ | 1 | /* $OpenBSD: bio_dump.c,v 1.5 2025/05/18 06:41:51 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> | 3 | * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> |
| 4 | * | 4 | * |
| @@ -809,7 +809,7 @@ bio_dump_test(const struct bio_dump_testcase *tc) | |||
| 809 | tc->indent, ret, got_len, strlen(tc->output)); | 809 | tc->indent, ret, got_len, strlen(tc->output)); |
| 810 | goto err; | 810 | goto err; |
| 811 | } | 811 | } |
| 812 | if (strncmp(tc->output, got, got_len) != 0) { | 812 | if (got_len > 0 && strncmp(tc->output, got, got_len) != 0) { |
| 813 | fprintf(stderr, "%d: mismatch\n", tc->indent); | 813 | fprintf(stderr, "%d: mismatch\n", tc->indent); |
| 814 | goto err; | 814 | goto err; |
| 815 | } | 815 | } |
diff --git a/src/regress/lib/libcrypto/bn/bn_mul_div.c b/src/regress/lib/libcrypto/bn/bn_mul_div.c index 625d5e318e..dbad01004e 100644 --- a/src/regress/lib/libcrypto/bn/bn_mul_div.c +++ b/src/regress/lib/libcrypto/bn/bn_mul_div.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_mul_div.c,v 1.7 2023/06/21 07:18:10 jsing Exp $ */ | 1 | /* $OpenBSD: bn_mul_div.c,v 1.8 2025/08/12 10:29:35 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -233,6 +233,13 @@ struct benchmark benchmarks[] = { | |||
| 233 | .b_bits = 256, | 233 | .b_bits = 256, |
| 234 | }, | 234 | }, |
| 235 | { | 235 | { |
| 236 | .desc = "BN_mul (384 bit x 384 bit)", | ||
| 237 | .setup = benchmark_bn_mul_setup, | ||
| 238 | .run_once = benchmark_bn_mul_run_once, | ||
| 239 | .a_bits = 384, | ||
| 240 | .b_bits = 384, | ||
| 241 | }, | ||
| 242 | { | ||
| 236 | .desc = "BN_mul (512 bit x 512 bit)", | 243 | .desc = "BN_mul (512 bit x 512 bit)", |
| 237 | .setup = benchmark_bn_mul_setup, | 244 | .setup = benchmark_bn_mul_setup, |
| 238 | .run_once = benchmark_bn_mul_run_once, | 245 | .run_once = benchmark_bn_mul_run_once, |
| @@ -294,6 +301,12 @@ struct benchmark benchmarks[] = { | |||
| 294 | .a_bits = 256, | 301 | .a_bits = 256, |
| 295 | }, | 302 | }, |
| 296 | { | 303 | { |
| 304 | .desc = "BN_sqr (384 bit)", | ||
| 305 | .setup = benchmark_bn_sqr_setup, | ||
| 306 | .run_once = benchmark_bn_sqr_run_once, | ||
| 307 | .a_bits = 384, | ||
| 308 | }, | ||
| 309 | { | ||
| 297 | .desc = "BN_sqr (512 bit)", | 310 | .desc = "BN_sqr (512 bit)", |
| 298 | .setup = benchmark_bn_sqr_setup, | 311 | .setup = benchmark_bn_sqr_setup, |
| 299 | .run_once = benchmark_bn_sqr_run_once, | 312 | .run_once = benchmark_bn_sqr_run_once, |
diff --git a/src/regress/lib/libcrypto/bn/bn_print.c b/src/regress/lib/libcrypto/bn/bn_print.c index a3118869fc..d3e1e83464 100644 --- a/src/regress/lib/libcrypto/bn/bn_print.c +++ b/src/regress/lib/libcrypto/bn/bn_print.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_print.c,v 1.5 2023/07/27 06:41:39 tb Exp $ */ | 1 | /* $OpenBSD: bn_print.c,v 1.6 2025/11/05 11:40:47 jsing Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (c) 2023 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2023 Theo Buehler <tb@openbsd.org> |
| @@ -51,7 +51,7 @@ const struct print_test { | |||
| 51 | .desc = "minus one", | 51 | .desc = "minus one", |
| 52 | .want = " mana mana -1 (-0x1)\n", | 52 | .want = " mana mana -1 (-0x1)\n", |
| 53 | }, | 53 | }, |
| 54 | #ifdef _LP64 | 54 | #if BN_BYTES == 8 |
| 55 | { | 55 | { |
| 56 | .desc = "largest word", | 56 | .desc = "largest word", |
| 57 | .want = " mana mana 18446744073709551615 " | 57 | .want = " mana mana 18446744073709551615 " |
diff --git a/src/regress/lib/libcrypto/bn/bn_test.c b/src/regress/lib/libcrypto/bn/bn_test.c index 5348788f50..b32b9e81e2 100644 --- a/src/regress/lib/libcrypto/bn/bn_test.c +++ b/src/regress/lib/libcrypto/bn/bn_test.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_test.c,v 1.23 2025/02/12 21:22:15 tb Exp $ */ | 1 | /* $OpenBSD: bn_test.c,v 1.25 2025/11/15 16:30:10 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -69,7 +69,9 @@ | |||
| 69 | * | 69 | * |
| 70 | */ | 70 | */ |
| 71 | 71 | ||
| 72 | #include <inttypes.h> | ||
| 72 | #include <stdio.h> | 73 | #include <stdio.h> |
| 74 | #include <stdint.h> | ||
| 73 | #include <stdlib.h> | 75 | #include <stdlib.h> |
| 74 | #include <string.h> | 76 | #include <string.h> |
| 75 | 77 | ||
| @@ -474,18 +476,7 @@ test_div(BIO *bp, BN_CTX *ctx) | |||
| 474 | static void | 476 | static void |
| 475 | print_word(BIO *bp, BN_ULONG w) | 477 | print_word(BIO *bp, BN_ULONG w) |
| 476 | { | 478 | { |
| 477 | #ifdef SIXTY_FOUR_BIT | 479 | BIO_printf(bp, "%" PRIX64, (uint64_t)w); |
| 478 | if (sizeof(w) > sizeof(unsigned long)) { | ||
| 479 | unsigned long h = (unsigned long)(w >> 32), l = (unsigned long)(w); | ||
| 480 | |||
| 481 | if (h) | ||
| 482 | BIO_printf(bp, "%lX%08lX", h, l); | ||
| 483 | else | ||
| 484 | BIO_printf(bp, "%lX", l); | ||
| 485 | return; | ||
| 486 | } | ||
| 487 | #endif | ||
| 488 | BIO_printf(bp, BN_HEX_FMT1, w); | ||
| 489 | } | 480 | } |
| 490 | 481 | ||
| 491 | int | 482 | int |
diff --git a/src/regress/lib/libcrypto/bn/bn_word.c b/src/regress/lib/libcrypto/bn/bn_word.c index 2ec518ed1b..433a8a3ba6 100644 --- a/src/regress/lib/libcrypto/bn/bn_word.c +++ b/src/regress/lib/libcrypto/bn/bn_word.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_word.c,v 1.2 2024/08/23 12:56:26 anton Exp $ */ | 1 | /* $OpenBSD: bn_word.c,v 1.3 2025/12/05 14:07:01 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -20,6 +20,8 @@ | |||
| 20 | 20 | ||
| 21 | #include <openssl/bn.h> | 21 | #include <openssl/bn.h> |
| 22 | 22 | ||
| 23 | #include "bn_local.h" | ||
| 24 | |||
| 23 | struct bn_word_test { | 25 | struct bn_word_test { |
| 24 | const char *in_hex; | 26 | const char *in_hex; |
| 25 | BN_ULONG in_word; | 27 | BN_ULONG in_word; |
diff --git a/src/regress/lib/libcrypto/c2sp/Makefile b/src/regress/lib/libcrypto/c2sp/Makefile index 9b2c944ba4..73ee0b8c22 100644 --- a/src/regress/lib/libcrypto/c2sp/Makefile +++ b/src/regress/lib/libcrypto/c2sp/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.4 2024/10/28 16:27:14 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.7 2025/07/23 07:35:21 tb Exp $ |
| 2 | 2 | ||
| 3 | C2SP_TESTVECTORS = /usr/local/share/c2sp-testvectors/ | 3 | C2SP_TESTVECTORS = /usr/local/share/c2sp-testvectors/ |
| 4 | 4 | ||
| @@ -13,12 +13,12 @@ PROGS += cctv | |||
| 13 | SRCS_cctv = | 13 | SRCS_cctv = |
| 14 | 14 | ||
| 15 | cctv: cctv.go | 15 | cctv: cctv.go |
| 16 | go build -o $@ ${.CURDIR}/cctv.go | 16 | env GOCACHE=${.OBJDIR}/go-build go build -o $@ ${.CURDIR}/cctv.go |
| 17 | 17 | ||
| 18 | OSSL_LIB = /usr/local/lib/eopenssl | 18 | OSSL_LIB = /usr/local/lib/eopenssl |
| 19 | OSSL_INC = /usr/local/include/eopenssl | 19 | OSSL_INC = /usr/local/include/eopenssl |
| 20 | 20 | ||
| 21 | . for V in 11 32 33 34 | 21 | . for V in 35 |
| 22 | . if exists(/usr/local/bin/eopenssl$V) | 22 | . if exists(/usr/local/bin/eopenssl$V) |
| 23 | PROGS += cctv-openssl$V | 23 | PROGS += cctv-openssl$V |
| 24 | SRCS_cctv-openssl$V = | 24 | SRCS_cctv-openssl$V = |
| @@ -29,10 +29,17 @@ CGO_LDFLAGS_$V += -L${OSSL_LIB}$V | |||
| 29 | 29 | ||
| 30 | cctv-openssl$V: cctv.go | 30 | cctv-openssl$V: cctv.go |
| 31 | env CGO_CFLAGS="${CGO_CFLAGS_$V}" CGO_LDFLAGS="${CGO_LDFLAGS_$V}" \ | 31 | env CGO_CFLAGS="${CGO_CFLAGS_$V}" CGO_LDFLAGS="${CGO_LDFLAGS_$V}" \ |
| 32 | GOCACHE=${.OBJDIR}/go-build \ | ||
| 32 | go build -o $@ ${.CURDIR}/cctv.go | 33 | go build -o $@ ${.CURDIR}/cctv.go |
| 33 | . endif | 34 | . endif |
| 34 | . endfor | 35 | . endfor |
| 35 | 36 | ||
| 37 | REGRESS_CLEANUP = clean-go-cache | ||
| 38 | |||
| 39 | clean-go-cache: | ||
| 40 | env GOCACHE=${.OBJDIR}/go-build go clean -cache | ||
| 41 | rm -rf ${.OBJDIR}/go-build | ||
| 42 | |||
| 36 | .endif | 43 | .endif |
| 37 | 44 | ||
| 38 | .include <bsd.regress.mk> | 45 | .include <bsd.regress.mk> |
diff --git a/src/regress/lib/libcrypto/certs/Makefile b/src/regress/lib/libcrypto/certs/Makefile index 621c60907f..f7ba9fcad8 100644 --- a/src/regress/lib/libcrypto/certs/Makefile +++ b/src/regress/lib/libcrypto/certs/Makefile | |||
| @@ -1,21 +1,24 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.1 2020/07/14 18:27:28 jsing Exp $ | 1 | # $OpenBSD: Makefile,v 1.2 2025/07/09 05:04:35 tb Exp $ |
| 2 | 2 | ||
| 3 | .if ! (make(clean) || make(cleandir) || make(obj)) | 3 | .if !exists(/usr/local/bin/go) |
| 4 | GO_VERSION != sh -c "(go version) 2>/dev/null || true" | ||
| 5 | .endif | ||
| 6 | |||
| 7 | .if empty(GO_VERSION) | ||
| 8 | regress: | 4 | regress: |
| 9 | @echo package go is required for this regress | 5 | @echo package go is required for this regress |
| 10 | @echo SKIPPED | 6 | @echo SKIPPED |
| 11 | .endif | 7 | .else |
| 12 | 8 | ||
| 13 | REGRESS_TARGETS=regress-go-verify | 9 | REGRESS_TARGETS=regress-go-verify |
| 10 | REGRESS_CLEANUP=clean-go-cache | ||
| 14 | 11 | ||
| 15 | certs: | 12 | certs: |
| 16 | cd ${.CURDIR} && sh ./make-certs.sh | 13 | cd ${.CURDIR} && sh ./make-certs.sh |
| 17 | 14 | ||
| 18 | regress-go-verify: | 15 | regress-go-verify: |
| 19 | cd ${.CURDIR} && go test -test.v . | 16 | cd ${.CURDIR} && env GOCACHE=${.OBJDIR}/go-build go test -test.v . |
| 17 | |||
| 18 | clean-go-cache: | ||
| 19 | env GOCACHE=${.OBJDIR}/go-build go clean -cache | ||
| 20 | rm -rf ${.OBJDIR}/go-build | ||
| 21 | |||
| 22 | .endif | ||
| 20 | 23 | ||
| 21 | .include <bsd.regress.mk> | 24 | .include <bsd.regress.mk> |
diff --git a/src/regress/lib/libcrypto/des/destest.c b/src/regress/lib/libcrypto/des/destest.c index ebc67f3107..8a2b94d2d6 100644 --- a/src/regress/lib/libcrypto/des/destest.c +++ b/src/regress/lib/libcrypto/des/destest.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: destest.c,v 1.4 2018/07/17 17:06:49 tb Exp $ */ | 1 | /* $OpenBSD: destest.c,v 1.5 2025/12/26 19:11:01 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -233,24 +233,12 @@ static unsigned char cbc_ok[32]={ | |||
| 233 | 0x46,0x8e,0x91,0x15,0x78,0x88,0xba,0x68, | 233 | 0x46,0x8e,0x91,0x15,0x78,0x88,0xba,0x68, |
| 234 | 0x1d,0x26,0x93,0x97,0xf7,0xfe,0x62,0xb4}; | 234 | 0x1d,0x26,0x93,0x97,0xf7,0xfe,0x62,0xb4}; |
| 235 | 235 | ||
| 236 | #ifdef SCREW_THE_PARITY | ||
| 237 | #error "SCREW_THE_PARITY is not ment to be defined." | ||
| 238 | #error "Original vectors are preserved for reference only." | ||
| 239 | static unsigned char cbc2_key[8]={0xf0,0xe1,0xd2,0xc3,0xb4,0xa5,0x96,0x87}; | ||
| 240 | static unsigned char xcbc_ok[32]={ | ||
| 241 | 0x86,0x74,0x81,0x0D,0x61,0xA4,0xA5,0x48, | ||
| 242 | 0xB9,0x93,0x03,0xE1,0xB8,0xBB,0xBD,0xBD, | ||
| 243 | 0x64,0x30,0x0B,0xB9,0x06,0x65,0x81,0x76, | ||
| 244 | 0x04,0x1D,0x77,0x62,0x17,0xCA,0x2B,0xD2, | ||
| 245 | }; | ||
| 246 | #else | ||
| 247 | static unsigned char xcbc_ok[32]={ | 236 | static unsigned char xcbc_ok[32]={ |
| 248 | 0x84,0x6B,0x29,0x14,0x85,0x1E,0x9A,0x29, | 237 | 0x84,0x6B,0x29,0x14,0x85,0x1E,0x9A,0x29, |
| 249 | 0x54,0x73,0x2F,0x8A,0xA0,0xA6,0x11,0xC1, | 238 | 0x54,0x73,0x2F,0x8A,0xA0,0xA6,0x11,0xC1, |
| 250 | 0x15,0xCD,0xC2,0xD7,0x95,0x1B,0x10,0x53, | 239 | 0x15,0xCD,0xC2,0xD7,0x95,0x1B,0x10,0x53, |
| 251 | 0xA6,0x3C,0x5E,0x03,0xB2,0x1A,0xA3,0xC4, | 240 | 0xA6,0x3C,0x5E,0x03,0xB2,0x1A,0xA3,0xC4, |
| 252 | }; | 241 | }; |
| 253 | #endif | ||
| 254 | 242 | ||
| 255 | static unsigned char cbc3_ok[32]={ | 243 | static unsigned char cbc3_ok[32]={ |
| 256 | 0x3F,0xE3,0x01,0xC9,0x62,0xAC,0x01,0xD0, | 244 | 0x3F,0xE3,0x01,0xC9,0x62,0xAC,0x01,0xD0, |
diff --git a/src/regress/lib/libcrypto/ec/Makefile b/src/regress/lib/libcrypto/ec/Makefile index b21eacb4bc..1d976c77d0 100644 --- a/src/regress/lib/libcrypto/ec/Makefile +++ b/src/regress/lib/libcrypto/ec/Makefile | |||
| @@ -1,12 +1,13 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.11 2025/03/08 20:09:35 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.13 2025/08/03 08:29:39 jsing Exp $ |
| 2 | 2 | ||
| 3 | .ifdef EOPENSSL33 | 3 | .ifdef EOPENSSL35 |
| 4 | LDADD += -Wl,-rpath,/usr/local/lib/eopenssl33 -L/usr/local/lib/eopenssl33 | 4 | LDADD += -Wl,-rpath,/usr/local/lib/eopenssl35 -L/usr/local/lib/eopenssl35 |
| 5 | CFLAGS += -I/usr/local/include/eopenssl33/ | 5 | CFLAGS += -I/usr/local/include/eopenssl35/ |
| 6 | CFLAGS += -DOPENSSL_SUPPRESS_DEPRECATED | 6 | CFLAGS += -DOPENSSL_SUPPRESS_DEPRECATED |
| 7 | .endif | 7 | .endif |
| 8 | 8 | ||
| 9 | PROGS += ectest | 9 | PROGS += ectest |
| 10 | PROGS += ec_arithmetic | ||
| 10 | PROGS += ec_asn1_test | 11 | PROGS += ec_asn1_test |
| 11 | PROGS += ec_point_conversion | 12 | PROGS += ec_point_conversion |
| 12 | 13 | ||
diff --git a/src/regress/lib/libcrypto/ec/ec_arithmetic.c b/src/regress/lib/libcrypto/ec/ec_arithmetic.c new file mode 100644 index 0000000000..c6f7cd4f8c --- /dev/null +++ b/src/regress/lib/libcrypto/ec/ec_arithmetic.c | |||
| @@ -0,0 +1,210 @@ | |||
| 1 | /* $OpenBSD: ec_arithmetic.c,v 1.1 2025/08/03 08:29:39 jsing Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2022,2025 Joel Sing <jsing@openbsd.org> | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <sys/time.h> | ||
| 19 | |||
| 20 | #include <err.h> | ||
| 21 | #include <signal.h> | ||
| 22 | #include <stdio.h> | ||
| 23 | #include <string.h> | ||
| 24 | #include <time.h> | ||
| 25 | #include <unistd.h> | ||
| 26 | |||
| 27 | #include <openssl/bn.h> | ||
| 28 | #include <openssl/ec.h> | ||
| 29 | #include <openssl/objects.h> | ||
| 30 | |||
| 31 | static void | ||
| 32 | benchmark_ec_point_add(const EC_GROUP *group, EC_POINT *result, | ||
| 33 | const BIGNUM *scalar, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx) | ||
| 34 | { | ||
| 35 | if (!EC_POINT_add(group, result, a, b, ctx)) | ||
| 36 | errx(1, "EC_POINT_add"); | ||
| 37 | } | ||
| 38 | |||
| 39 | static void | ||
| 40 | benchmark_ec_point_dbl(const EC_GROUP *group, EC_POINT *result, | ||
| 41 | const BIGNUM *scalar, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx) | ||
| 42 | { | ||
| 43 | if (!EC_POINT_dbl(group, result, a, ctx)) | ||
| 44 | errx(1, "EC_POINT_dbl"); | ||
| 45 | } | ||
| 46 | |||
| 47 | static void | ||
| 48 | benchmark_ec_point_mul_generator(const EC_GROUP *group, EC_POINT *result, | ||
| 49 | const BIGNUM *scalar, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx) | ||
| 50 | { | ||
| 51 | if (!EC_POINT_mul(group, result, scalar, NULL, NULL, ctx)) | ||
| 52 | errx(1, "EC_POINT_mul"); | ||
| 53 | } | ||
| 54 | |||
| 55 | struct benchmark { | ||
| 56 | int curve; | ||
| 57 | const char *desc; | ||
| 58 | void (*func)(const EC_GROUP *, EC_POINT *, const BIGNUM *, | ||
| 59 | const EC_POINT *, const EC_POINT *, BN_CTX *); | ||
| 60 | }; | ||
| 61 | |||
| 62 | static const struct benchmark benchmarks[] = { | ||
| 63 | { | ||
| 64 | .curve = NID_X9_62_prime256v1, | ||
| 65 | .desc = "EC_POINT_add() p256", | ||
| 66 | .func = benchmark_ec_point_add, | ||
| 67 | }, | ||
| 68 | { | ||
| 69 | .curve = NID_secp384r1, | ||
| 70 | .desc = "EC_POINT_add() p384", | ||
| 71 | .func = benchmark_ec_point_add, | ||
| 72 | }, | ||
| 73 | { | ||
| 74 | .curve = NID_secp521r1, | ||
| 75 | .desc = "EC_POINT_add() p521", | ||
| 76 | .func = benchmark_ec_point_add, | ||
| 77 | }, | ||
| 78 | { | ||
| 79 | .curve = NID_X9_62_prime256v1, | ||
| 80 | .desc = "EC_POINT_dbl() p256", | ||
| 81 | .func = benchmark_ec_point_dbl, | ||
| 82 | }, | ||
| 83 | { | ||
| 84 | .curve = NID_secp384r1, | ||
| 85 | .desc = "EC_POINT_dbl() p384", | ||
| 86 | .func = benchmark_ec_point_dbl, | ||
| 87 | }, | ||
| 88 | { | ||
| 89 | .curve = NID_secp521r1, | ||
| 90 | .desc = "EC_POINT_dbl() p521", | ||
| 91 | .func = benchmark_ec_point_dbl, | ||
| 92 | }, | ||
| 93 | { | ||
| 94 | .curve = NID_X9_62_prime256v1, | ||
| 95 | .desc = "EC_POINT_mul() generator p256", | ||
| 96 | .func = benchmark_ec_point_mul_generator, | ||
| 97 | }, | ||
| 98 | { | ||
| 99 | .curve = NID_secp384r1, | ||
| 100 | .desc = "EC_POINT_mul() generator p384", | ||
| 101 | .func = benchmark_ec_point_mul_generator, | ||
| 102 | }, | ||
| 103 | { | ||
| 104 | .curve = NID_secp521r1, | ||
| 105 | .desc = "EC_POINT_mul() generator p521", | ||
| 106 | .func = benchmark_ec_point_mul_generator, | ||
| 107 | }, | ||
| 108 | }; | ||
| 109 | |||
| 110 | #define N_BENCHMARKS (sizeof(benchmarks) / sizeof(benchmarks[0])) | ||
| 111 | |||
| 112 | static volatile sig_atomic_t benchmark_stop; | ||
| 113 | |||
| 114 | static void | ||
| 115 | benchmark_sig_alarm(int sig) | ||
| 116 | { | ||
| 117 | benchmark_stop = 1; | ||
| 118 | } | ||
| 119 | |||
| 120 | static void | ||
| 121 | benchmark_run(const struct benchmark *bm, int seconds) | ||
| 122 | { | ||
| 123 | struct timespec start, end, duration; | ||
| 124 | EC_GROUP *group = NULL; | ||
| 125 | EC_POINT *a = NULL, *b = NULL, *result = NULL; | ||
| 126 | BIGNUM *order = NULL, *scalar = NULL; | ||
| 127 | BN_CTX *ctx = NULL; | ||
| 128 | int i; | ||
| 129 | |||
| 130 | signal(SIGALRM, benchmark_sig_alarm); | ||
| 131 | |||
| 132 | if ((ctx = BN_CTX_new()) == NULL) | ||
| 133 | errx(1, "BN_CTX_new"); | ||
| 134 | |||
| 135 | if ((group = EC_GROUP_new_by_curve_name(bm->curve)) == NULL) | ||
| 136 | errx(1, "EC_GROUP_new_by_curve_name"); | ||
| 137 | if ((order = BN_new()) == NULL) | ||
| 138 | errx(1, "BN_new"); | ||
| 139 | if (!EC_GROUP_get_order(group, order, ctx)) | ||
| 140 | errx(1, "EC_GROUP_get_order"); | ||
| 141 | |||
| 142 | if ((scalar = BN_new()) == NULL) | ||
| 143 | errx(1, "BN_new"); | ||
| 144 | if (!BN_rand_range(scalar, order)) | ||
| 145 | errx(1, "BN_rand_range"); | ||
| 146 | if (!BN_set_bit(scalar, EC_GROUP_order_bits(group) - 1)) | ||
| 147 | errx(1, "BN_set_bit"); | ||
| 148 | |||
| 149 | if ((result = EC_POINT_new(group)) == NULL) | ||
| 150 | errx(1, "EC_POINT_new"); | ||
| 151 | if ((a = EC_POINT_new(group)) == NULL) | ||
| 152 | errx(1, "EC_POINT_new"); | ||
| 153 | if ((b = EC_POINT_new(group)) == NULL) | ||
| 154 | errx(1, "EC_POINT_new"); | ||
| 155 | |||
| 156 | if (!EC_POINT_mul(group, a, scalar, NULL, NULL, ctx)) | ||
| 157 | errx(1, "EC_POINT_mul"); | ||
| 158 | if (!EC_POINT_mul(group, b, scalar, NULL, NULL, ctx)) | ||
| 159 | errx(1, "EC_POINT_mul"); | ||
| 160 | |||
| 161 | benchmark_stop = 0; | ||
| 162 | i = 0; | ||
| 163 | alarm(seconds); | ||
| 164 | |||
| 165 | clock_gettime(CLOCK_MONOTONIC, &start); | ||
| 166 | |||
| 167 | fprintf(stderr, "Benchmarking %s for %ds: ", bm->desc, seconds); | ||
| 168 | while (!benchmark_stop) { | ||
| 169 | bm->func(group, result, scalar, a, b, ctx); | ||
| 170 | i++; | ||
| 171 | } | ||
| 172 | clock_gettime(CLOCK_MONOTONIC, &end); | ||
| 173 | timespecsub(&end, &start, &duration); | ||
| 174 | fprintf(stderr, "%d iterations in %f seconds\n", i, | ||
| 175 | duration.tv_sec + duration.tv_nsec / 1000000000.0); | ||
| 176 | |||
| 177 | EC_GROUP_free(group); | ||
| 178 | EC_POINT_free(result); | ||
| 179 | EC_POINT_free(a); | ||
| 180 | EC_POINT_free(b); | ||
| 181 | BN_free(order); | ||
| 182 | BN_free(scalar); | ||
| 183 | BN_CTX_free(ctx); | ||
| 184 | } | ||
| 185 | |||
| 186 | static void | ||
| 187 | benchmark_ec_mul_single(void) | ||
| 188 | { | ||
| 189 | const struct benchmark *bm; | ||
| 190 | size_t i; | ||
| 191 | |||
| 192 | for (i = 0; i < N_BENCHMARKS; i++) { | ||
| 193 | bm = &benchmarks[i]; | ||
| 194 | benchmark_run(bm, 5); | ||
| 195 | } | ||
| 196 | } | ||
| 197 | |||
| 198 | int | ||
| 199 | main(int argc, char **argv) | ||
| 200 | { | ||
| 201 | int benchmark = 0, failed = 0; | ||
| 202 | |||
| 203 | if (argc == 2 && strcmp(argv[1], "--benchmark") == 0) | ||
| 204 | benchmark = 1; | ||
| 205 | |||
| 206 | if (benchmark && !failed) | ||
| 207 | benchmark_ec_mul_single(); | ||
| 208 | |||
| 209 | return failed; | ||
| 210 | } | ||
diff --git a/src/regress/lib/libcrypto/ec/ec_asn1_test.c b/src/regress/lib/libcrypto/ec/ec_asn1_test.c index 03358e69ca..4dfe681dbd 100644 --- a/src/regress/lib/libcrypto/ec/ec_asn1_test.c +++ b/src/regress/lib/libcrypto/ec/ec_asn1_test.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* $OpenBSD: ec_asn1_test.c,v 1.32 2025/03/08 20:09:35 tb Exp $ */ | 1 | /* $OpenBSD: ec_asn1_test.c,v 1.41 2025/12/07 11:39:00 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2017, 2021 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2017, 2021 Joel Sing <jsing@openbsd.org> |
| 4 | * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2024, 2025 Theo Buehler <tb@openbsd.org> |
| 5 | * | 5 | * |
| 6 | * Permission to use, copy, modify, and distribute this software for any | 6 | * Permission to use, copy, modify, and distribute this software for any |
| 7 | * purpose with or without fee is hereby granted, provided that the above | 7 | * purpose with or without fee is hereby granted, provided that the above |
| @@ -17,12 +17,17 @@ | |||
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | #include <err.h> | 19 | #include <err.h> |
| 20 | #include <stdio.h> | ||
| 21 | #include <stdint.h> | ||
| 22 | #include <stdlib.h> | ||
| 20 | #include <string.h> | 23 | #include <string.h> |
| 21 | 24 | ||
| 22 | #include <openssl/bio.h> | 25 | #include <openssl/bio.h> |
| 26 | #include <openssl/bn.h> | ||
| 23 | #include <openssl/ec.h> | 27 | #include <openssl/ec.h> |
| 24 | #include <openssl/err.h> | 28 | #include <openssl/err.h> |
| 25 | #include <openssl/objects.h> | 29 | #include <openssl/objects.h> |
| 30 | #include <openssl/sha.h> | ||
| 26 | 31 | ||
| 27 | #include "ec_local.h" | 32 | #include "ec_local.h" |
| 28 | 33 | ||
| @@ -730,6 +735,82 @@ static const struct curve secp256k1_m = { | |||
| 730 | .param_len = sizeof(ec_secp256k1_m_pkparameters_parameters), | 735 | .param_len = sizeof(ec_secp256k1_m_pkparameters_parameters), |
| 731 | }; | 736 | }; |
| 732 | 737 | ||
| 738 | /* | ||
| 739 | * From https://eips.ethereum.org/EIPS/eip-2539 | ||
| 740 | */ | ||
| 741 | |||
| 742 | static const uint8_t ec_bls12_377_pkparameters_named_curve[] = { | ||
| 743 | 0x06, 0x04, 0x29, 0x01, 0x01, 0x01, | ||
| 744 | }; | ||
| 745 | |||
| 746 | static const uint8_t ec_bls12_377_pkparameters_parameters[] = { | ||
| 747 | 0x30, 0x82, 0x01, 0x3d, 0x02, 0x01, 0x01, 0x30, | ||
| 748 | 0x3b, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, | ||
| 749 | 0x01, 0x01, 0x02, 0x30, 0x01, 0xae, 0x3a, 0x46, | ||
| 750 | 0x17, 0xc5, 0x10, 0xea, 0xc6, 0x3b, 0x05, 0xc0, | ||
| 751 | 0x6c, 0xa1, 0x49, 0x3b, 0x1a, 0x22, 0xd9, 0xf3, | ||
| 752 | 0x00, 0xf5, 0x13, 0x8f, 0x1e, 0xf3, 0x62, 0x2f, | ||
| 753 | 0xba, 0x09, 0x48, 0x00, 0x17, 0x0b, 0x5d, 0x44, | ||
| 754 | 0x30, 0x00, 0x00, 0x00, 0x85, 0x08, 0xc0, 0x00, | ||
| 755 | 0x00, 0x00, 0x00, 0x01, 0x30, 0x64, 0x04, 0x30, | ||
| 756 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 757 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 758 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 759 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 760 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 761 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 762 | 0x04, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 763 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 764 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 765 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 766 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 767 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 768 | 0x00, 0x01, 0x04, 0x61, 0x04, 0x00, 0x88, 0x48, | ||
| 769 | 0xde, 0xfe, 0x74, 0x0a, 0x67, 0xc8, 0xfc, 0x62, | ||
| 770 | 0x25, 0xbf, 0x87, 0xff, 0x54, 0x85, 0x95, 0x1e, | ||
| 771 | 0x2c, 0xaa, 0x9d, 0x41, 0xbb, 0x18, 0x82, 0x82, | ||
| 772 | 0xc8, 0xbd, 0x37, 0xcb, 0x5c, 0xd5, 0x48, 0x15, | ||
| 773 | 0x12, 0xff, 0xcd, 0x39, 0x4e, 0xea, 0xb9, 0xb1, | ||
| 774 | 0x6e, 0xb2, 0x1b, 0xe9, 0xef, 0x01, 0x91, 0x4a, | ||
| 775 | 0x69, 0xc5, 0x10, 0x2e, 0xff, 0x1f, 0x67, 0x4f, | ||
| 776 | 0x5d, 0x30, 0xaf, 0xee, 0xc4, 0xbd, 0x7f, 0xb3, | ||
| 777 | 0x48, 0xca, 0x3e, 0x52, 0xd9, 0x6d, 0x18, 0x2a, | ||
| 778 | 0xd4, 0x4f, 0xb8, 0x23, 0x05, 0xc2, 0xfe, 0x3d, | ||
| 779 | 0x36, 0x34, 0xa9, 0x59, 0x1a, 0xfd, 0x82, 0xde, | ||
| 780 | 0x55, 0x55, 0x9c, 0x8e, 0xa6, 0x02, 0x20, 0x12, | ||
| 781 | 0xab, 0x65, 0x5e, 0x9a, 0x2c, 0xa5, 0x56, 0x60, | ||
| 782 | 0xb4, 0x4d, 0x1e, 0x5c, 0x37, 0xb0, 0x01, 0x59, | ||
| 783 | 0xaa, 0x76, 0xfe, 0xd0, 0x00, 0x00, 0x01, 0x0a, | ||
| 784 | 0x11, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, | ||
| 785 | 0x10, 0x17, 0x0b, 0x5d, 0x44, 0x30, 0x00, 0x00, | ||
| 786 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 787 | 0x00, | ||
| 788 | }; | ||
| 789 | |||
| 790 | static const struct curve bls12_377 = { | ||
| 791 | .descr = "BLS12-377", | ||
| 792 | .oid = "1.1.1.1.1", /* XXX */ | ||
| 793 | .sn = "BLS12-377", | ||
| 794 | .p = "01ae3a46" "17c510ea" "c63b05c0" "6ca1493b" | ||
| 795 | "1a22d9f3" "00f5138f" "1ef3622f" "ba094800" | ||
| 796 | "170b5d44" "30000000" "8508c000" "00000001", | ||
| 797 | .a = "0", | ||
| 798 | .b = "1", | ||
| 799 | .x = "008848de" "fe740a67" "c8fc6225" "bf87ff54" | ||
| 800 | "85951e2c" "aa9d41bb" "188282c8" "bd37cb5c" | ||
| 801 | "d5481512" "ffcd394e" "eab9b16e" "b21be9ef", | ||
| 802 | .y = "01914a69" "c5102eff" "1f674f5d" "30afeec4" | ||
| 803 | "bd7fb348" "ca3e52d9" "6d182ad4" "4fb82305" | ||
| 804 | "c2fe3d36" "34a9591a" "fd82de55" "559c8ea6", | ||
| 805 | .order = "12ab655e" "9a2ca556" "60b44d1e" "5c37b001" | ||
| 806 | "59aa76fe" "d0000001" "0a118000" "00000001", | ||
| 807 | .cofactor = "170b5d44" "30000000" "00000000" "00000000", | ||
| 808 | .named = ec_bls12_377_pkparameters_named_curve, | ||
| 809 | .named_len = sizeof(ec_bls12_377_pkparameters_named_curve), | ||
| 810 | .param = ec_bls12_377_pkparameters_parameters, | ||
| 811 | .param_len = sizeof(ec_bls12_377_pkparameters_parameters), | ||
| 812 | }; | ||
| 813 | |||
| 733 | static EC_GROUP * | 814 | static EC_GROUP * |
| 734 | ec_group_from_curve_method(const struct curve *curve, const EC_METHOD *method, | 815 | ec_group_from_curve_method(const struct curve *curve, const EC_METHOD *method, |
| 735 | BN_CTX *ctx) | 816 | BN_CTX *ctx) |
| @@ -1020,6 +1101,65 @@ ec_group_non_builtin_curves(void) | |||
| 1020 | failed |= ec_group_non_builtin_curve(&secp256k1_m, EC_GFp_mont_method(), ctx); | 1101 | failed |= ec_group_non_builtin_curve(&secp256k1_m, EC_GFp_mont_method(), ctx); |
| 1021 | failed |= ec_group_non_builtin_curve(&secp256k1_m, EC_GFp_simple_method(), ctx); | 1102 | failed |= ec_group_non_builtin_curve(&secp256k1_m, EC_GFp_simple_method(), ctx); |
| 1022 | 1103 | ||
| 1104 | failed |= ec_group_non_builtin_curve(&bls12_377, EC_GFp_mont_method(), ctx); | ||
| 1105 | failed |= ec_group_non_builtin_curve(&bls12_377, EC_GFp_simple_method(), ctx); | ||
| 1106 | |||
| 1107 | BN_CTX_free(ctx); | ||
| 1108 | |||
| 1109 | return failed; | ||
| 1110 | } | ||
| 1111 | |||
| 1112 | static int | ||
| 1113 | ec_group_check_prime_order(EC_builtin_curve *curve, BN_CTX *ctx) | ||
| 1114 | { | ||
| 1115 | EC_GROUP *group; | ||
| 1116 | BIGNUM *order; | ||
| 1117 | int rv; | ||
| 1118 | int failed = 0; | ||
| 1119 | |||
| 1120 | if ((group = EC_GROUP_new_by_curve_name(curve->nid)) == NULL) | ||
| 1121 | errx(1, "EC_GROUP_new_by_curve_name"); | ||
| 1122 | |||
| 1123 | BN_CTX_start(ctx); | ||
| 1124 | |||
| 1125 | if ((order = BN_CTX_get(ctx)) == NULL) | ||
| 1126 | errx(1, "order = BN_CTX_get()"); | ||
| 1127 | |||
| 1128 | if (!EC_GROUP_get_order(group, order, ctx)) | ||
| 1129 | errx(1, "EC_GROUP_get_order"); | ||
| 1130 | |||
| 1131 | if ((rv = BN_is_prime_ex(order, 0, ctx, NULL)) != 1) { | ||
| 1132 | fprintf(stderr, "%s: nid %d: BN_is_prime_ex() returned %d, want 1\n", | ||
| 1133 | __func__, curve->nid, rv); | ||
| 1134 | failed = 1; | ||
| 1135 | } | ||
| 1136 | |||
| 1137 | BN_CTX_end(ctx); | ||
| 1138 | EC_GROUP_free(group); | ||
| 1139 | |||
| 1140 | return failed; | ||
| 1141 | } | ||
| 1142 | |||
| 1143 | static int | ||
| 1144 | ec_group_builtin_curves_have_prime_order(void) | ||
| 1145 | { | ||
| 1146 | BN_CTX *ctx = NULL; | ||
| 1147 | EC_builtin_curve *all_curves = NULL; | ||
| 1148 | size_t curve_id, ncurves; | ||
| 1149 | int failed = 0; | ||
| 1150 | |||
| 1151 | if ((ctx = BN_CTX_new()) == NULL) | ||
| 1152 | errx(1, "BN_CTX_new"); | ||
| 1153 | |||
| 1154 | ncurves = EC_get_builtin_curves(NULL, 0); | ||
| 1155 | if ((all_curves = calloc(ncurves, sizeof(*all_curves))) == NULL) | ||
| 1156 | err(1, "calloc builtin curves"); | ||
| 1157 | EC_get_builtin_curves(all_curves, ncurves); | ||
| 1158 | |||
| 1159 | for (curve_id = 0; curve_id < ncurves; curve_id++) | ||
| 1160 | failed |= ec_group_check_prime_order(&all_curves[curve_id], ctx); | ||
| 1161 | |||
| 1162 | free(all_curves); | ||
| 1023 | BN_CTX_free(ctx); | 1163 | BN_CTX_free(ctx); |
| 1024 | 1164 | ||
| 1025 | return failed; | 1165 | return failed; |
| @@ -1281,126 +1421,6 @@ static const struct ec_private_key { | |||
| 1281 | }, | 1421 | }, |
| 1282 | }, | 1422 | }, |
| 1283 | { | 1423 | { |
| 1284 | .name = "prime239v1", | ||
| 1285 | .der_len = 115, | ||
| 1286 | .der = { | ||
| 1287 | 0x30, 0x71, 0x02, 0x01, 0x01, 0x04, 0x1e, 0x6e, | ||
| 1288 | 0x26, 0x5e, 0xde, 0x5b, 0x67, 0xd6, 0x38, 0x52, | ||
| 1289 | 0xe7, 0x1e, 0x8d, 0x44, 0xb1, 0xfb, 0xf8, 0xaf, | ||
| 1290 | 0xf9, 0x94, 0x2c, 0xe2, 0x0d, 0xa8, 0x5f, 0x03, | ||
| 1291 | 0x67, 0x53, 0x7b, 0x8b, 0x2e, 0xa0, 0x0a, 0x06, | ||
| 1292 | 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, | ||
| 1293 | 0x04, 0xa1, 0x40, 0x03, 0x3e, 0x00, 0x04, 0x33, | ||
| 1294 | 0xc6, 0xe5, 0x8a, 0xc1, 0x8b, 0x7c, 0x96, 0x19, | ||
| 1295 | 0xc9, 0xe1, 0x54, 0x7f, 0x81, 0x9e, 0x59, 0x62, | ||
| 1296 | 0xec, 0xc0, 0x1e, 0xe5, 0x53, 0xd5, 0xae, 0x6b, | ||
| 1297 | 0xd3, 0xe0, 0x09, 0x07, 0xc5, 0x27, 0x81, 0xa6, | ||
| 1298 | 0x8d, 0x39, 0x8e, 0xfe, 0x01, 0xc2, 0x1d, 0xda, | ||
| 1299 | 0xde, 0x7b, 0xdc, 0x76, 0x27, 0x17, 0xf9, 0x6f, | ||
| 1300 | 0xe3, 0x04, 0xef, 0x5d, 0x65, 0x75, 0x98, 0x7f, | ||
| 1301 | 0x2d, 0xd0, 0x68, | ||
| 1302 | }, | ||
| 1303 | .hex = "0433C6E58AC18B7C" | ||
| 1304 | "9619C9E1547F819E" | ||
| 1305 | "5962ECC01EE553D5" | ||
| 1306 | "AE6BD3E00907C527" | ||
| 1307 | "81A68D398EFE01C2" | ||
| 1308 | "1DDADE7BDC762717" | ||
| 1309 | "F96FE304EF5D6575" | ||
| 1310 | "987F2DD068", | ||
| 1311 | .oct_len = 61, | ||
| 1312 | .oct = { | ||
| 1313 | 0x04, 0x33, 0xc6, 0xe5, 0x8a, 0xc1, 0x8b, 0x7c, | ||
| 1314 | 0x96, 0x19, 0xc9, 0xe1, 0x54, 0x7f, 0x81, 0x9e, | ||
| 1315 | 0x59, 0x62, 0xec, 0xc0, 0x1e, 0xe5, 0x53, 0xd5, | ||
| 1316 | 0xae, 0x6b, 0xd3, 0xe0, 0x09, 0x07, 0xc5, 0x27, | ||
| 1317 | 0x81, 0xa6, 0x8d, 0x39, 0x8e, 0xfe, 0x01, 0xc2, | ||
| 1318 | 0x1d, 0xda, 0xde, 0x7b, 0xdc, 0x76, 0x27, 0x17, | ||
| 1319 | 0xf9, 0x6f, 0xe3, 0x04, 0xef, 0x5d, 0x65, 0x75, | ||
| 1320 | 0x98, 0x7f, 0x2d, 0xd0, 0x68, | ||
| 1321 | }, | ||
| 1322 | }, | ||
| 1323 | { | ||
| 1324 | .name = "prime239v2", | ||
| 1325 | .der_len = 115, | ||
| 1326 | .der = { | ||
| 1327 | 0x30, 0x71, 0x02, 0x01, 0x01, 0x04, 0x1e, 0x30, | ||
| 1328 | 0x2f, 0x01, 0x10, 0xe9, 0x09, 0x15, 0xdd, 0xe3, | ||
| 1329 | 0xdd, 0xae, 0xcb, 0x9d, 0x3a, 0x58, 0x92, 0x02, | ||
| 1330 | 0x1e, 0x6e, 0x02, 0x57, 0xa8, 0x36, 0x0b, 0x20, | ||
| 1331 | 0x0b, 0x7e, 0xf4, 0xad, 0x0b, 0xa0, 0x0a, 0x06, | ||
| 1332 | 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, | ||
| 1333 | 0x05, 0xa1, 0x40, 0x03, 0x3e, 0x00, 0x04, 0x3c, | ||
| 1334 | 0x10, 0x27, 0x7b, 0xac, 0xdf, 0x86, 0xc9, 0x4f, | ||
| 1335 | 0xf8, 0x39, 0x87, 0x02, 0x39, 0xaf, 0x41, 0xbc, | ||
| 1336 | 0x4b, 0x67, 0xd8, 0x5e, 0x04, 0x96, 0x84, 0xb5, | ||
| 1337 | 0x60, 0x50, 0x48, 0x6a, 0x20, 0x1d, 0x2b, 0x7e, | ||
| 1338 | 0x9f, 0xaf, 0xf8, 0x8e, 0x7e, 0xa4, 0xcd, 0x00, | ||
| 1339 | 0xad, 0xb1, 0xad, 0x22, 0x69, 0x32, 0x10, 0x6c, | ||
| 1340 | 0xe0, 0xcc, 0xdd, 0x45, 0xd8, 0xa6, 0x29, 0x2f, | ||
| 1341 | 0xad, 0x6b, 0xf9, | ||
| 1342 | }, | ||
| 1343 | .hex = "043C10277BACDF86" | ||
| 1344 | "C94FF839870239AF" | ||
| 1345 | "41BC4B67D85E0496" | ||
| 1346 | "84B56050486A201D" | ||
| 1347 | "2B7E9FAFF88E7EA4" | ||
| 1348 | "CD00ADB1AD226932" | ||
| 1349 | "106CE0CCDD45D8A6" | ||
| 1350 | "292FAD6BF9", | ||
| 1351 | .oct_len = 61, | ||
| 1352 | .oct = { | ||
| 1353 | 0x04, 0x3c, 0x10, 0x27, 0x7b, 0xac, 0xdf, 0x86, | ||
| 1354 | 0xc9, 0x4f, 0xf8, 0x39, 0x87, 0x02, 0x39, 0xaf, | ||
| 1355 | 0x41, 0xbc, 0x4b, 0x67, 0xd8, 0x5e, 0x04, 0x96, | ||
| 1356 | 0x84, 0xb5, 0x60, 0x50, 0x48, 0x6a, 0x20, 0x1d, | ||
| 1357 | 0x2b, 0x7e, 0x9f, 0xaf, 0xf8, 0x8e, 0x7e, 0xa4, | ||
| 1358 | 0xcd, 0x00, 0xad, 0xb1, 0xad, 0x22, 0x69, 0x32, | ||
| 1359 | 0x10, 0x6c, 0xe0, 0xcc, 0xdd, 0x45, 0xd8, 0xa6, | ||
| 1360 | 0x29, 0x2f, 0xad, 0x6b, 0xf9, | ||
| 1361 | }, | ||
| 1362 | }, | ||
| 1363 | { | ||
| 1364 | .name = "prime239v3", | ||
| 1365 | .der_len = 115, | ||
| 1366 | .der = { | ||
| 1367 | 0x30, 0x71, 0x02, 0x01, 0x01, 0x04, 0x1e, 0x26, | ||
| 1368 | 0x3f, 0x23, 0x4c, 0xe7, 0xbd, 0xa8, 0xe4, 0xfe, | ||
| 1369 | 0x7c, 0xf6, 0x18, 0x6a, 0xb2, 0xa6, 0x39, 0x15, | ||
| 1370 | 0x6d, 0x72, 0xe8, 0x9e, 0x3f, 0x0f, 0x10, 0x1e, | ||
| 1371 | 0xe5, 0xdf, 0xac, 0xe8, 0x2f, 0xa0, 0x0a, 0x06, | ||
| 1372 | 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, | ||
| 1373 | 0x06, 0xa1, 0x40, 0x03, 0x3e, 0x00, 0x04, 0x37, | ||
| 1374 | 0xba, 0x07, 0x7f, 0xd9, 0x46, 0x5a, 0x33, 0x03, | ||
| 1375 | 0x31, 0x77, 0x38, 0xef, 0xee, 0xcc, 0x3d, 0xe1, | ||
| 1376 | 0xaa, 0x57, 0xe3, 0x8d, 0xb7, 0xcd, 0xe3, 0x01, | ||
| 1377 | 0xf4, 0xd6, 0x75, 0x49, 0x72, 0x61, 0x4c, 0xbf, | ||
| 1378 | 0xc0, 0x1f, 0x8b, 0x5f, 0x98, 0x9b, 0xa7, 0xe5, | ||
| 1379 | 0x6a, 0xb7, 0xfe, 0x63, 0xdb, 0xb0, 0x40, 0xcb, | ||
| 1380 | 0x26, 0x81, 0x2a, 0x91, 0x14, 0x0f, 0xc7, 0x31, | ||
| 1381 | 0x13, 0x78, 0x16, | ||
| 1382 | }, | ||
| 1383 | .hex = "0437BA077FD9465A" | ||
| 1384 | "3303317738EFEECC" | ||
| 1385 | "3DE1AA57E38DB7CD" | ||
| 1386 | "E301F4D675497261" | ||
| 1387 | "4CBFC01F8B5F989B" | ||
| 1388 | "A7E56AB7FE63DBB0" | ||
| 1389 | "40CB26812A91140F" | ||
| 1390 | "C731137816", | ||
| 1391 | .oct_len = 61, | ||
| 1392 | .oct = { | ||
| 1393 | 0x04, 0x37, 0xba, 0x07, 0x7f, 0xd9, 0x46, 0x5a, | ||
| 1394 | 0x33, 0x03, 0x31, 0x77, 0x38, 0xef, 0xee, 0xcc, | ||
| 1395 | 0x3d, 0xe1, 0xaa, 0x57, 0xe3, 0x8d, 0xb7, 0xcd, | ||
| 1396 | 0xe3, 0x01, 0xf4, 0xd6, 0x75, 0x49, 0x72, 0x61, | ||
| 1397 | 0x4c, 0xbf, 0xc0, 0x1f, 0x8b, 0x5f, 0x98, 0x9b, | ||
| 1398 | 0xa7, 0xe5, 0x6a, 0xb7, 0xfe, 0x63, 0xdb, 0xb0, | ||
| 1399 | 0x40, 0xcb, 0x26, 0x81, 0x2a, 0x91, 0x14, 0x0f, | ||
| 1400 | 0xc7, 0x31, 0x13, 0x78, 0x16, | ||
| 1401 | }, | ||
| 1402 | }, | ||
| 1403 | { | ||
| 1404 | .name = "prime256v1", | 1424 | .name = "prime256v1", |
| 1405 | .der_len = 121, | 1425 | .der_len = 121, |
| 1406 | .der = { | 1426 | .der = { |
| @@ -2468,6 +2488,197 @@ ec_group_check_private_keys(void) | |||
| 2468 | return failed; | 2488 | return failed; |
| 2469 | } | 2489 | } |
| 2470 | 2490 | ||
| 2491 | static void | ||
| 2492 | ec_group_sha1_bignum(BIGNUM *out, const BIGNUM *in) | ||
| 2493 | { | ||
| 2494 | char md[SHA_DIGEST_LENGTH]; | ||
| 2495 | unsigned char *bin; | ||
| 2496 | size_t bin_len; | ||
| 2497 | |||
| 2498 | if (BN_num_bytes(in) <= 0) | ||
| 2499 | errx(1, "%s: invalid bignum", __func__); | ||
| 2500 | |||
| 2501 | bin_len = BN_num_bytes(in); | ||
| 2502 | if ((bin = calloc(1, bin_len)) == NULL) | ||
| 2503 | err(1, "calloc"); | ||
| 2504 | if (BN_bn2bin(in, bin) <= 0) | ||
| 2505 | errx(1, "BN_bn2bin"); | ||
| 2506 | |||
| 2507 | SHA1(bin, bin_len, md); | ||
| 2508 | free(bin); | ||
| 2509 | |||
| 2510 | if (BN_bin2bn(md, sizeof(md), out) == NULL) | ||
| 2511 | errx(1, "BN_bin2bn"); | ||
| 2512 | } | ||
| 2513 | |||
| 2514 | static int | ||
| 2515 | ec_group_check_seed(const EC_builtin_curve *curve, BN_CTX *ctx) | ||
| 2516 | { | ||
| 2517 | EC_GROUP *group = NULL; | ||
| 2518 | BIGNUM *p, *a, *b, *pow2, *r, *seed_bn, *w; | ||
| 2519 | const unsigned char *seed; | ||
| 2520 | size_t seed_len; | ||
| 2521 | int i, g, h, s, t; | ||
| 2522 | int failed = 1; | ||
| 2523 | |||
| 2524 | if ((group = EC_GROUP_new_by_curve_name(curve->nid)) == NULL) | ||
| 2525 | errx(1, "EC_GROUP_new_by_curve_name"); | ||
| 2526 | |||
| 2527 | BN_CTX_start(ctx); | ||
| 2528 | |||
| 2529 | if ((p = BN_CTX_get(ctx)) == NULL) | ||
| 2530 | errx(1, "p = BN_CTX_get()"); | ||
| 2531 | if ((a = BN_CTX_get(ctx)) == NULL) | ||
| 2532 | errx(1, "a = BN_CTX_get()"); | ||
| 2533 | if ((b = BN_CTX_get(ctx)) == NULL) | ||
| 2534 | errx(1, "b = BN_CTX_get()"); | ||
| 2535 | if ((r = BN_CTX_get(ctx)) == NULL) | ||
| 2536 | errx(1, "r = BN_CTX_get()"); | ||
| 2537 | if ((pow2 = BN_CTX_get(ctx)) == NULL) | ||
| 2538 | errx(1, "pow2 = BN_CTX_get()"); | ||
| 2539 | if ((seed_bn = BN_CTX_get(ctx)) == NULL) | ||
| 2540 | errx(1, "seed_bn = BN_CTX_get()"); | ||
| 2541 | if ((w = BN_CTX_get(ctx)) == NULL) | ||
| 2542 | errx(1, "w = BN_CTX_get()"); | ||
| 2543 | |||
| 2544 | /* | ||
| 2545 | * If the curve has a seed, verify that its parameters a and b have | ||
| 2546 | * been selected using that seed, loosely following X9.62, F.3.4.b. | ||
| 2547 | * Otherwise there's nothing to do. | ||
| 2548 | */ | ||
| 2549 | if ((seed = EC_GROUP_get0_seed(group)) == NULL) | ||
| 2550 | goto done; | ||
| 2551 | seed_len = EC_GROUP_get_seed_len(group); | ||
| 2552 | |||
| 2553 | /* | ||
| 2554 | * This isn't a requirement but happens to be the case for NIST | ||
| 2555 | * curves - the only built-in curves that have a seed. | ||
| 2556 | */ | ||
| 2557 | if (seed_len != SHA_DIGEST_LENGTH) { | ||
| 2558 | fprintf(stderr, "%s FAIL: unexpected seed length. " | ||
| 2559 | "want %d, got %zu\n", __func__, SHA_DIGEST_LENGTH, seed_len); | ||
| 2560 | goto err; | ||
| 2561 | } | ||
| 2562 | |||
| 2563 | /* Seed length in bits, per F.3.3.b. */ | ||
| 2564 | g = 8 * seed_len; | ||
| 2565 | |||
| 2566 | /* | ||
| 2567 | * Prepare to build the verifiably random element r of GFp by | ||
| 2568 | * concatenating the SHA-1 of modifications of the seed as a number. | ||
| 2569 | */ | ||
| 2570 | if (BN_bin2bn(seed, seed_len, seed_bn) == NULL) | ||
| 2571 | errx(1, "BN_bin2bn"); | ||
| 2572 | |||
| 2573 | if (!EC_GROUP_get_curve(group, p, a, b, ctx)) | ||
| 2574 | errx(1, "EC_GROUP_get_curve"); | ||
| 2575 | |||
| 2576 | t = BN_num_bits(p); /* bit length needed. */ | ||
| 2577 | s = (t - 1) / 160; /* number of SHA-1 fitting in bit length. */ | ||
| 2578 | h = t - 160 * s; /* remaining number of bits in r. */ | ||
| 2579 | |||
| 2580 | /* | ||
| 2581 | * Steps 1 - 3: compute hash of the seed and take h - 1 rightmost bits. | ||
| 2582 | */ | ||
| 2583 | |||
| 2584 | ec_group_sha1_bignum(r, seed_bn); | ||
| 2585 | BN_zero(pow2); | ||
| 2586 | if (!BN_set_bit(pow2, h - 1)) | ||
| 2587 | errx(1, "BN_set_bit"); | ||
| 2588 | if (!BN_mod(r, r, pow2, ctx)) | ||
| 2589 | errx(1, "BN_nnmod"); | ||
| 2590 | |||
| 2591 | /* | ||
| 2592 | * Steps 4 - 6: for i from 1 to s do Wi = SHA-1(SEED + i mod 2^g). | ||
| 2593 | * With W0 = r as already computed, let r = W0 || W1 || ... || Ws. | ||
| 2594 | */ | ||
| 2595 | |||
| 2596 | BN_zero(pow2); | ||
| 2597 | if (!BN_set_bit(pow2, g)) | ||
| 2598 | errx(1, "BN_set_bit"); | ||
| 2599 | |||
| 2600 | for (i = 0; i < s; i++) { | ||
| 2601 | /* | ||
| 2602 | * This is a bit silly since the seed isn't going to have all | ||
| 2603 | * its bits set, so BN_add_word(seed_bn, 1) would do, but for | ||
| 2604 | * the sake of correctness... | ||
| 2605 | */ | ||
| 2606 | if (!BN_mod_add(seed_bn, seed_bn, BN_value_one(), pow2, ctx)) | ||
| 2607 | errx(1, "BN_mod_add"); | ||
| 2608 | |||
| 2609 | ec_group_sha1_bignum(w, seed_bn); | ||
| 2610 | |||
| 2611 | if (!BN_lshift(r, r, 8 * SHA_DIGEST_LENGTH)) | ||
| 2612 | errx(1, "BN_lshift"); | ||
| 2613 | if (!BN_add(r, r, w)) | ||
| 2614 | errx(1, "BN_add"); | ||
| 2615 | } | ||
| 2616 | |||
| 2617 | /* | ||
| 2618 | * Step 7: check that r * b^2 == a^3 (mod p) | ||
| 2619 | */ | ||
| 2620 | |||
| 2621 | /* Compute r = r * b^2 (mod p). */ | ||
| 2622 | if (!BN_mod_sqr(b, b, p, ctx)) | ||
| 2623 | errx(1, "BN_mod_sqr"); | ||
| 2624 | if (!BN_mod_mul(r, r, b, p, ctx)) | ||
| 2625 | errx(1, "BN_mod_mul"); | ||
| 2626 | |||
| 2627 | /* Compute a = a^3 (mod p). */ | ||
| 2628 | if (!BN_mod_sqr(b, a, p, ctx)) | ||
| 2629 | errx(1, "BN_mod_sqr"); | ||
| 2630 | if (!BN_mod_mul(a, a, b, p, ctx)) | ||
| 2631 | errx(1, "BN_mod_mul"); | ||
| 2632 | |||
| 2633 | /* | ||
| 2634 | * XXX - this assumes that a, b, p >= 0, so the results are in [0, p). | ||
| 2635 | * This is currently enforced in the EC code. | ||
| 2636 | */ | ||
| 2637 | if (BN_cmp(r, a) != 0) { | ||
| 2638 | fprintf(stderr, "FAIL: %s verification failed for %s\nr * b^2:\t", | ||
| 2639 | __func__, curve->comment); | ||
| 2640 | BN_print_fp(stderr, r); | ||
| 2641 | fprintf(stderr, "\na^3:\t\t"); | ||
| 2642 | BN_print_fp(stderr, a); | ||
| 2643 | fprintf(stderr, "\n"); | ||
| 2644 | goto err; | ||
| 2645 | } | ||
| 2646 | |||
| 2647 | done: | ||
| 2648 | failed = 0; | ||
| 2649 | |||
| 2650 | err: | ||
| 2651 | BN_CTX_end(ctx); | ||
| 2652 | EC_GROUP_free(group); | ||
| 2653 | |||
| 2654 | return failed; | ||
| 2655 | } | ||
| 2656 | |||
| 2657 | static int | ||
| 2658 | ec_group_check_seeds(void) | ||
| 2659 | { | ||
| 2660 | BN_CTX *ctx = NULL; | ||
| 2661 | EC_builtin_curve *all_curves = NULL; | ||
| 2662 | size_t curve_id, ncurves; | ||
| 2663 | int failed = 0; | ||
| 2664 | |||
| 2665 | if ((ctx = BN_CTX_new()) == NULL) | ||
| 2666 | errx(1, "BN_CTX_new"); | ||
| 2667 | |||
| 2668 | ncurves = EC_get_builtin_curves(NULL, 0); | ||
| 2669 | if ((all_curves = calloc(ncurves, sizeof(*all_curves))) == NULL) | ||
| 2670 | err(1, "calloc builtin curves"); | ||
| 2671 | EC_get_builtin_curves(all_curves, ncurves); | ||
| 2672 | |||
| 2673 | for (curve_id = 0; curve_id < ncurves; curve_id++) | ||
| 2674 | failed |= ec_group_check_seed(&all_curves[curve_id], ctx); | ||
| 2675 | |||
| 2676 | free(all_curves); | ||
| 2677 | BN_CTX_free(ctx); | ||
| 2678 | |||
| 2679 | return failed; | ||
| 2680 | } | ||
| 2681 | |||
| 2471 | int | 2682 | int |
| 2472 | main(int argc, char **argv) | 2683 | main(int argc, char **argv) |
| 2473 | { | 2684 | { |
| @@ -2478,7 +2689,9 @@ main(int argc, char **argv) | |||
| 2478 | failed |= ec_group_pkparameters_correct_padding_test(); | 2689 | failed |= ec_group_pkparameters_correct_padding_test(); |
| 2479 | failed |= ec_group_roundtrip_builtin_curves(); | 2690 | failed |= ec_group_roundtrip_builtin_curves(); |
| 2480 | failed |= ec_group_non_builtin_curves(); | 2691 | failed |= ec_group_non_builtin_curves(); |
| 2692 | failed |= ec_group_builtin_curves_have_prime_order(); | ||
| 2481 | failed |= ec_group_check_private_keys(); | 2693 | failed |= ec_group_check_private_keys(); |
| 2694 | failed |= ec_group_check_seeds(); | ||
| 2482 | 2695 | ||
| 2483 | return failed; | 2696 | return failed; |
| 2484 | } | 2697 | } |
diff --git a/src/regress/lib/libcrypto/ec/ectest.c b/src/regress/lib/libcrypto/ec/ectest.c index fc44f9c886..3e81954174 100644 --- a/src/regress/lib/libcrypto/ec/ectest.c +++ b/src/regress/lib/libcrypto/ec/ectest.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ectest.c,v 1.35 2025/01/24 11:49:13 tb Exp $ */ | 1 | /* $OpenBSD: ectest.c,v 1.36 2025/07/23 07:40:07 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -71,14 +71,11 @@ | |||
| 71 | 71 | ||
| 72 | #include <stdio.h> | 72 | #include <stdio.h> |
| 73 | #include <stdlib.h> | 73 | #include <stdlib.h> |
| 74 | #include <string.h> | ||
| 75 | #include <time.h> | ||
| 76 | 74 | ||
| 75 | #include <openssl/bn.h> | ||
| 76 | #include <openssl/crypto.h> | ||
| 77 | #include <openssl/ec.h> | 77 | #include <openssl/ec.h> |
| 78 | #include <openssl/err.h> | 78 | #include <openssl/err.h> |
| 79 | #include <openssl/obj_mac.h> | ||
| 80 | #include <openssl/objects.h> | ||
| 81 | #include <openssl/bn.h> | ||
| 82 | #include <openssl/opensslconf.h> | 79 | #include <openssl/opensslconf.h> |
| 83 | 80 | ||
| 84 | #define ABORT do { \ | 81 | #define ABORT do { \ |
diff --git a/src/regress/lib/libcrypto/evp/evp_pkey_cleanup.c b/src/regress/lib/libcrypto/evp/evp_pkey_cleanup.c index d4825f68e8..1d2fa60be7 100644 --- a/src/regress/lib/libcrypto/evp/evp_pkey_cleanup.c +++ b/src/regress/lib/libcrypto/evp/evp_pkey_cleanup.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: evp_pkey_cleanup.c,v 1.5 2024/02/29 20:02:00 tb Exp $ */ | 1 | /* $OpenBSD: evp_pkey_cleanup.c,v 1.6 2025/05/21 03:53:20 kenjiro Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> |
| @@ -38,6 +38,8 @@ int pkey_ids[] = { | |||
| 38 | EVP_PKEY_RSA, | 38 | EVP_PKEY_RSA, |
| 39 | EVP_PKEY_RSA_PSS, | 39 | EVP_PKEY_RSA_PSS, |
| 40 | EVP_PKEY_X25519, | 40 | EVP_PKEY_X25519, |
| 41 | EVP_PKEY_HKDF, | ||
| 42 | EVP_PKEY_TLS1_PRF, | ||
| 41 | }; | 43 | }; |
| 42 | 44 | ||
| 43 | static const size_t N_PKEY_IDS = sizeof(pkey_ids) / sizeof(pkey_ids[0]); | 45 | static const size_t N_PKEY_IDS = sizeof(pkey_ids) / sizeof(pkey_ids[0]); |
diff --git a/src/regress/lib/libcrypto/evp/evp_test.c b/src/regress/lib/libcrypto/evp/evp_test.c index a699832c45..0bd8b4d092 100644 --- a/src/regress/lib/libcrypto/evp/evp_test.c +++ b/src/regress/lib/libcrypto/evp/evp_test.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: evp_test.c,v 1.20 2024/07/09 17:24:12 tb Exp $ */ | 1 | /* $OpenBSD: evp_test.c,v 1.21 2025/05/22 00:13:47 kenjiro Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2017, 2022 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2017, 2022 Joel Sing <jsing@openbsd.org> |
| 4 | * Copyright (c) 2023, 2024 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2023, 2024 Theo Buehler <tb@openbsd.org> |
| @@ -802,6 +802,85 @@ kdf_compare_bytes(const char *label, const unsigned char *d1, int len1, | |||
| 802 | } | 802 | } |
| 803 | 803 | ||
| 804 | static int | 804 | static int |
| 805 | evp_kdf_hkdf_basic(void) | ||
| 806 | { | ||
| 807 | EVP_PKEY_CTX *pctx; | ||
| 808 | unsigned char out[42]; | ||
| 809 | size_t outlen = sizeof(out); | ||
| 810 | int failed = 1; | ||
| 811 | |||
| 812 | /* Test vector from RFC 5869, Appendix A.1. */ | ||
| 813 | const unsigned char ikm[] = { | ||
| 814 | 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, | ||
| 815 | 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, | ||
| 816 | 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, | ||
| 817 | 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, | ||
| 818 | 0x0b, 0x0b, | ||
| 819 | }; | ||
| 820 | const unsigned char salt[] = { | ||
| 821 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, | ||
| 822 | 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, | ||
| 823 | 0x0c, | ||
| 824 | }; | ||
| 825 | const unsigned char info[] = { | ||
| 826 | 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, | ||
| 827 | 0xf6, 0xf7, 0xf8, 0xf9, | ||
| 828 | }; | ||
| 829 | const unsigned char expected[42] = { | ||
| 830 | 0x3c, 0xb2, 0x5f, 0x25, 0xfa, 0xac, 0xd5, 0x7a, | ||
| 831 | 0x90, 0x43, 0x4f, 0x64, 0xd0, 0x36, 0x2f, 0x2a, | ||
| 832 | 0x2d, 0x2d, 0x0a, 0x90, 0xcf, 0x1a, 0x5a, 0x4c, | ||
| 833 | 0x5d, 0xb0, 0x2d, 0x56, 0xec, 0xc4, 0xc5, 0xbf, | ||
| 834 | 0x34, 0x00, 0x72, 0x08, 0xd5, 0xb8, 0x87, 0x18, | ||
| 835 | 0x58, 0x65, | ||
| 836 | }; | ||
| 837 | |||
| 838 | if ((pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, NULL)) == NULL) { | ||
| 839 | fprintf(stderr, "FAIL: EVP_PKEY_CTX_new_id\n"); | ||
| 840 | goto err; | ||
| 841 | } | ||
| 842 | |||
| 843 | if (EVP_PKEY_derive_init(pctx) <= 0) { | ||
| 844 | fprintf(stderr, "FAIL: EVP_PKEY_derive_init\n"); | ||
| 845 | goto err; | ||
| 846 | } | ||
| 847 | |||
| 848 | if (EVP_PKEY_CTX_set_hkdf_md(pctx, EVP_sha256()) <= 0) { | ||
| 849 | fprintf(stderr, "FAIL: EVP_PKEY_CTX_set_hkdf_md\n"); | ||
| 850 | goto err; | ||
| 851 | } | ||
| 852 | |||
| 853 | if (EVP_PKEY_CTX_set1_hkdf_salt(pctx, salt, sizeof(salt)) <= 0) { | ||
| 854 | fprintf(stderr, "FAIL: EVP_PKEY_CTX_set1_hkdf_salt\n"); | ||
| 855 | goto err; | ||
| 856 | } | ||
| 857 | |||
| 858 | if (EVP_PKEY_CTX_set1_hkdf_key(pctx, ikm, sizeof(ikm)) <= 0) { | ||
| 859 | fprintf(stderr, "FAIL: EVP_PKEY_CTX_set1_hkdf_key\n"); | ||
| 860 | goto err; | ||
| 861 | } | ||
| 862 | |||
| 863 | if (EVP_PKEY_CTX_add1_hkdf_info(pctx, info, sizeof(info)) <= 0) { | ||
| 864 | fprintf(stderr, "FAIL: EVP_PKEY_CTX_add1_hkdf_info\n"); | ||
| 865 | goto err; | ||
| 866 | } | ||
| 867 | |||
| 868 | if (EVP_PKEY_derive(pctx, out, &outlen) <= 0) { | ||
| 869 | fprintf(stderr, "FAIL: EVP_PKEY_derive\n"); | ||
| 870 | goto err; | ||
| 871 | } | ||
| 872 | |||
| 873 | if (!kdf_compare_bytes("HKDF test", out, outlen, expected, sizeof(expected))) | ||
| 874 | goto err; | ||
| 875 | |||
| 876 | failed = 0; | ||
| 877 | |||
| 878 | err: | ||
| 879 | EVP_PKEY_CTX_free(pctx); | ||
| 880 | return failed; | ||
| 881 | } | ||
| 882 | |||
| 883 | static int | ||
| 805 | evp_kdf_tls1_prf_basic(void) | 884 | evp_kdf_tls1_prf_basic(void) |
| 806 | { | 885 | { |
| 807 | EVP_PKEY_CTX *pctx; | 886 | EVP_PKEY_CTX *pctx; |
| @@ -1038,6 +1117,7 @@ main(int argc, char **argv) | |||
| 1038 | failed |= obj_name_do_all_test(); | 1117 | failed |= obj_name_do_all_test(); |
| 1039 | failed |= evp_get_cipherbyname_test(); | 1118 | failed |= evp_get_cipherbyname_test(); |
| 1040 | failed |= evp_get_digestbyname_test(); | 1119 | failed |= evp_get_digestbyname_test(); |
| 1120 | failed |= evp_kdf_hkdf_basic(); | ||
| 1041 | failed |= evp_kdf_tls1_prf_basic(); | 1121 | failed |= evp_kdf_tls1_prf_basic(); |
| 1042 | failed |= evp_kdf_tls1_prf(); | 1122 | failed |= evp_kdf_tls1_prf(); |
| 1043 | 1123 | ||
diff --git a/src/regress/lib/libcrypto/free/Makefile b/src/regress/lib/libcrypto/free/Makefile index 21516f1172..9171393c0f 100644 --- a/src/regress/lib/libcrypto/free/Makefile +++ b/src/regress/lib/libcrypto/free/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.5 2023/04/15 14:10:09 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.6 2025/08/25 06:08:33 tb Exp $ |
| 2 | 2 | ||
| 3 | TESTS = \ | 3 | TESTS = \ |
| 4 | freenull | 4 | freenull |
| @@ -10,9 +10,11 @@ REGRESS_TARGETS= all_tests | |||
| 10 | LDADD= -lcrypto | 10 | LDADD= -lcrypto |
| 11 | DPADD= ${LIBCRYPTO} | 11 | DPADD= ${LIBCRYPTO} |
| 12 | 12 | ||
| 13 | CFLAGS+= -Wall -Werror | ||
| 14 | |||
| 13 | CLEANFILES+= freenull.c freenull.c.body freenull.c.tmp | 15 | CLEANFILES+= freenull.c freenull.c.body freenull.c.tmp |
| 14 | 16 | ||
| 15 | freenull.c: freenull.awk ../../../../lib/libcrypto/Symbols.list | 17 | freenull.c: freenull.awk freenull.c.head freenull.c.tail ../../../../lib/libcrypto/Symbols.list |
| 16 | awk -f ${.CURDIR}/freenull.awk \ | 18 | awk -f ${.CURDIR}/freenull.awk \ |
| 17 | < ${BSDSRCDIR}/lib/libcrypto/Symbols.list > freenull.c.body | 19 | < ${BSDSRCDIR}/lib/libcrypto/Symbols.list > freenull.c.body |
| 18 | cat ${.CURDIR}/freenull.c.head freenull.c.body \ | 20 | cat ${.CURDIR}/freenull.c.head freenull.c.body \ |
diff --git a/src/regress/lib/libcrypto/free/freenull.c.head b/src/regress/lib/libcrypto/free/freenull.c.head index db652bfb01..747f174a4c 100644 --- a/src/regress/lib/libcrypto/free/freenull.c.head +++ b/src/regress/lib/libcrypto/free/freenull.c.head | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: freenull.c.head,v 1.10 2024/08/30 05:00:38 tb Exp $ */ | 1 | /* $OpenBSD: freenull.c.head,v 1.11 2025/08/25 06:01:33 tb Exp $ */ |
| 2 | 2 | ||
| 3 | #include <openssl/asn1.h> | 3 | #include <openssl/asn1.h> |
| 4 | #include <openssl/cmac.h> | 4 | #include <openssl/cmac.h> |
| @@ -10,6 +10,7 @@ | |||
| 10 | #include <openssl/gost.h> | 10 | #include <openssl/gost.h> |
| 11 | #endif | 11 | #endif |
| 12 | #include <openssl/hmac.h> | 12 | #include <openssl/hmac.h> |
| 13 | #include <openssl/mlkem.h> | ||
| 13 | #include <openssl/ocsp.h> | 14 | #include <openssl/ocsp.h> |
| 14 | #include <openssl/pkcs12.h> | 15 | #include <openssl/pkcs12.h> |
| 15 | #include <openssl/ts.h> | 16 | #include <openssl/ts.h> |
diff --git a/src/regress/lib/libcrypto/gcm128/gcm128test.c b/src/regress/lib/libcrypto/gcm128/gcm128test.c index def7653c7b..78631979fe 100644 --- a/src/regress/lib/libcrypto/gcm128/gcm128test.c +++ b/src/regress/lib/libcrypto/gcm128/gcm128test.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: gcm128test.c,v 1.7 2022/09/05 21:06:31 tb Exp $ */ | 1 | /* $OpenBSD: gcm128test.c,v 1.8 2025/05/16 14:03:49 jsing Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 2010 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2010 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -57,11 +57,6 @@ | |||
| 57 | #include <openssl/aes.h> | 57 | #include <openssl/aes.h> |
| 58 | #include <openssl/modes.h> | 58 | #include <openssl/modes.h> |
| 59 | 59 | ||
| 60 | /* XXX - something like this should be in the public headers. */ | ||
| 61 | struct gcm128_context { | ||
| 62 | uint64_t opaque[64]; | ||
| 63 | }; | ||
| 64 | |||
| 65 | struct gcm128_test { | 60 | struct gcm128_test { |
| 66 | const uint8_t K[128]; | 61 | const uint8_t K[128]; |
| 67 | size_t K_len; | 62 | size_t K_len; |
| @@ -856,7 +851,7 @@ struct gcm128_test gcm128_tests[] = { | |||
| 856 | static int | 851 | static int |
| 857 | do_gcm128_test(int test_no, struct gcm128_test *tv) | 852 | do_gcm128_test(int test_no, struct gcm128_test *tv) |
| 858 | { | 853 | { |
| 859 | GCM128_CONTEXT ctx; | 854 | GCM128_CONTEXT *ctx; |
| 860 | AES_KEY key; | 855 | AES_KEY key; |
| 861 | uint8_t *out = NULL; | 856 | uint8_t *out = NULL; |
| 862 | size_t out_len; | 857 | size_t out_len; |
| @@ -873,13 +868,16 @@ do_gcm128_test(int test_no, struct gcm128_test *tv) | |||
| 873 | 868 | ||
| 874 | if (out_len != 0) | 869 | if (out_len != 0) |
| 875 | memset(out, 0, out_len); | 870 | memset(out, 0, out_len); |
| 876 | CRYPTO_gcm128_init(&ctx, &key, (block128_f)AES_encrypt); | 871 | |
| 877 | CRYPTO_gcm128_setiv(&ctx, tv->IV, tv->IV_len); | 872 | if ((ctx = CRYPTO_gcm128_new(&key, (block128_f)AES_encrypt)) == NULL) |
| 873 | err(1, "CRYPTO_gcm128_new"); | ||
| 874 | |||
| 875 | CRYPTO_gcm128_setiv(ctx, tv->IV, tv->IV_len); | ||
| 878 | if (tv->A_len > 0) | 876 | if (tv->A_len > 0) |
| 879 | CRYPTO_gcm128_aad(&ctx, tv->A, tv->A_len); | 877 | CRYPTO_gcm128_aad(ctx, tv->A, tv->A_len); |
| 880 | if (tv->P_len > 0) | 878 | if (tv->P_len > 0) |
| 881 | CRYPTO_gcm128_encrypt(&ctx, tv->P, out, out_len); | 879 | CRYPTO_gcm128_encrypt(ctx, tv->P, out, out_len); |
| 882 | if (CRYPTO_gcm128_finish(&ctx, tv->T, 16)) { | 880 | if (CRYPTO_gcm128_finish(ctx, tv->T, 16)) { |
| 883 | fprintf(stderr, "TEST %d: CRYPTO_gcm128_finish failed\n", | 881 | fprintf(stderr, "TEST %d: CRYPTO_gcm128_finish failed\n", |
| 884 | test_no); | 882 | test_no); |
| 885 | goto fail; | 883 | goto fail; |
| @@ -891,12 +889,12 @@ do_gcm128_test(int test_no, struct gcm128_test *tv) | |||
| 891 | 889 | ||
| 892 | if (out_len != 0) | 890 | if (out_len != 0) |
| 893 | memset(out, 0, out_len); | 891 | memset(out, 0, out_len); |
| 894 | CRYPTO_gcm128_setiv(&ctx, tv->IV, tv->IV_len); | 892 | CRYPTO_gcm128_setiv(ctx, tv->IV, tv->IV_len); |
| 895 | if (tv->A_len > 0) | 893 | if (tv->A_len > 0) |
| 896 | CRYPTO_gcm128_aad(&ctx, tv->A, tv->A_len); | 894 | CRYPTO_gcm128_aad(ctx, tv->A, tv->A_len); |
| 897 | if (tv->C_len > 0) | 895 | if (tv->C_len > 0) |
| 898 | CRYPTO_gcm128_decrypt(&ctx, tv->C, out, out_len); | 896 | CRYPTO_gcm128_decrypt(ctx, tv->C, out, out_len); |
| 899 | if (CRYPTO_gcm128_finish(&ctx, tv->T, 16)) { | 897 | if (CRYPTO_gcm128_finish(ctx, tv->T, 16)) { |
| 900 | fprintf(stderr, "TEST %d: CRYPTO_gcm128_finish failed\n", | 898 | fprintf(stderr, "TEST %d: CRYPTO_gcm128_finish failed\n", |
| 901 | test_no); | 899 | test_no); |
| 902 | goto fail; | 900 | goto fail; |
| @@ -909,6 +907,8 @@ do_gcm128_test(int test_no, struct gcm128_test *tv) | |||
| 909 | ret = 0; | 907 | ret = 0; |
| 910 | 908 | ||
| 911 | fail: | 909 | fail: |
| 910 | CRYPTO_gcm128_release(ctx); | ||
| 911 | |||
| 912 | free(out); | 912 | free(out); |
| 913 | return (ret); | 913 | return (ret); |
| 914 | } | 914 | } |
diff --git a/src/regress/lib/libcrypto/man/check_complete.pl b/src/regress/lib/libcrypto/man/check_complete.pl index 5f2d12ec73..dbce9b74ec 100755 --- a/src/regress/lib/libcrypto/man/check_complete.pl +++ b/src/regress/lib/libcrypto/man/check_complete.pl | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #!/usr/bin/perl | 1 | #!/usr/bin/perl |
| 2 | # | 2 | # |
| 3 | # Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | # Copyright (c) 2021,2022,2023,2024,2025 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | # | 4 | # |
| 5 | # Permission to use, copy, modify, and distribute this software for any | 5 | # Permission to use, copy, modify, and distribute this software for any |
| 6 | # purpose with or without fee is hereby granted, provided that the above | 6 | # purpose with or without fee is hereby granted, provided that the above |
| @@ -25,10 +25,10 @@ my %internal = ( | |||
| 25 | CHARTYPE_FIRST_ESC_2253 CHARTYPE_LAST_ESC_2253 CHARTYPE_PRINTABLESTRING | 25 | CHARTYPE_FIRST_ESC_2253 CHARTYPE_LAST_ESC_2253 CHARTYPE_PRINTABLESTRING |
| 26 | )], | 26 | )], |
| 27 | bn => [qw( | 27 | bn => [qw( |
| 28 | BN_BITS BN_BITS4 BN_BYTES | 28 | BN_BYTES BN_LLONG BN_ULLONG |
| 29 | BN_DEC_CONV BN_DEC_FMT1 BN_DEC_FMT2 BN_DEC_NUM BN_LLONG BN_LONG | 29 | )], |
| 30 | BN_MASK2 BN_MASK2h BN_MASK2h1 BN_MASK2l | 30 | conf => [qw( |
| 31 | BN_TBIT BN_ULLONG | 31 | conf_st conf_method_st |
| 32 | )], | 32 | )], |
| 33 | evp => [qw( | 33 | evp => [qw( |
| 34 | ASN1_PKEY_CTRL_CMS_ENVELOPE ASN1_PKEY_CTRL_CMS_RI_TYPE | 34 | ASN1_PKEY_CTRL_CMS_ENVELOPE ASN1_PKEY_CTRL_CMS_RI_TYPE |
| @@ -55,7 +55,6 @@ my %obsolete = ( | |||
| 55 | ASN1_dup ASN1_d2i_bio ASN1_d2i_bio_of ASN1_d2i_fp ASN1_d2i_fp_of | 55 | ASN1_dup ASN1_d2i_bio ASN1_d2i_bio_of ASN1_d2i_fp ASN1_d2i_fp_of |
| 56 | ASN1_i2d_bio ASN1_i2d_bio_of ASN1_i2d_bio_of_const | 56 | ASN1_i2d_bio ASN1_i2d_bio_of ASN1_i2d_bio_of_const |
| 57 | ASN1_i2d_fp ASN1_i2d_fp_of ASN1_i2d_fp_of_const | 57 | ASN1_i2d_fp ASN1_i2d_fp_of ASN1_i2d_fp_of_const |
| 58 | ASN1_LONG_UNDEF | ||
| 59 | BIT_STRING_BITNAME | 58 | BIT_STRING_BITNAME |
| 60 | V_ASN1_PRIMATIVE_TAG | 59 | V_ASN1_PRIMATIVE_TAG |
| 61 | X509_algor_st | 60 | X509_algor_st |
| @@ -69,9 +68,6 @@ my %obsolete = ( | |||
| 69 | BIO_set_filter_bio BIO_set_no_connect_return BIO_set_proxies | 68 | BIO_set_filter_bio BIO_set_no_connect_return BIO_set_proxies |
| 70 | BIO_set_proxy_cb BIO_set_proxy_header BIO_set_url | 69 | BIO_set_proxy_cb BIO_set_proxy_header BIO_set_url |
| 71 | )], | 70 | )], |
| 72 | bn => [qw( | ||
| 73 | BN_HEX_FMT1 BN_HEX_FMT2 BN_MASK | ||
| 74 | )], | ||
| 75 | evp => [qw( | 71 | evp => [qw( |
| 76 | EVP_CIPH_FLAG_FIPS EVP_CIPH_FLAG_NON_FIPS_ALLOW | 72 | EVP_CIPH_FLAG_FIPS EVP_CIPH_FLAG_NON_FIPS_ALLOW |
| 77 | EVP_CTRL_AEAD_SET_MAC_KEY EVP_CTRL_AEAD_TLS1_AAD | 73 | EVP_CTRL_AEAD_SET_MAC_KEY EVP_CTRL_AEAD_TLS1_AAD |
| @@ -116,7 +112,7 @@ my %postponed = ( | |||
| 116 | 112 | ||
| 117 | my $MANW = 'man -M /usr/share/man -w'; | 113 | my $MANW = 'man -M /usr/share/man -w'; |
| 118 | my $srcdir = '/usr/src/lib/libcrypto/man'; | 114 | my $srcdir = '/usr/src/lib/libcrypto/man'; |
| 119 | my $hfile = '/usr/include/openssl'; | 115 | my $hfile = '/usr/include'; |
| 120 | 116 | ||
| 121 | my $in_cplusplus = 0; | 117 | my $in_cplusplus = 0; |
| 122 | my $in_comment = 0; | 118 | my $in_comment = 0; |
| @@ -133,6 +129,7 @@ if (defined $ARGV[0] && $ARGV[0] eq '-v') { | |||
| 133 | shift @ARGV; | 129 | shift @ARGV; |
| 134 | } | 130 | } |
| 135 | $#ARGV == 0 or die "usage: $0 [-v] headername"; | 131 | $#ARGV == 0 or die "usage: $0 [-v] headername"; |
| 132 | $hfile .= "/openssl" unless $ARGV[0] eq 'tls'; | ||
| 136 | $hfile .= "/$ARGV[0].h"; | 133 | $hfile .= "/$ARGV[0].h"; |
| 137 | open my $in_fh, '<', $hfile or die "$hfile: $!"; | 134 | open my $in_fh, '<', $hfile or die "$hfile: $!"; |
| 138 | 135 | ||
| @@ -236,6 +233,7 @@ try_again: | |||
| 236 | # Uninteresting lines. | 233 | # Uninteresting lines. |
| 237 | 234 | ||
| 238 | if (/^\s*$/ || | 235 | if (/^\s*$/ || |
| 236 | /^DECLARE_LHASH_OF\(\w+\);$/ || | ||
| 239 | /^DECLARE_STACK_OF\(\w+\)$/ || | 237 | /^DECLARE_STACK_OF\(\w+\)$/ || |
| 240 | /^DECLARE_PKCS12_STACK_OF\(\w+\)$/ || | 238 | /^DECLARE_PKCS12_STACK_OF\(\w+\)$/ || |
| 241 | /^TYPEDEF_D2I2D_OF\(\w+\);$/ || | 239 | /^TYPEDEF_D2I2D_OF\(\w+\);$/ || |
| @@ -288,7 +286,7 @@ try_again: | |||
| 288 | print "D- $line\n" if $verbose; | 286 | print "D- $line\n" if $verbose; |
| 289 | next; | 287 | next; |
| 290 | } | 288 | } |
| 291 | if ($id =~ /^(?:ASN1|BIO|BN|EVP|X509(?:V3)?)_[FR]_\w+$/) { | 289 | if ($id =~ /^(?:ASN1|BIO|BN|CONF|EVP|X509(?:V3)?)_[FR]_\w+$/) { |
| 292 | print "D- $line\n" if $verbose; | 290 | print "D- $line\n" if $verbose; |
| 293 | next; | 291 | next; |
| 294 | } | 292 | } |
diff --git a/src/regress/lib/libcrypto/md/Makefile b/src/regress/lib/libcrypto/md/Makefile index 94bec95e05..1df57283b2 100644 --- a/src/regress/lib/libcrypto/md/Makefile +++ b/src/regress/lib/libcrypto/md/Makefile | |||
| @@ -1,9 +1,15 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.1.1.1 2022/09/02 13:34:48 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.2 2025/05/22 03:24:47 joshua Exp $ |
| 2 | 2 | ||
| 3 | PROG= md_test | 3 | PROG = md_test |
| 4 | LDADD= -lcrypto | 4 | LDADD = -lcrypto |
| 5 | DPADD= ${LIBCRYPTO} | 5 | DPADD = ${LIBCRYPTO} |
| 6 | WARNINGS= Yes | 6 | WARNINGS = Yes |
| 7 | CFLAGS+= -DLIBRESSL_INTERNAL -Werror | 7 | CFLAGS += -DLIBRESSL_INTERNAL -Werror |
| 8 | CFLAGS += -I${.CURDIR}/../test | ||
| 9 | SRCS += md_test.c | ||
| 10 | SRCS += test.c | ||
| 11 | SRCS += test_util.c | ||
| 12 | |||
| 13 | .PATH: ${.CURDIR}/../test | ||
| 8 | 14 | ||
| 9 | .include <bsd.regress.mk> | 15 | .include <bsd.regress.mk> |
diff --git a/src/regress/lib/libcrypto/md/md_test.c b/src/regress/lib/libcrypto/md/md_test.c index 590bb50ee3..752f2e4958 100644 --- a/src/regress/lib/libcrypto/md/md_test.c +++ b/src/regress/lib/libcrypto/md/md_test.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* $OpenBSD: md_test.c,v 1.3 2025/01/19 10:17:39 tb Exp $ */ | 1 | /* $OpenBSD: md_test.c,v 1.4 2025/05/22 03:24:47 joshua Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2022 Joshua Sing <joshua@hypera.dev> | 3 | * Copyright (c) 2022, 2025 Joshua Sing <joshua@joshuasing.dev> |
| 4 | * | 4 | * |
| 5 | * Permission to use, copy, modify, and distribute this software for any | 5 | * Permission to use, copy, modify, and distribute this software for any |
| 6 | * purpose with or without fee is hereby granted, provided that the above | 6 | * purpose with or without fee is hereby granted, provided that the above |
| @@ -22,6 +22,8 @@ | |||
| 22 | #include <stdint.h> | 22 | #include <stdint.h> |
| 23 | #include <string.h> | 23 | #include <string.h> |
| 24 | 24 | ||
| 25 | #include "test.h" | ||
| 26 | |||
| 25 | struct md_test { | 27 | struct md_test { |
| 26 | const int algorithm; | 28 | const int algorithm; |
| 27 | const uint8_t in[128]; | 29 | const uint8_t in[128]; |
| @@ -30,7 +32,7 @@ struct md_test { | |||
| 30 | }; | 32 | }; |
| 31 | 33 | ||
| 32 | static const struct md_test md_tests[] = { | 34 | static const struct md_test md_tests[] = { |
| 33 | /* MD4 (RFC 1320 test vectors) */ | 35 | /* MD4 (RFC 1320 test vectors) */ |
| 34 | { | 36 | { |
| 35 | .algorithm = NID_md4, | 37 | .algorithm = NID_md4, |
| 36 | .in = "", | 38 | .in = "", |
| @@ -99,7 +101,7 @@ static const struct md_test md_tests[] = { | |||
| 99 | } | 101 | } |
| 100 | }, | 102 | }, |
| 101 | 103 | ||
| 102 | /* MD5 (RFC 1321 test vectors) */ | 104 | /* MD5 (RFC 1321 test vectors) */ |
| 103 | { | 105 | { |
| 104 | .algorithm = NID_md5, | 106 | .algorithm = NID_md5, |
| 105 | .in = "", | 107 | .in = "", |
| @@ -175,25 +177,21 @@ typedef unsigned char *(*md_hash_func)(const unsigned char *, size_t, | |||
| 175 | unsigned char *); | 177 | unsigned char *); |
| 176 | 178 | ||
| 177 | static int | 179 | static int |
| 178 | md_hash_from_algorithm(int algorithm, const char **out_label, | 180 | md_hash_from_algorithm(int algorithm, md_hash_func *out_func, |
| 179 | md_hash_func *out_func, const EVP_MD **out_md, size_t *out_len) | 181 | const EVP_MD **out_md, size_t *out_len) |
| 180 | { | 182 | { |
| 181 | switch (algorithm) { | 183 | switch (algorithm) { |
| 182 | case NID_md4: | 184 | case NID_md4: |
| 183 | *out_label = SN_md4; | ||
| 184 | *out_func = MD4; | 185 | *out_func = MD4; |
| 185 | *out_md = EVP_md4(); | 186 | *out_md = EVP_md4(); |
| 186 | *out_len = MD4_DIGEST_LENGTH; | 187 | *out_len = MD4_DIGEST_LENGTH; |
| 187 | break; | 188 | break; |
| 188 | case NID_md5: | 189 | case NID_md5: |
| 189 | *out_label = SN_md5; | ||
| 190 | *out_func = MD5; | 190 | *out_func = MD5; |
| 191 | *out_md = EVP_md5(); | 191 | *out_md = EVP_md5(); |
| 192 | *out_len = MD5_DIGEST_LENGTH; | 192 | *out_len = MD5_DIGEST_LENGTH; |
| 193 | break; | 193 | break; |
| 194 | default: | 194 | default: |
| 195 | fprintf(stderr, "FAIL: unknown algorithm (%d)\n", | ||
| 196 | algorithm); | ||
| 197 | return 0; | 195 | return 0; |
| 198 | } | 196 | } |
| 199 | 197 | ||
| @@ -201,108 +199,100 @@ md_hash_from_algorithm(int algorithm, const char **out_label, | |||
| 201 | } | 199 | } |
| 202 | 200 | ||
| 203 | static void | 201 | static void |
| 204 | hexdump(const unsigned char *buf, size_t len) | 202 | test_md_tv(struct test *t, const void *arg) |
| 205 | { | ||
| 206 | size_t i; | ||
| 207 | |||
| 208 | for (i = 1; i <= len; i++) | ||
| 209 | fprintf(stderr, " 0x%02hhx,%s", buf[i - 1], i % 8 ? "" : "\n"); | ||
| 210 | |||
| 211 | fprintf(stderr, "\n"); | ||
| 212 | } | ||
| 213 | |||
| 214 | static int | ||
| 215 | md_test(void) | ||
| 216 | { | 203 | { |
| 217 | unsigned char *(*md_func)(const unsigned char *, size_t, unsigned char *); | 204 | const struct md_test *st = arg; |
| 218 | const struct md_test *st; | 205 | md_hash_func md_func; |
| 219 | EVP_MD_CTX *hash = NULL; | ||
| 220 | const EVP_MD *md; | 206 | const EVP_MD *md; |
| 207 | EVP_MD_CTX *hash = NULL; | ||
| 221 | uint8_t out[EVP_MAX_MD_SIZE]; | 208 | uint8_t out[EVP_MAX_MD_SIZE]; |
| 222 | size_t in_len, out_len; | 209 | size_t in_len, out_len; |
| 223 | size_t i; | ||
| 224 | const char *label; | ||
| 225 | int failed = 1; | ||
| 226 | 210 | ||
| 227 | if ((hash = EVP_MD_CTX_new()) == NULL) { | 211 | if (!md_hash_from_algorithm(st->algorithm, &md_func, &md, &out_len)) { |
| 228 | fprintf(stderr, "FAIL: EVP_MD_CTX_new() failed\n"); | 212 | test_errorf(t, "md_hash_from_algorithm: unknown algorithm: %d", |
| 229 | goto failed; | 213 | st->algorithm); |
| 214 | goto fail; | ||
| 230 | } | 215 | } |
| 231 | 216 | ||
| 232 | for (i = 0; i < N_MD_TESTS; i++) { | 217 | if ((hash = EVP_MD_CTX_new()) == NULL) { |
| 233 | st = &md_tests[i]; | 218 | test_errorf(t, "EVP_MD_CTX_new()"); |
| 234 | if (!md_hash_from_algorithm(st->algorithm, &label, &md_func, | 219 | goto fail; |
| 235 | &md, &out_len)) | 220 | } |
| 236 | goto failed; | ||
| 237 | |||
| 238 | /* Digest */ | ||
| 239 | memset(out, 0, sizeof(out)); | ||
| 240 | md_func(st->in, st->in_len, out); | ||
| 241 | if (memcmp(st->out, out, out_len) != 0) { | ||
| 242 | fprintf(stderr, "FAIL (%s): mismatch\n", label); | ||
| 243 | goto failed; | ||
| 244 | } | ||
| 245 | 221 | ||
| 246 | /* EVP single-shot digest */ | 222 | /* Digest */ |
| 247 | memset(out, 0, sizeof(out)); | 223 | memset(out, 0, sizeof(out)); |
| 248 | if (!EVP_Digest(st->in, st->in_len, out, NULL, md, NULL)) { | 224 | md_func(st->in, st->in_len, out); |
| 249 | fprintf(stderr, "FAIL (%s): EVP_Digest failed\n", | 225 | if (memcmp(st->out, out, out_len) != 0) { |
| 250 | label); | 226 | test_errorf(t, "MD: digest output mismatch"); |
| 251 | goto failed; | 227 | test_hexdiff(t, out, out_len, st->out); |
| 252 | } | 228 | } |
| 253 | 229 | ||
| 254 | if (memcmp(st->out, out, out_len) != 0) { | 230 | /* EVP single-shot digest */ |
| 255 | fprintf(stderr, "FAIL (%s): EVP single-shot mismatch\n", | 231 | memset(out, 0, sizeof(out)); |
| 256 | label); | 232 | if (!EVP_Digest(st->in, st->in_len, out, NULL, md, NULL)) { |
| 257 | goto failed; | 233 | test_errorf(t, "EVP_Digest()"); |
| 258 | } | 234 | goto fail; |
| 235 | } | ||
| 236 | if (memcmp(st->out, out, out_len) != 0) { | ||
| 237 | test_errorf(t, "EVP_Digest: digest output mismatch"); | ||
| 238 | test_hexdiff(t, out, out_len, st->out); | ||
| 239 | } | ||
| 259 | 240 | ||
| 260 | /* EVP digest */ | 241 | /* EVP digest */ |
| 261 | memset(out, 0, sizeof(out)); | 242 | memset(out, 0, sizeof(out)); |
| 262 | if (!EVP_DigestInit_ex(hash, md, NULL)) { | 243 | if (!EVP_DigestInit_ex(hash, md, NULL)) { |
| 263 | fprintf(stderr, "FAIL (%s): EVP_DigestInit_ex failed\n", | 244 | test_errorf(t, "EVP_DigestInit_ex()"); |
| 264 | label); | 245 | goto fail; |
| 265 | goto failed; | 246 | } |
| 266 | } | ||
| 267 | 247 | ||
| 268 | in_len = st->in_len / 2; | 248 | in_len = st->in_len / 2; |
| 269 | if (!EVP_DigestUpdate(hash, st->in, in_len)) { | 249 | if (!EVP_DigestUpdate(hash, st->in, in_len)) { |
| 270 | fprintf(stderr, | 250 | test_errorf(t, "EVP_DigestUpdate: first half failed"); |
| 271 | "FAIL (%s): EVP_DigestUpdate first half failed\n", | 251 | goto fail; |
| 272 | label); | 252 | } |
| 273 | goto failed; | ||
| 274 | } | ||
| 275 | 253 | ||
| 276 | if (!EVP_DigestUpdate(hash, st->in + in_len, | 254 | if (!EVP_DigestUpdate(hash, st->in + in_len, |
| 277 | st->in_len - in_len)) { | 255 | st->in_len - in_len)) { |
| 278 | fprintf(stderr, | 256 | test_errorf(t, "EVP_DigestUpdate: second half failed"); |
| 279 | "FAIL (%s): EVP_DigestUpdate second half failed\n", | 257 | goto fail; |
| 280 | label); | 258 | } |
| 281 | goto failed; | ||
| 282 | } | ||
| 283 | 259 | ||
| 284 | if (!EVP_DigestFinal_ex(hash, out, NULL)) { | 260 | if (!EVP_DigestFinal_ex(hash, out, NULL)) { |
| 285 | fprintf(stderr, | 261 | test_errorf(t, "EVP_DigestFinal_ex()"); |
| 286 | "FAIL (%s): EVP_DigestFinal_ex failed\n", | 262 | goto fail; |
| 287 | label); | 263 | } |
| 288 | goto failed; | ||
| 289 | } | ||
| 290 | 264 | ||
| 291 | if (memcmp(st->out, out, out_len) != 0) { | 265 | if (memcmp(st->out, out, out_len) != 0) { |
| 292 | fprintf(stderr, "FAIL (%s): EVP mismatch\n", label); | 266 | test_errorf(t, "EVP: digest output mismatch"); |
| 293 | goto failed; | 267 | test_hexdiff(t, out, out_len, st->out); |
| 294 | } | ||
| 295 | } | 268 | } |
| 296 | 269 | ||
| 297 | failed = 0; | ||
| 298 | 270 | ||
| 299 | failed: | 271 | fail: |
| 300 | EVP_MD_CTX_free(hash); | 272 | EVP_MD_CTX_free(hash); |
| 301 | return failed; | ||
| 302 | } | 273 | } |
| 303 | 274 | ||
| 304 | static int | 275 | static void |
| 305 | md5_large_test(void) | 276 | test_md(struct test *t, const void *arg) |
| 277 | { | ||
| 278 | const struct md_test *st; | ||
| 279 | size_t i; | ||
| 280 | char *name; | ||
| 281 | |||
| 282 | for (i = 0; i < N_MD_TESTS; i++) { | ||
| 283 | st = &md_tests[i]; | ||
| 284 | if (asprintf(&name, "%s: '%s'", OBJ_nid2sn(st->algorithm), st->in) == -1) { | ||
| 285 | test_errorf(t, "create test name"); | ||
| 286 | return; | ||
| 287 | } | ||
| 288 | |||
| 289 | test_run(t, name, test_md_tv, st); | ||
| 290 | free(name); | ||
| 291 | } | ||
| 292 | } | ||
| 293 | |||
| 294 | static void | ||
| 295 | test_md5_large(struct test *t, const void *arg) | ||
| 306 | { | 296 | { |
| 307 | MD5_CTX ctx; | 297 | MD5_CTX ctx; |
| 308 | uint8_t in[1024]; | 298 | uint8_t in[1024]; |
| @@ -310,12 +300,10 @@ md5_large_test(void) | |||
| 310 | unsigned int out_len; | 300 | unsigned int out_len; |
| 311 | size_t in_len; | 301 | size_t in_len; |
| 312 | size_t i; | 302 | size_t i; |
| 313 | const char *label; | ||
| 314 | uint8_t want[] = { | 303 | uint8_t want[] = { |
| 315 | 0xd8, 0xbc, 0xae, 0x13, 0xb5, 0x5a, 0xb0, 0xfc, | 304 | 0xd8, 0xbc, 0xae, 0x13, 0xb5, 0x5a, 0xb0, 0xfc, |
| 316 | 0x7f, 0x8a, 0xe1, 0x78, 0x27, 0x8d, 0x44, 0x1b, | 305 | 0x7f, 0x8a, 0xe1, 0x78, 0x27, 0x8d, 0x44, 0x1b, |
| 317 | }; | 306 | }; |
| 318 | int failed = 1; | ||
| 319 | 307 | ||
| 320 | memset(in, 'A', sizeof(in)); | 308 | memset(in, 'A', sizeof(in)); |
| 321 | in_len = sizeof(in); | 309 | in_len = sizeof(in); |
| @@ -323,44 +311,34 @@ md5_large_test(void) | |||
| 323 | memset(out, 0, sizeof(out)); | 311 | memset(out, 0, sizeof(out)); |
| 324 | out_len = 16; | 312 | out_len = 16; |
| 325 | 313 | ||
| 326 | label = "md5"; | ||
| 327 | |||
| 328 | MD5_Init(&ctx); | 314 | MD5_Init(&ctx); |
| 329 | 315 | ||
| 330 | for (i = 0; i < (1<<29) + 1; i += in_len) { | 316 | for (i = 0; i < (1<<29) + 1; i += in_len) { |
| 331 | if (!MD5_Update(&ctx, in, in_len)) { | 317 | if (!MD5_Update(&ctx, in, in_len)) { |
| 332 | fprintf(stderr, "FAIL (%s): MD5_Update failed\n", label); | 318 | test_errorf(t, "MD5_Update()"); |
| 333 | goto failed; | 319 | return; |
| 334 | } | 320 | } |
| 335 | } | 321 | } |
| 336 | if (!MD5_Final(out, &ctx)) { | 322 | if (!MD5_Final(out, &ctx)) { |
| 337 | fprintf(stderr, "FAIL (%s): MD5_Final failed\n", label); | 323 | test_errorf(t, "MD5_Final()"); |
| 338 | goto failed; | 324 | return; |
| 339 | } | 325 | } |
| 340 | 326 | ||
| 341 | if (memcmp(out, want, out_len) != 0) { | 327 | if (memcmp(out, want, out_len) != 0) { |
| 342 | fprintf(stderr, "FAIL (%s): MD5 mismatch\n", label); | 328 | test_errorf(t, "MD5 digest output mismatch"); |
| 343 | hexdump(out, out_len); | 329 | test_hexdump(t, out, out_len); |
| 344 | goto failed; | ||
| 345 | } | 330 | } |
| 346 | if (ctx.Nh != 0x1 || ctx.Nl != 0x2000) { | 331 | if (ctx.Nh != 0x1 || ctx.Nl != 0x2000) |
| 347 | fprintf(stderr, "FAIL (%s): MD5 incorrect bit length\n", label); | 332 | test_errorf(t, "MD5 incorrect bit length"); |
| 348 | goto failed; | ||
| 349 | } | ||
| 350 | |||
| 351 | failed = 0; | ||
| 352 | |||
| 353 | failed: | ||
| 354 | return failed; | ||
| 355 | } | 333 | } |
| 356 | 334 | ||
| 357 | int | 335 | int |
| 358 | main(int argc, char **argv) | 336 | main(int argc, char **argv) |
| 359 | { | 337 | { |
| 360 | int failed = 0; | 338 | struct test *t = test_init(); |
| 361 | 339 | ||
| 362 | failed |= md_test(); | 340 | test_run(t, "md", test_md, NULL); |
| 363 | failed |= md5_large_test(); | 341 | test_run(t, "md5 large", test_md5_large, NULL); |
| 364 | 342 | ||
| 365 | return failed; | 343 | return test_result(t); |
| 366 | } | 344 | } |
diff --git a/src/regress/lib/libcrypto/mlkem/Makefile b/src/regress/lib/libcrypto/mlkem/Makefile index a08623c90a..3acaf78e63 100644 --- a/src/regress/lib/libcrypto/mlkem/Makefile +++ b/src/regress/lib/libcrypto/mlkem/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.9 2024/12/29 20:14:15 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.10 2025/08/15 14:46:37 tb Exp $ |
| 2 | 2 | ||
| 3 | REGRESS_SLOW_TARGETS += run-regress-mlkem_iteration_tests | 3 | REGRESS_SLOW_TARGETS += run-regress-mlkem_iteration_tests |
| 4 | 4 | ||
| @@ -22,7 +22,7 @@ run-regress-mlkem_tests: mlkem_tests | |||
| 22 | ./mlkem_tests $f ${.CURDIR}/$f.txt | 22 | ./mlkem_tests $f ${.CURDIR}/$f.txt |
| 23 | .endfor | 23 | .endfor |
| 24 | 24 | ||
| 25 | SRCS_mlkem_tests = mlkem_tests.c mlkem_tests_util.c parse_test_file.c | 25 | SRCS_mlkem_tests = mlkem_tests.c parse_test_file.c |
| 26 | SRCS_mlkem_iteration_tests = mlkem_iteration_tests.c mlkem_tests_util.c | 26 | SRCS_mlkem_iteration_tests = mlkem_iteration_tests.c mlkem_tests_util.c |
| 27 | SRCS_mlkem_unittest = mlkem_unittest.c mlkem_tests_util.c | 27 | SRCS_mlkem_unittest = mlkem_unittest.c mlkem_tests_util.c |
| 28 | 28 | ||
diff --git a/src/regress/lib/libcrypto/mlkem/mlkem768_encap_tests.txt b/src/regress/lib/libcrypto/mlkem/mlkem768_encap_tests.txt index 76b0cbdef3..bf37654e0c 100644 --- a/src/regress/lib/libcrypto/mlkem/mlkem768_encap_tests.txt +++ b/src/regress/lib/libcrypto/mlkem/mlkem768_encap_tests.txt | |||
| @@ -1769,70 +1769,70 @@ result: pass | |||
| 1769 | ciphertext: bb7e0dca6eca3ef57e945d921c2f80875556f7786d6bcca1312f86b3bea6d0f0a73f7d6036a7c38c62d4e356961ec6a28d8026a2d915d9721ef815147fc09ca65a3394aa5dc14c08d41cbe932337b9a531ddf68df20b6aea297194ac398f15919830e3ee6c20145c0aae7a2cd276ccad7b5c414212f0c0ae7106333868938a6a00da19377d996c7796d400606007dff30fe554a5fef86944d43ba047a00da5c2c2a1aad053aeafcc75a1e826a417b4c320e60a68e63dd7b54827f5b8b0063a00043f29ce8975d95bd418eb2ed29db0d9263c67fdcc153ba9b5a33279becb7ab193c2f257bd660fd7012712be3fdc2e52490ade145e8e030ba1ee5368791e6f3efe00deb34cb454cbf7fdae3a507261d9fce66ab58998ca19380187e3455d425977a8396cee3442935e24347aed45fba9b323a289f1b98691e35017ecfd7a423cd8d0149432a2063e0786c2f912e1134ebed188511c905a1a9890cd55d496e8441ccf637b4d660d93c7a46c3e17219167c3b4740878ae35766470b5eff3c6b1fc8c30e5c9645a94ebd48d2d40fbd4baf9d822deb26c089da84043340a564e6c311bca18c7a2c868831fbb866d89652556b53297b9c0040e98a692fa536af4c9a7aa09321ca27068ca66c665b1121ee4529cb3e6d899964de759ab915b0d2c571c5aa76cd64df4a4e55d9de59eca7b4379b30f8559db41e804a18b8771f594b9bee3de9ae98a003430aac58c141e6f0b7b1e5e08e27d1127b682882be055ba31e280dbace7878ae60426626ea4c5bc034a9206e27f578edd17fa6c33180b649bc7bd437b2c86ef4e0f4583071f99090b95db1e415d21ddd88a910b1fd10e3a04e391d947558a6619683ae070be04cab88300614839503f088e2f04cc4a7d091af9833a4f957cfdc574b1c994673ea14dce6ad89adebf5130d266c1440b3f544eea380ba245e21651f1f2aeb2b3d578000a87683dec69ccac18b0702d3d030077981076766e7e5f3ae1174eaf21bf03662c6bda5fd209da19ff6792c0bbc5d210851061dcdd2e4794d2c3c0c531e92a2c4a23556878d3e890b65289a6a02530bbd40ed66db3bb220aeb71fcc3c0b5d5b3afc71377746b22ce636dba028bc052c219783d468fac1d4eed555c1b4676705c8d27aa8a09c6fd8640a6f7b6790ff173ac39b5f3c709281df4274cccdc1e3b690ac0a77f7ece34cdf3216d2b6058baf5f649ff5036360dff99334ff06a366785c0404c584f623801190082fe5cdf88f9cf41032681e8fd6b84d127add01d4b2286af648b83fe69aa8d109c9320bd40621cf75adff8603e3da00be36f03ed7925f19b2e913d756e952a9402cd4fbffc0428cd7eebdd7fc7d3b4cde181b16b26811cd53d9f5d85d37c1670b957d4b3d04fd06567ac68d3f9dbdd45d182619180cf9292e86f42bcc213e94900e0c759e051bc0e30ffbdb91a2493913dc8b81ba4c3e8ba0e7277dc38dc91eb2b27823dac71b6f1c47e2a04136e2c0474fe070e2e4bf8e6fc98e73143ead3c5f778ce8a4efde4 | 1769 | ciphertext: bb7e0dca6eca3ef57e945d921c2f80875556f7786d6bcca1312f86b3bea6d0f0a73f7d6036a7c38c62d4e356961ec6a28d8026a2d915d9721ef815147fc09ca65a3394aa5dc14c08d41cbe932337b9a531ddf68df20b6aea297194ac398f15919830e3ee6c20145c0aae7a2cd276ccad7b5c414212f0c0ae7106333868938a6a00da19377d996c7796d400606007dff30fe554a5fef86944d43ba047a00da5c2c2a1aad053aeafcc75a1e826a417b4c320e60a68e63dd7b54827f5b8b0063a00043f29ce8975d95bd418eb2ed29db0d9263c67fdcc153ba9b5a33279becb7ab193c2f257bd660fd7012712be3fdc2e52490ade145e8e030ba1ee5368791e6f3efe00deb34cb454cbf7fdae3a507261d9fce66ab58998ca19380187e3455d425977a8396cee3442935e24347aed45fba9b323a289f1b98691e35017ecfd7a423cd8d0149432a2063e0786c2f912e1134ebed188511c905a1a9890cd55d496e8441ccf637b4d660d93c7a46c3e17219167c3b4740878ae35766470b5eff3c6b1fc8c30e5c9645a94ebd48d2d40fbd4baf9d822deb26c089da84043340a564e6c311bca18c7a2c868831fbb866d89652556b53297b9c0040e98a692fa536af4c9a7aa09321ca27068ca66c665b1121ee4529cb3e6d899964de759ab915b0d2c571c5aa76cd64df4a4e55d9de59eca7b4379b30f8559db41e804a18b8771f594b9bee3de9ae98a003430aac58c141e6f0b7b1e5e08e27d1127b682882be055ba31e280dbace7878ae60426626ea4c5bc034a9206e27f578edd17fa6c33180b649bc7bd437b2c86ef4e0f4583071f99090b95db1e415d21ddd88a910b1fd10e3a04e391d947558a6619683ae070be04cab88300614839503f088e2f04cc4a7d091af9833a4f957cfdc574b1c994673ea14dce6ad89adebf5130d266c1440b3f544eea380ba245e21651f1f2aeb2b3d578000a87683dec69ccac18b0702d3d030077981076766e7e5f3ae1174eaf21bf03662c6bda5fd209da19ff6792c0bbc5d210851061dcdd2e4794d2c3c0c531e92a2c4a23556878d3e890b65289a6a02530bbd40ed66db3bb220aeb71fcc3c0b5d5b3afc71377746b22ce636dba028bc052c219783d468fac1d4eed555c1b4676705c8d27aa8a09c6fd8640a6f7b6790ff173ac39b5f3c709281df4274cccdc1e3b690ac0a77f7ece34cdf3216d2b6058baf5f649ff5036360dff99334ff06a366785c0404c584f623801190082fe5cdf88f9cf41032681e8fd6b84d127add01d4b2286af648b83fe69aa8d109c9320bd40621cf75adff8603e3da00be36f03ed7925f19b2e913d756e952a9402cd4fbffc0428cd7eebdd7fc7d3b4cde181b16b26811cd53d9f5d85d37c1670b957d4b3d04fd06567ac68d3f9dbdd45d182619180cf9292e86f42bcc213e94900e0c759e051bc0e30ffbdb91a2493913dc8b81ba4c3e8ba0e7277dc38dc91eb2b27823dac71b6f1c47e2a04136e2c0474fe070e2e4bf8e6fc98e73143ead3c5f778ce8a4efde4 |
| 1770 | shared_secret: 5b357f714a293b6724c0dc2e2c5509676782a9dddb050d88e6efa0a6d09d20b7 | 1770 | shared_secret: 5b357f714a293b6724c0dc2e2c5509676782a9dddb050d88e6efa0a6d09d20b7 |
| 1771 | 1771 | ||
| 1772 | # Rho leads to a matrix with unusally large entries | 1772 | # Rho leads to a matrix with unusually large entries |
| 1773 | entropy: adf510dc0e997af14f96e4863f316475be59850bc861ca0d1b057d6b94c3b5d6 | 1773 | entropy: adf510dc0e997af14f96e4863f316475be59850bc861ca0d1b057d6b94c3b5d6 |
| 1774 | public_key = d7dab73b47cd1ca43c7e036d41c94f8f31a0de404fa38a1da0992933d752acc0407234883488a581e340bf5a8dd7112099259ebfdb0cb094c8d592485f25729e1844870a3d57d63fe9c1295fc2c4a374508f359a7e9b062348c6c807322f1a2dc887a20ff1b8e951b103698492504dd86babc01339f5b0c9bdb01b65514c8df3a61abb7941da84b8005648fa0e5b094e54e56a56e8c840371349820dc3f48ef0fa488f180f57b5c0ad663512467836d6765f6517ebd0172d886430357baec25c709b3abb9c01dda27e2ac7c17cac7511726a39050fe92399e14780e3288ae775612b2c4baaa032af561d0356c43175c6263c5d9cbc62f57194c9f76fb5293e86d9a95a641325013dee98067d513525eb5d2f7cb5783915d0917faee635bcdab95a61592fdb1de202c439dba37a235e3888134249044519732701111385b9c91c2fc96b039d6483c6d1bba2223cb0f612c3f7c6dc62bf64a04b349a0fab73290acbb15ce1cfaa15c68d896493e67dd9a518782b35fe141a4d70bf33e97a616c51193b711b04a40c9634bb62726f748572155667146d311016880c670067c653e9a8dc0bc32865adbf41ba99f19b2dd9ac7998bfc8679c689a05a5038042885742a68ef84c429984588995a6cee077c3a099caa7a5d3761cb4411d1dab8fe7258c75903ef515b6b0629ff659436ff687e6625d2080671e0cbe0cb624bf8b367e780452ea3713804e083aa6e0c7adc15618cf223b3587a364320d56c58be8f037f89cae0be209ded78cbae29ed73767ede6793f0051cd5692f63661a257ccd9d859a92ac08784070bfa7ede4577e7ab1ff6c7b159089b8dbcc5ba56357b2659a7a04c8748a86991b2b775c2015a4c12341ebb419e1244396c233c161495366104b8e29979e571c9614fe10c868db56cd934c5b2d04986a70be8dc25d61cb6f0054d5e4000ef72557b712658d962b1e673a07222d59bcbc4e8339bb5b37cc1c2bbd38780f8233843ad420782b4951c3321888fc3b488897c8bab046f79cc456bba9f666ba261284a1285bf1a9a9d274d9b87788c225c0ffa20388183f35817e5825d450a1eee881f94a5a129e688ce6664021356580190a3ec5ed220b8a5878068ec5cd485816f8c1ee05c3c23ec0d0aab7f73aac249142d8992678b38410d41be710a285d3b593a8245e514a870c3c348fa45f99aacc464b399ecc0cb3c306c273e5f4c671b806864120a88c07caa53a550d52c5641203a7927b40631e21344a9337da2d128dbbb5f97b68b8e57cfbb1a67ca7741c60c2533e49ece409b0492a2e81523e6b6ad655a6dd1870b5de3690de3369c898b557886c4877ad1d67a1583bc70502b32a44afb9b60f88838eae005e2703ca26355ddc479bdf1a93756af16b7789a3221fed9a4e468b710035060752e884c56034b768d0a7106a4bebde7622bb46b6649195301192c498bb555c653c42f6d84883be82e8fa56ea303caac534014b6bbf38a9f73283e5a40b36e36c9d8b1a9856aa7d9913b22c40cb103b74853c53c3ab4ce895388aca8584449fae927b16534f48b3aaf350030a8460c8572bcc527f1f62bf1c5a9bb8ccf3ee66f66dc19286782911a6765c72db77ac0e976a2bc114a1b11000000000000000000000000000000000000000000000000000000 | 1774 | public_key = d7dab73b47cd1ca43c7e036d41c94f8f31a0de404fa38a1da0992933d752acc0407234883488a581e340bf5a8dd7112099259ebfdb0cb094c8d592485f25729e1844870a3d57d63fe9c1295fc2c4a374508f359a7e9b062348c6c807322f1a2dc887a20ff1b8e951b103698492504dd86babc01339f5b0c9bdb01b65514c8df3a61abb7941da84b8005648fa0e5b094e54e56a56e8c840371349820dc3f48ef0fa488f180f57b5c0ad663512467836d6765f6517ebd0172d886430357baec25c709b3abb9c01dda27e2ac7c17cac7511726a39050fe92399e14780e3288ae775612b2c4baaa032af561d0356c43175c6263c5d9cbc62f57194c9f76fb5293e86d9a95a641325013dee98067d513525eb5d2f7cb5783915d0917faee635bcdab95a61592fdb1de202c439dba37a235e3888134249044519732701111385b9c91c2fc96b039d6483c6d1bba2223cb0f612c3f7c6dc62bf64a04b349a0fab73290acbb15ce1cfaa15c68d896493e67dd9a518782b35fe141a4d70bf33e97a616c51193b711b04a40c9634bb62726f748572155667146d311016880c670067c653e9a8dc0bc32865adbf41ba99f19b2dd9ac7998bfc8679c689a05a5038042885742a68ef84c429984588995a6cee077c3a099caa7a5d3761cb4411d1dab8fe7258c75903ef515b6b0629ff659436ff687e6625d2080671e0cbe0cb624bf8b367e780452ea3713804e083aa6e0c7adc15618cf223b3587a364320d56c58be8f037f89cae0be209ded78cbae29ed73767ede6793f0051cd5692f63661a257ccd9d859a92ac08784070bfa7ede4577e7ab1ff6c7b159089b8dbcc5ba56357b2659a7a04c8748a86991b2b775c2015a4c12341ebb419e1244396c233c161495366104b8e29979e571c9614fe10c868db56cd934c5b2d04986a70be8dc25d61cb6f0054d5e4000ef72557b712658d962b1e673a07222d59bcbc4e8339bb5b37cc1c2bbd38780f8233843ad420782b4951c3321888fc3b488897c8bab046f79cc456bba9f666ba261284a1285bf1a9a9d274d9b87788c225c0ffa20388183f35817e5825d450a1eee881f94a5a129e688ce6664021356580190a3ec5ed220b8a5878068ec5cd485816f8c1ee05c3c23ec0d0aab7f73aac249142d8992678b38410d41be710a285d3b593a8245e514a870c3c348fa45f99aacc464b399ecc0cb3c306c273e5f4c671b806864120a88c07caa53a550d52c5641203a7927b40631e21344a9337da2d128dbbb5f97b68b8e57cfbb1a67ca7741c60c2533e49ece409b0492a2e81523e6b6ad655a6dd1870b5de3690de3369c898b557886c4877ad1d67a1583bc70502b32a44afb9b60f88838eae005e2703ca26355ddc479bdf1a93756af16b7789a3221fed9a4e468b710035060752e884c56034b768d0a7106a4bebde7622bb46b6649195301192c498bb555c653c42f6d84883be82e8fa56ea303caac534014b6bbf38a9f73283e5a40b36e36c9d8b1a9856aa7d9913b22c40cb103b74853c53c3ab4ce895388aca8584449fae927b16534f48b3aaf350030a8460c8572bcc527f1f62bf1c5a9bb8ccf3ee66f66dc19286782911a6765c72db77ac0e976a2bc114a1b11000000000000000000000000000000000000000000000000000000 |
| 1775 | result: pass | 1775 | result: pass |
| 1776 | ciphertext: 1a2dd390e05984bfc0f55ef96da5050fd9bb03891d4d2ddea46c463aab28fdfaf63d4b2e0c9af992e4f1421efc26ae86c2b296f6851bbe2e898b8bdf4057e875d4a98469b7d2646edb86a5eb5259341e0d14986a8ccf93563bc6ac067f8ff6997c2e7bbd897f02e844f180769fec5af9d6fa017022cb0af622b6e4f7a69d73ab01d3d09067b118d51805e1b6413b7a9e0ef292a6fca18a8828912a2db675f0244cd63d9340aa3ca00dc5d70c915b0061664b1e1d64d3d4dced3ef739302f1063442569efed0dfbe8c019c27823a3aabd865a47600ff9e24f748302bfca1bb60faf4105889a548be9ecaf266d8f02d3aa4997202477a70ee71b6e79dd1609acb4dabab72a38448758d8debf55369c5d3e0870ca193018e0ae6d0ffa33b93e962598b43e89d5978a9d55a608b98ceae5e897363f8a9e253acf8af560c57e07c4c4bde807620b6deb76d581bf92b7f514509446f5c4e4d09430b1855e62854988302c931b9e624644a636ab8acaec56d7673b26852c692e8325fa1b6215f24ebfb388ad1022fedc0bef272c87e10dca97df1e63f1a0e9582daae0f49e30c6acd119f7c4eef59d47443f491df846431cfbd23900341086a304589f52de1d862c26af32095e922b92650c68facfc13892430d428f626fba00cf9501e1e4646e55f5304c806b5acafe100084d7635702139725561522632e7e3871effe883298a7264a411484cdef78f9e721c0e5f3937f2fb7d40bb91620e473f9b97adddea69b3ac682e8aea2513b985fbae268176c1bff90e401a31e729fe8b76d13b5c8c85ed833d9b076b5e11acecbf0e96edcf8ff562255124edbeb5b9117cf486f30d7883aa353b9e433a77ac6912cc8e5093c12385ad926be1d0893afc7e64fb9ec55d3285e01a3ca63f3c07b95399bb4411c3f820f53d8350d1979ee9cc6bbf2d7c92d0cb2fd0a1de910d92589cf1aac29992489bc179676c31ae768869398fda50ff14860a1b4dd3bb2e4ba8b2c87aef7ee00d375956a62dc1e5d548a59f209448e62c4b1221631d4776dd5192154d637217d31feea1c4cb3ef1903b8987f4c184cf3d6b5355ad53c7bd3e0ae5373d9971115698214a93e12b98489cdd75028cf22c1da41096daca95854b35d8bbf7d0d4ca2727aa511eeb6cec5352ed487bd3b00b261cbabcfa9f082ba7300610c6f92725d532a86e00b2ed1929a8be7a342c079835a2285569dca92a808049f170fba39d990884ef39ca511aaf9a713b8d78973b4f4a2fde7ca8b6adbdc5a70241fe3ea7d005b33e48cc9fe6ce5bc2bae0746827e548332adf83f8aa707e703fd688c494136d8dfa50961a9e5b69b542ed6ae0e70ae159df95dd9d4789e284a675fe048585214047f7f6819f7f011141d265de9fd4c04f4ed5dead63fa4c8938b2f42108d263d5394d164b3254294402cbeb48663cf1ab2c296d6ada107e8aa5b505da49af96e1cebc6b302faa148216d38b9e8130cc654974ce299172cb875742e62c32c063ffe7535db2726f65fc8f600d4dbb1a20f | 1776 | ciphertext: 1a2dd390e05984bfc0f55ef96da5050fd9bb03891d4d2ddea46c463aab28fdfaf63d4b2e0c9af992e4f1421efc26ae86c2b296f6851bbe2e898b8bdf4057e875d4a98469b7d2646edb86a5eb5259341e0d14986a8ccf93563bc6ac067f8ff6997c2e7bbd897f02e844f180769fec5af9d6fa017022cb0af622b6e4f7a69d73ab01d3d09067b118d51805e1b6413b7a9e0ef292a6fca18a8828912a2db675f0244cd63d9340aa3ca00dc5d70c915b0061664b1e1d64d3d4dced3ef739302f1063442569efed0dfbe8c019c27823a3aabd865a47600ff9e24f748302bfca1bb60faf4105889a548be9ecaf266d8f02d3aa4997202477a70ee71b6e79dd1609acb4dabab72a38448758d8debf55369c5d3e0870ca193018e0ae6d0ffa33b93e962598b43e89d5978a9d55a608b98ceae5e897363f8a9e253acf8af560c57e07c4c4bde807620b6deb76d581bf92b7f514509446f5c4e4d09430b1855e62854988302c931b9e624644a636ab8acaec56d7673b26852c692e8325fa1b6215f24ebfb388ad1022fedc0bef272c87e10dca97df1e63f1a0e9582daae0f49e30c6acd119f7c4eef59d47443f491df846431cfbd23900341086a304589f52de1d862c26af32095e922b92650c68facfc13892430d428f626fba00cf9501e1e4646e55f5304c806b5acafe100084d7635702139725561522632e7e3871effe883298a7264a411484cdef78f9e721c0e5f3937f2fb7d40bb91620e473f9b97adddea69b3ac682e8aea2513b985fbae268176c1bff90e401a31e729fe8b76d13b5c8c85ed833d9b076b5e11acecbf0e96edcf8ff562255124edbeb5b9117cf486f30d7883aa353b9e433a77ac6912cc8e5093c12385ad926be1d0893afc7e64fb9ec55d3285e01a3ca63f3c07b95399bb4411c3f820f53d8350d1979ee9cc6bbf2d7c92d0cb2fd0a1de910d92589cf1aac29992489bc179676c31ae768869398fda50ff14860a1b4dd3bb2e4ba8b2c87aef7ee00d375956a62dc1e5d548a59f209448e62c4b1221631d4776dd5192154d637217d31feea1c4cb3ef1903b8987f4c184cf3d6b5355ad53c7bd3e0ae5373d9971115698214a93e12b98489cdd75028cf22c1da41096daca95854b35d8bbf7d0d4ca2727aa511eeb6cec5352ed487bd3b00b261cbabcfa9f082ba7300610c6f92725d532a86e00b2ed1929a8be7a342c079835a2285569dca92a808049f170fba39d990884ef39ca511aaf9a713b8d78973b4f4a2fde7ca8b6adbdc5a70241fe3ea7d005b33e48cc9fe6ce5bc2bae0746827e548332adf83f8aa707e703fd688c494136d8dfa50961a9e5b69b542ed6ae0e70ae159df95dd9d4789e284a675fe048585214047f7f6819f7f011141d265de9fd4c04f4ed5dead63fa4c8938b2f42108d263d5394d164b3254294402cbeb48663cf1ab2c296d6ada107e8aa5b505da49af96e1cebc6b302faa148216d38b9e8130cc654974ce299172cb875742e62c32c063ffe7535db2726f65fc8f600d4dbb1a20f |
| 1777 | shared_secret: 54c35602dafe572b99aedb7069a59c4f7818c860b27a947347657ac1954d6454 | 1777 | shared_secret: 54c35602dafe572b99aedb7069a59c4f7818c860b27a947347657ac1954d6454 |
| 1778 | 1778 | ||
| 1779 | # Rho leads to a matrix with unusally large entries | 1779 | # Rho leads to a matrix with unusually large entries |
| 1780 | entropy: 3983da6a4615805f6d55c14ba582d59a40e646c7ae77f4835a51afc6c37f11f3 | 1780 | entropy: 3983da6a4615805f6d55c14ba582d59a40e646c7ae77f4835a51afc6c37f11f3 |
| 1781 | public_key = 47340db6d04313d3a689b357566b9743cace5d5b906a39249f1c2bcdf335f37aac2565932631ac318bbb7ca75db36ac198ac6b15a02173049721d10f7521a52f358f35f3719269a695a4b0fa03b32d8a209aa12a5d786d8dea4ba05498ba222eadd647dd5a397e655ed309883d76326231a6764a7ba4226567022d70fa20cc53a045cc5a1fc54abe0189a4a2b6bf8a969d61706944bc59c6add2992b6e562e9732973d32b97956203dbc523803ca0a462ae118633483cab85c645ee3ad51682c0596378dea5e93bc7ab652648cf1954745172a75c2bf6a3177a7841b089b6ee911149871a9d987c6d499b6e0c4d15c9b74685401b680d3e112d6d70bdad6a3f9954b0057335ca36823328ac4e124d55b9932d548f58b85a32844e9f0260d8a4339285ab46152bbc05a967c5f16072f16178687b0bc06b621f5a4a14ef86b9cf1bade0185c5c52b3f2c407479467e5516ab9a1128260317605d4db250e8f4b59bf28a6ac2606d280af28664b75092fdea1fe9374976722dff579728e121fc1944891c586625a880a7bd154aace3e919b841b1f5f8c0fb841d1eac1fb18002ece216d42cb401dc1681836c1198653456c9392944054200a3b95b986a396d443a306b66018b525fbbb042e662ec108f6b872749d3287440c12bd07d1061a524a01ad7342d74f8a4b76222c5a439eef4235d51c9494602f6624dee256ea7fc09ceba9877f9332bf195c43502ee43c75e78720c306c2fa47f4ef6b7d69038dbcb8272b334c98cb665b306c04252fad3559eda4b96c14bf50b78d4a9a37081a2d61cad33b3b9418bba25409fbf4a5bb3c775a43b39520b37b5b82191b4983398858bbb0c6c8031b9736a5f76cab0e647443cb6d983a5e0a6c27756cbf471baa17870015566db8c8a51aba969e976a1c6cb2be166f20680893950ddf09cf8e3827a2a884a7a65d61c7c70a522d17ac0939625fe63958741255b012712e76fa8da809a8cb447d730d4097bd3e86471019dc8897bfc82c3804a76a38919f7cb50ce79bc13ec4bdda215bda9789503aa822c71ad8107a35818a7cb055b303338e465933565b94950c11836e8e33ae8093b0aa0c5d5d555cbec5eb4190eecaa1525014e8a341e9400180937afeb126c278a5bc4713fe9c417c50c1e47c8756fbb6a6b265bdffb4c1456c5b7d7a895b6932dd9a55623341354549283ccfb36abb3068b2db7348bdb1172318357bac12422ab93a32b453bcc0faa4e8e595b05a145e614aded6bb77278bd78907b828b18a22aabea48bdd69cab061522a618cf39406f6c78cb983354384415d8b857cb451e01b24f489a3133070d775307fb61a0f6d56d1255c4d4e18c62e57d8422080cebc919b81e67c4304cdb560ab16d929413af650a53f870e8017e90096452ca3ea648ca644010d34bb79c5898b775b197189a55840f43371dd9cccb7b4a28a66309a515658f06acdddc47042acee250a37632b42af51adf1c0666902fe0acbfc8f59127753a40161de4ca07a5c8bec0d8ad3141487da4a842147b9de945e4962699033375548d680b88ae8354d6114efe284517778eb9b7957eecaf5b4165424a5f82f100d02b7d39968b98f69c2cea1a0b39394f49265b492ea8f4000000000000000000000000000000000000000000000000000000 | 1781 | public_key = 47340db6d04313d3a689b357566b9743cace5d5b906a39249f1c2bcdf335f37aac2565932631ac318bbb7ca75db36ac198ac6b15a02173049721d10f7521a52f358f35f3719269a695a4b0fa03b32d8a209aa12a5d786d8dea4ba05498ba222eadd647dd5a397e655ed309883d76326231a6764a7ba4226567022d70fa20cc53a045cc5a1fc54abe0189a4a2b6bf8a969d61706944bc59c6add2992b6e562e9732973d32b97956203dbc523803ca0a462ae118633483cab85c645ee3ad51682c0596378dea5e93bc7ab652648cf1954745172a75c2bf6a3177a7841b089b6ee911149871a9d987c6d499b6e0c4d15c9b74685401b680d3e112d6d70bdad6a3f9954b0057335ca36823328ac4e124d55b9932d548f58b85a32844e9f0260d8a4339285ab46152bbc05a967c5f16072f16178687b0bc06b621f5a4a14ef86b9cf1bade0185c5c52b3f2c407479467e5516ab9a1128260317605d4db250e8f4b59bf28a6ac2606d280af28664b75092fdea1fe9374976722dff579728e121fc1944891c586625a880a7bd154aace3e919b841b1f5f8c0fb841d1eac1fb18002ece216d42cb401dc1681836c1198653456c9392944054200a3b95b986a396d443a306b66018b525fbbb042e662ec108f6b872749d3287440c12bd07d1061a524a01ad7342d74f8a4b76222c5a439eef4235d51c9494602f6624dee256ea7fc09ceba9877f9332bf195c43502ee43c75e78720c306c2fa47f4ef6b7d69038dbcb8272b334c98cb665b306c04252fad3559eda4b96c14bf50b78d4a9a37081a2d61cad33b3b9418bba25409fbf4a5bb3c775a43b39520b37b5b82191b4983398858bbb0c6c8031b9736a5f76cab0e647443cb6d983a5e0a6c27756cbf471baa17870015566db8c8a51aba969e976a1c6cb2be166f20680893950ddf09cf8e3827a2a884a7a65d61c7c70a522d17ac0939625fe63958741255b012712e76fa8da809a8cb447d730d4097bd3e86471019dc8897bfc82c3804a76a38919f7cb50ce79bc13ec4bdda215bda9789503aa822c71ad8107a35818a7cb055b303338e465933565b94950c11836e8e33ae8093b0aa0c5d5d555cbec5eb4190eecaa1525014e8a341e9400180937afeb126c278a5bc4713fe9c417c50c1e47c8756fbb6a6b265bdffb4c1456c5b7d7a895b6932dd9a55623341354549283ccfb36abb3068b2db7348bdb1172318357bac12422ab93a32b453bcc0faa4e8e595b05a145e614aded6bb77278bd78907b828b18a22aabea48bdd69cab061522a618cf39406f6c78cb983354384415d8b857cb451e01b24f489a3133070d775307fb61a0f6d56d1255c4d4e18c62e57d8422080cebc919b81e67c4304cdb560ab16d929413af650a53f870e8017e90096452ca3ea648ca644010d34bb79c5898b775b197189a55840f43371dd9cccb7b4a28a66309a515658f06acdddc47042acee250a37632b42af51adf1c0666902fe0acbfc8f59127753a40161de4ca07a5c8bec0d8ad3141487da4a842147b9de945e4962699033375548d680b88ae8354d6114efe284517778eb9b7957eecaf5b4165424a5f82f100d02b7d39968b98f69c2cea1a0b39394f49265b492ea8f4000000000000000000000000000000000000000000000000000000 |
| 1782 | result: pass | 1782 | result: pass |
| 1783 | ciphertext: bc07d2caff561b4645e3878d1de0730a88c05f46348526829a396f05a0a00603f0e2fc79e13beaacbe903827c20d9d687f3fb4eb2a8e9335459fb21380b8bf3734518778d8cfae9524ead1427c6a2dc379ddd2e985e2977bb63e932ed59c83a8b9a593e2adba0cc5f106620fc8c6c4cba5106bfdb4105def0c1d7b6800327cacb964e1d4ebbddfaa15b279115a1d05754c0c8a715fc2fe5aa09af7b96d5a93e758458aa5af8cba03b942f4d3c0fbbc2a45d3f7af5818d67219a72f4f538883ee2d3e507e2dbf4f7748446443bb71bfbb4eff0f57d8154d29f5cb26cfb52c51b676e9b1ac08786d5f475cbbfb49697a748b7902a83da49d285a48c7e9cae74b66a30b02a353a287b40a66a0663e7a71adab7d03272f2ec32d47097d4c303396db3e7b7a947f467a70646777cda227d72310806107b5dc16cfb36918e88784524e3a46c30242a40811593aa8f72c742f885a9623534753b2bac5e29110a1a854646abe1c0337251e85987aa612f3a095409a5a632af14acd19491577223c278b18a9c3ffa7f72ae49b89df6dc45ebb2803ece96cfa94ef9ef5b24fbe686ff90d130d3ae953a4f9ee6581a346b0612f84cb6ccad4fe94a53602817d67c61a9604d288319f5933f4a97dcc6ffc36cf14db593fe27f873be712186a6695d949d4552dab37e36e2e0ced229ea9dccd6d3bae22f9fb888ef400b594ec08a15972e8d2478e50f11947b52bf384c731b0e50dcd4ba116abab8af3b880c54badb11d83b4266d3e5fc25c2c8dbbba12fee2fa5c2017987f31277a67ac702b8dbe110894a8c81011c7c662ce9ab96a2e25cf5056a3e202dbf6bd5bef2347537f7811637e932d13ce02283d48d032c284b6cfb84fd813b6c3421017a7527eafcd3fbc5d4324b5351b30abcf1b366f424a8a0b5edf6bc1f3e8702b03eff875687c6caebd7bc15f1118696cc63859e3aab75aa9acc58484da7f2bc9a120844e4830429c0eee2b2324890bde302bc93f661edd9c04e1183528482f9950654e8c267234245aa9482d94e90e00e929b65431f986e7bb34524cc41f4b4443646713c7abe6c4131a2d67f3bf42f0a7f2eddf82b5c08a94d99a0a7d14c1b0b375fc158b7d4276eab22efb438f0d0a9b30e9dc127026181e42643af8da0b24bd10a532069392724948ad722b25477b481006fc1fd030aa62b217e6695dd4c7ad34dbfb75aff1df5774b061a4ea8526e9bcdf9679405c0d2e40dca00c9e80840e832fd663596dc55f602d094253893405a02d4414f119d23c4544cf832888db5ae8494dd2e8ee357753515d929b8a37b5b45446ffac20fb204b5c937f6344c453ffa449fe839b4afe1da61301057338fe29df93aa962a7374a2ec181ffff9252c8af5c3f75ebee02fba58a76066df4c6acfd5d1c18390652eb2f469d35dd708e63a498c08c5241b2717333904ba0e6e0845dca8c9608f28bd1046805cf7b220498145b23cb18184a259458dd2fbaeb1c383005a0d289562b0a9daf7d1e320aa302fd3d9a02c65fa901d46d4 | 1783 | ciphertext: bc07d2caff561b4645e3878d1de0730a88c05f46348526829a396f05a0a00603f0e2fc79e13beaacbe903827c20d9d687f3fb4eb2a8e9335459fb21380b8bf3734518778d8cfae9524ead1427c6a2dc379ddd2e985e2977bb63e932ed59c83a8b9a593e2adba0cc5f106620fc8c6c4cba5106bfdb4105def0c1d7b6800327cacb964e1d4ebbddfaa15b279115a1d05754c0c8a715fc2fe5aa09af7b96d5a93e758458aa5af8cba03b942f4d3c0fbbc2a45d3f7af5818d67219a72f4f538883ee2d3e507e2dbf4f7748446443bb71bfbb4eff0f57d8154d29f5cb26cfb52c51b676e9b1ac08786d5f475cbbfb49697a748b7902a83da49d285a48c7e9cae74b66a30b02a353a287b40a66a0663e7a71adab7d03272f2ec32d47097d4c303396db3e7b7a947f467a70646777cda227d72310806107b5dc16cfb36918e88784524e3a46c30242a40811593aa8f72c742f885a9623534753b2bac5e29110a1a854646abe1c0337251e85987aa612f3a095409a5a632af14acd19491577223c278b18a9c3ffa7f72ae49b89df6dc45ebb2803ece96cfa94ef9ef5b24fbe686ff90d130d3ae953a4f9ee6581a346b0612f84cb6ccad4fe94a53602817d67c61a9604d288319f5933f4a97dcc6ffc36cf14db593fe27f873be712186a6695d949d4552dab37e36e2e0ced229ea9dccd6d3bae22f9fb888ef400b594ec08a15972e8d2478e50f11947b52bf384c731b0e50dcd4ba116abab8af3b880c54badb11d83b4266d3e5fc25c2c8dbbba12fee2fa5c2017987f31277a67ac702b8dbe110894a8c81011c7c662ce9ab96a2e25cf5056a3e202dbf6bd5bef2347537f7811637e932d13ce02283d48d032c284b6cfb84fd813b6c3421017a7527eafcd3fbc5d4324b5351b30abcf1b366f424a8a0b5edf6bc1f3e8702b03eff875687c6caebd7bc15f1118696cc63859e3aab75aa9acc58484da7f2bc9a120844e4830429c0eee2b2324890bde302bc93f661edd9c04e1183528482f9950654e8c267234245aa9482d94e90e00e929b65431f986e7bb34524cc41f4b4443646713c7abe6c4131a2d67f3bf42f0a7f2eddf82b5c08a94d99a0a7d14c1b0b375fc158b7d4276eab22efb438f0d0a9b30e9dc127026181e42643af8da0b24bd10a532069392724948ad722b25477b481006fc1fd030aa62b217e6695dd4c7ad34dbfb75aff1df5774b061a4ea8526e9bcdf9679405c0d2e40dca00c9e80840e832fd663596dc55f602d094253893405a02d4414f119d23c4544cf832888db5ae8494dd2e8ee357753515d929b8a37b5b45446ffac20fb204b5c937f6344c453ffa449fe839b4afe1da61301057338fe29df93aa962a7374a2ec181ffff9252c8af5c3f75ebee02fba58a76066df4c6acfd5d1c18390652eb2f469d35dd708e63a498c08c5241b2717333904ba0e6e0845dca8c9608f28bd1046805cf7b220498145b23cb18184a259458dd2fbaeb1c383005a0d289562b0a9daf7d1e320aa302fd3d9a02c65fa901d46d4 |
| 1784 | shared_secret: 7e1b4195e9cb70e6884d3d00f0b3f0a66b4d8c00ce112e1e79a1dd236ab62b26 | 1784 | shared_secret: 7e1b4195e9cb70e6884d3d00f0b3f0a66b4d8c00ce112e1e79a1dd236ab62b26 |
| 1785 | 1785 | ||
| 1786 | # Rho leads to a matrix with unusally large entries | 1786 | # Rho leads to a matrix with unusually large entries |
| 1787 | entropy: 2676b8426b9d6a30af007094bb76d65d388c2b3da938215dd6f6987206400e13 | 1787 | entropy: 2676b8426b9d6a30af007094bb76d65d388c2b3da938215dd6f6987206400e13 |
| 1788 | public_key = ddabceea01649d9c6588d68c05e93cb6959fbe348468cb6e7f482d2b0507a097625325a7ff5740086bc203410414845a177c578698b313842dd2737d79806fdc8aa4ad8b91b514b6aab60885a49be68ba60d05891dd1cb47c1850b0105ec15a95c93136f22a170e346d2256a0cea672941335423cde35492967759b4317981c34fb0d759a2b08aeb411c362b2630c4b8ef342cf844206d7a5a3934bdfda95ba9fac912fb1844a0bb62041868ba0e3660a5551951b39880eac2959b5028eaa765492416ecf7a05102450eb20eb2a28be460972066b41ac87abcc28b38a7c92d91779e0c7cc8b42f107b48269521edf0c558a1b767536d295c3a7e60b9de6a8f299563be7c4d33d33940234af8c7764b181fb7b5af1dc88e4e830725533656520af7344e4ab40f6df34a90a898c672b854021d0631c1b1e9999d8176b22a5ce829a240642e19472e635a83c5086f87872f72a62e5fa038481a6861141227666f9203675db45a444c6310518d86a9221c9b6bedd753bb7914f7995e39031963ea056536a96c9b14598c95652091dba9210168467d7388b73770aa905052645eaa877c6f8a45acbb775d080521479314e214a5217835667dc2cc67dac17b0103b1049a03585b30631c6dac53b6d4056e5877786b295fe94c8804b57a027609bee938a8812666d12345e04c92469463443fad1c2188c951cfc6a06c3b8c3ad8856ef26a67b7841428a1f5b69a3fb82cad843a55645b78219d6de824701b0b1f192d4f816f45032b1cd5b465d33b3a9cb2fb04cb271a3cc74a8bf7ab6ac7a00e8ce6a0486c660680219c6ace0917b31595584f4756c9c5273ee36c37d25d5da146e57613edd34795b9cf61bbb7ebc441d575631215a87c4070159136348854c297cf3ca44fb2814448e30eb2c555aa2393bee966ceec0221a278f048aaa6d09b1d801aa0fb369ae4480f051329390af222712c61a59f98a31a03ba90c1a6c34c1c98c0be7bf59fd717ad9894786acb1cd081405c66a2e79a1fd77cad853761461c99218aca3cf4920703654fb9529c106f41a78b259294709bbc91679d0442bb383c28d64683ebdc7b94f4592c8ba2c1126c9dba9377040d3a124176fa33a3905cbb96764bc89a69480b74e38f558b422ef22e390bbc76e048c01129c97c26125bb2f86c4bcd274816265d8c41167223b0a22406d2a193ad3b1083b0cb75f9542e55b9aac02845f59618b5aa580b5b2bb44c192a906ce61b8c368278618d8ca8409fc02bb9b097acb208e3c2a9b651a316b70cafe6b9bdb32ad794b4f018b66ce55639e5558f5a3990475794bcaa06f17093d490fa583e6fd9596b40958359a30f813b940b1e1e4223d3857cfea691eeca944de845c2fb502e35a5f1a3750454593fe1c41662a3b3da407aa269c43167acc98f5f3c662d6177d3594d0cb800087c6a525c586d86c12e941b046625d90c8ec6dc8a5c546abb19a0b585aef39379db926691124265103bbb49cfc4e9100c803b4ef68a904273a6c899e48609bca003bcea9cf82203d52b5f9b65c409ba9503b3b16c7077465aae45d2cd4ada79ca43a9e99a124b7c9fa24a323f6c6bc18b81d9a6161191561f3776740b539479582a46bd913ad73e09000000000000000000000000000000000000000000000000000000 | 1788 | public_key = ddabceea01649d9c6588d68c05e93cb6959fbe348468cb6e7f482d2b0507a097625325a7ff5740086bc203410414845a177c578698b313842dd2737d79806fdc8aa4ad8b91b514b6aab60885a49be68ba60d05891dd1cb47c1850b0105ec15a95c93136f22a170e346d2256a0cea672941335423cde35492967759b4317981c34fb0d759a2b08aeb411c362b2630c4b8ef342cf844206d7a5a3934bdfda95ba9fac912fb1844a0bb62041868ba0e3660a5551951b39880eac2959b5028eaa765492416ecf7a05102450eb20eb2a28be460972066b41ac87abcc28b38a7c92d91779e0c7cc8b42f107b48269521edf0c558a1b767536d295c3a7e60b9de6a8f299563be7c4d33d33940234af8c7764b181fb7b5af1dc88e4e830725533656520af7344e4ab40f6df34a90a898c672b854021d0631c1b1e9999d8176b22a5ce829a240642e19472e635a83c5086f87872f72a62e5fa038481a6861141227666f9203675db45a444c6310518d86a9221c9b6bedd753bb7914f7995e39031963ea056536a96c9b14598c95652091dba9210168467d7388b73770aa905052645eaa877c6f8a45acbb775d080521479314e214a5217835667dc2cc67dac17b0103b1049a03585b30631c6dac53b6d4056e5877786b295fe94c8804b57a027609bee938a8812666d12345e04c92469463443fad1c2188c951cfc6a06c3b8c3ad8856ef26a67b7841428a1f5b69a3fb82cad843a55645b78219d6de824701b0b1f192d4f816f45032b1cd5b465d33b3a9cb2fb04cb271a3cc74a8bf7ab6ac7a00e8ce6a0486c660680219c6ace0917b31595584f4756c9c5273ee36c37d25d5da146e57613edd34795b9cf61bbb7ebc441d575631215a87c4070159136348854c297cf3ca44fb2814448e30eb2c555aa2393bee966ceec0221a278f048aaa6d09b1d801aa0fb369ae4480f051329390af222712c61a59f98a31a03ba90c1a6c34c1c98c0be7bf59fd717ad9894786acb1cd081405c66a2e79a1fd77cad853761461c99218aca3cf4920703654fb9529c106f41a78b259294709bbc91679d0442bb383c28d64683ebdc7b94f4592c8ba2c1126c9dba9377040d3a124176fa33a3905cbb96764bc89a69480b74e38f558b422ef22e390bbc76e048c01129c97c26125bb2f86c4bcd274816265d8c41167223b0a22406d2a193ad3b1083b0cb75f9542e55b9aac02845f59618b5aa580b5b2bb44c192a906ce61b8c368278618d8ca8409fc02bb9b097acb208e3c2a9b651a316b70cafe6b9bdb32ad794b4f018b66ce55639e5558f5a3990475794bcaa06f17093d490fa583e6fd9596b40958359a30f813b940b1e1e4223d3857cfea691eeca944de845c2fb502e35a5f1a3750454593fe1c41662a3b3da407aa269c43167acc98f5f3c662d6177d3594d0cb800087c6a525c586d86c12e941b046625d90c8ec6dc8a5c546abb19a0b585aef39379db926691124265103bbb49cfc4e9100c803b4ef68a904273a6c899e48609bca003bcea9cf82203d52b5f9b65c409ba9503b3b16c7077465aae45d2cd4ada79ca43a9e99a124b7c9fa24a323f6c6bc18b81d9a6161191561f3776740b539479582a46bd913ad73e09000000000000000000000000000000000000000000000000000000 |
| 1789 | result: pass | 1789 | result: pass |
| 1790 | ciphertext: 79efa2d537baa2b87a787317162d3dbcb40cb3c25f540ddb91aea6cea9870bbc5a5f86f8900b913fd4154bcfc7c8a463b9b66118c502ddad539186fcb079664f44a5363cc8d80d6a4c09f28cf8952157526cfef7bad2fc2cb69ff03ac39e37d47faab64cf54f63919303badeaab9e59df7040511ae335c5230e46e00a666b994d647d11cb032e7ee235b5e18b1894621ae93ee129823334580381b857cf0360196cb75180410f9fe7558d0e189502a5dbac5b4f0597cb3d1d201f89de26f7b4ec0d200a418a26cfb82cd4496c3ee22f6eb60f3ad2e1af981c238da13063d1746d65f77ce0ef30894468b687b31443c7acacfc3b3878fc9ec56878e7bd1a9f72ecb1706a4e5face0a83282cbc2bd15c89afbe3c97dfaf395a96ffbe1a3f75af03311afc69dbc01b11ffed2aeb8906505e910105806febc6e1298fbb5c0bf501232b888b7e8b285953d250b866a20cfdc7833a732966b3a03485ae2852d0a3fbeec6dfd0ec8015db5de69e55f091e956ab4392834c5128417105541b1145b27175fe35efbf3102277b35e42bd83aac25e25da6c55c28a03b9e2a8135871b4cc49fbfd5598c9eaa2482f249c0b6332a6999306be55921a3016499bc63a072a6e9eac894a3ec209177d07208d0d271c47f8065d0facd2e975011944f7884088768fdc053cf86f31f6d348222c06467fcf8ce0d404a2558e8cc422521a4e249549037d3e8a29e03a9a9bb511d9ffef4c5185a380d874732c9e862a6e8fa3fb72b213dab2ad0d91b047440b1d334660067566e6d2e14765d8fd0a45b9b8e8566419a6d7138e5a106c31b1278d50027d152bc8658d7045cb2297bb8382585b38be2d5fafaa7e8c867c74be013793874f181a9798193dee26fd5812eb469d1b842a969cda65d3440c67b00e6d1c3ae8630165499c1b4cf3153fb5731916ab779a2562ec62637d747d61342d832aed330e5cd794de900fa507d4b5fbdbc5f3ec1aa69d0319b3644d46d9502d435c1b5a329c0d3524611a145e3024595e91c2afd577a422d59d4d54a430f439534003be467b6f018736c4bebceaf7c83c799c2b7745ce7498dc84b9e455b96410dba1a0a5720fe703b7c0d859a42445eee7ca3353f294438a7d463fc3e98f4403f93b5fc4add88cc22db7bba150a2988639ba96cba8e2a0c980c9bf8cebdb5beb262d79e86cceb774750cd9a192ae93d85e60722ec6590beb7df8e4d036837c97dc05c7964dab00034683a576da5b51aa8a0622edc27975978c7daf1b942285572b09c170dd332a99bbf703d84becc6a96373fd1c0b355f063e4c2c6e59f5437802676000a819b9b99418df893b98a8e6ca22d95da2c151fb24a3a0e5944ac4ca6376e6c281b275589a3907c0473282967a121f1792d09a15e9d71e71e73f9f627ef0dd478061cf053af434b0663624c3bbafe0f37d7a32504e9c686f41bf48e287aaa8fadb73fece907f26a9576611ab2176a58e5c1f3e98ec0248a15774434c2a81c7a8f57f9950b83c0d3770d17c4e57582387d6f19bd | 1790 | ciphertext: 79efa2d537baa2b87a787317162d3dbcb40cb3c25f540ddb91aea6cea9870bbc5a5f86f8900b913fd4154bcfc7c8a463b9b66118c502ddad539186fcb079664f44a5363cc8d80d6a4c09f28cf8952157526cfef7bad2fc2cb69ff03ac39e37d47faab64cf54f63919303badeaab9e59df7040511ae335c5230e46e00a666b994d647d11cb032e7ee235b5e18b1894621ae93ee129823334580381b857cf0360196cb75180410f9fe7558d0e189502a5dbac5b4f0597cb3d1d201f89de26f7b4ec0d200a418a26cfb82cd4496c3ee22f6eb60f3ad2e1af981c238da13063d1746d65f77ce0ef30894468b687b31443c7acacfc3b3878fc9ec56878e7bd1a9f72ecb1706a4e5face0a83282cbc2bd15c89afbe3c97dfaf395a96ffbe1a3f75af03311afc69dbc01b11ffed2aeb8906505e910105806febc6e1298fbb5c0bf501232b888b7e8b285953d250b866a20cfdc7833a732966b3a03485ae2852d0a3fbeec6dfd0ec8015db5de69e55f091e956ab4392834c5128417105541b1145b27175fe35efbf3102277b35e42bd83aac25e25da6c55c28a03b9e2a8135871b4cc49fbfd5598c9eaa2482f249c0b6332a6999306be55921a3016499bc63a072a6e9eac894a3ec209177d07208d0d271c47f8065d0facd2e975011944f7884088768fdc053cf86f31f6d348222c06467fcf8ce0d404a2558e8cc422521a4e249549037d3e8a29e03a9a9bb511d9ffef4c5185a380d874732c9e862a6e8fa3fb72b213dab2ad0d91b047440b1d334660067566e6d2e14765d8fd0a45b9b8e8566419a6d7138e5a106c31b1278d50027d152bc8658d7045cb2297bb8382585b38be2d5fafaa7e8c867c74be013793874f181a9798193dee26fd5812eb469d1b842a969cda65d3440c67b00e6d1c3ae8630165499c1b4cf3153fb5731916ab779a2562ec62637d747d61342d832aed330e5cd794de900fa507d4b5fbdbc5f3ec1aa69d0319b3644d46d9502d435c1b5a329c0d3524611a145e3024595e91c2afd577a422d59d4d54a430f439534003be467b6f018736c4bebceaf7c83c799c2b7745ce7498dc84b9e455b96410dba1a0a5720fe703b7c0d859a42445eee7ca3353f294438a7d463fc3e98f4403f93b5fc4add88cc22db7bba150a2988639ba96cba8e2a0c980c9bf8cebdb5beb262d79e86cceb774750cd9a192ae93d85e60722ec6590beb7df8e4d036837c97dc05c7964dab00034683a576da5b51aa8a0622edc27975978c7daf1b942285572b09c170dd332a99bbf703d84becc6a96373fd1c0b355f063e4c2c6e59f5437802676000a819b9b99418df893b98a8e6ca22d95da2c151fb24a3a0e5944ac4ca6376e6c281b275589a3907c0473282967a121f1792d09a15e9d71e71e73f9f627ef0dd478061cf053af434b0663624c3bbafe0f37d7a32504e9c686f41bf48e287aaa8fadb73fece907f26a9576611ab2176a58e5c1f3e98ec0248a15774434c2a81c7a8f57f9950b83c0d3770d17c4e57582387d6f19bd |
| 1791 | shared_secret: 2522e72d308dc9d7d701e0b024af9e15627572f13573b27c406fa750df9636fd | 1791 | shared_secret: 2522e72d308dc9d7d701e0b024af9e15627572f13573b27c406fa750df9636fd |
| 1792 | 1792 | ||
| 1793 | # Rho leads to a matrix with unusally large entries | 1793 | # Rho leads to a matrix with unusually large entries |
| 1794 | entropy: 319c51bcb76124b92f39820a5653c0ecfba79ec91d632b0488f4020e5df4e37a | 1794 | entropy: 319c51bcb76124b92f39820a5653c0ecfba79ec91d632b0488f4020e5df4e37a |
| 1795 | public_key = e2c1184862562b91806efa62f1b72a8ec43e70663de1f66a59687ae0cc1d9de1ce69244fccb0841b4b1de2e964e29408094a1ac0a9b4daa836e94454ebb942c6e9ac66f39abae73f61a99834292ada3c824bb53c8e67912a07377da92e63087f8d947f59d94a842b7aa8832b2c3c1aa957577f55027e76c106f86946f036804671b0e0416cf62e70eb8194d88030e2b38585181c4ab1fd8165a821bd68dc8fb3b403016ba5fd129bb9d23182029c4a292433087632816c009a237a608e65cbae17d688a326bd6c1ab4634576fdab2322b983f29c3e63b31303cc386bc90641c84965572c49a91f4e8258764834f38ca7f869cddbb10674d4296e5205ad805ac48462d3b31a9e6067fc0a27470aa593b896c3c319357b9bdf0632bf0786fadb0ac242609462a06f82460ea75762a678fcb07c350649d13c24c9e33200c9ca0e9bb87dd2c8578c7c4e27b1b75681a0b6aec6a55e767c4e14820f2ea609a16b862d5695556b0937f53e0ae370086c8f771295b1a09f0003a07bf512c4272f7241752a6603f8f51ea9a088e5263a59eb0b13b87a1d2929c2c29557681f180261f46c294de4aeaf380ca5f79efa2c64ed3131272ba489494ddbea14c69c46fd6346a7ec9f72d89559435e139a67bc3240bca29b3774127dd85d53c20bef719724612c462bc598c54738c87a00a9cb8c4b44e4e7ad4573afd9324fcab820cbf2091fd83fea52adc1b82b3f6c86369aa358498197631a20d40c790c2ddc66b0871c1ef882305bd978055bb934467d3ffc0359c2b31748cb19f615a63262fdf695f555be1ac432126b08e4a97acc18b8606ab6adc5cbe4589389e1121d737ba2b3a84d02bfbaa669f3a06b1be13fafd42a1773c830749cad35456e956c0ee64a5fcc46f1763c3b0c0d3de5c296a28f61194ae72979add8c7ce710d4ee846af81cba3e18d5e459addea9fb565b010e9ceed5798155227dcab155984635d7539d68c9f0d30537ce8b573b6bef1170540d0c10528737d6a5b219b2d96e5709a721b40536ee3c416fcec0bdba013b0fc0e786c9765d312692a80a5c9a3d65a6662788d194722d63b4bdcaa700e4c3daeb911e4d45674c3720be35269a21c0717a4c3aa2f3e1ab4f20a885cac44228138ebb70bb4548dedf8678d2163c339c1a9c719c2f1a51748571358c1451b0ced7b90109c98591126fbe57e1c913b5a935eff14450a22c4a108108b99b6efcc9bfd8438b5024677144885f1886ba068a6191ae17b9ffac1087bc94badf510095baa7167a7fe245a89a2a627d2631706a15d5aa081d037a4101b217c1c45fa0d83dc790447121cd9a533592cf8ac424de8770b45307f0aab484467c4acaa82a5669f7621e8ca42ec0b9222766b52775173b288ff5b01d70a60a853aa44917b8cd09a4b666138e91a3206c97877c96d690957b58553018f55f168c1c51bd9a48ae762a65dc73f366c79e77c42e793750924bcc1472cd5e552e20868a42047593842619c2e0fd40a3c7bba9557bb5c71185430a0158b9b95d04fefa266005141ffb4ba5160a5eee1499c09b11c549bc88cc501dc94a0a5828ee8a776a2a4aba3bafd410cc8354216cc3a93a457e9847af39b898b04b60a0c661a72a2df2b000000000000000000000000000000000000000000000000000000 | 1795 | public_key = e2c1184862562b91806efa62f1b72a8ec43e70663de1f66a59687ae0cc1d9de1ce69244fccb0841b4b1de2e964e29408094a1ac0a9b4daa836e94454ebb942c6e9ac66f39abae73f61a99834292ada3c824bb53c8e67912a07377da92e63087f8d947f59d94a842b7aa8832b2c3c1aa957577f55027e76c106f86946f036804671b0e0416cf62e70eb8194d88030e2b38585181c4ab1fd8165a821bd68dc8fb3b403016ba5fd129bb9d23182029c4a292433087632816c009a237a608e65cbae17d688a326bd6c1ab4634576fdab2322b983f29c3e63b31303cc386bc90641c84965572c49a91f4e8258764834f38ca7f869cddbb10674d4296e5205ad805ac48462d3b31a9e6067fc0a27470aa593b896c3c319357b9bdf0632bf0786fadb0ac242609462a06f82460ea75762a678fcb07c350649d13c24c9e33200c9ca0e9bb87dd2c8578c7c4e27b1b75681a0b6aec6a55e767c4e14820f2ea609a16b862d5695556b0937f53e0ae370086c8f771295b1a09f0003a07bf512c4272f7241752a6603f8f51ea9a088e5263a59eb0b13b87a1d2929c2c29557681f180261f46c294de4aeaf380ca5f79efa2c64ed3131272ba489494ddbea14c69c46fd6346a7ec9f72d89559435e139a67bc3240bca29b3774127dd85d53c20bef719724612c462bc598c54738c87a00a9cb8c4b44e4e7ad4573afd9324fcab820cbf2091fd83fea52adc1b82b3f6c86369aa358498197631a20d40c790c2ddc66b0871c1ef882305bd978055bb934467d3ffc0359c2b31748cb19f615a63262fdf695f555be1ac432126b08e4a97acc18b8606ab6adc5cbe4589389e1121d737ba2b3a84d02bfbaa669f3a06b1be13fafd42a1773c830749cad35456e956c0ee64a5fcc46f1763c3b0c0d3de5c296a28f61194ae72979add8c7ce710d4ee846af81cba3e18d5e459addea9fb565b010e9ceed5798155227dcab155984635d7539d68c9f0d30537ce8b573b6bef1170540d0c10528737d6a5b219b2d96e5709a721b40536ee3c416fcec0bdba013b0fc0e786c9765d312692a80a5c9a3d65a6662788d194722d63b4bdcaa700e4c3daeb911e4d45674c3720be35269a21c0717a4c3aa2f3e1ab4f20a885cac44228138ebb70bb4548dedf8678d2163c339c1a9c719c2f1a51748571358c1451b0ced7b90109c98591126fbe57e1c913b5a935eff14450a22c4a108108b99b6efcc9bfd8438b5024677144885f1886ba068a6191ae17b9ffac1087bc94badf510095baa7167a7fe245a89a2a627d2631706a15d5aa081d037a4101b217c1c45fa0d83dc790447121cd9a533592cf8ac424de8770b45307f0aab484467c4acaa82a5669f7621e8ca42ec0b9222766b52775173b288ff5b01d70a60a853aa44917b8cd09a4b666138e91a3206c97877c96d690957b58553018f55f168c1c51bd9a48ae762a65dc73f366c79e77c42e793750924bcc1472cd5e552e20868a42047593842619c2e0fd40a3c7bba9557bb5c71185430a0158b9b95d04fefa266005141ffb4ba5160a5eee1499c09b11c549bc88cc501dc94a0a5828ee8a776a2a4aba3bafd410cc8354216cc3a93a457e9847af39b898b04b60a0c661a72a2df2b000000000000000000000000000000000000000000000000000000 |
| 1796 | result: pass | 1796 | result: pass |
| 1797 | ciphertext: b0e578cabf9deab616e52934955f42eec74bde5ea98acb022c427e08232142dd08f9120eefe5f455c8f120e672cb68f3a146c3aa457b637d0901fe2b4cd45e8b208e06823b8aae09778cd00fff5bed5232d219a2c33645f2dc30593e591f697118a8472eadbce05c9fbbc5d4b717b880065173cc0854182555376dbbe39194e4204067358808c890e5fe96028921fca344e3500b615f2201a1c4e4d13dcc889cc9b1ac72429074c21a52f4c78ea2c467d65cd2c9ed682f21f31b27af4eb5cad33dd633185bf32e726fe6e57b03168803f693bd85f5a9f2c3ec6944e9ded2b8f3270a89139ce50ba6ded6bc6b0be8893f44aa5856acda60dc1c4c0834d45574ecb6183d6e59a183c0125ff45c718be2cf85b5ce6daae6e37336ea63856561f1bd4404df725d5ed9263038d1c623b2e1aeb35924b79de474407168834891af783fe5d83a631eb14d7cfa949d698ffa45e7d8c46ed4abf75cc666b78526c9b95ebb2920c77c56227eae6c893b57f9f463ff2ebc9acddb2f7ad543c5b2259047a4cc87ad05c08bbf02e8bb267bc490c4b67106fb598d42135c927fef3397f4c3f6838776787f23a9759dd3214075e79eb3929932becde84e82c257e4638a19e1e3312cfe09d4ac681d653d749c8fa6efa6dac35ad59399f1e233540fa354681ca55db90007039b7e504e2e4082aa3e4d672019741aa02a281454d4e1c73a1c7d0b5449c2e143ceaa3b18cb9a74a89f1ba74963dc5dd4155a356211277af3a267947700a2cfd84a605ab02d37bd6faa8a26b50f7b3d9bdc79913272c31dcc0f0183d05933a9f233504ddee2dd851529667ec5174a3d23bfca197538ebacda36bc29ca675384c0b3f45e4f67fb66d8dd4aa57b7da50ead391e6b663af173e7f4d46139f5d0f4cea84dd32e4e718967c6b93617271224f2fb3a1ca5febff5f26c4edc60e9acdd9e464ebb4571dced645814e1038a50515a7e06501adb2de19fec4119dec7548c41097964c3151226153ccac24abd1415579ba1c37c805a5827332d97ba90713829fb30b7b09b275d75bc10d4a26b33980a0ccd4b00844d9f379551bd0170ee895286526ea9625a72b6cb8decd9cf18e57262f8102a025025e8168465a65a7c7e4d5fc8742781acdc16171085d51dd5ec9f4f71f58cfaf4557a55d07e7c164ccf7eb427145c7f9a800e9bd9192ec0f74d19fc17d3881b1d55e8600aa55abf78fd1e226d9dd6e8da2bea15712f5f43325d4b9c083d6e37d35c043f2bc8c796ade072555263331bee7fffa54e2099135ea363575847abb770322376cbfd3f1b7980a1857c55fc82aa80bdcd701c7b7d66221f08492efb5438a04d041b485bcb61f6fd306e96cfe758d99ca1cee70b200eedee86145fe37ab7aafcfbb2df694361fe9923e754187c3277cc895c4a53732ee118c7b6156b55b30847a6e828b7069a5d4be623abff66ba87bff49294dd9b1f698ba445d610973d052a80691c9968e3179aa3eea5b0bccb3cf674c5cfe7d2c14d7b6daa7a4813abcd56ef930099 | 1797 | ciphertext: b0e578cabf9deab616e52934955f42eec74bde5ea98acb022c427e08232142dd08f9120eefe5f455c8f120e672cb68f3a146c3aa457b637d0901fe2b4cd45e8b208e06823b8aae09778cd00fff5bed5232d219a2c33645f2dc30593e591f697118a8472eadbce05c9fbbc5d4b717b880065173cc0854182555376dbbe39194e4204067358808c890e5fe96028921fca344e3500b615f2201a1c4e4d13dcc889cc9b1ac72429074c21a52f4c78ea2c467d65cd2c9ed682f21f31b27af4eb5cad33dd633185bf32e726fe6e57b03168803f693bd85f5a9f2c3ec6944e9ded2b8f3270a89139ce50ba6ded6bc6b0be8893f44aa5856acda60dc1c4c0834d45574ecb6183d6e59a183c0125ff45c718be2cf85b5ce6daae6e37336ea63856561f1bd4404df725d5ed9263038d1c623b2e1aeb35924b79de474407168834891af783fe5d83a631eb14d7cfa949d698ffa45e7d8c46ed4abf75cc666b78526c9b95ebb2920c77c56227eae6c893b57f9f463ff2ebc9acddb2f7ad543c5b2259047a4cc87ad05c08bbf02e8bb267bc490c4b67106fb598d42135c927fef3397f4c3f6838776787f23a9759dd3214075e79eb3929932becde84e82c257e4638a19e1e3312cfe09d4ac681d653d749c8fa6efa6dac35ad59399f1e233540fa354681ca55db90007039b7e504e2e4082aa3e4d672019741aa02a281454d4e1c73a1c7d0b5449c2e143ceaa3b18cb9a74a89f1ba74963dc5dd4155a356211277af3a267947700a2cfd84a605ab02d37bd6faa8a26b50f7b3d9bdc79913272c31dcc0f0183d05933a9f233504ddee2dd851529667ec5174a3d23bfca197538ebacda36bc29ca675384c0b3f45e4f67fb66d8dd4aa57b7da50ead391e6b663af173e7f4d46139f5d0f4cea84dd32e4e718967c6b93617271224f2fb3a1ca5febff5f26c4edc60e9acdd9e464ebb4571dced645814e1038a50515a7e06501adb2de19fec4119dec7548c41097964c3151226153ccac24abd1415579ba1c37c805a5827332d97ba90713829fb30b7b09b275d75bc10d4a26b33980a0ccd4b00844d9f379551bd0170ee895286526ea9625a72b6cb8decd9cf18e57262f8102a025025e8168465a65a7c7e4d5fc8742781acdc16171085d51dd5ec9f4f71f58cfaf4557a55d07e7c164ccf7eb427145c7f9a800e9bd9192ec0f74d19fc17d3881b1d55e8600aa55abf78fd1e226d9dd6e8da2bea15712f5f43325d4b9c083d6e37d35c043f2bc8c796ade072555263331bee7fffa54e2099135ea363575847abb770322376cbfd3f1b7980a1857c55fc82aa80bdcd701c7b7d66221f08492efb5438a04d041b485bcb61f6fd306e96cfe758d99ca1cee70b200eedee86145fe37ab7aafcfbb2df694361fe9923e754187c3277cc895c4a53732ee118c7b6156b55b30847a6e828b7069a5d4be623abff66ba87bff49294dd9b1f698ba445d610973d052a80691c9968e3179aa3eea5b0bccb3cf674c5cfe7d2c14d7b6daa7a4813abcd56ef930099 |
| 1798 | shared_secret: 1cffb3d6d9dd9cf90d79fb2c5c974818c5bd6f32ea4d44c302337c4cbea44334 | 1798 | shared_secret: 1cffb3d6d9dd9cf90d79fb2c5c974818c5bd6f32ea4d44c302337c4cbea44334 |
| 1799 | 1799 | ||
| 1800 | # Rho leads to a matrix with unusally large entries | 1800 | # Rho leads to a matrix with unusually large entries |
| 1801 | entropy: 00ff48b3769ffaf4e91c1c9110eb8ce9e2cb99f060b486b37035407d2f4ca517 | 1801 | entropy: 00ff48b3769ffaf4e91c1c9110eb8ce9e2cb99f060b486b37035407d2f4ca517 |
| 1802 | public_key = e8014b4f4687bb6670b1c2a29ba577100943d5b926cb396423663f710328a8b536403530eee05006e7a7cd679ea44c29146494f1775cddd3b43ce6a903283f7890979ee98842d5a76f93777297abffccc0b8faace8f362c081aa435c32a5c31773bc046e61921f1a5707579fe36067588a0f32e2cbf91aa3ca6b38a0e12ffdf8685874869028775fcb7d7fd7a1e37c611316515638a510a13e950960e6f39395e436821165e734837ed575ad510d4fba6c3ad67e039b71a9b6c2a7ac240ccb3742d65b4b1c50a6a1a496995da77921ce33624fc48135e88c59caa47b299605ac1c79009dabb2062e375547ec907590b9bec52c86a6b9e394ba5f02401e4545c462c5f320939075b516c4a5dd0aa5d879456449a115125369584a609a83df8685ed2ab45f038559dc6b0ea170b09680e7e747cc7246b6c182d9199941847d9c1168a84400da2a98215a9e96f6bc869035a8822b27d459cb52147d966e0c354b70ecbe46daa9034074019acdac30055d8a1a02741ed8e602e2cb3185ea44c9e61fab637188554c8b12cc5abb9073b35108f59f6832112ff23b00acb0936594c00c0534a8c4c11cae4787092bf497b60b4a44116156e8368c0c950f3677f6424690803ee92373ed5c13d84c355bf041edcc872965816d6723b344244d0a54f8ecb0f1703ac251293503baac445996a1c9bd6ab851eb52f042692a2b10e4b9b44dc9625973af03fba67a3a93ff849dbea64739f643bfb803ea8653c2b9ab9639614000994bf48a8024c4e61c8a07a5c79b19540084bc7664ad44122e46ca1fbd517c8e68aeb3d835e53846848742a9fc2a4058047969bc11a773e623462c7bac66a34c62db861ef64dedf23c0b7441f6b75b4e60b86fe309b1b7746d558987f6a92cb8513792360ef76cb6548f0813ae8dbac418c25a1d95b06c530d79c6751e7569a2027f8a5354de3a70752764fabc632f3a1bf2473e8aa2a5cf815b3856a89afc122d98ba3f74185a3b2c09049601e23ee226329f024ac2692adccb2018b22a592a450b4a5819b2a498738d29f7145e534e527c859f05ad96cb963314c58a5a6b050ac6ead9adc4782859e3383170cabe4871cfc17a30ea4ac55cb998e77e1a26662a255f99f4ac7b98723341b2c7134adcdcab12a473bfe001127bcb01f84df31384af06171776263085bed1aa3374da7136648608b569a88663d2122e84b4b946b35c1f24a836e924202b7c7828c15507b17f906bc0e4b28c230134d90655696edde11a32c7a70303aaae3363e2a6947b4bccefe9ce62953f92521029959096a8910e71c51b69a0615ac790341c0ac3a574a79d34c11b4a974ffd7cccb05995d4089f8186b545b80a166982cb53123ef644e82897c77889ef91bd8c5a4ed1a4a414389d77307d53487940fa32782061e8458e0c601c884321d121b48ec04bca78c60d39b0c4bc9291945ae18224ec73ab7a451b9cb511bae34a20e326a497cb6ce46b5848c289da630f497ea3975eda79489f18a405e91bde288379f291f538c1a1426cf1634bc033098bbc9958f7af6e408354314e7221c37c1610bf904cf9e7807ad327f0f316761939674867ec7223f06a245711b0d47832b1a699badc8e1217798c0d000000000000000000000000000000000000000000000000000000 | 1802 | public_key = e8014b4f4687bb6670b1c2a29ba577100943d5b926cb396423663f710328a8b536403530eee05006e7a7cd679ea44c29146494f1775cddd3b43ce6a903283f7890979ee98842d5a76f93777297abffccc0b8faace8f362c081aa435c32a5c31773bc046e61921f1a5707579fe36067588a0f32e2cbf91aa3ca6b38a0e12ffdf8685874869028775fcb7d7fd7a1e37c611316515638a510a13e950960e6f39395e436821165e734837ed575ad510d4fba6c3ad67e039b71a9b6c2a7ac240ccb3742d65b4b1c50a6a1a496995da77921ce33624fc48135e88c59caa47b299605ac1c79009dabb2062e375547ec907590b9bec52c86a6b9e394ba5f02401e4545c462c5f320939075b516c4a5dd0aa5d879456449a115125369584a609a83df8685ed2ab45f038559dc6b0ea170b09680e7e747cc7246b6c182d9199941847d9c1168a84400da2a98215a9e96f6bc869035a8822b27d459cb52147d966e0c354b70ecbe46daa9034074019acdac30055d8a1a02741ed8e602e2cb3185ea44c9e61fab637188554c8b12cc5abb9073b35108f59f6832112ff23b00acb0936594c00c0534a8c4c11cae4787092bf497b60b4a44116156e8368c0c950f3677f6424690803ee92373ed5c13d84c355bf041edcc872965816d6723b344244d0a54f8ecb0f1703ac251293503baac445996a1c9bd6ab851eb52f042692a2b10e4b9b44dc9625973af03fba67a3a93ff849dbea64739f643bfb803ea8653c2b9ab9639614000994bf48a8024c4e61c8a07a5c79b19540084bc7664ad44122e46ca1fbd517c8e68aeb3d835e53846848742a9fc2a4058047969bc11a773e623462c7bac66a34c62db861ef64dedf23c0b7441f6b75b4e60b86fe309b1b7746d558987f6a92cb8513792360ef76cb6548f0813ae8dbac418c25a1d95b06c530d79c6751e7569a2027f8a5354de3a70752764fabc632f3a1bf2473e8aa2a5cf815b3856a89afc122d98ba3f74185a3b2c09049601e23ee226329f024ac2692adccb2018b22a592a450b4a5819b2a498738d29f7145e534e527c859f05ad96cb963314c58a5a6b050ac6ead9adc4782859e3383170cabe4871cfc17a30ea4ac55cb998e77e1a26662a255f99f4ac7b98723341b2c7134adcdcab12a473bfe001127bcb01f84df31384af06171776263085bed1aa3374da7136648608b569a88663d2122e84b4b946b35c1f24a836e924202b7c7828c15507b17f906bc0e4b28c230134d90655696edde11a32c7a70303aaae3363e2a6947b4bccefe9ce62953f92521029959096a8910e71c51b69a0615ac790341c0ac3a574a79d34c11b4a974ffd7cccb05995d4089f8186b545b80a166982cb53123ef644e82897c77889ef91bd8c5a4ed1a4a414389d77307d53487940fa32782061e8458e0c601c884321d121b48ec04bca78c60d39b0c4bc9291945ae18224ec73ab7a451b9cb511bae34a20e326a497cb6ce46b5848c289da630f497ea3975eda79489f18a405e91bde288379f291f538c1a1426cf1634bc033098bbc9958f7af6e408354314e7221c37c1610bf904cf9e7807ad327f0f316761939674867ec7223f06a245711b0d47832b1a699badc8e1217798c0d000000000000000000000000000000000000000000000000000000 |
| 1803 | result: pass | 1803 | result: pass |
| 1804 | ciphertext: 3159aa52482f4262cee553f9eb6d853d091a507831f5ed1af37b9c55f217eb1e87e8b0dfb653932c27e9e9f2c4d45cf89e9cfe9ba0d5175be56b7fe3751a4255649cfabdf0cbd5a8704d58511acf6e0580eed572561fab262b24d39c3a430a4e54fca969394037df12fd8cd71b7b6ec3d8f7345b05d4c16c5871b686690cee9804012a3379bbcf720f405c3c83f59aa391cefd8b00a73b41147d42c8b7820b0e779c44e032209067349fa4cd35e83850ae37ee73f96fc6bc5b71ff9b0462604b4e07be60cc76903175b045b908c9b8e7e94c6bc7c48ffd49698873913f9132025e51614317d27a874e319d802923804d1ce1626420d5794bbbe5e077cbd7fa3d958fb2d9608a3d41f605908d21fc7f942e3152337115a28b661f76405620b056692bfcc066f370449628f8e31b7453e5b7b10702f7c195dfb779fb3253f86acbaf4444ba9ce01c9b043133a233030247f8fc44d5b8c9b024ee83c186a62ba9fa5a3e45389217884a478f238d6a9b8eaf3d87b7b4b4375d4d5226dfb80255faab42380365b5511567978be9726d21178eced7294463a348b1e976d800b1114fb8230115b28e51f628a31aa8cf2e3253a7dccaa37f975fa2b8d32a6b6147033cfcbde33ab8857e3a6af95e4cd0db62fc020f55c2d6c9204a05835e2cf878c66502f572016d95b30c45c2ef6048471ad0cb7fe14250dddcb4014c392c22fb1dce1adc8e02f416d3e9b417f41c1b4065b975de472d0e9fd5b3a012ee9bf6311345b4968f6f18262bfc2a38d56d911f9efb981813f77a8a8d6af0618e015b8b005e7ea957f89f140192c7442a645ea7012b5ea2ba9f8cd2fea2ad3e41c6a57582237d53444fceaa933d61eac36d03a2865bfb7f12fd8cf451edb5050a35a75c95dd328296dc32daf61622ce0cc457c5968414b634b3e12a0ce45bbd733e3982c087a037d89cc86d546007bd92eef33949d19dbd4daa18e59c7ea3572bf3155a9a46af527347f4f4dcc2be3cc285d65f2f86c681a137850431ce8d2f76e295e74bd0b3c88f1b68885522dadb99fe1c8e40d938c9610e466770d62c34e9393241907d9cd7bfa470cb8fc149306d9450a7a1887d03cddad3fcdeda1ea54d3f126bb29a1ac3d7c5a60ead90d74ccbf1a75b4289a74a49e0a7c4006ab76a83915ebd4a95a471525444dd2c3e748b1bd347774e2cf01f90f05a1672c58f4f563e4da083e95e0fadd4ba57acebcb45611a3923da1d0d73f5c9a55489fb0097e123694e413460252892a0c6317dcb56efa834f7a51db4a413976afcb30ab4dafbe737f43da11c1b08a2472cdff3995dd7d23382b866873624fedee76823d37ec230dee2107258993d5b802fadeb89c9469a33c66c91567ea92581e0c2c1eaa2e2a4696b024c7c6009687d07769438a8b2ba75a7bfb32841dab8acfb8cbd4d1e26c5eb68bc49bb394b178e6f89dde843f4e2c5353b04390c245a0bddd1aeaefb87528b719fe42b35ad2a89ef34826d9e23f95b1bd3c3b24f785985e10dcaf0eb33f5f71f5cbe55 | 1804 | ciphertext: 3159aa52482f4262cee553f9eb6d853d091a507831f5ed1af37b9c55f217eb1e87e8b0dfb653932c27e9e9f2c4d45cf89e9cfe9ba0d5175be56b7fe3751a4255649cfabdf0cbd5a8704d58511acf6e0580eed572561fab262b24d39c3a430a4e54fca969394037df12fd8cd71b7b6ec3d8f7345b05d4c16c5871b686690cee9804012a3379bbcf720f405c3c83f59aa391cefd8b00a73b41147d42c8b7820b0e779c44e032209067349fa4cd35e83850ae37ee73f96fc6bc5b71ff9b0462604b4e07be60cc76903175b045b908c9b8e7e94c6bc7c48ffd49698873913f9132025e51614317d27a874e319d802923804d1ce1626420d5794bbbe5e077cbd7fa3d958fb2d9608a3d41f605908d21fc7f942e3152337115a28b661f76405620b056692bfcc066f370449628f8e31b7453e5b7b10702f7c195dfb779fb3253f86acbaf4444ba9ce01c9b043133a233030247f8fc44d5b8c9b024ee83c186a62ba9fa5a3e45389217884a478f238d6a9b8eaf3d87b7b4b4375d4d5226dfb80255faab42380365b5511567978be9726d21178eced7294463a348b1e976d800b1114fb8230115b28e51f628a31aa8cf2e3253a7dccaa37f975fa2b8d32a6b6147033cfcbde33ab8857e3a6af95e4cd0db62fc020f55c2d6c9204a05835e2cf878c66502f572016d95b30c45c2ef6048471ad0cb7fe14250dddcb4014c392c22fb1dce1adc8e02f416d3e9b417f41c1b4065b975de472d0e9fd5b3a012ee9bf6311345b4968f6f18262bfc2a38d56d911f9efb981813f77a8a8d6af0618e015b8b005e7ea957f89f140192c7442a645ea7012b5ea2ba9f8cd2fea2ad3e41c6a57582237d53444fceaa933d61eac36d03a2865bfb7f12fd8cf451edb5050a35a75c95dd328296dc32daf61622ce0cc457c5968414b634b3e12a0ce45bbd733e3982c087a037d89cc86d546007bd92eef33949d19dbd4daa18e59c7ea3572bf3155a9a46af527347f4f4dcc2be3cc285d65f2f86c681a137850431ce8d2f76e295e74bd0b3c88f1b68885522dadb99fe1c8e40d938c9610e466770d62c34e9393241907d9cd7bfa470cb8fc149306d9450a7a1887d03cddad3fcdeda1ea54d3f126bb29a1ac3d7c5a60ead90d74ccbf1a75b4289a74a49e0a7c4006ab76a83915ebd4a95a471525444dd2c3e748b1bd347774e2cf01f90f05a1672c58f4f563e4da083e95e0fadd4ba57acebcb45611a3923da1d0d73f5c9a55489fb0097e123694e413460252892a0c6317dcb56efa834f7a51db4a413976afcb30ab4dafbe737f43da11c1b08a2472cdff3995dd7d23382b866873624fedee76823d37ec230dee2107258993d5b802fadeb89c9469a33c66c91567ea92581e0c2c1eaa2e2a4696b024c7c6009687d07769438a8b2ba75a7bfb32841dab8acfb8cbd4d1e26c5eb68bc49bb394b178e6f89dde843f4e2c5353b04390c245a0bddd1aeaefb87528b719fe42b35ad2a89ef34826d9e23f95b1bd3c3b24f785985e10dcaf0eb33f5f71f5cbe55 |
| 1805 | shared_secret: fd9e333ac811ae8be12c052c65131e3a7a32ce82e39055012ea564e10acaa85e | 1805 | shared_secret: fd9e333ac811ae8be12c052c65131e3a7a32ce82e39055012ea564e10acaa85e |
| 1806 | 1806 | ||
| 1807 | # Rho leads to a matrix with unusally large entries | 1807 | # Rho leads to a matrix with unusually large entries |
| 1808 | entropy: 4960ccb1276f96d7aa55885b6ae6f90343d42e1391e8241b5952931a979837e1 | 1808 | entropy: 4960ccb1276f96d7aa55885b6ae6f90343d42e1391e8241b5952931a979837e1 |
| 1809 | public_key = f6513e1ec8234bc145eba3446eec18b3826b2ae709792648e071a7c4627e4ac7716db5b1d6040ba7b8ac39b347ef721a99c879453846e1aa591b8495e19003df973580d4192cabb72ae2b1f498bae9b3cfffc8bbce09122cd1910a406574106810dc556894777f35316c992f3b902186dba411ca3462b927688c81f7269b7c2770de5aaf90c81f752a3ec77942729a68fcb38a62946c601c945249bf0e280b66764ba71a44134ba84df1400bebccc61456fdf3bf50aa85e8e60f491ac1c1317d831ba5db6601133883fda81115c67fe4691d9df01fd3732b336bbc3899cf067b9e3905294902ca5686480cc94eb4e98260408b4dd060cf4b5344380c89d564b31158ce098ce1e06b91446c4189c6a4d89aa7e81befa900b250a7060406e25725e09399963c5e3e04219d390e6c28983e335646485023312c4d5bcad9aa7ee683b935d71af1908703fa2c9d66c8b6c55049b3319d39c047b5824d04975a9034e8ca1a9e1a5b0bcb222c5b5c848818d14503c31270d4f8446d013d4ecbc250b72dc25934726b426afc85631ca1065ca6e957ba00f1176a6a45b68a5e93274423e642451129ce83b7de439963c0c4e5d8b25f3b74fc053151610b4263725fe51423e886bed19c534165b4cc90fbd67256839b9371290af9853c948251c768e157041ac91fe6649bd1b1855dc417624b8ca0d798b1947c720b3414db56f01500fba30207322ede05612bb6505818a9a68538c9eb98f2b0a83dd38b765891f0d01f1db768d2355fc6b7a47414527c92ba104637072a72a6c0ce74772664e68660c9c0c28347315b17273a6846a79904a04b90a60c5b15973630209d9460365529bb72524404b3d9cacc013b0a7355a7eb2172d317cd356a07e5a341bab7c33db5a48fca4b1600443df6bf441983cc05125f6aa94f114a8c3ccea3f9c498c1126c072f27e97555456114f6bb3244c4698c3f6091864274a16bd82aaf0711eb8c4fd86a11b35b3b8b0528cefc253d7906b6b05382e37428253ebda5b48b6a068354381b24348dec73c279010bd32e41431d139a021a398f0e5c7fc1a98863f069b9d42a96b029455670caa89e0b867781f73fb7549392124485cb032a008d63812f832cab899a8d5d24b403e76d17d6ccb56c729e15abb2e04e32928c9b8971be6a4c70b15bee620eef375489347df7c622d9a803a86c2a9ec5a7a0554ff763912bcb7f57eb8b8633cf6ef39556162eadf8c285b61a53f4837c8c9ef48c3a58b3b6c31b8227c98df0b9057d452df2c258da8a1de1b99449c0054c48a0bc61a2336323367077cee252d366661904b12ea6215b3ba55aab06f60a517704a4046312731325df563cbed805e2c7b2a5848fa1cb97e17a2f926664c2947a2fdb56ed1b3c5e084a680073669b2b9e888ee010410acba461910795958e7c0c98294865cc700315e86a5c54912dc2affc2469244912d8180eab244332a00b7536c4cab62345872dc31ca3c0d2078d07beda4431f278aeaf2482cde53afc56352a894dfe3948fc14956917a4dc836f54369eacd4af052b4aa6b60af5e86bc868be275abd1118a83e5acfdcd4c92a3c2e2b13cce7101a9d303339f0b2dd4a282499579b803ede0b26c75eb8af34000000000000000000000000000000000000000000000000000000 | 1809 | public_key = f6513e1ec8234bc145eba3446eec18b3826b2ae709792648e071a7c4627e4ac7716db5b1d6040ba7b8ac39b347ef721a99c879453846e1aa591b8495e19003df973580d4192cabb72ae2b1f498bae9b3cfffc8bbce09122cd1910a406574106810dc556894777f35316c992f3b902186dba411ca3462b927688c81f7269b7c2770de5aaf90c81f752a3ec77942729a68fcb38a62946c601c945249bf0e280b66764ba71a44134ba84df1400bebccc61456fdf3bf50aa85e8e60f491ac1c1317d831ba5db6601133883fda81115c67fe4691d9df01fd3732b336bbc3899cf067b9e3905294902ca5686480cc94eb4e98260408b4dd060cf4b5344380c89d564b31158ce098ce1e06b91446c4189c6a4d89aa7e81befa900b250a7060406e25725e09399963c5e3e04219d390e6c28983e335646485023312c4d5bcad9aa7ee683b935d71af1908703fa2c9d66c8b6c55049b3319d39c047b5824d04975a9034e8ca1a9e1a5b0bcb222c5b5c848818d14503c31270d4f8446d013d4ecbc250b72dc25934726b426afc85631ca1065ca6e957ba00f1176a6a45b68a5e93274423e642451129ce83b7de439963c0c4e5d8b25f3b74fc053151610b4263725fe51423e886bed19c534165b4cc90fbd67256839b9371290af9853c948251c768e157041ac91fe6649bd1b1855dc417624b8ca0d798b1947c720b3414db56f01500fba30207322ede05612bb6505818a9a68538c9eb98f2b0a83dd38b765891f0d01f1db768d2355fc6b7a47414527c92ba104637072a72a6c0ce74772664e68660c9c0c28347315b17273a6846a79904a04b90a60c5b15973630209d9460365529bb72524404b3d9cacc013b0a7355a7eb2172d317cd356a07e5a341bab7c33db5a48fca4b1600443df6bf441983cc05125f6aa94f114a8c3ccea3f9c498c1126c072f27e97555456114f6bb3244c4698c3f6091864274a16bd82aaf0711eb8c4fd86a11b35b3b8b0528cefc253d7906b6b05382e37428253ebda5b48b6a068354381b24348dec73c279010bd32e41431d139a021a398f0e5c7fc1a98863f069b9d42a96b029455670caa89e0b867781f73fb7549392124485cb032a008d63812f832cab899a8d5d24b403e76d17d6ccb56c729e15abb2e04e32928c9b8971be6a4c70b15bee620eef375489347df7c622d9a803a86c2a9ec5a7a0554ff763912bcb7f57eb8b8633cf6ef39556162eadf8c285b61a53f4837c8c9ef48c3a58b3b6c31b8227c98df0b9057d452df2c258da8a1de1b99449c0054c48a0bc61a2336323367077cee252d366661904b12ea6215b3ba55aab06f60a517704a4046312731325df563cbed805e2c7b2a5848fa1cb97e17a2f926664c2947a2fdb56ed1b3c5e084a680073669b2b9e888ee010410acba461910795958e7c0c98294865cc700315e86a5c54912dc2affc2469244912d8180eab244332a00b7536c4cab62345872dc31ca3c0d2078d07beda4431f278aeaf2482cde53afc56352a894dfe3948fc14956917a4dc836f54369eacd4af052b4aa6b60af5e86bc868be275abd1118a83e5acfdcd4c92a3c2e2b13cce7101a9d303339f0b2dd4a282499579b803ede0b26c75eb8af34000000000000000000000000000000000000000000000000000000 |
| 1810 | result: pass | 1810 | result: pass |
| 1811 | ciphertext: 5ab063c95a541d1be3fa0744e0db7e0ece17b6b47cca0fa41d08e7969fe87de63f319f80b9a31ff01e203de6e518e62e6133edd108e5a3e08d3f8ae0556cfd36b399dc1ebf3b229bc5013d06d7550512280bad2b27657d3ca0679d9fc62f0bf875dd0b326008a89b4f29e97211ee7ec75108a9e4a320a34daed15fd7ad394a1747e4e35bbe4f1118703c330aea81bef3e3883fd41c3efc3423ab46b553c7587894ad64db57bb0fe4d289d54c8ba78d40683bdf6330ccecbacd3f7f41541f1f2b1a7626d3969df6586b4214c02f921451f6adc04f5e8de1e3beda82e4aebc5e06abb33f4cd8a3b3b5741617b6a385739133cf5b77dd5607a5c8721d5b51c6c0b6df551a5b440082093f49f31910a04e4226b9ae6f41383672e0694bc4075207034e39c40668aa3174cfc8a75fb1a474485e9aff01f3572a5c7e4914e7519344c8ce7b81377d8c2af66bebc558359601b21beb984c1f00564d46585b4bf02c958c6b348642be25119b12f34a6e5755588f649837ba53c0efaa4c6c95d109a4ce1f761c1dcecb84cce8376cb1c4e34ff932408ccd2d06f20c5397f6277bf9c3234b20cedd45afecb7e87793d85af15909546c6ee41987f36d85865c8c1e281e13d9575abb9a9f215c08d89420535f73643dc584707deb7d5275252e862393fb6493f9e126c651b7981f26af8daf978153fa4476d615183bf147629fe36de7cceaa670dab930ba8a684b0bee24b55961ea556123b34e29491704d2122e46bed0f6fd50601e13a5d46c907b915f3b8e695e0bbf474aab6e082d156e79e59572731b48338892f2268dcbb8fc21cfd537979278ceb210fe3efd052365fa249c97e8e596ae6225839e5b8b296770f3b42240b8727a0a730534d0f42f8c6ef148fc04e4285e1aecf060c3666fc17a1ff794f584b26b0b1c41f0fcca249935cd411a151932b09402016a99832850b3f56c4846145738f709f5e11e28a90d9137e4e43f03dd1ddb6565c67c2a138aca59e8aebcfa61984bc7ac13a60ddd2c1f0fa84fcf9264ad5049c888b9f555e024f0fa685474e083025da168e3b9c4ad91f074e7e711f84bb808604114e09d1ceb83b697cc0f045b5089b0bf7381ff2efc08e7316ddb7eb7be47a1d82cf533ea898e668f0da124d2e87fef2b558f877b50b13a08641c74e2726b19fa7c0f33ab213f403c328ea60d08c07155ca0c19bb75f7f6716de89e34c20f9d15ba8aebcb98e9b6461477f56f9c65ea7e8744a4d7306e216f806ea8f9f1dc45781c1adba44319031fb9e81c6d33bb317d959bc53a677270f13d96da19833965aea9a18172f6f975bc4d03036b1239e7c315ecacec35cc0f788be1220c0497844fe7c989fff5ef7fcdf89c261a0fed3915cbfae94b1fba22827daaaaa0f968f1ac71e9772aed587d607d5d3f57c1500b6e08760e0b971c1999d01553bf87f55fbad96ce61d0750d75180623543f40e5b0cee74bb429edbed1b4c2a3e1aab86c8dc7381afb0b9e7d4151a3f76b7dec4199b97304d7b3845788e19126e | 1811 | ciphertext: 5ab063c95a541d1be3fa0744e0db7e0ece17b6b47cca0fa41d08e7969fe87de63f319f80b9a31ff01e203de6e518e62e6133edd108e5a3e08d3f8ae0556cfd36b399dc1ebf3b229bc5013d06d7550512280bad2b27657d3ca0679d9fc62f0bf875dd0b326008a89b4f29e97211ee7ec75108a9e4a320a34daed15fd7ad394a1747e4e35bbe4f1118703c330aea81bef3e3883fd41c3efc3423ab46b553c7587894ad64db57bb0fe4d289d54c8ba78d40683bdf6330ccecbacd3f7f41541f1f2b1a7626d3969df6586b4214c02f921451f6adc04f5e8de1e3beda82e4aebc5e06abb33f4cd8a3b3b5741617b6a385739133cf5b77dd5607a5c8721d5b51c6c0b6df551a5b440082093f49f31910a04e4226b9ae6f41383672e0694bc4075207034e39c40668aa3174cfc8a75fb1a474485e9aff01f3572a5c7e4914e7519344c8ce7b81377d8c2af66bebc558359601b21beb984c1f00564d46585b4bf02c958c6b348642be25119b12f34a6e5755588f649837ba53c0efaa4c6c95d109a4ce1f761c1dcecb84cce8376cb1c4e34ff932408ccd2d06f20c5397f6277bf9c3234b20cedd45afecb7e87793d85af15909546c6ee41987f36d85865c8c1e281e13d9575abb9a9f215c08d89420535f73643dc584707deb7d5275252e862393fb6493f9e126c651b7981f26af8daf978153fa4476d615183bf147629fe36de7cceaa670dab930ba8a684b0bee24b55961ea556123b34e29491704d2122e46bed0f6fd50601e13a5d46c907b915f3b8e695e0bbf474aab6e082d156e79e59572731b48338892f2268dcbb8fc21cfd537979278ceb210fe3efd052365fa249c97e8e596ae6225839e5b8b296770f3b42240b8727a0a730534d0f42f8c6ef148fc04e4285e1aecf060c3666fc17a1ff794f584b26b0b1c41f0fcca249935cd411a151932b09402016a99832850b3f56c4846145738f709f5e11e28a90d9137e4e43f03dd1ddb6565c67c2a138aca59e8aebcfa61984bc7ac13a60ddd2c1f0fa84fcf9264ad5049c888b9f555e024f0fa685474e083025da168e3b9c4ad91f074e7e711f84bb808604114e09d1ceb83b697cc0f045b5089b0bf7381ff2efc08e7316ddb7eb7be47a1d82cf533ea898e668f0da124d2e87fef2b558f877b50b13a08641c74e2726b19fa7c0f33ab213f403c328ea60d08c07155ca0c19bb75f7f6716de89e34c20f9d15ba8aebcb98e9b6461477f56f9c65ea7e8744a4d7306e216f806ea8f9f1dc45781c1adba44319031fb9e81c6d33bb317d959bc53a677270f13d96da19833965aea9a18172f6f975bc4d03036b1239e7c315ecacec35cc0f788be1220c0497844fe7c989fff5ef7fcdf89c261a0fed3915cbfae94b1fba22827daaaaa0f968f1ac71e9772aed587d607d5d3f57c1500b6e08760e0b971c1999d01553bf87f55fbad96ce61d0750d75180623543f40e5b0cee74bb429edbed1b4c2a3e1aab86c8dc7381afb0b9e7d4151a3f76b7dec4199b97304d7b3845788e19126e |
| 1812 | shared_secret: b4b4634ad37852e19175ccfb5eca50093291da8f76b86be7511379188bc20d92 | 1812 | shared_secret: b4b4634ad37852e19175ccfb5eca50093291da8f76b86be7511379188bc20d92 |
| 1813 | 1813 | ||
| 1814 | # Rho leads to a matrix with unusally large entries | 1814 | # Rho leads to a matrix with unusually large entries |
| 1815 | entropy: 456be124e7f43803de5f734ea016455d68164a7f054c003f4ef49e46f42dd8d0 | 1815 | entropy: 456be124e7f43803de5f734ea016455d68164a7f054c003f4ef49e46f42dd8d0 |
| 1816 | public_key = b0abba905c1559715f25f720b7b745a52332355154e60577e598c754b6346b335b0195ac305268bae78bb4617807ca4666738ca81515bb041d43a4188003c52ac4ae4b3808d8c755d3e99d00537249d39d4cc02ed9f98ed4106895666c47538f79e30f5104adab1540a1fc58d1a857a1a4611257be37e0327491aa4b543aa6322ef7816a5c9a55eb3bc8604b15540b62c3405b861a84218211c20bc3d35a8a506b0153306fa98b9488a7841d85197c170f84c380098077e42cafdf1913df369f37f3291ec47289710c57f152b74572c23324f83618fd281f5e41976e77097a570a991b3bc623ad6331a1bb34673b1c328319758ed731ca2981b50a5a2cf8c66d31b10e88c95ffc27c3b6aabe8b207e6cb4373464b1b83f4a5a9806449bf7fb622360bf9f098b56729c5738191d57492b377ca8f989a87922a7368d724b07b7e36133620fa0735d60f5be8b51c19ed1655de5108681cb27273d511c643b7867516c2982a74f62e4cb759bb1f5f0808cc90e1baab60365722293bb07841803076504d00e6fbaae853749fc322e3458810ea41d832b35bf05a10e62a4ff8317b506b9af7216c445663c9061cc62914b0b72b5989d7d9c2b761c2fc5a28b5839bee5596c0de25c10a15776447e17770edb666249a2310962152059c5ed5738741a29e899072427891fb53606ab8b5dd06c005d239adb7bc368b10b74508c45c4aca726fe59c7729cc1ad617236e1b75c760e47815df33297c084429ca371c16c5761c9a23ebbcc2cb43ae9734ba9495d5a86a89e75aef50b9e73470d8d9974cf27a961c0cb2c180ff36140818b005f05afaabc86d8b8bf5c2a62f0632ebeca0c9c567514c9311ba6216fb13f1603c77656cced520d977ac75031044c8790d1b4c97dd38b2aa43dd8808a79e406f8e01503db8f7b51cc1e4265ee830461f41cec398251ea60d2c573ec59b4d28b09dc9446bb972f6d134e2e192e987153b39538e1f631bd81b2e65c2c5c68a96d1b78360889efa4c692b7cc374160e8dc485f47a676d77706e047d3e717386bb49cd942e4c05374b3a1cca148535a3ff1085102f4a7077b5f9c7b1a9ed651edb32691037f9388b672a662bc247beed215d51b414d3530c6b0631999663fd7c0e5da7e411c32c506476fd08a09d499ba3c27bbf6a804cc7e8be5c1f3f97d7aac085dbb3bd1076a69db89bc990efe59b00ca943ef8560642176e926af342b48e8002f6d1aa99b58cd013b03e0d285455786b54a4be3c581419730081361c04697b1b2c07df068621213c8ca6554b5982d5a1aaa113ed9343a56101aec68b838a37ef2c8a15d0504c672b278556b40c766c2066ac995caa32676da182545773881545cd58b71d3d7a02a209bc7407f420a830513b9d9d6c93c56571e42c8bf154afa060667a46d13cc542429c9d1a35be012cd3c9abc2bb7484fc89a4a83a20f7c2bb088793dab732ff370cbab614aa851fb77ce176b8f806c4f2e6068235b93d08c39e96badb37a457e8a790b2b8ef00b0b9e941592373fd2caa3ec3477c6c440d0daa755ac0ad2285754ac64b0852086112b0c9794f1657916fc173209a40425afc9b19946c529ca95154f24ca3cda5f9547c429836c377123c6ec000000000000000000000000000000000000000000000000000000 | 1816 | public_key = b0abba905c1559715f25f720b7b745a52332355154e60577e598c754b6346b335b0195ac305268bae78bb4617807ca4666738ca81515bb041d43a4188003c52ac4ae4b3808d8c755d3e99d00537249d39d4cc02ed9f98ed4106895666c47538f79e30f5104adab1540a1fc58d1a857a1a4611257be37e0327491aa4b543aa6322ef7816a5c9a55eb3bc8604b15540b62c3405b861a84218211c20bc3d35a8a506b0153306fa98b9488a7841d85197c170f84c380098077e42cafdf1913df369f37f3291ec47289710c57f152b74572c23324f83618fd281f5e41976e77097a570a991b3bc623ad6331a1bb34673b1c328319758ed731ca2981b50a5a2cf8c66d31b10e88c95ffc27c3b6aabe8b207e6cb4373464b1b83f4a5a9806449bf7fb622360bf9f098b56729c5738191d57492b377ca8f989a87922a7368d724b07b7e36133620fa0735d60f5be8b51c19ed1655de5108681cb27273d511c643b7867516c2982a74f62e4cb759bb1f5f0808cc90e1baab60365722293bb07841803076504d00e6fbaae853749fc322e3458810ea41d832b35bf05a10e62a4ff8317b506b9af7216c445663c9061cc62914b0b72b5989d7d9c2b761c2fc5a28b5839bee5596c0de25c10a15776447e17770edb666249a2310962152059c5ed5738741a29e899072427891fb53606ab8b5dd06c005d239adb7bc368b10b74508c45c4aca726fe59c7729cc1ad617236e1b75c760e47815df33297c084429ca371c16c5761c9a23ebbcc2cb43ae9734ba9495d5a86a89e75aef50b9e73470d8d9974cf27a961c0cb2c180ff36140818b005f05afaabc86d8b8bf5c2a62f0632ebeca0c9c567514c9311ba6216fb13f1603c77656cced520d977ac75031044c8790d1b4c97dd38b2aa43dd8808a79e406f8e01503db8f7b51cc1e4265ee830461f41cec398251ea60d2c573ec59b4d28b09dc9446bb972f6d134e2e192e987153b39538e1f631bd81b2e65c2c5c68a96d1b78360889efa4c692b7cc374160e8dc485f47a676d77706e047d3e717386bb49cd942e4c05374b3a1cca148535a3ff1085102f4a7077b5f9c7b1a9ed651edb32691037f9388b672a662bc247beed215d51b414d3530c6b0631999663fd7c0e5da7e411c32c506476fd08a09d499ba3c27bbf6a804cc7e8be5c1f3f97d7aac085dbb3bd1076a69db89bc990efe59b00ca943ef8560642176e926af342b48e8002f6d1aa99b58cd013b03e0d285455786b54a4be3c581419730081361c04697b1b2c07df068621213c8ca6554b5982d5a1aaa113ed9343a56101aec68b838a37ef2c8a15d0504c672b278556b40c766c2066ac995caa32676da182545773881545cd58b71d3d7a02a209bc7407f420a830513b9d9d6c93c56571e42c8bf154afa060667a46d13cc542429c9d1a35be012cd3c9abc2bb7484fc89a4a83a20f7c2bb088793dab732ff370cbab614aa851fb77ce176b8f806c4f2e6068235b93d08c39e96badb37a457e8a790b2b8ef00b0b9e941592373fd2caa3ec3477c6c440d0daa755ac0ad2285754ac64b0852086112b0c9794f1657916fc173209a40425afc9b19946c529ca95154f24ca3cda5f9547c429836c377123c6ec000000000000000000000000000000000000000000000000000000 |
| 1817 | result: pass | 1817 | result: pass |
| 1818 | ciphertext: 925fde875ae198cfea88c4eeb3a0091897e25a793672df1de3f24ab4fd3edb2cad0b07e698f35dc97bfd1d551fcace3282c8c3d8131857d96ee9986da7b79a02ddc6cfc9fb7f2b809a8e5511b1c1256dbab33e7606d8a5fc048b36f6ee53c7f556efadf94494595a549ca260ac9c45bf9962bf406610ca58dc286a9eeccc447a767b6db3ab009f5848558acea4503de747d72d43218babd6f68c091b4581f4e41f2e850047f5f543a02407e7331202b0eac7bed180061bb53f4dd3504ccbd3f298d96b43bbaf8f0c2545be54c59830e1f343ca88bb9c6812c66bfbb59a6d68298985767a73d34fa69b52cea98d95d8305f97c4d4fd643b56c60fe31e3c2ee7e938ac2e4a5da2297e670931c1dea5fcbe9cf118c62a76a461495f10f640fb416ff7bc2478c0e8a1356bb840345f3d43476bc4cd990eb7f7cde7ccb96452d055397ee402be2ce395a29a4f4061ec3d85b99f086341441022435b636028a1a04c5d787abe1c24a5a55653b7063b1cacdaee40ae0de77b4034b9ac0e860a90c8834b352c71e353c02b1f46b135fa68fa7a5c1c719896987d79f3174b8d0b0c28ed64cf9f2907924497e35bf519d519a9199a4dd68025992c6f466604bb2ec3d7b13eba76e4803fb73bb125b83413998ae86691a0b35c0054e1418898f435ab26cc12a12fd4dcfa9e80887af7ebb6c856a7fc010cfcaef9e1c5a4dc24a91a622fb7307521faff0b8e8e966b7b6ae849ccc75d31c8d700a3b6a9c3f646b2a88d1e9391c2ddc6c9ff15db961874c87dd94bf0165cfc8f719806539a8beb8e28350610461b1252872f0f3ac273b3366abd78d9fe8868dca1a5eecb683ab8b50ced8cf4a5ed3b721e0fe6b205fb191985ca745ff5dae0010493f8296b6586e1c96f7f23fcb4ac4dda15eab811107c977aa0a16439b06986a9027640cf7a01051934dfc758215d22c6f06866d5b871dfdb6ed240a73dfde43f7f89c0ce6909b54b0a633a25f7253c10906166f81ae91a1419028d6182c1f277dc7872b824c7a5a22bc7afc02afeaa9ba4c271ee68882397e6cec34a955cfc672f4e6f5ed870a35ebce97f34542cf0a162938c91922230ee3fe9ed9a166a790ccf450b80cb5f483c3c6ae5b2e52e907824b45e69e5ab38226cbd6519de995e1a62a910fd45ed189540e0b4058ff01edbc6ba4eebd58d55c0e33702de299eb53d6518254b8471f282779533eaaef90602e52373be8b519c56a2f6fac0953c0f84135715c5674e45d15804fb94d9e0525ab493aa625fbf73ebdf74f0a1246e1eb0e4e2e261b24ab81d8da6e1770634c747542450cf0a2af23507f8b6766a16dbb2e67b2c94859228b91eec6c59f5a271902b340320412ae947398ad102073f8b9b8c021f81f786622c3483e61f812aa76232e6f9453eae044c5e918e6e4e0e18a78efaf6cb36f7b75929d0036c44edf928d6efe1ddc87b96288c7c624655d302b98865978ed7bc779c800e6113a0484dd225aef29796c8ba300b3f48dd566fd877dfeb5d25f96da5d07e643c5d | 1818 | ciphertext: 925fde875ae198cfea88c4eeb3a0091897e25a793672df1de3f24ab4fd3edb2cad0b07e698f35dc97bfd1d551fcace3282c8c3d8131857d96ee9986da7b79a02ddc6cfc9fb7f2b809a8e5511b1c1256dbab33e7606d8a5fc048b36f6ee53c7f556efadf94494595a549ca260ac9c45bf9962bf406610ca58dc286a9eeccc447a767b6db3ab009f5848558acea4503de747d72d43218babd6f68c091b4581f4e41f2e850047f5f543a02407e7331202b0eac7bed180061bb53f4dd3504ccbd3f298d96b43bbaf8f0c2545be54c59830e1f343ca88bb9c6812c66bfbb59a6d68298985767a73d34fa69b52cea98d95d8305f97c4d4fd643b56c60fe31e3c2ee7e938ac2e4a5da2297e670931c1dea5fcbe9cf118c62a76a461495f10f640fb416ff7bc2478c0e8a1356bb840345f3d43476bc4cd990eb7f7cde7ccb96452d055397ee402be2ce395a29a4f4061ec3d85b99f086341441022435b636028a1a04c5d787abe1c24a5a55653b7063b1cacdaee40ae0de77b4034b9ac0e860a90c8834b352c71e353c02b1f46b135fa68fa7a5c1c719896987d79f3174b8d0b0c28ed64cf9f2907924497e35bf519d519a9199a4dd68025992c6f466604bb2ec3d7b13eba76e4803fb73bb125b83413998ae86691a0b35c0054e1418898f435ab26cc12a12fd4dcfa9e80887af7ebb6c856a7fc010cfcaef9e1c5a4dc24a91a622fb7307521faff0b8e8e966b7b6ae849ccc75d31c8d700a3b6a9c3f646b2a88d1e9391c2ddc6c9ff15db961874c87dd94bf0165cfc8f719806539a8beb8e28350610461b1252872f0f3ac273b3366abd78d9fe8868dca1a5eecb683ab8b50ced8cf4a5ed3b721e0fe6b205fb191985ca745ff5dae0010493f8296b6586e1c96f7f23fcb4ac4dda15eab811107c977aa0a16439b06986a9027640cf7a01051934dfc758215d22c6f06866d5b871dfdb6ed240a73dfde43f7f89c0ce6909b54b0a633a25f7253c10906166f81ae91a1419028d6182c1f277dc7872b824c7a5a22bc7afc02afeaa9ba4c271ee68882397e6cec34a955cfc672f4e6f5ed870a35ebce97f34542cf0a162938c91922230ee3fe9ed9a166a790ccf450b80cb5f483c3c6ae5b2e52e907824b45e69e5ab38226cbd6519de995e1a62a910fd45ed189540e0b4058ff01edbc6ba4eebd58d55c0e33702de299eb53d6518254b8471f282779533eaaef90602e52373be8b519c56a2f6fac0953c0f84135715c5674e45d15804fb94d9e0525ab493aa625fbf73ebdf74f0a1246e1eb0e4e2e261b24ab81d8da6e1770634c747542450cf0a2af23507f8b6766a16dbb2e67b2c94859228b91eec6c59f5a271902b340320412ae947398ad102073f8b9b8c021f81f786622c3483e61f812aa76232e6f9453eae044c5e918e6e4e0e18a78efaf6cb36f7b75929d0036c44edf928d6efe1ddc87b96288c7c624655d302b98865978ed7bc779c800e6113a0484dd225aef29796c8ba300b3f48dd566fd877dfeb5d25f96da5d07e643c5d |
| 1819 | shared_secret: d4b9a0f77a52d4f8b9c95951257348d1931725c27eede694ecc09204a931daf7 | 1819 | shared_secret: d4b9a0f77a52d4f8b9c95951257348d1931725c27eede694ecc09204a931daf7 |
| 1820 | 1820 | ||
| 1821 | # Rho leads to a matrix with unusally large entries | 1821 | # Rho leads to a matrix with unusually large entries |
| 1822 | entropy: e8ac9e76377d67d84f85a142383e777157805be0d0f679ba89cefdfa61583780 | 1822 | entropy: e8ac9e76377d67d84f85a142383e777157805be0d0f679ba89cefdfa61583780 |
| 1823 | public_key = 038c5d80656805b427d0b9167abb3697444af88a0f3eb48bf658be44f36b01233902291860215084ec7bb3e170e517c65c623ecf4a488f69923f9045ea18334d5c8ee847381b5a8903a6233796b1def36e46d343cd3547f4a757d82c262278432bd555fb5430e7f936affb453ac1a031c70cb1b3a8f3762dbe226461501d13d10052fb621be30b8ce63ce93591979863816397f0d198a6c534b55213d778ae7bb1a20ef1809ec37b08382c43e82b4a758458d7758d23a350538b3e524d27c9074d1cc4e3e1a17a6b06fd71178c5b18803b1c439b9e903a0d63018d2f765fa7426a0684793ea789c30435657b9aed58886cb8788e14426ea0295da18293024eb1a39eb99a20619a3e2db48a93eb90dbf42b84fbcec1f0b9571946b6f150ef5a672686a30e52be2d536bf3664550f60c99a89b81f3c911784d8a371ebea0b97ff50e2af68f822a72e9a76cf473bcc1cb81fe2a03051771b1c91f1e1a444ab6119c0a83b25a434fd598bc767315881aef9cb4d4c51ceadbb3b1a1142e0b87d5826b161233ce253d2adc9a00bd00e3cc21fff09abd919b54e09ba6b505601a358e50593dfa117eb2b8d7458745a25e7c7321cda0c432aa5bb41aab60eb3dc7e03ce4017b245809a534c3dfa49e97f4474689901e814a97fc0892ca04d0c00e3dfc836b36bbf74256e77525a031160fb3bf8ac31502c049d0a264140104c7488e36a46d23a76f4535b5902677cb98a5abec57b9357b0cb3b36b68349b273a2f8396e6c8594b4a32f0aa8a622378b3ca0426f44443942c02162907b2651ac2168fd1279b040192716bb584211df4ba36cb363b8c3adc39b410977ae3cac26c21470426837a43b821f65d8ee1950c87b4765a034aba1a35579f4148b8c2f39949812cf9d850d5e25be7713ce62ba31366737c03ad45f23e9b226d1835c5ab01c081063dc193630d72821cfa2a56d16108c40ffc483177d075b6a7a1bbf5cac7da0834d755acd10b9b9850a7c97d90a1061ce94efa4b0c0707339dbc7f160a45eeec022815a4494334254c08ade388c07c34e3a07e51ea60fdeb9b20b4b9afdc6c3c2b63e872aac9b2a90b798bc2dc8d585c69c1b33c1d51372c583e835b9ed561c218a2968c044051f8a969a7b2db6a7031d20cc9e024bbaab4385a3ae13ca264c25f6c5b4170b5c0da13044664a10f335ae9045bd6319abe139bb2b8b635bb06e2f48427e256a16a0f71f119230a9acfb19f0fe07c71828063f42a844a5c703aab9a844f689944ead511d8c97127d99429fc87ede190e0fa002261494076b7a10496dbe12919f585685733ae780eab3ac168287aae3842cfb637a94483f68170f6a3092d51b82ef10496a6374572a527aa7a7d1a99315953f625842ec0bc8851180b98cbe411453027c9b8a4a07fc3bbe32b897fc09e5e65a0457556a8b28e5b7c8b28db24e5431893953c912c195ca52db5d125c3f595f2ea75a63b6c83c8cbca257824ac60ce16bb5be02b30488974a22a66d37b19531e3cf17b59bb43d738cea25326dbd6355243ceff3caae98446927351ff623260472f8c7a715016ca5480af5cecc001c6b65f41221b16bfa61863e225709775b5e6393e4b71920c0c539c6bc5ec5c609466000000000000000000000000000000000000000000000000000000 | 1823 | public_key = 038c5d80656805b427d0b9167abb3697444af88a0f3eb48bf658be44f36b01233902291860215084ec7bb3e170e517c65c623ecf4a488f69923f9045ea18334d5c8ee847381b5a8903a6233796b1def36e46d343cd3547f4a757d82c262278432bd555fb5430e7f936affb453ac1a031c70cb1b3a8f3762dbe226461501d13d10052fb621be30b8ce63ce93591979863816397f0d198a6c534b55213d778ae7bb1a20ef1809ec37b08382c43e82b4a758458d7758d23a350538b3e524d27c9074d1cc4e3e1a17a6b06fd71178c5b18803b1c439b9e903a0d63018d2f765fa7426a0684793ea789c30435657b9aed58886cb8788e14426ea0295da18293024eb1a39eb99a20619a3e2db48a93eb90dbf42b84fbcec1f0b9571946b6f150ef5a672686a30e52be2d536bf3664550f60c99a89b81f3c911784d8a371ebea0b97ff50e2af68f822a72e9a76cf473bcc1cb81fe2a03051771b1c91f1e1a444ab6119c0a83b25a434fd598bc767315881aef9cb4d4c51ceadbb3b1a1142e0b87d5826b161233ce253d2adc9a00bd00e3cc21fff09abd919b54e09ba6b505601a358e50593dfa117eb2b8d7458745a25e7c7321cda0c432aa5bb41aab60eb3dc7e03ce4017b245809a534c3dfa49e97f4474689901e814a97fc0892ca04d0c00e3dfc836b36bbf74256e77525a031160fb3bf8ac31502c049d0a264140104c7488e36a46d23a76f4535b5902677cb98a5abec57b9357b0cb3b36b68349b273a2f8396e6c8594b4a32f0aa8a622378b3ca0426f44443942c02162907b2651ac2168fd1279b040192716bb584211df4ba36cb363b8c3adc39b410977ae3cac26c21470426837a43b821f65d8ee1950c87b4765a034aba1a35579f4148b8c2f39949812cf9d850d5e25be7713ce62ba31366737c03ad45f23e9b226d1835c5ab01c081063dc193630d72821cfa2a56d16108c40ffc483177d075b6a7a1bbf5cac7da0834d755acd10b9b9850a7c97d90a1061ce94efa4b0c0707339dbc7f160a45eeec022815a4494334254c08ade388c07c34e3a07e51ea60fdeb9b20b4b9afdc6c3c2b63e872aac9b2a90b798bc2dc8d585c69c1b33c1d51372c583e835b9ed561c218a2968c044051f8a969a7b2db6a7031d20cc9e024bbaab4385a3ae13ca264c25f6c5b4170b5c0da13044664a10f335ae9045bd6319abe139bb2b8b635bb06e2f48427e256a16a0f71f119230a9acfb19f0fe07c71828063f42a844a5c703aab9a844f689944ead511d8c97127d99429fc87ede190e0fa002261494076b7a10496dbe12919f585685733ae780eab3ac168287aae3842cfb637a94483f68170f6a3092d51b82ef10496a6374572a527aa7a7d1a99315953f625842ec0bc8851180b98cbe411453027c9b8a4a07fc3bbe32b897fc09e5e65a0457556a8b28e5b7c8b28db24e5431893953c912c195ca52db5d125c3f595f2ea75a63b6c83c8cbca257824ac60ce16bb5be02b30488974a22a66d37b19531e3cf17b59bb43d738cea25326dbd6355243ceff3caae98446927351ff623260472f8c7a715016ca5480af5cecc001c6b65f41221b16bfa61863e225709775b5e6393e4b71920c0c539c6bc5ec5c609466000000000000000000000000000000000000000000000000000000 |
| 1824 | result: pass | 1824 | result: pass |
| 1825 | ciphertext: 7c06bbeca8b58423e2ad420ec36064ed42c881e3655668f8865a2d643ecd1a4eecf915b6c64b37c98947f06c3ccc8e00bbd16017c246db88cc83f12c887aaad7db61b4d567c285841689169c3f928f1d178a0ddae50d8c46cfd95258667d6239c300595738defd2e806637ca46baa4c6c7b97f1a9b47d53cba9ffe074f88d104c4971d250d085b1800fcbd91584d8cc48e145fc81438290d74765e7ee8c1605e8048b37b9d22b050791fe008b9b84b7f23b0f49955e32c0eef78d7a3a0b2effe8b37d124e19d4cb6f6914204598a525239d9baa116e1c9c39c47f9f37f965941b2aef8519782c65f3ad3a6509d1e31e7efb67db21911e4edeb1f7e9c37b3f852c81d63a95e4775e3f2a8ff315a214680adf44d290e42ebab8ca95bf471140b9d7e03f5e9f97864289a0ae8c9a105e00409f714e413b69be366303b4a138ed51264ab0e5cca5f6dc9387c6608109e8859893efa3bc7384e9f418468b1078807dadb768e254094039d1b807d67353c8e0b5a03d28b8e41ffa0eb3ce0837a132144597908f7a059a097b79a1bac323757324e907b445d064e25c378d2069e7c5d671036871e4fe36705747635e40c6e835319e3ff81714cacc44515d671b703c5581dc76afca0b881f37c1ffc93f2e4afab1e8ac776ca883f3adf7f9ab99396f7e19541c26342a7d5618958523b81871326c357ad84ccc6d3574d97cbd875524e7b08a102263d80f318a48e510c22126568f76936c904c231700ad042d73137eec741c827a082de4a45d296745c55b8367719dd08b8295e38d8d3894b9f8e2f9b483b266e1fc71d6374353ca7d9ed1c6b73ab5a42f6abff7b2ba8fd484d1ae6928b5ea92ea3577be01dc1e88abcd0886eb771dca4d36e91c45bca4807c89736b7d6a927cf64b22c5f323077f5488f6044976f310b4b99f7d486335dcca60571157ac0e480a4dba79a826b4bac3dcb7327a33b16381eb41e1d39915e91a58750ceb71098ec7f1a2d7e44d4bab75bb7482eec277df206502c497eaa345109a145a4da6bed1900b680ad12fb028d33563bfb204ecf66e6ead587c5fe27f8a2eb0e27471925ea0f35eb9d5e53ef801eba3acaaa7790b105eb6128ace992668181c1d7cf203afdccdfefbac67dbd97cad05d499239df84e4cf7372117932c973957e5c70a8520f822be430758990296877df62069d818768513d14df0568be8e63e123bdde35036dcc69a98197f52dfbaae5e5e0cee4a48c67fdda605dad8a27651625c2b35e81dfcacd2a41a6d17f6d7067a67faf2479b3868673b248270f4a2d8ee26de9c787ce966ecf186c1401ad9d3bbf2c43b1d5de32bdd77f5433f4325427254a13985d733ab0863e62a4f3d484ab3f5d3b88f23049079143b058babffc8367cebdd9d2468d7af782979a3ef12841370da6ef2db03679e6bca0db72166c361adfbfc02234119abaf98d4fea8ddc6e8490c2fb5a1be4806a61bc7b36884cf4631cfd53138a23fdda11e597aed323748314282672473a1819ef2b9488f6744544ad | 1825 | ciphertext: 7c06bbeca8b58423e2ad420ec36064ed42c881e3655668f8865a2d643ecd1a4eecf915b6c64b37c98947f06c3ccc8e00bbd16017c246db88cc83f12c887aaad7db61b4d567c285841689169c3f928f1d178a0ddae50d8c46cfd95258667d6239c300595738defd2e806637ca46baa4c6c7b97f1a9b47d53cba9ffe074f88d104c4971d250d085b1800fcbd91584d8cc48e145fc81438290d74765e7ee8c1605e8048b37b9d22b050791fe008b9b84b7f23b0f49955e32c0eef78d7a3a0b2effe8b37d124e19d4cb6f6914204598a525239d9baa116e1c9c39c47f9f37f965941b2aef8519782c65f3ad3a6509d1e31e7efb67db21911e4edeb1f7e9c37b3f852c81d63a95e4775e3f2a8ff315a214680adf44d290e42ebab8ca95bf471140b9d7e03f5e9f97864289a0ae8c9a105e00409f714e413b69be366303b4a138ed51264ab0e5cca5f6dc9387c6608109e8859893efa3bc7384e9f418468b1078807dadb768e254094039d1b807d67353c8e0b5a03d28b8e41ffa0eb3ce0837a132144597908f7a059a097b79a1bac323757324e907b445d064e25c378d2069e7c5d671036871e4fe36705747635e40c6e835319e3ff81714cacc44515d671b703c5581dc76afca0b881f37c1ffc93f2e4afab1e8ac776ca883f3adf7f9ab99396f7e19541c26342a7d5618958523b81871326c357ad84ccc6d3574d97cbd875524e7b08a102263d80f318a48e510c22126568f76936c904c231700ad042d73137eec741c827a082de4a45d296745c55b8367719dd08b8295e38d8d3894b9f8e2f9b483b266e1fc71d6374353ca7d9ed1c6b73ab5a42f6abff7b2ba8fd484d1ae6928b5ea92ea3577be01dc1e88abcd0886eb771dca4d36e91c45bca4807c89736b7d6a927cf64b22c5f323077f5488f6044976f310b4b99f7d486335dcca60571157ac0e480a4dba79a826b4bac3dcb7327a33b16381eb41e1d39915e91a58750ceb71098ec7f1a2d7e44d4bab75bb7482eec277df206502c497eaa345109a145a4da6bed1900b680ad12fb028d33563bfb204ecf66e6ead587c5fe27f8a2eb0e27471925ea0f35eb9d5e53ef801eba3acaaa7790b105eb6128ace992668181c1d7cf203afdccdfefbac67dbd97cad05d499239df84e4cf7372117932c973957e5c70a8520f822be430758990296877df62069d818768513d14df0568be8e63e123bdde35036dcc69a98197f52dfbaae5e5e0cee4a48c67fdda605dad8a27651625c2b35e81dfcacd2a41a6d17f6d7067a67faf2479b3868673b248270f4a2d8ee26de9c787ce966ecf186c1401ad9d3bbf2c43b1d5de32bdd77f5433f4325427254a13985d733ab0863e62a4f3d484ab3f5d3b88f23049079143b058babffc8367cebdd9d2468d7af782979a3ef12841370da6ef2db03679e6bca0db72166c361adfbfc02234119abaf98d4fea8ddc6e8490c2fb5a1be4806a61bc7b36884cf4631cfd53138a23fdda11e597aed323748314282672473a1819ef2b9488f6744544ad |
| 1826 | shared_secret: c9d0cf3edb1172344364afec3615ba98477ce9316f92ca46ca5f42b73553a9f5 | 1826 | shared_secret: c9d0cf3edb1172344364afec3615ba98477ce9316f92ca46ca5f42b73553a9f5 |
| 1827 | 1827 | ||
| 1828 | # Rho leads to a matrix with unusally large entries | 1828 | # Rho leads to a matrix with unusually large entries |
| 1829 | entropy: 2fe6b9cf4510f212839e348d671b3345da68a477f57513ce363414e87299a717 | 1829 | entropy: 2fe6b9cf4510f212839e348d671b3345da68a477f57513ce363414e87299a717 |
| 1830 | public_key = 7dd722a23522b0d8cb522a67d63a75af305c05f3659bc496f1c47e410582a0e58bbba80751bb2f5ab71414051627f46a78f9708e3139f8950b999378df4709a08b9b511982ab1b2cc4d51d177578ef263c8e12752f914733023d9e8068d4fc1aac34106fa72197f6b4e4bb26ab29ab64d7c848f98ef5557ec2b35edea70b67c084193921d8cb52e132a24372be7046aa2af66696007e2e0830df1c7b4396bcc8f27aca46932c463b49db0ed88882f3a45901a4b96ee3b74e78afb8dbae7bc653be895179f208c27c6ecd60c26e54152aecbc13bb5ece39840574c56fb39fd2385c76d62c59a41b3311702d5a99e366467b6c4f6c252a95db32e5096e61d1ba872924d358b346dc099a485c3df72a94e437a82a6cd778888995c473c203e091309ba42511950c19db3acbc5987259bea952b5a549839f197d7bf64ca0772cc1dc89572a0e04690fe651a79ffb3dc07388c30c06711c6b25572bbc83ba868a379d54c6439754bcd67c9b0364ab3790967a062948084ab33a80ac5971fa99830aa7d1e9263e7087af67ab6a83ab34f405dbd72b3fe46e9f2114e26cc6643b6d3adb9de63090394213e72b64ecbb2242266139579ea9cab2e51868ef82ababaac38e7ca0b9554d665365dd8b0b58f3020cc9218b866955f54d9f7b9af9634ab995a0b5e234fcc78cd1594e1cb8a845ca0cdbc82e3fbb35414c53423b76875ab267a702d51710149061e7655a0168695053aa61b990fa9439883640e7600345033ca90678925b1d632962deaa0ef5642b870610be3387eda90cf608254dc2b000c06632331680e12e9b277597d07633a31f6445318ac7b9cc1b087cb58bddd30a07ea6e1b1429950b7e7efb1a6b88b037c92cf987c904268ce39cba4bd3c163f5a8bdb9698488152a18b02bc98a83fb6c28a55a018b48979660ad5b42281b8745a4bdcb02cabd16735ab1523916adcb031e34ccbf4c50bf61bb7d562804d4104d3f6ac183f447e6608acb0bc40a34ada4897e9a91c542571877931864b612cec01c88010cbe039d42540835422f5900c944c7025ba3365543536d093a68c27abe1175bc227faa590f8fb8ca9ab1a87366574422379fd8659fe5bb5ec76e179666adebcedc7b54f1aa9388b2907a4ba5c48441ad90499c64a57768631d4a961d88976c816adb897da7715a100c75099cc122f3b1df183385673a3bbc98cbb0ccb0b090b3517993815e3f6b26b984bdda32c11947b2fa5411004c2c41f2a646036b86bba618e72be7f97ec6369af5ca2ab2dc9493d9078a0c8598841385205177c80a3be42a31d1166b02cd1dd2871148033c794242962e8645ae2e4867a3e5c74f71a1d978379ad45f7fa5c70066cbfc4cbfbe05cf23612b2dea551cc52dd90a8468ec771ff071371544e96400e288a82e9c9eefe807d6f4903ac567741abeaec9707533b38dd8c4366bb33cf86f77272478e43a2d8061293332c8d805a4516238d5ad1934a9683655674aa6b6d91610d4c82e966d74c41dfe7ac18e993c22d59b2d286a0b5272cd44988510b9b342405757a25731729e934c58c601f5c311a244a24dbcc772088a20dac4c8410167304fda18445f6c6126b9645d4042d6033419d246968848e1f5000000000000000000000000000000000000000000000000000000 | 1830 | public_key = 7dd722a23522b0d8cb522a67d63a75af305c05f3659bc496f1c47e410582a0e58bbba80751bb2f5ab71414051627f46a78f9708e3139f8950b999378df4709a08b9b511982ab1b2cc4d51d177578ef263c8e12752f914733023d9e8068d4fc1aac34106fa72197f6b4e4bb26ab29ab64d7c848f98ef5557ec2b35edea70b67c084193921d8cb52e132a24372be7046aa2af66696007e2e0830df1c7b4396bcc8f27aca46932c463b49db0ed88882f3a45901a4b96ee3b74e78afb8dbae7bc653be895179f208c27c6ecd60c26e54152aecbc13bb5ece39840574c56fb39fd2385c76d62c59a41b3311702d5a99e366467b6c4f6c252a95db32e5096e61d1ba872924d358b346dc099a485c3df72a94e437a82a6cd778888995c473c203e091309ba42511950c19db3acbc5987259bea952b5a549839f197d7bf64ca0772cc1dc89572a0e04690fe651a79ffb3dc07388c30c06711c6b25572bbc83ba868a379d54c6439754bcd67c9b0364ab3790967a062948084ab33a80ac5971fa99830aa7d1e9263e7087af67ab6a83ab34f405dbd72b3fe46e9f2114e26cc6643b6d3adb9de63090394213e72b64ecbb2242266139579ea9cab2e51868ef82ababaac38e7ca0b9554d665365dd8b0b58f3020cc9218b866955f54d9f7b9af9634ab995a0b5e234fcc78cd1594e1cb8a845ca0cdbc82e3fbb35414c53423b76875ab267a702d51710149061e7655a0168695053aa61b990fa9439883640e7600345033ca90678925b1d632962deaa0ef5642b870610be3387eda90cf608254dc2b000c06632331680e12e9b277597d07633a31f6445318ac7b9cc1b087cb58bddd30a07ea6e1b1429950b7e7efb1a6b88b037c92cf987c904268ce39cba4bd3c163f5a8bdb9698488152a18b02bc98a83fb6c28a55a018b48979660ad5b42281b8745a4bdcb02cabd16735ab1523916adcb031e34ccbf4c50bf61bb7d562804d4104d3f6ac183f447e6608acb0bc40a34ada4897e9a91c542571877931864b612cec01c88010cbe039d42540835422f5900c944c7025ba3365543536d093a68c27abe1175bc227faa590f8fb8ca9ab1a87366574422379fd8659fe5bb5ec76e179666adebcedc7b54f1aa9388b2907a4ba5c48441ad90499c64a57768631d4a961d88976c816adb897da7715a100c75099cc122f3b1df183385673a3bbc98cbb0ccb0b090b3517993815e3f6b26b984bdda32c11947b2fa5411004c2c41f2a646036b86bba618e72be7f97ec6369af5ca2ab2dc9493d9078a0c8598841385205177c80a3be42a31d1166b02cd1dd2871148033c794242962e8645ae2e4867a3e5c74f71a1d978379ad45f7fa5c70066cbfc4cbfbe05cf23612b2dea551cc52dd90a8468ec771ff071371544e96400e288a82e9c9eefe807d6f4903ac567741abeaec9707533b38dd8c4366bb33cf86f77272478e43a2d8061293332c8d805a4516238d5ad1934a9683655674aa6b6d91610d4c82e966d74c41dfe7ac18e993c22d59b2d286a0b5272cd44988510b9b342405757a25731729e934c58c601f5c311a244a24dbcc772088a20dac4c8410167304fda18445f6c6126b9645d4042d6033419d246968848e1f5000000000000000000000000000000000000000000000000000000 |
| 1831 | result: pass | 1831 | result: pass |
| 1832 | ciphertext: 83ea5ed982570cd981b7430de924469d4e2faba68e03261a74f5114ab8c448376cfcd1b9cb3e72bb031bf0fefe772bc40888abc6acffc1d335d46d267acde2cb89cf1b3c67a139796d6a5763805d5edcebb81070b44ffe021b6c2b3c6c3d5dfb6d9e546930223ab0139990c6c5d6257520fe394a3aa30c6a71d47f415ac86b68eb8c83b131a3c5cbf051971fef5ef3bda355d3868e71ed8a0e2c6de8a759bc0c9e760277cc2c04c783d29d1ad3d3385accb85cc88c39bc8348f84dd8c714c5feda50b0770414a333136d6678be6ccbc5df488bafdcade883fbb310c99cc648493aed72680fe1e43c0cf523d3dd06417d29dd97c98ce53089505d36a476c0ae6d89b165c3ff6b2c62ba954fb81ac5782ae648a6802bc057c64fabd3726559ba79de9c144aaa525f6a840ed55abf21b37231c6c4cbb0110fdbcd0004f6f4974ec644c33a8aea34ef4a0a146f7502650c3def5a313d2f309cb428880502d3bdf39196a99bee296f9231d87972efd1159d3cf59bea05f0d0373a0e218ee5e0528e1ac7132440980d1153b9423bb2e099d05fbc8241ec1f316bf0add575a69982f546e99c64457c12ac83951ad46a5f024f6a61c91b7d3853ba1fa41d5a95f6ca811610ba3f32addf011ea4091ef217cdd126ec5e45cc40ec6f1292602b16c02718419646370e5b2c7c55c1128fc5d6c767cc75248b79e2379d40f91a8617e8a3db43c42cabb5cd39a7a7969147f30344c4b03de7034b12d8a1c3639697c97c4483e4191ca0fa81d8659f40e31b899b4ef4610644b1314ab2ef14b8dd8dc0082826fe65dc17211572cb14fa376f1b1784a00033c8dcddc44d6a1128a200eea668b6516ba42585cbb2e2be2a42148120013d0a9378ed7c185071fa8fdc09102164c63a665fd09c08d34104c9abb64e394b2e2a00dd834f7c7f5de16f6c02906ae37acc923dd76e530c78f2143396bfc371d14e6c48bec072b6b4e18eeae967456beb3f897a06eae17de174cf09be1435e691350632c0b1eac69dd66549c1d980fb147fa295ca6f21b5dc398e63a7c4263c75b55c85b4f38fbd7cc0fad84aba90dda1f2c9ca88d88905602096162486dba1ed0a8caa6b897c99e25934152a35fd0d476de09fb211abf36565af3744f3fb737247f5d8f172fbf438ed04422a6b3e17bdfe2cb0f09a1d57f1f1a113a768697f23d61ab288f15abc760feb0f5c5d4d5c0b1c891d3dad6089a3b7e54516b8f9755d38430312cf17b21efeeecbfd2719b62480225b9b3ee8940b1f1784ed5630d152635a1233acdd16e5489a9a15eafa7bec99aff25b18d9cac1e726c9e424773a7083f213cea53dcd310b0037aecbde1d584657f32cf548a6872c6f5a1a3a70d4db29ee3773291c94b00b5a596e1691f7752e246ca0960561cd233ec7d5f54496d34ba65b359a856315f02d16c990cdf3db2051b17bf283fed1b808ac79a9ce8250c806896bf75f2cfe76465c09360aba4c9688acea341fe755363abe41c0cba3ebad00c6c7bcc3f7ce091f87079f60094b92 | 1832 | ciphertext: 83ea5ed982570cd981b7430de924469d4e2faba68e03261a74f5114ab8c448376cfcd1b9cb3e72bb031bf0fefe772bc40888abc6acffc1d335d46d267acde2cb89cf1b3c67a139796d6a5763805d5edcebb81070b44ffe021b6c2b3c6c3d5dfb6d9e546930223ab0139990c6c5d6257520fe394a3aa30c6a71d47f415ac86b68eb8c83b131a3c5cbf051971fef5ef3bda355d3868e71ed8a0e2c6de8a759bc0c9e760277cc2c04c783d29d1ad3d3385accb85cc88c39bc8348f84dd8c714c5feda50b0770414a333136d6678be6ccbc5df488bafdcade883fbb310c99cc648493aed72680fe1e43c0cf523d3dd06417d29dd97c98ce53089505d36a476c0ae6d89b165c3ff6b2c62ba954fb81ac5782ae648a6802bc057c64fabd3726559ba79de9c144aaa525f6a840ed55abf21b37231c6c4cbb0110fdbcd0004f6f4974ec644c33a8aea34ef4a0a146f7502650c3def5a313d2f309cb428880502d3bdf39196a99bee296f9231d87972efd1159d3cf59bea05f0d0373a0e218ee5e0528e1ac7132440980d1153b9423bb2e099d05fbc8241ec1f316bf0add575a69982f546e99c64457c12ac83951ad46a5f024f6a61c91b7d3853ba1fa41d5a95f6ca811610ba3f32addf011ea4091ef217cdd126ec5e45cc40ec6f1292602b16c02718419646370e5b2c7c55c1128fc5d6c767cc75248b79e2379d40f91a8617e8a3db43c42cabb5cd39a7a7969147f30344c4b03de7034b12d8a1c3639697c97c4483e4191ca0fa81d8659f40e31b899b4ef4610644b1314ab2ef14b8dd8dc0082826fe65dc17211572cb14fa376f1b1784a00033c8dcddc44d6a1128a200eea668b6516ba42585cbb2e2be2a42148120013d0a9378ed7c185071fa8fdc09102164c63a665fd09c08d34104c9abb64e394b2e2a00dd834f7c7f5de16f6c02906ae37acc923dd76e530c78f2143396bfc371d14e6c48bec072b6b4e18eeae967456beb3f897a06eae17de174cf09be1435e691350632c0b1eac69dd66549c1d980fb147fa295ca6f21b5dc398e63a7c4263c75b55c85b4f38fbd7cc0fad84aba90dda1f2c9ca88d88905602096162486dba1ed0a8caa6b897c99e25934152a35fd0d476de09fb211abf36565af3744f3fb737247f5d8f172fbf438ed04422a6b3e17bdfe2cb0f09a1d57f1f1a113a768697f23d61ab288f15abc760feb0f5c5d4d5c0b1c891d3dad6089a3b7e54516b8f9755d38430312cf17b21efeeecbfd2719b62480225b9b3ee8940b1f1784ed5630d152635a1233acdd16e5489a9a15eafa7bec99aff25b18d9cac1e726c9e424773a7083f213cea53dcd310b0037aecbde1d584657f32cf548a6872c6f5a1a3a70d4db29ee3773291c94b00b5a596e1691f7752e246ca0960561cd233ec7d5f54496d34ba65b359a856315f02d16c990cdf3db2051b17bf283fed1b808ac79a9ce8250c806896bf75f2cfe76465c09360aba4c9688acea341fe755363abe41c0cba3ebad00c6c7bcc3f7ce091f87079f60094b92 |
| 1833 | shared_secret: 4bb6a6b27596869efae3d411c69c593afff99b1a703ee1f4ff3e0e7e9756e75b | 1833 | shared_secret: 4bb6a6b27596869efae3d411c69c593afff99b1a703ee1f4ff3e0e7e9756e75b |
| 1834 | 1834 | ||
| 1835 | # Rho leads to a matrix with unusally large entries | 1835 | # Rho leads to a matrix with unusually large entries |
| 1836 | entropy: 86630b4f72820d19e9941784183b3a0d770609becd6fe0dc463cb6edac432d59 | 1836 | entropy: 86630b4f72820d19e9941784183b3a0d770609becd6fe0dc463cb6edac432d59 |
| 1837 | public_key = 59b479b444b510d9b6d89b7001b237f4a34c57509f69208c7e6b956144bedc8b2d19b12c1baa725dd106f5418ed943370050808ed2636fa634add059541a7a8c7976b0990e59c20c00343d1c37bc3ab587e312991bb88a74227651b340346c58bbb174ac18c204f37445681bc5905354d834f86016d0921219fb467d829daf24901815666d664b8c4aae307485cb95885b7cb9125a14d4d988d3a42c0816ba7ef14de9b622e08871988b8c02d857626b65065551d5bcc81112384f979cd8d2b9ecb55c6afaa700e92e3ecbb285c01112a19cbdb90b8af135b235914c901e2314902a43c939d065481128f83ac801dc2fa69c912f2b69189736d72414df12646680c9c858a9afaa28b994531960b0f2b82fc6b9c6f10706930786ab5c6b0da61ae813cdb7387c27324499b111c6ca5767056070e608cf421af52cb45a842da82560dd86acf45a7e70245e0b535f7559a9fceb9369c44032c09302438cb4670925c7a831d52f083a7919e575be844d9e6a009957c15e6c5f84f050cc4801561876f9f483ded505b3c77a4a97788358801f012b59d716fed55975f8abd3464420d849d89c16dd2a95c372cf631a93a8897ddda2a038070adc2a97b5538778c0215cea399deb8279b2ade6c5ab84bbc8c6e181c091b7002a4d5f395bb60c817e03966b63ba76e88fb05b79d126ab0975c995b5bb2ae6550af78d80b96af40c9514f945d72b0c9602412242c81b60b2df97999fbbaec0404056195879535041231803aa7cf064b5fdfc8b86344d65eb30e52cc0d5b86947b8051ea93008d789914493b58abbd5395b657560f5823c387574db554118d06b26ba14b9660b4b390f8b828ba8a852870cba24a114a68094cf0168b721af8f0998e599b5db2135a3e9360b5754dd49155eea830f0035c2c116dbc9039cf69034c505ed998f8460a170eb5f09786d902664c8135ad77101d0b802248b6f3165a847b5c989131d7ee3135cbcb48b3cabfd100074c00f2e7bc85d4c84bec8980a6920e6f318a4bc805900b548fc7d98316c1b3c3b49f6c5d90595ff7a7b56465385620544aa3f39114e53581e851849726023d953b5df56b87be98854b253a39297f060449fc1c02725c3442a4ed8624f7f6abf3854cf04166b24c3b5a38358bae933ee4777df09720415314b152efc0b175b664c0c0a3521cac1817314d1e69fe03b351fe211c4c44639622a73a4547ef52d46b033aa52a79182baf49a8808fb259c048a04cc03f8a1038e9112eb30965c797f90c277b3549df4f757526351bd1a100767b4bcfa7489c17cb181b707986b9af85e766aa1f99b08aa2a7bc8a385d294277cb00d705b4ce2583e61c16be2b18445d051d7f0cee51703db3162bdd328cf0b0b24a424bd830c6574091088ab746a291c737e8cd595d1b51f9646c7813a8991f89c168489d1a3b61a82466d98ac9de55b4d5aa020243e638328fedbc93d341e1fdc7eb861bba3783a57c86a7184aaa7d5051b7018f3f18b40b69fd7780ae9609194db70123801729c561e973dff3a7ea5ba9045b24e5fe5bc63ea858c687184a8276612c80ab600cc37699583b9ffa8c5a1b7934f3c12873522dd1c4f976b73121bb79766803d247de1dff18807000000000000000000000000000000000000000000000000000000 | 1837 | public_key = 59b479b444b510d9b6d89b7001b237f4a34c57509f69208c7e6b956144bedc8b2d19b12c1baa725dd106f5418ed943370050808ed2636fa634add059541a7a8c7976b0990e59c20c00343d1c37bc3ab587e312991bb88a74227651b340346c58bbb174ac18c204f37445681bc5905354d834f86016d0921219fb467d829daf24901815666d664b8c4aae307485cb95885b7cb9125a14d4d988d3a42c0816ba7ef14de9b622e08871988b8c02d857626b65065551d5bcc81112384f979cd8d2b9ecb55c6afaa700e92e3ecbb285c01112a19cbdb90b8af135b235914c901e2314902a43c939d065481128f83ac801dc2fa69c912f2b69189736d72414df12646680c9c858a9afaa28b994531960b0f2b82fc6b9c6f10706930786ab5c6b0da61ae813cdb7387c27324499b111c6ca5767056070e608cf421af52cb45a842da82560dd86acf45a7e70245e0b535f7559a9fceb9369c44032c09302438cb4670925c7a831d52f083a7919e575be844d9e6a009957c15e6c5f84f050cc4801561876f9f483ded505b3c77a4a97788358801f012b59d716fed55975f8abd3464420d849d89c16dd2a95c372cf631a93a8897ddda2a038070adc2a97b5538778c0215cea399deb8279b2ade6c5ab84bbc8c6e181c091b7002a4d5f395bb60c817e03966b63ba76e88fb05b79d126ab0975c995b5bb2ae6550af78d80b96af40c9514f945d72b0c9602412242c81b60b2df97999fbbaec0404056195879535041231803aa7cf064b5fdfc8b86344d65eb30e52cc0d5b86947b8051ea93008d789914493b58abbd5395b657560f5823c387574db554118d06b26ba14b9660b4b390f8b828ba8a852870cba24a114a68094cf0168b721af8f0998e599b5db2135a3e9360b5754dd49155eea830f0035c2c116dbc9039cf69034c505ed998f8460a170eb5f09786d902664c8135ad77101d0b802248b6f3165a847b5c989131d7ee3135cbcb48b3cabfd100074c00f2e7bc85d4c84bec8980a6920e6f318a4bc805900b548fc7d98316c1b3c3b49f6c5d90595ff7a7b56465385620544aa3f39114e53581e851849726023d953b5df56b87be98854b253a39297f060449fc1c02725c3442a4ed8624f7f6abf3854cf04166b24c3b5a38358bae933ee4777df09720415314b152efc0b175b664c0c0a3521cac1817314d1e69fe03b351fe211c4c44639622a73a4547ef52d46b033aa52a79182baf49a8808fb259c048a04cc03f8a1038e9112eb30965c797f90c277b3549df4f757526351bd1a100767b4bcfa7489c17cb181b707986b9af85e766aa1f99b08aa2a7bc8a385d294277cb00d705b4ce2583e61c16be2b18445d051d7f0cee51703db3162bdd328cf0b0b24a424bd830c6574091088ab746a291c737e8cd595d1b51f9646c7813a8991f89c168489d1a3b61a82466d98ac9de55b4d5aa020243e638328fedbc93d341e1fdc7eb861bba3783a57c86a7184aaa7d5051b7018f3f18b40b69fd7780ae9609194db70123801729c561e973dff3a7ea5ba9045b24e5fe5bc63ea858c687184a8276612c80ab600cc37699583b9ffa8c5a1b7934f3c12873522dd1c4f976b73121bb79766803d247de1dff18807000000000000000000000000000000000000000000000000000000 |
| 1838 | result: pass | 1838 | result: pass |
diff --git a/src/regress/lib/libcrypto/mlkem/mlkem_iteration_tests.c b/src/regress/lib/libcrypto/mlkem/mlkem_iteration_tests.c index 5a61248090..d6451fafb8 100644 --- a/src/regress/lib/libcrypto/mlkem/mlkem_iteration_tests.c +++ b/src/regress/lib/libcrypto/mlkem/mlkem_iteration_tests.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: mlkem_iteration_tests.c,v 1.2 2024/12/26 07:26:45 tb Exp $ */ | 1 | /* $OpenBSD: mlkem_iteration_tests.c,v 1.9 2026/01/01 12:47:52 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Google Inc. | 3 | * Copyright (c) 2024 Google Inc. |
| 4 | * Copyright (c) 2024 Bob Beck <beck@obtuse.com> | 4 | * Copyright (c) 2024 Bob Beck <beck@obtuse.com> |
| @@ -22,7 +22,7 @@ | |||
| 22 | #include <stdio.h> | 22 | #include <stdio.h> |
| 23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
| 24 | 24 | ||
| 25 | #include "mlkem.h" | 25 | #include <openssl/mlkem.h> |
| 26 | 26 | ||
| 27 | #include "mlkem_internal.h" | 27 | #include "mlkem_internal.h" |
| 28 | #include "mlkem_tests_util.h" | 28 | #include "mlkem_tests_util.h" |
| @@ -63,46 +63,49 @@ const uint8_t kExpectedAdam1024[32] = { | |||
| 63 | 0x04, 0xab, 0xdb, 0x94, 0x8b, 0x90, 0x8b, 0x75, 0xba, 0xd5 | 63 | 0x04, 0xab, 0xdb, 0x94, 0x8b, 0x90, 0x8b, 0x75, 0xba, 0xd5 |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | struct iteration_ctx { | ||
| 67 | uint8_t *encoded_public_key; | ||
| 68 | size_t encoded_public_key_len; | ||
| 69 | uint8_t *ciphertext; | ||
| 70 | size_t ciphertext_len; | ||
| 71 | uint8_t *invalid_ciphertext; | ||
| 72 | size_t invalid_ciphertext_len; | ||
| 73 | void *priv; | ||
| 74 | void *pub; | ||
| 75 | |||
| 76 | mlkem_encode_private_key_fn encode_private_key; | ||
| 77 | mlkem_encap_external_entropy_fn encap_external_entropy; | ||
| 78 | mlkem_generate_key_external_entropy_fn generate_key_external_entropy; | ||
| 79 | mlkem_public_from_private_fn public_from_private; | ||
| 80 | mlkem_decap_fn decap; | ||
| 81 | |||
| 82 | const uint8_t *start; | ||
| 83 | size_t start_len; | ||
| 84 | |||
| 85 | const uint8_t *expected; | ||
| 86 | size_t expected_len; | ||
| 87 | }; | ||
| 88 | |||
| 89 | static int | 66 | static int |
| 90 | MlkemIterativeTest(struct iteration_ctx *ctx) | 67 | MlkemIterativeTest(int rank) |
| 91 | { | 68 | { |
| 92 | uint8_t shared_secret[MLKEM_SHARED_SECRET_BYTES]; | 69 | const uint8_t *start, *expected; |
| 70 | size_t start_len; | ||
| 93 | uint8_t encap_entropy[MLKEM_ENCAP_ENTROPY]; | 71 | uint8_t encap_entropy[MLKEM_ENCAP_ENTROPY]; |
| 94 | uint8_t seed[MLKEM_SEED_BYTES] = {0}; | 72 | uint8_t seed[MLKEM_SEED_LENGTH] = {0}; |
| 73 | uint8_t *shared_secret = NULL; | ||
| 95 | sha3_ctx drng, results; | 74 | sha3_ctx drng, results; |
| 96 | uint8_t out[32]; | 75 | uint8_t out[32]; |
| 97 | int i; | 76 | int i; |
| 98 | 77 | ||
| 78 | start = kExpectedSeedStart; | ||
| 79 | start_len = sizeof(kExpectedSeedStart); | ||
| 80 | switch(rank){ | ||
| 81 | case MLKEM768_RANK: | ||
| 82 | expected = kExpectedAdam768; | ||
| 83 | break; | ||
| 84 | case MLKEM1024_RANK: | ||
| 85 | expected = kExpectedAdam1024; | ||
| 86 | break; | ||
| 87 | default: | ||
| 88 | errx(1, "invalid rank %d", rank); | ||
| 89 | } | ||
| 90 | |||
| 99 | shake128_init(&drng); | 91 | shake128_init(&drng); |
| 100 | shake128_init(&results); | 92 | shake128_init(&results); |
| 101 | 93 | ||
| 102 | shake_xof(&drng); | 94 | shake_xof(&drng); |
| 103 | for (i = 0; i < 10000; i++) { | 95 | for (i = 0; i < 10000; i++) { |
| 104 | uint8_t *encoded_private_key = NULL; | 96 | uint8_t *encoded_public_key = NULL, *ciphertext = NULL, |
| 105 | size_t encoded_private_key_len; | 97 | *encoded_private_key = NULL, *invalid_ciphertext = NULL; |
| 98 | size_t encoded_public_key_len, ciphertext_len, | ||
| 99 | encoded_private_key_len, invalid_ciphertext_len; | ||
| 100 | MLKEM_private_key *priv; | ||
| 101 | MLKEM_public_key *pub; | ||
| 102 | size_t s_len = 0; | ||
| 103 | |||
| 104 | /* allocate keys for this iteration */ | ||
| 105 | if ((priv = MLKEM_private_key_new(rank)) == NULL) | ||
| 106 | errx(1, "malloc"); | ||
| 107 | if ((pub = MLKEM_public_key_new(rank)) == NULL) | ||
| 108 | errx(1, "malloc"); | ||
| 106 | 109 | ||
| 107 | /* | 110 | /* |
| 108 | * This should draw both d and z from DRNG concatenating in | 111 | * This should draw both d and z from DRNG concatenating in |
| @@ -110,118 +113,91 @@ MlkemIterativeTest(struct iteration_ctx *ctx) | |||
| 110 | */ | 113 | */ |
| 111 | shake_out(&drng, seed, sizeof(seed)); | 114 | shake_out(&drng, seed, sizeof(seed)); |
| 112 | if (i == 0) { | 115 | if (i == 0) { |
| 113 | if (compare_data(seed, ctx->start, ctx->start_len, | 116 | if (compare_data(seed, start, start_len, |
| 114 | "seed start") != 0) | 117 | "seed start") != 0) |
| 115 | errx(1, "compare_data"); | 118 | errx(1, "compare_data"); |
| 116 | } | 119 | } |
| 117 | 120 | ||
| 118 | /* generate ek as encoded_public_key */ | 121 | /* generate ek as encoded_public_key */ |
| 119 | ctx->generate_key_external_entropy(ctx->encoded_public_key, | 122 | if (!MLKEM_generate_key_external_entropy(priv, |
| 120 | ctx->priv, seed); | 123 | &encoded_public_key, &encoded_public_key_len, |
| 121 | ctx->public_from_private(ctx->pub, ctx->priv); | 124 | seed)) |
| 125 | errx(1, "generate_key_external_entropy"); | ||
| 126 | |||
| 127 | if (!MLKEM_public_from_private(priv, pub)) | ||
| 128 | errx(1, "public_from_private"); | ||
| 122 | 129 | ||
| 123 | /* hash in ek */ | 130 | /* hash in ek */ |
| 124 | shake_update(&results, ctx->encoded_public_key, | 131 | shake_update(&results, encoded_public_key, |
| 125 | ctx->encoded_public_key_len); | 132 | encoded_public_key_len); |
| 126 | 133 | ||
| 127 | /* marshal priv to dk as encoded_private_key */ | 134 | /* marshal priv to dk as encoded_private_key */ |
| 128 | if (!ctx->encode_private_key(ctx->priv, &encoded_private_key, | 135 | if (!MLKEM_marshal_private_key(priv, &encoded_private_key, |
| 129 | &encoded_private_key_len)) | 136 | &encoded_private_key_len)) |
| 130 | errx(1, "encode private key"); | 137 | errx(1, "marshal private key"); |
| 131 | 138 | ||
| 132 | /* hash in dk */ | 139 | /* hash in dk */ |
| 133 | shake_update(&results, encoded_private_key, | 140 | shake_update(&results, encoded_private_key, |
| 134 | encoded_private_key_len); | 141 | encoded_private_key_len); |
| 135 | 142 | ||
| 136 | free(encoded_private_key); | 143 | freezero(encoded_private_key, encoded_private_key_len); |
| 137 | 144 | ||
| 138 | /* draw m as encap entropy from DRNG */ | 145 | /* draw m as encap entropy from DRNG */ |
| 139 | shake_out(&drng, encap_entropy, sizeof(encap_entropy)); | 146 | shake_out(&drng, encap_entropy, sizeof(encap_entropy)); |
| 140 | 147 | ||
| 141 | /* generate ct as ciphertext, k as shared_secret */ | 148 | /* generate ct as ciphertext, k as shared_secret */ |
| 142 | ctx->encap_external_entropy(ctx->ciphertext, shared_secret, | 149 | if (!MLKEM_encap_external_entropy(pub, encap_entropy, |
| 143 | ctx->pub, encap_entropy); | 150 | &ciphertext, &ciphertext_len, &shared_secret, &s_len)) |
| 151 | errx(1, "encap_external_entropy"); | ||
| 144 | 152 | ||
| 145 | /* hash in ct */ | 153 | /* hash in ct */ |
| 146 | shake_update(&results, ctx->ciphertext, ctx->ciphertext_len); | 154 | shake_update(&results, ciphertext, ciphertext_len); |
| 147 | /* hash in k */ | 155 | /* hash in k */ |
| 148 | shake_update(&results, shared_secret, sizeof(shared_secret)); | 156 | shake_update(&results, shared_secret, s_len); |
| 157 | |||
| 158 | freezero(shared_secret, s_len); | ||
| 159 | shared_secret = NULL; | ||
| 160 | |||
| 161 | invalid_ciphertext_len = ciphertext_len; | ||
| 162 | if ((invalid_ciphertext = calloc(1, invalid_ciphertext_len)) | ||
| 163 | == NULL) | ||
| 164 | errx(1, "malloc"); | ||
| 149 | 165 | ||
| 150 | /* draw ct as invalid_ciphertxt from DRNG */ | 166 | /* draw ct as invalid_ciphertxt from DRNG */ |
| 151 | shake_out(&drng, ctx->invalid_ciphertext, | 167 | shake_out(&drng, invalid_ciphertext, invalid_ciphertext_len); |
| 152 | ctx->invalid_ciphertext_len); | ||
| 153 | 168 | ||
| 154 | /* generate k as shared secret from invalid ciphertext */ | 169 | /* generate k as shared secret from invalid ciphertext */ |
| 155 | if (!ctx->decap(shared_secret, ctx->invalid_ciphertext, | 170 | if (!MLKEM_decap(priv, invalid_ciphertext, |
| 156 | ctx->invalid_ciphertext_len, ctx->priv)) | 171 | invalid_ciphertext_len, &shared_secret, &s_len)) |
| 157 | errx(1, "decap failed"); | 172 | errx(1, "decap failed, iteration %d", i); |
| 158 | 173 | ||
| 159 | /* hash in k */ | 174 | /* hash in k */ |
| 160 | shake_update(&results, shared_secret, sizeof(shared_secret)); | 175 | shake_update(&results, shared_secret, s_len); |
| 176 | |||
| 177 | freezero(shared_secret, s_len); | ||
| 178 | shared_secret = NULL; | ||
| 179 | freezero(invalid_ciphertext, invalid_ciphertext_len); | ||
| 180 | invalid_ciphertext = NULL; | ||
| 181 | |||
| 182 | /* free keys and intermediate products for this iteration */ | ||
| 183 | MLKEM_private_key_free(priv); | ||
| 184 | MLKEM_public_key_free(pub); | ||
| 185 | freezero(encoded_public_key, encoded_public_key_len); | ||
| 186 | freezero(ciphertext, ciphertext_len); | ||
| 161 | } | 187 | } |
| 162 | shake_xof(&results); | 188 | shake_xof(&results); |
| 163 | shake_out(&results, out, sizeof(out)); | 189 | shake_out(&results, out, sizeof(out)); |
| 164 | 190 | ||
| 165 | return compare_data(ctx->expected, out, sizeof(out), "final result hash"); | 191 | return compare_data(expected, out, sizeof(out), "final result hash"); |
| 166 | } | 192 | } |
| 167 | 193 | ||
| 168 | int | 194 | int |
| 169 | main(void) | 195 | main(void) |
| 170 | { | 196 | { |
| 171 | uint8_t encoded_public_key768[MLKEM768_PUBLIC_KEY_BYTES]; | ||
| 172 | uint8_t ciphertext768[MLKEM768_CIPHERTEXT_BYTES]; | ||
| 173 | uint8_t invalid_ciphertext768[MLKEM768_CIPHERTEXT_BYTES]; | ||
| 174 | struct MLKEM768_private_key priv768; | ||
| 175 | struct MLKEM768_public_key pub768; | ||
| 176 | struct iteration_ctx iteration768 = { | ||
| 177 | .encoded_public_key = encoded_public_key768, | ||
| 178 | .encoded_public_key_len = sizeof(encoded_public_key768), | ||
| 179 | .ciphertext = ciphertext768, | ||
| 180 | .ciphertext_len = sizeof(ciphertext768), | ||
| 181 | .invalid_ciphertext = invalid_ciphertext768, | ||
| 182 | .invalid_ciphertext_len = sizeof(invalid_ciphertext768), | ||
| 183 | .priv = &priv768, | ||
| 184 | .pub = &pub768, | ||
| 185 | .encap_external_entropy = mlkem768_encap_external_entropy, | ||
| 186 | .encode_private_key = mlkem768_encode_private_key, | ||
| 187 | .generate_key_external_entropy = | ||
| 188 | mlkem768_generate_key_external_entropy, | ||
| 189 | .public_from_private = mlkem768_public_from_private, | ||
| 190 | .decap = mlkem768_decap, | ||
| 191 | .start = kExpectedSeedStart, | ||
| 192 | .start_len = sizeof(kExpectedSeedStart), | ||
| 193 | .expected = kExpectedAdam768, | ||
| 194 | .expected_len = sizeof(kExpectedAdam768), | ||
| 195 | }; | ||
| 196 | uint8_t encoded_public_key1024[MLKEM1024_PUBLIC_KEY_BYTES]; | ||
| 197 | uint8_t ciphertext1024[MLKEM1024_CIPHERTEXT_BYTES]; | ||
| 198 | uint8_t invalid_ciphertext1024[MLKEM1024_CIPHERTEXT_BYTES]; | ||
| 199 | struct MLKEM1024_private_key priv1024; | ||
| 200 | struct MLKEM1024_public_key pub1024; | ||
| 201 | struct iteration_ctx iteration1024 = { | ||
| 202 | .encoded_public_key = encoded_public_key1024, | ||
| 203 | .encoded_public_key_len = sizeof(encoded_public_key1024), | ||
| 204 | .ciphertext = ciphertext1024, | ||
| 205 | .ciphertext_len = sizeof(ciphertext1024), | ||
| 206 | .invalid_ciphertext = invalid_ciphertext1024, | ||
| 207 | .invalid_ciphertext_len = sizeof(invalid_ciphertext1024), | ||
| 208 | .priv = &priv1024, | ||
| 209 | .pub = &pub1024, | ||
| 210 | .encap_external_entropy = mlkem1024_encap_external_entropy, | ||
| 211 | .encode_private_key = mlkem1024_encode_private_key, | ||
| 212 | .generate_key_external_entropy = | ||
| 213 | mlkem1024_generate_key_external_entropy, | ||
| 214 | .public_from_private = mlkem1024_public_from_private, | ||
| 215 | .decap = mlkem1024_decap, | ||
| 216 | .start = kExpectedSeedStart, | ||
| 217 | .start_len = sizeof(kExpectedSeedStart), | ||
| 218 | .expected = kExpectedAdam1024, | ||
| 219 | .expected_len = sizeof(kExpectedAdam1024), | ||
| 220 | }; | ||
| 221 | int failed = 0; | 197 | int failed = 0; |
| 222 | 198 | ||
| 223 | failed |= MlkemIterativeTest(&iteration768); | 199 | failed |= MlkemIterativeTest(MLKEM768_RANK); |
| 224 | failed |= MlkemIterativeTest(&iteration1024); | 200 | failed |= MlkemIterativeTest(MLKEM1024_RANK); |
| 225 | 201 | ||
| 226 | return failed; | 202 | return failed; |
| 227 | } | 203 | } |
diff --git a/src/regress/lib/libcrypto/mlkem/mlkem_tests.c b/src/regress/lib/libcrypto/mlkem/mlkem_tests.c index 2801a58890..5e8441307c 100644 --- a/src/regress/lib/libcrypto/mlkem/mlkem_tests.c +++ b/src/regress/lib/libcrypto/mlkem/mlkem_tests.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: mlkem_tests.c,v 1.2 2024/12/26 00:10:19 tb Exp $ */ | 1 | /* $OpenBSD: mlkem_tests.c,v 1.11 2026/01/01 12:47:52 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Google Inc. | 3 | * Copyright (c) 2024 Google Inc. |
| 4 | * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> |
| @@ -23,12 +23,11 @@ | |||
| 23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
| 24 | #include <string.h> | 24 | #include <string.h> |
| 25 | 25 | ||
| 26 | #include "bytestring.h" | 26 | #include <openssl/mlkem.h> |
| 27 | #include "mlkem.h" | ||
| 28 | 27 | ||
| 28 | #include "bytestring.h" | ||
| 29 | #include "mlkem_internal.h" | 29 | #include "mlkem_internal.h" |
| 30 | 30 | ||
| 31 | #include "mlkem_tests_util.h" | ||
| 32 | #include "parse_test_file.h" | 31 | #include "parse_test_file.h" |
| 33 | 32 | ||
| 34 | enum test_type { | 33 | enum test_type { |
| @@ -39,11 +38,7 @@ enum test_type { | |||
| 39 | struct decap_ctx { | 38 | struct decap_ctx { |
| 40 | struct parse *parse_ctx; | 39 | struct parse *parse_ctx; |
| 41 | 40 | ||
| 42 | void *private_key; | 41 | int rank; |
| 43 | size_t private_key_len; | ||
| 44 | |||
| 45 | mlkem_parse_private_key_fn parse_private_key; | ||
| 46 | mlkem_decap_fn decap; | ||
| 47 | }; | 42 | }; |
| 48 | 43 | ||
| 49 | enum decap_states { | 44 | enum decap_states { |
| @@ -102,8 +97,10 @@ static int | |||
| 102 | MlkemDecapFileTest(struct decap_ctx *decap) | 97 | MlkemDecapFileTest(struct decap_ctx *decap) |
| 103 | { | 98 | { |
| 104 | struct parse *p = decap->parse_ctx; | 99 | struct parse *p = decap->parse_ctx; |
| 105 | uint8_t shared_secret_buf[MLKEM_SHARED_SECRET_BYTES]; | 100 | MLKEM_private_key *priv_key = NULL; |
| 106 | CBS ciphertext, shared_secret, private_key; | 101 | CBS ciphertext, shared_secret, private_key; |
| 102 | uint8_t *shared_secret_buf = NULL; | ||
| 103 | size_t shared_secret_buf_len = 0; | ||
| 107 | int should_fail; | 104 | int should_fail; |
| 108 | int failed = 1; | 105 | int failed = 1; |
| 109 | 106 | ||
| @@ -112,20 +109,31 @@ MlkemDecapFileTest(struct decap_ctx *decap) | |||
| 112 | parse_get_cbs(p, DECAP_PRIVATE_KEY, &private_key); | 109 | parse_get_cbs(p, DECAP_PRIVATE_KEY, &private_key); |
| 113 | parse_get_int(p, DECAP_RESULT, &should_fail); | 110 | parse_get_int(p, DECAP_RESULT, &should_fail); |
| 114 | 111 | ||
| 115 | if (!decap->parse_private_key(decap->private_key, &private_key)) { | 112 | if ((priv_key = MLKEM_private_key_new(decap->rank)) == NULL) |
| 113 | parse_errx(p, "MLKEM_private_key_new"); | ||
| 114 | |||
| 115 | if (!MLKEM_parse_private_key(priv_key, | ||
| 116 | CBS_data(&private_key), CBS_len(&private_key))) { | ||
| 116 | if ((failed = !should_fail)) | 117 | if ((failed = !should_fail)) |
| 117 | parse_info(p, "parse private key"); | 118 | parse_info(p, "parse private key"); |
| 118 | goto err; | 119 | goto err; |
| 119 | } | 120 | } |
| 120 | if (!decap->decap(shared_secret_buf, | 121 | if (!MLKEM_decap(priv_key, CBS_data(&ciphertext), CBS_len(&ciphertext), |
| 121 | CBS_data(&ciphertext), CBS_len(&ciphertext), decap->private_key)) { | 122 | &shared_secret_buf, &shared_secret_buf_len)) { |
| 122 | if ((failed = !should_fail)) | 123 | if ((failed = !should_fail)) |
| 123 | parse_info(p, "decap"); | 124 | parse_info(p, "decap"); |
| 124 | goto err; | 125 | goto err; |
| 125 | } | 126 | } |
| 126 | 127 | ||
| 128 | if (shared_secret_buf_len != MLKEM_SHARED_SECRET_LENGTH) { | ||
| 129 | if ((failed = !should_fail)) | ||
| 130 | parse_info(p, "shared secret length %zu != %d", | ||
| 131 | shared_secret_buf_len, MLKEM_SHARED_SECRET_LENGTH); | ||
| 132 | goto err; | ||
| 133 | } | ||
| 134 | |||
| 127 | failed = !parse_data_equal(p, "shared_secret", &shared_secret, | 135 | failed = !parse_data_equal(p, "shared_secret", &shared_secret, |
| 128 | shared_secret_buf, sizeof(shared_secret_buf)); | 136 | shared_secret_buf, shared_secret_buf_len); |
| 129 | 137 | ||
| 130 | if (should_fail != failed) { | 138 | if (should_fail != failed) { |
| 131 | parse_info(p, "FAIL: should_fail %d, failed %d", | 139 | parse_info(p, "FAIL: should_fail %d, failed %d", |
| @@ -134,6 +142,9 @@ MlkemDecapFileTest(struct decap_ctx *decap) | |||
| 134 | } | 142 | } |
| 135 | 143 | ||
| 136 | err: | 144 | err: |
| 145 | MLKEM_private_key_free(priv_key); | ||
| 146 | freezero(shared_secret_buf, shared_secret_buf_len); | ||
| 147 | |||
| 137 | return failed; | 148 | return failed; |
| 138 | } | 149 | } |
| 139 | 150 | ||
| @@ -192,35 +203,49 @@ static int | |||
| 192 | MlkemNistDecapFileTest(struct decap_ctx *decap) | 203 | MlkemNistDecapFileTest(struct decap_ctx *decap) |
| 193 | { | 204 | { |
| 194 | struct parse *p = decap->parse_ctx; | 205 | struct parse *p = decap->parse_ctx; |
| 195 | uint8_t shared_secret[MLKEM_SHARED_SECRET_BYTES]; | 206 | MLKEM_private_key *priv_key = NULL; |
| 196 | CBS dk, c, k; | 207 | CBS dk, c, k; |
| 208 | uint8_t *shared_secret = NULL; | ||
| 209 | size_t shared_secret_len = 0; | ||
| 197 | int failed = 1; | 210 | int failed = 1; |
| 198 | 211 | ||
| 199 | parse_instruction_get_cbs(p, NIST_DECAP_DK, &dk); | 212 | parse_instruction_get_cbs(p, NIST_DECAP_DK, &dk); |
| 200 | parse_get_cbs(p, NIST_DECAP_C, &c); | 213 | parse_get_cbs(p, NIST_DECAP_C, &c); |
| 201 | parse_get_cbs(p, NIST_DECAP_K, &k); | 214 | parse_get_cbs(p, NIST_DECAP_K, &k); |
| 202 | 215 | ||
| 216 | if ((priv_key = MLKEM_private_key_new(decap->rank)) == NULL) | ||
| 217 | parse_errx(p, "MLKEM_private_key_new"); | ||
| 218 | |||
| 203 | if (!parse_length_equal(p, "private key", | 219 | if (!parse_length_equal(p, "private key", |
| 204 | decap->private_key_len, CBS_len(&dk))) | 220 | MLKEM_private_key_encoded_length(priv_key), CBS_len(&dk))) |
| 205 | goto err; | 221 | goto err; |
| 206 | if (!parse_length_equal(p, "shared secret", | 222 | if (!parse_length_equal(p, "shared secret", |
| 207 | MLKEM_SHARED_SECRET_BYTES, CBS_len(&k))) | 223 | MLKEM_SHARED_SECRET_LENGTH, CBS_len(&k))) |
| 208 | goto err; | 224 | goto err; |
| 209 | 225 | ||
| 210 | if (!decap->parse_private_key(decap->private_key, &dk)) { | 226 | if (!MLKEM_parse_private_key(priv_key, CBS_data(&dk), CBS_len(&dk))) { |
| 211 | parse_info(p, "parse private key"); | 227 | parse_info(p, "parse private key"); |
| 212 | goto err; | 228 | goto err; |
| 213 | } | 229 | } |
| 214 | if (!decap->decap(shared_secret, CBS_data(&c), CBS_len(&c), | 230 | if (!MLKEM_decap(priv_key, CBS_data(&c), CBS_len(&c), |
| 215 | decap->private_key)) { | 231 | &shared_secret, &shared_secret_len)) { |
| 216 | parse_info(p, "decap"); | 232 | parse_info(p, "decap"); |
| 217 | goto err; | 233 | goto err; |
| 218 | } | 234 | } |
| 219 | 235 | ||
| 236 | if (shared_secret_len != MLKEM_SHARED_SECRET_LENGTH) { | ||
| 237 | parse_info(p, "shared secret length %zu != %d", | ||
| 238 | shared_secret_len, MLKEM_SHARED_SECRET_LENGTH); | ||
| 239 | goto err; | ||
| 240 | } | ||
| 241 | |||
| 220 | failed = !parse_data_equal(p, "shared secret", &k, | 242 | failed = !parse_data_equal(p, "shared secret", &k, |
| 221 | shared_secret, MLKEM_SHARED_SECRET_BYTES); | 243 | shared_secret, shared_secret_len); |
| 222 | 244 | ||
| 223 | err: | 245 | err: |
| 246 | MLKEM_private_key_free(priv_key); | ||
| 247 | freezero(shared_secret, shared_secret_len); | ||
| 248 | |||
| 224 | return failed; | 249 | return failed; |
| 225 | } | 250 | } |
| 226 | 251 | ||
| @@ -244,46 +269,24 @@ static const struct test_parse nist_decap_parse = { | |||
| 244 | }; | 269 | }; |
| 245 | 270 | ||
| 246 | static int | 271 | static int |
| 247 | mlkem_decap_tests(const char *fn, size_t size, enum test_type test_type) | 272 | mlkem_decap_tests(const char *fn, int rank, enum test_type test_type) |
| 248 | { | 273 | { |
| 249 | struct MLKEM768_private_key private_key768; | 274 | struct decap_ctx decap = { |
| 250 | struct decap_ctx decap768 = { | 275 | .rank = rank, |
| 251 | .private_key = &private_key768, | ||
| 252 | .private_key_len = MLKEM768_PRIVATE_KEY_BYTES, | ||
| 253 | |||
| 254 | .parse_private_key = mlkem768_parse_private_key, | ||
| 255 | .decap = mlkem768_decap, | ||
| 256 | }; | 276 | }; |
| 257 | struct MLKEM1024_private_key private_key1024; | ||
| 258 | struct decap_ctx decap1024 = { | ||
| 259 | .private_key = &private_key1024, | ||
| 260 | .private_key_len = MLKEM1024_PRIVATE_KEY_BYTES, | ||
| 261 | 277 | ||
| 262 | .parse_private_key = mlkem1024_parse_private_key, | 278 | if (test_type == TEST_TYPE_NORMAL) |
| 263 | .decap = mlkem1024_decap, | 279 | return parse_test_file(fn, &decap_parse, &decap); |
| 264 | }; | 280 | if (test_type == TEST_TYPE_NIST) |
| 265 | 281 | return parse_test_file(fn, &nist_decap_parse, &decap); | |
| 266 | if (size == 768 && test_type == TEST_TYPE_NORMAL) | ||
| 267 | return parse_test_file(fn, &decap_parse, &decap768); | ||
| 268 | if (size == 768 && test_type == TEST_TYPE_NIST) | ||
| 269 | return parse_test_file(fn, &nist_decap_parse, &decap768); | ||
| 270 | if (size == 1024 && test_type == TEST_TYPE_NORMAL) | ||
| 271 | return parse_test_file(fn, &decap_parse, &decap1024); | ||
| 272 | if (size == 1024 && test_type == TEST_TYPE_NIST) | ||
| 273 | return parse_test_file(fn, &nist_decap_parse, &decap1024); | ||
| 274 | 282 | ||
| 275 | errx(1, "unknown decap test: size %zu, type %d", size, test_type); | 283 | errx(1, "unknown decap test: rank %d, type %d", rank, test_type); |
| 276 | } | 284 | } |
| 277 | 285 | ||
| 278 | struct encap_ctx { | 286 | struct encap_ctx { |
| 279 | struct parse *parse_ctx; | 287 | struct parse *parse_ctx; |
| 280 | 288 | ||
| 281 | void *public_key; | 289 | int rank; |
| 282 | uint8_t *ciphertext; | ||
| 283 | size_t ciphertext_len; | ||
| 284 | |||
| 285 | mlkem_parse_public_key_fn parse_public_key; | ||
| 286 | mlkem_encap_external_entropy_fn encap_external_entropy; | ||
| 287 | }; | 290 | }; |
| 288 | 291 | ||
| 289 | enum encap_states { | 292 | enum encap_states { |
| @@ -349,8 +352,12 @@ static int | |||
| 349 | MlkemEncapFileTest(struct encap_ctx *encap) | 352 | MlkemEncapFileTest(struct encap_ctx *encap) |
| 350 | { | 353 | { |
| 351 | struct parse *p = encap->parse_ctx; | 354 | struct parse *p = encap->parse_ctx; |
| 352 | uint8_t shared_secret_buf[MLKEM_SHARED_SECRET_BYTES]; | 355 | MLKEM_public_key *pub_key = NULL; |
| 353 | CBS entropy, public_key, ciphertext, shared_secret; | 356 | CBS entropy, public_key, ciphertext, shared_secret; |
| 357 | uint8_t *ciphertext_buf = NULL; | ||
| 358 | size_t ciphertext_buf_len = 0; | ||
| 359 | uint8_t *shared_secret_buf = NULL; | ||
| 360 | size_t shared_secret_buf_len = 0; | ||
| 354 | int should_fail; | 361 | int should_fail; |
| 355 | int failed = 1; | 362 | int failed = 1; |
| 356 | 363 | ||
| @@ -360,18 +367,34 @@ MlkemEncapFileTest(struct encap_ctx *encap) | |||
| 360 | parse_get_cbs(p, ENCAP_SHARED_SECRET, &shared_secret); | 367 | parse_get_cbs(p, ENCAP_SHARED_SECRET, &shared_secret); |
| 361 | parse_get_int(p, ENCAP_RESULT, &should_fail); | 368 | parse_get_int(p, ENCAP_RESULT, &should_fail); |
| 362 | 369 | ||
| 363 | if (!encap->parse_public_key(encap->public_key, &public_key)) { | 370 | if ((pub_key = MLKEM_public_key_new(encap->rank)) == NULL) |
| 371 | parse_errx(p, "MLKEM_public_key_new"); | ||
| 372 | |||
| 373 | if (!MLKEM_parse_public_key(pub_key, | ||
| 374 | CBS_data(&public_key), CBS_len(&public_key))) { | ||
| 364 | if ((failed = !should_fail)) | 375 | if ((failed = !should_fail)) |
| 365 | parse_info(p, "parse public key"); | 376 | parse_info(p, "parse public key"); |
| 366 | goto err; | 377 | goto err; |
| 367 | } | 378 | } |
| 368 | encap->encap_external_entropy(encap->ciphertext, shared_secret_buf, | 379 | if (!MLKEM_encap_external_entropy(pub_key, CBS_data(&entropy), |
| 369 | encap->public_key, CBS_data(&entropy)); | 380 | &ciphertext_buf, &ciphertext_buf_len, |
| 381 | &shared_secret_buf, &shared_secret_buf_len)) { | ||
| 382 | if ((failed = !should_fail)) | ||
| 383 | parse_info(p, "encap_external_entropy"); | ||
| 384 | goto err; | ||
| 385 | } | ||
| 386 | |||
| 387 | if (shared_secret_buf_len != MLKEM_SHARED_SECRET_LENGTH) { | ||
| 388 | if ((failed = !should_fail)) | ||
| 389 | parse_info(p, "shared secret length %zu != %d", | ||
| 390 | shared_secret_buf_len, MLKEM_SHARED_SECRET_LENGTH); | ||
| 391 | goto err; | ||
| 392 | } | ||
| 370 | 393 | ||
| 371 | failed = !parse_data_equal(p, "shared_secret", &shared_secret, | 394 | failed = !parse_data_equal(p, "shared_secret", &shared_secret, |
| 372 | shared_secret_buf, sizeof(shared_secret_buf)); | 395 | shared_secret_buf, shared_secret_buf_len); |
| 373 | failed |= !parse_data_equal(p, "ciphertext", &ciphertext, | 396 | failed |= !parse_data_equal(p, "ciphertext", &ciphertext, |
| 374 | encap->ciphertext, encap->ciphertext_len); | 397 | ciphertext_buf, ciphertext_buf_len); |
| 375 | 398 | ||
| 376 | if (should_fail != failed) { | 399 | if (should_fail != failed) { |
| 377 | parse_info(p, "FAIL: should_fail %d, failed %d", | 400 | parse_info(p, "FAIL: should_fail %d, failed %d", |
| @@ -380,6 +403,10 @@ MlkemEncapFileTest(struct encap_ctx *encap) | |||
| 380 | } | 403 | } |
| 381 | 404 | ||
| 382 | err: | 405 | err: |
| 406 | MLKEM_public_key_free(pub_key); | ||
| 407 | freezero(ciphertext_buf, ciphertext_buf_len); | ||
| 408 | freezero(shared_secret_buf, shared_secret_buf_len); | ||
| 409 | |||
| 383 | return failed; | 410 | return failed; |
| 384 | } | 411 | } |
| 385 | 412 | ||
| @@ -400,48 +427,19 @@ static const struct test_parse encap_parse = { | |||
| 400 | }; | 427 | }; |
| 401 | 428 | ||
| 402 | static int | 429 | static int |
| 403 | mlkem_encap_tests(const char *fn, size_t size) | 430 | mlkem_encap_tests(const char *fn, int rank) |
| 404 | { | 431 | { |
| 405 | struct MLKEM768_public_key public_key768; | 432 | struct encap_ctx encap = { |
| 406 | uint8_t ciphertext768[MLKEM768_CIPHERTEXT_BYTES]; | 433 | .rank = rank, |
| 407 | struct encap_ctx encap768 = { | ||
| 408 | .public_key = &public_key768, | ||
| 409 | .ciphertext = ciphertext768, | ||
| 410 | .ciphertext_len = sizeof(ciphertext768), | ||
| 411 | |||
| 412 | .parse_public_key = mlkem768_parse_public_key, | ||
| 413 | .encap_external_entropy = mlkem768_encap_external_entropy, | ||
| 414 | }; | ||
| 415 | struct MLKEM1024_public_key public_key1024; | ||
| 416 | uint8_t ciphertext1024[MLKEM1024_CIPHERTEXT_BYTES]; | ||
| 417 | struct encap_ctx encap1024 = { | ||
| 418 | .public_key = &public_key1024, | ||
| 419 | .ciphertext = ciphertext1024, | ||
| 420 | .ciphertext_len = sizeof(ciphertext1024), | ||
| 421 | |||
| 422 | .parse_public_key = mlkem1024_parse_public_key, | ||
| 423 | .encap_external_entropy = mlkem1024_encap_external_entropy, | ||
| 424 | }; | 434 | }; |
| 425 | 435 | ||
| 426 | if (size == 768) | 436 | return parse_test_file(fn, &encap_parse, &encap); |
| 427 | return parse_test_file(fn, &encap_parse, &encap768); | ||
| 428 | if (size == 1024) | ||
| 429 | return parse_test_file(fn, &encap_parse, &encap1024); | ||
| 430 | |||
| 431 | errx(1, "unknown encap test: size %zu", size); | ||
| 432 | } | 437 | } |
| 433 | 438 | ||
| 434 | struct keygen_ctx { | 439 | struct keygen_ctx { |
| 435 | struct parse *parse_ctx; | 440 | struct parse *parse_ctx; |
| 436 | 441 | ||
| 437 | void *private_key; | 442 | int rank; |
| 438 | void *encoded_public_key; | ||
| 439 | size_t encoded_public_key_len; | ||
| 440 | size_t private_key_len; | ||
| 441 | size_t public_key_len; | ||
| 442 | |||
| 443 | mlkem_generate_key_external_entropy_fn generate_key_external_entropy; | ||
| 444 | mlkem_encode_private_key_fn encode_private_key; | ||
| 445 | }; | 443 | }; |
| 446 | 444 | ||
| 447 | enum keygen_states { | 445 | enum keygen_states { |
| @@ -492,27 +490,38 @@ static int | |||
| 492 | MlkemKeygenFileTest(struct keygen_ctx *keygen) | 490 | MlkemKeygenFileTest(struct keygen_ctx *keygen) |
| 493 | { | 491 | { |
| 494 | struct parse *p = keygen->parse_ctx; | 492 | struct parse *p = keygen->parse_ctx; |
| 493 | MLKEM_private_key *priv_key = NULL; | ||
| 495 | CBS seed, public_key, private_key; | 494 | CBS seed, public_key, private_key; |
| 496 | uint8_t *encoded_private_key = NULL; | 495 | uint8_t *encoded_private_key = NULL; |
| 497 | size_t encoded_private_key_len = 0; | 496 | size_t encoded_private_key_len = 0; |
| 497 | uint8_t *encoded_public_key = NULL; | ||
| 498 | size_t encoded_public_key_len = 0; | ||
| 498 | int failed = 1; | 499 | int failed = 1; |
| 499 | 500 | ||
| 500 | parse_get_cbs(p, KEYGEN_SEED, &seed); | 501 | parse_get_cbs(p, KEYGEN_SEED, &seed); |
| 501 | parse_get_cbs(p, KEYGEN_PUBLIC_KEY, &public_key); | 502 | parse_get_cbs(p, KEYGEN_PUBLIC_KEY, &public_key); |
| 502 | parse_get_cbs(p, KEYGEN_PRIVATE_KEY, &private_key); | 503 | parse_get_cbs(p, KEYGEN_PRIVATE_KEY, &private_key); |
| 503 | 504 | ||
| 504 | if (!parse_length_equal(p, "seed", MLKEM_SEED_BYTES, CBS_len(&seed))) | 505 | if (!parse_length_equal(p, "seed", MLKEM_SEED_LENGTH, CBS_len(&seed))) |
| 505 | goto err; | 506 | goto err; |
| 507 | |||
| 508 | if ((priv_key = MLKEM_private_key_new(keygen->rank)) == NULL) | ||
| 509 | parse_errx(p, "MLKEM_public_key_free"); | ||
| 510 | |||
| 511 | if (!MLKEM_generate_key_external_entropy(priv_key, | ||
| 512 | &encoded_public_key, &encoded_public_key_len, CBS_data(&seed))) { | ||
| 513 | parse_info(p, "generate_key_external_entropy"); | ||
| 514 | goto err; | ||
| 515 | } | ||
| 516 | |||
| 506 | if (!parse_length_equal(p, "public key", | 517 | if (!parse_length_equal(p, "public key", |
| 507 | keygen->public_key_len, CBS_len(&public_key))) | 518 | encoded_public_key_len, CBS_len(&public_key))) |
| 508 | goto err; | 519 | goto err; |
| 509 | if (!parse_length_equal(p, "private key", | 520 | if (!parse_length_equal(p, "private key", |
| 510 | keygen->private_key_len, CBS_len(&private_key))) | 521 | MLKEM_private_key_encoded_length(priv_key), CBS_len(&private_key))) |
| 511 | goto err; | 522 | goto err; |
| 512 | 523 | ||
| 513 | keygen->generate_key_external_entropy(keygen->encoded_public_key, | 524 | if (!MLKEM_marshal_private_key(priv_key, |
| 514 | keygen->private_key, CBS_data(&seed)); | ||
| 515 | if (!keygen->encode_private_key(keygen->private_key, | ||
| 516 | &encoded_private_key, &encoded_private_key_len)) { | 525 | &encoded_private_key, &encoded_private_key_len)) { |
| 517 | parse_info(p, "encode private key"); | 526 | parse_info(p, "encode private key"); |
| 518 | goto err; | 527 | goto err; |
| @@ -521,10 +530,12 @@ MlkemKeygenFileTest(struct keygen_ctx *keygen) | |||
| 521 | failed = !parse_data_equal(p, "private key", &private_key, | 530 | failed = !parse_data_equal(p, "private key", &private_key, |
| 522 | encoded_private_key, encoded_private_key_len); | 531 | encoded_private_key, encoded_private_key_len); |
| 523 | failed |= !parse_data_equal(p, "public key", &public_key, | 532 | failed |= !parse_data_equal(p, "public key", &public_key, |
| 524 | keygen->encoded_public_key, keygen->encoded_public_key_len); | 533 | encoded_public_key, encoded_public_key_len); |
| 525 | 534 | ||
| 526 | err: | 535 | err: |
| 536 | MLKEM_private_key_free(priv_key); | ||
| 527 | freezero(encoded_private_key, encoded_private_key_len); | 537 | freezero(encoded_private_key, encoded_private_key_len); |
| 538 | freezero(encoded_public_key, encoded_public_key_len); | ||
| 528 | 539 | ||
| 529 | return failed; | 540 | return failed; |
| 530 | } | 541 | } |
| @@ -584,12 +595,15 @@ static int | |||
| 584 | MlkemNistKeygenFileTest(struct keygen_ctx *keygen) | 595 | MlkemNistKeygenFileTest(struct keygen_ctx *keygen) |
| 585 | { | 596 | { |
| 586 | struct parse *p = keygen->parse_ctx; | 597 | struct parse *p = keygen->parse_ctx; |
| 598 | MLKEM_private_key *priv_key = NULL; | ||
| 587 | CBB seed_cbb; | 599 | CBB seed_cbb; |
| 588 | CBS z, d, ek, dk; | 600 | CBS z, d, ek, dk; |
| 589 | uint8_t seed[MLKEM_SEED_BYTES]; | 601 | uint8_t seed[MLKEM_SEED_LENGTH]; |
| 590 | size_t seed_len; | 602 | size_t seed_len; |
| 591 | uint8_t *encoded_private_key = NULL; | 603 | uint8_t *encoded_private_key = NULL; |
| 592 | size_t encoded_private_key_len = 0; | 604 | size_t encoded_private_key_len = 0; |
| 605 | uint8_t *encoded_public_key = NULL; | ||
| 606 | size_t encoded_public_key_len = 0; | ||
| 593 | int failed = 1; | 607 | int failed = 1; |
| 594 | 608 | ||
| 595 | parse_get_cbs(p, NIST_KEYGEN_Z, &z); | 609 | parse_get_cbs(p, NIST_KEYGEN_Z, &z); |
| @@ -606,24 +620,33 @@ MlkemNistKeygenFileTest(struct keygen_ctx *keygen) | |||
| 606 | if (!CBB_finish(&seed_cbb, NULL, &seed_len)) | 620 | if (!CBB_finish(&seed_cbb, NULL, &seed_len)) |
| 607 | parse_errx(p, "CBB_finish"); | 621 | parse_errx(p, "CBB_finish"); |
| 608 | 622 | ||
| 609 | if (!parse_length_equal(p, "bogus z or d", MLKEM_SEED_BYTES, seed_len)) | 623 | if (!parse_length_equal(p, "bogus z or d", MLKEM_SEED_LENGTH, seed_len)) |
| 610 | goto err; | 624 | goto err; |
| 611 | 625 | ||
| 612 | keygen->generate_key_external_entropy(keygen->encoded_public_key, | 626 | if ((priv_key = MLKEM_private_key_new(keygen->rank)) == NULL) |
| 613 | keygen->private_key, seed); | 627 | parse_errx(p, "MLKEM_private_key_new"); |
| 614 | if (!keygen->encode_private_key(keygen->private_key, | 628 | |
| 629 | if (!MLKEM_generate_key_external_entropy(priv_key, | ||
| 630 | &encoded_public_key, &encoded_public_key_len, seed)) { | ||
| 631 | parse_info(p, "MLKEM_generate_key_external_entropy"); | ||
| 632 | goto err; | ||
| 633 | } | ||
| 634 | |||
| 635 | if (!MLKEM_marshal_private_key(priv_key, | ||
| 615 | &encoded_private_key, &encoded_private_key_len)) { | 636 | &encoded_private_key, &encoded_private_key_len)) { |
| 616 | parse_info(p, "encode private key"); | 637 | parse_info(p, "encode private key"); |
| 617 | goto err; | 638 | goto err; |
| 618 | } | 639 | } |
| 619 | 640 | ||
| 620 | failed = !parse_data_equal(p, "public key", &ek, | 641 | failed = !parse_data_equal(p, "public key", &ek, |
| 621 | keygen->encoded_public_key, keygen->encoded_public_key_len); | 642 | encoded_public_key, encoded_public_key_len); |
| 622 | failed |= !parse_data_equal(p, "private key", &dk, | 643 | failed |= !parse_data_equal(p, "private key", &dk, |
| 623 | encoded_private_key, encoded_private_key_len); | 644 | encoded_private_key, encoded_private_key_len); |
| 624 | 645 | ||
| 625 | err: | 646 | err: |
| 647 | MLKEM_private_key_free(priv_key); | ||
| 626 | freezero(encoded_private_key, encoded_private_key_len); | 648 | freezero(encoded_private_key, encoded_private_key_len); |
| 649 | freezero(encoded_public_key, encoded_public_key_len); | ||
| 627 | 650 | ||
| 628 | return failed; | 651 | return failed; |
| 629 | } | 652 | } |
| @@ -645,73 +668,45 @@ static const struct test_parse nist_keygen_parse = { | |||
| 645 | }; | 668 | }; |
| 646 | 669 | ||
| 647 | static int | 670 | static int |
| 648 | mlkem_keygen_tests(const char *fn, size_t size, enum test_type test_type) | 671 | mlkem_keygen_tests(const char *fn, int rank, enum test_type test_type) |
| 649 | { | 672 | { |
| 650 | struct MLKEM768_private_key private_key768; | 673 | struct keygen_ctx keygen = { |
| 651 | uint8_t encoded_public_key768[MLKEM768_PUBLIC_KEY_BYTES]; | 674 | .rank = rank, |
| 652 | struct keygen_ctx keygen768 = { | ||
| 653 | .private_key = &private_key768, | ||
| 654 | .encoded_public_key = encoded_public_key768, | ||
| 655 | .encoded_public_key_len = sizeof(encoded_public_key768), | ||
| 656 | .private_key_len = MLKEM768_PRIVATE_KEY_BYTES, | ||
| 657 | .public_key_len = MLKEM768_PUBLIC_KEY_BYTES, | ||
| 658 | .generate_key_external_entropy = | ||
| 659 | mlkem768_generate_key_external_entropy, | ||
| 660 | .encode_private_key = | ||
| 661 | mlkem768_encode_private_key, | ||
| 662 | }; | ||
| 663 | struct MLKEM1024_private_key private_key1024; | ||
| 664 | uint8_t encoded_public_key1024[MLKEM1024_PUBLIC_KEY_BYTES]; | ||
| 665 | struct keygen_ctx keygen1024 = { | ||
| 666 | .private_key = &private_key1024, | ||
| 667 | .encoded_public_key = encoded_public_key1024, | ||
| 668 | .encoded_public_key_len = sizeof(encoded_public_key1024), | ||
| 669 | .private_key_len = MLKEM1024_PRIVATE_KEY_BYTES, | ||
| 670 | .public_key_len = MLKEM1024_PUBLIC_KEY_BYTES, | ||
| 671 | |||
| 672 | .generate_key_external_entropy = | ||
| 673 | mlkem1024_generate_key_external_entropy, | ||
| 674 | .encode_private_key = | ||
| 675 | mlkem1024_encode_private_key, | ||
| 676 | }; | 675 | }; |
| 677 | 676 | ||
| 678 | if (size == 768 && test_type == TEST_TYPE_NORMAL) | 677 | if (test_type == TEST_TYPE_NORMAL) |
| 679 | return parse_test_file(fn, &keygen_parse, &keygen768); | 678 | return parse_test_file(fn, &keygen_parse, &keygen); |
| 680 | if (size == 768 && test_type == TEST_TYPE_NIST) | 679 | if (test_type == TEST_TYPE_NIST) |
| 681 | return parse_test_file(fn, &nist_keygen_parse, &keygen768); | 680 | return parse_test_file(fn, &nist_keygen_parse, &keygen); |
| 682 | if (size == 1024 && test_type == TEST_TYPE_NORMAL) | ||
| 683 | return parse_test_file(fn, &keygen_parse, &keygen1024); | ||
| 684 | if (size == 1024 && test_type == TEST_TYPE_NIST) | ||
| 685 | return parse_test_file(fn, &nist_keygen_parse, &keygen1024); | ||
| 686 | 681 | ||
| 687 | errx(1, "unknown keygen test: size %zu, type %d", size, test_type); | 682 | errx(1, "unknown keygen test: rank %d, type %d", rank, test_type); |
| 688 | } | 683 | } |
| 689 | 684 | ||
| 690 | static int | 685 | static int |
| 691 | run_mlkem_test(const char *test, const char *fn) | 686 | run_mlkem_test(const char *test, const char *fn) |
| 692 | { | 687 | { |
| 693 | if (strcmp(test, "mlkem768_decap_tests") == 0) | 688 | if (strcmp(test, "mlkem768_decap_tests") == 0) |
| 694 | return mlkem_decap_tests(fn, 768, TEST_TYPE_NORMAL); | 689 | return mlkem_decap_tests(fn, MLKEM768_RANK, TEST_TYPE_NORMAL); |
| 695 | if (strcmp(test, "mlkem768_nist_decap_tests") == 0) | 690 | if (strcmp(test, "mlkem768_nist_decap_tests") == 0) |
| 696 | return mlkem_decap_tests(fn, 768, TEST_TYPE_NIST); | 691 | return mlkem_decap_tests(fn, MLKEM768_RANK, TEST_TYPE_NIST); |
| 697 | if (strcmp(test, "mlkem1024_decap_tests") == 0) | 692 | if (strcmp(test, "mlkem1024_decap_tests") == 0) |
| 698 | return mlkem_decap_tests(fn, 1024, TEST_TYPE_NORMAL); | 693 | return mlkem_decap_tests(fn, MLKEM1024_RANK, TEST_TYPE_NORMAL); |
| 699 | if (strcmp(test, "mlkem1024_nist_decap_tests") == 0) | 694 | if (strcmp(test, "mlkem1024_nist_decap_tests") == 0) |
| 700 | return mlkem_decap_tests(fn, 1024, TEST_TYPE_NIST); | 695 | return mlkem_decap_tests(fn, MLKEM1024_RANK, TEST_TYPE_NIST); |
| 701 | 696 | ||
| 702 | if (strcmp(test, "mlkem768_encap_tests") == 0) | 697 | if (strcmp(test, "mlkem768_encap_tests") == 0) |
| 703 | return mlkem_encap_tests(fn, 768); | 698 | return mlkem_encap_tests(fn, MLKEM768_RANK); |
| 704 | if (strcmp(test, "mlkem1024_encap_tests") == 0) | 699 | if (strcmp(test, "mlkem1024_encap_tests") == 0) |
| 705 | return mlkem_encap_tests(fn, 1024); | 700 | return mlkem_encap_tests(fn, MLKEM1024_RANK); |
| 706 | 701 | ||
| 707 | if (strcmp(test, "mlkem768_keygen_tests") == 0) | 702 | if (strcmp(test, "mlkem768_keygen_tests") == 0) |
| 708 | return mlkem_keygen_tests(fn, 768, TEST_TYPE_NORMAL); | 703 | return mlkem_keygen_tests(fn, MLKEM768_RANK, TEST_TYPE_NORMAL); |
| 709 | if (strcmp(test, "mlkem768_nist_keygen_tests") == 0) | 704 | if (strcmp(test, "mlkem768_nist_keygen_tests") == 0) |
| 710 | return mlkem_keygen_tests(fn, 768, TEST_TYPE_NIST); | 705 | return mlkem_keygen_tests(fn, MLKEM768_RANK, TEST_TYPE_NIST); |
| 711 | if (strcmp(test, "mlkem1024_keygen_tests") == 0) | 706 | if (strcmp(test, "mlkem1024_keygen_tests") == 0) |
| 712 | return mlkem_keygen_tests(fn, 1024, TEST_TYPE_NORMAL); | 707 | return mlkem_keygen_tests(fn, MLKEM1024_RANK, TEST_TYPE_NORMAL); |
| 713 | if (strcmp(test, "mlkem1024_nist_keygen_tests") == 0) | 708 | if (strcmp(test, "mlkem1024_nist_keygen_tests") == 0) |
| 714 | return mlkem_keygen_tests(fn, 1024, TEST_TYPE_NIST); | 709 | return mlkem_keygen_tests(fn, MLKEM1024_RANK, TEST_TYPE_NIST); |
| 715 | 710 | ||
| 716 | errx(1, "unknown test %s (test file %s)", test, fn); | 711 | errx(1, "unknown test %s (test file %s)", test, fn); |
| 717 | } | 712 | } |
diff --git a/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.c b/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.c index 1bb2ed3a8b..d2e0fbd7c7 100644 --- a/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.c +++ b/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: mlkem_tests_util.c,v 1.5 2024/12/26 00:04:24 tb Exp $ */ | 1 | /* $OpenBSD: mlkem_tests_util.c,v 1.10 2025/08/15 14:47:54 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Google Inc. | 3 | * Copyright (c) 2024 Google Inc. |
| 4 | * Copyright (c) 2024 Bob Beck <beck@obtuse.com> | 4 | * Copyright (c) 2024 Bob Beck <beck@obtuse.com> |
| @@ -22,11 +22,6 @@ | |||
| 22 | #include <stdio.h> | 22 | #include <stdio.h> |
| 23 | #include <string.h> | 23 | #include <string.h> |
| 24 | 24 | ||
| 25 | #include "bytestring.h" | ||
| 26 | #include "mlkem.h" | ||
| 27 | |||
| 28 | #include "mlkem_internal.h" | ||
| 29 | |||
| 30 | #include "mlkem_tests_util.h" | 25 | #include "mlkem_tests_util.h" |
| 31 | 26 | ||
| 32 | static void | 27 | static void |
| @@ -59,209 +54,3 @@ compare_data(const uint8_t *want, const uint8_t *got, size_t len, const char *ms | |||
| 59 | 54 | ||
| 60 | return 1; | 55 | return 1; |
| 61 | } | 56 | } |
| 62 | |||
| 63 | int | ||
| 64 | mlkem768_encode_private_key(const void *private_key, uint8_t **out_buf, | ||
| 65 | size_t *out_len) | ||
| 66 | { | ||
| 67 | CBB cbb; | ||
| 68 | int ret = 0; | ||
| 69 | |||
| 70 | if (!CBB_init(&cbb, MLKEM768_PUBLIC_KEY_BYTES)) | ||
| 71 | goto err; | ||
| 72 | if (!MLKEM768_marshal_private_key(&cbb, private_key)) | ||
| 73 | goto err; | ||
| 74 | if (!CBB_finish(&cbb, out_buf, out_len)) | ||
| 75 | goto err; | ||
| 76 | |||
| 77 | ret = 1; | ||
| 78 | |||
| 79 | err: | ||
| 80 | CBB_cleanup(&cbb); | ||
| 81 | |||
| 82 | return ret; | ||
| 83 | } | ||
| 84 | |||
| 85 | int | ||
| 86 | mlkem768_encode_public_key(const void *public_key, uint8_t **out_buf, | ||
| 87 | size_t *out_len) | ||
| 88 | { | ||
| 89 | CBB cbb; | ||
| 90 | int ret = 0; | ||
| 91 | |||
| 92 | if (!CBB_init(&cbb, MLKEM768_PUBLIC_KEY_BYTES)) | ||
| 93 | goto err; | ||
| 94 | if (!MLKEM768_marshal_public_key(&cbb, public_key)) | ||
| 95 | goto err; | ||
| 96 | if (!CBB_finish(&cbb, out_buf, out_len)) | ||
| 97 | goto err; | ||
| 98 | |||
| 99 | ret = 1; | ||
| 100 | |||
| 101 | err: | ||
| 102 | CBB_cleanup(&cbb); | ||
| 103 | |||
| 104 | return ret; | ||
| 105 | } | ||
| 106 | |||
| 107 | int | ||
| 108 | mlkem1024_encode_private_key(const void *private_key, uint8_t **out_buf, | ||
| 109 | size_t *out_len) | ||
| 110 | { | ||
| 111 | CBB cbb; | ||
| 112 | int ret = 0; | ||
| 113 | |||
| 114 | if (!CBB_init(&cbb, MLKEM1024_PUBLIC_KEY_BYTES)) | ||
| 115 | goto err; | ||
| 116 | if (!MLKEM1024_marshal_private_key(&cbb, private_key)) | ||
| 117 | goto err; | ||
| 118 | if (!CBB_finish(&cbb, out_buf, out_len)) | ||
| 119 | goto err; | ||
| 120 | |||
| 121 | ret = 1; | ||
| 122 | |||
| 123 | err: | ||
| 124 | CBB_cleanup(&cbb); | ||
| 125 | |||
| 126 | return ret; | ||
| 127 | } | ||
| 128 | |||
| 129 | int | ||
| 130 | mlkem1024_encode_public_key(const void *public_key, uint8_t **out_buf, | ||
| 131 | size_t *out_len) | ||
| 132 | { | ||
| 133 | CBB cbb; | ||
| 134 | int ret = 0; | ||
| 135 | |||
| 136 | if (!CBB_init(&cbb, MLKEM1024_PUBLIC_KEY_BYTES)) | ||
| 137 | goto err; | ||
| 138 | if (!MLKEM1024_marshal_public_key(&cbb, public_key)) | ||
| 139 | goto err; | ||
| 140 | if (!CBB_finish(&cbb, out_buf, out_len)) | ||
| 141 | goto err; | ||
| 142 | |||
| 143 | ret = 1; | ||
| 144 | |||
| 145 | err: | ||
| 146 | CBB_cleanup(&cbb); | ||
| 147 | |||
| 148 | return ret; | ||
| 149 | } | ||
| 150 | |||
| 151 | int | ||
| 152 | mlkem768_decap(uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], | ||
| 153 | const uint8_t *ciphertext, size_t ciphertext_len, const void *private_key) | ||
| 154 | { | ||
| 155 | return MLKEM768_decap(out_shared_secret, ciphertext, ciphertext_len, | ||
| 156 | private_key); | ||
| 157 | } | ||
| 158 | |||
| 159 | void | ||
| 160 | mlkem768_encap(uint8_t *out_ciphertext, | ||
| 161 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], | ||
| 162 | const void *public_key) | ||
| 163 | { | ||
| 164 | MLKEM768_encap(out_ciphertext, out_shared_secret, public_key); | ||
| 165 | } | ||
| 166 | |||
| 167 | void | ||
| 168 | mlkem768_encap_external_entropy(uint8_t *out_ciphertext, | ||
| 169 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], | ||
| 170 | const void *public_key, const uint8_t entropy[MLKEM_ENCAP_ENTROPY]) | ||
| 171 | { | ||
| 172 | MLKEM768_encap_external_entropy(out_ciphertext, out_shared_secret, | ||
| 173 | public_key, entropy); | ||
| 174 | } | ||
| 175 | |||
| 176 | void | ||
| 177 | mlkem768_generate_key(uint8_t *out_encoded_public_key, | ||
| 178 | uint8_t optional_out_seed[MLKEM_SEED_BYTES], void *out_private_key) | ||
| 179 | { | ||
| 180 | MLKEM768_generate_key(out_encoded_public_key, optional_out_seed, | ||
| 181 | out_private_key); | ||
| 182 | } | ||
| 183 | |||
| 184 | void | ||
| 185 | mlkem768_generate_key_external_entropy(uint8_t *out_encoded_public_key, | ||
| 186 | void *out_private_key, const uint8_t entropy[MLKEM_SEED_BYTES]) | ||
| 187 | { | ||
| 188 | MLKEM768_generate_key_external_entropy(out_encoded_public_key, | ||
| 189 | out_private_key, entropy); | ||
| 190 | } | ||
| 191 | |||
| 192 | int | ||
| 193 | mlkem768_parse_private_key(void *out_private_key, CBS *private_key_cbs) | ||
| 194 | { | ||
| 195 | return MLKEM768_parse_private_key(out_private_key, private_key_cbs); | ||
| 196 | } | ||
| 197 | |||
| 198 | int | ||
| 199 | mlkem768_parse_public_key(void *out_public_key, CBS *public_key_cbs) | ||
| 200 | { | ||
| 201 | return MLKEM768_parse_public_key(out_public_key, public_key_cbs); | ||
| 202 | } | ||
| 203 | |||
| 204 | void | ||
| 205 | mlkem768_public_from_private(void *out_public_key, const void *private_key) | ||
| 206 | { | ||
| 207 | MLKEM768_public_from_private(out_public_key, private_key); | ||
| 208 | } | ||
| 209 | |||
| 210 | int | ||
| 211 | mlkem1024_decap(uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], | ||
| 212 | const uint8_t *ciphertext, size_t ciphertext_len, const void *private_key) | ||
| 213 | { | ||
| 214 | return MLKEM1024_decap(out_shared_secret, ciphertext, ciphertext_len, | ||
| 215 | private_key); | ||
| 216 | } | ||
| 217 | |||
| 218 | void | ||
| 219 | mlkem1024_encap(uint8_t *out_ciphertext, | ||
| 220 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], | ||
| 221 | const void *public_key) | ||
| 222 | { | ||
| 223 | MLKEM1024_encap(out_ciphertext, out_shared_secret, public_key); | ||
| 224 | } | ||
| 225 | |||
| 226 | void | ||
| 227 | mlkem1024_encap_external_entropy(uint8_t *out_ciphertext, | ||
| 228 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], | ||
| 229 | const void *public_key, const uint8_t entropy[MLKEM_ENCAP_ENTROPY]) | ||
| 230 | { | ||
| 231 | MLKEM1024_encap_external_entropy(out_ciphertext, out_shared_secret, | ||
| 232 | public_key, entropy); | ||
| 233 | } | ||
| 234 | |||
| 235 | void | ||
| 236 | mlkem1024_generate_key(uint8_t *out_encoded_public_key, | ||
| 237 | uint8_t optional_out_seed[MLKEM_SEED_BYTES], void *out_private_key) | ||
| 238 | { | ||
| 239 | MLKEM1024_generate_key(out_encoded_public_key, optional_out_seed, | ||
| 240 | out_private_key); | ||
| 241 | } | ||
| 242 | |||
| 243 | void | ||
| 244 | mlkem1024_generate_key_external_entropy(uint8_t *out_encoded_public_key, | ||
| 245 | void *out_private_key, const uint8_t entropy[MLKEM_SEED_BYTES]) | ||
| 246 | { | ||
| 247 | MLKEM1024_generate_key_external_entropy(out_encoded_public_key, | ||
| 248 | out_private_key, entropy); | ||
| 249 | } | ||
| 250 | |||
| 251 | int | ||
| 252 | mlkem1024_parse_private_key(void *out_private_key, CBS *private_key_cbs) | ||
| 253 | { | ||
| 254 | return MLKEM1024_parse_private_key(out_private_key, private_key_cbs); | ||
| 255 | } | ||
| 256 | |||
| 257 | void | ||
| 258 | mlkem1024_public_from_private(void *out_public_key, const void *private_key) | ||
| 259 | { | ||
| 260 | MLKEM1024_public_from_private(out_public_key, private_key); | ||
| 261 | } | ||
| 262 | |||
| 263 | int | ||
| 264 | mlkem1024_parse_public_key(void *out_public_key, CBS *public_key_cbs) | ||
| 265 | { | ||
| 266 | return MLKEM1024_parse_public_key(out_public_key, public_key_cbs); | ||
| 267 | } | ||
diff --git a/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.h b/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.h index 7fbe6f76a9..514a309112 100644 --- a/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.h +++ b/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: mlkem_tests_util.h,v 1.4 2024/12/26 00:04:24 tb Exp $ */ | 1 | /* $OpenBSD: mlkem_tests_util.h,v 1.9 2025/08/15 14:47:54 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Bob Beck <beck@obtuse.com> | 3 | * Copyright (c) 2024 Bob Beck <beck@obtuse.com> |
| 4 | * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> |
| @@ -22,68 +22,7 @@ | |||
| 22 | #include <stddef.h> | 22 | #include <stddef.h> |
| 23 | #include <stdint.h> | 23 | #include <stdint.h> |
| 24 | 24 | ||
| 25 | #include "bytestring.h" | ||
| 26 | |||
| 27 | #include "mlkem.h" | ||
| 28 | #include "mlkem_internal.h" | ||
| 29 | |||
| 30 | int compare_data(const uint8_t *want, const uint8_t *got, size_t len, | 25 | int compare_data(const uint8_t *want, const uint8_t *got, size_t len, |
| 31 | const char *msg); | 26 | const char *msg); |
| 32 | 27 | ||
| 33 | int mlkem768_encode_private_key(const void *priv, uint8_t **out_buf, | ||
| 34 | size_t *out_len); | ||
| 35 | int mlkem768_encode_public_key(const void *pub, uint8_t **out_buf, | ||
| 36 | size_t *out_len); | ||
| 37 | int mlkem1024_encode_private_key(const void *priv, uint8_t **out_buf, | ||
| 38 | size_t *out_len); | ||
| 39 | int mlkem1024_encode_public_key(const void *pub, uint8_t **out_buf, | ||
| 40 | size_t *out_len); | ||
| 41 | |||
| 42 | int mlkem768_decap(uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], | ||
| 43 | const uint8_t *ciphertext, size_t ciphertext_len, const void *priv); | ||
| 44 | void mlkem768_encap(uint8_t *out_ciphertext, | ||
| 45 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], const void *pub); | ||
| 46 | void mlkem768_encap_external_entropy(uint8_t *out_ciphertext, | ||
| 47 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], const void *pub, | ||
| 48 | const uint8_t entropy[MLKEM_ENCAP_ENTROPY]); | ||
| 49 | void mlkem768_generate_key(uint8_t *out_encoded_public_key, | ||
| 50 | uint8_t optional_out_seed[MLKEM_SEED_BYTES], void *out_private_key); | ||
| 51 | void mlkem768_generate_key_external_entropy(uint8_t *out_encoded_public_key, | ||
| 52 | void *out_private_key, const uint8_t entropy[MLKEM_SEED_BYTES]); | ||
| 53 | int mlkem768_parse_private_key(void *priv, CBS *private_key_cbs); | ||
| 54 | int mlkem768_parse_public_key(void *pub, CBS *in); | ||
| 55 | void mlkem768_public_from_private(void *out_public_key, const void *private_key); | ||
| 56 | |||
| 57 | int mlkem1024_decap(uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], | ||
| 58 | const uint8_t *ciphertext, size_t ciphertext_len, const void *priv); | ||
| 59 | void mlkem1024_encap(uint8_t *out_ciphertext, | ||
| 60 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], const void *pub); | ||
| 61 | void mlkem1024_encap_external_entropy(uint8_t *out_ciphertext, | ||
| 62 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], const void *pub, | ||
| 63 | const uint8_t entropy[MLKEM_ENCAP_ENTROPY]); | ||
| 64 | void mlkem1024_generate_key(uint8_t *out_encoded_public_key, | ||
| 65 | uint8_t optional_out_seed[MLKEM_SEED_BYTES], void *out_private_key); | ||
| 66 | void mlkem1024_generate_key_external_entropy(uint8_t *out_encoded_public_key, | ||
| 67 | void *out_private_key, const uint8_t entropy[MLKEM_SEED_BYTES]); | ||
| 68 | int mlkem1024_parse_private_key(void *priv, CBS *private_key_cbs); | ||
| 69 | int mlkem1024_parse_public_key(void *pub, CBS *in); | ||
| 70 | void mlkem1024_public_from_private(void *out_public_key, const void *private_key); | ||
| 71 | |||
| 72 | typedef int (*mlkem_encode_private_key_fn)(const void *, uint8_t **, size_t *); | ||
| 73 | typedef int (*mlkem_encode_public_key_fn)(const void *, uint8_t **, size_t *); | ||
| 74 | typedef int (*mlkem_decap_fn)(uint8_t [MLKEM_SHARED_SECRET_BYTES], | ||
| 75 | const uint8_t *, size_t, const void *); | ||
| 76 | typedef void (*mlkem_encap_fn)(uint8_t *, uint8_t [MLKEM_SHARED_SECRET_BYTES], | ||
| 77 | const void *); | ||
| 78 | typedef void (*mlkem_encap_external_entropy_fn)(uint8_t *, | ||
| 79 | uint8_t [MLKEM_SHARED_SECRET_BYTES], const void *, | ||
| 80 | const uint8_t [MLKEM_ENCAP_ENTROPY]); | ||
| 81 | typedef void (*mlkem_generate_key_fn)(uint8_t *, uint8_t *, void *); | ||
| 82 | typedef void (*mlkem_generate_key_external_entropy_fn)(uint8_t *, void *, | ||
| 83 | const uint8_t [MLKEM_SEED_BYTES]); | ||
| 84 | typedef int (*mlkem_parse_private_key_fn)(void *, CBS *); | ||
| 85 | typedef int (*mlkem_parse_public_key_fn)(void *, CBS *); | ||
| 86 | typedef void (*mlkem_public_from_private_fn)(void *out_public_key, | ||
| 87 | const void *private_key); | ||
| 88 | |||
| 89 | #endif /* MLKEM_TEST_UTIL_H */ | 28 | #endif /* MLKEM_TEST_UTIL_H */ |
diff --git a/src/regress/lib/libcrypto/mlkem/mlkem_unittest.c b/src/regress/lib/libcrypto/mlkem/mlkem_unittest.c index 23b3d8b261..1d8149b523 100644 --- a/src/regress/lib/libcrypto/mlkem/mlkem_unittest.c +++ b/src/regress/lib/libcrypto/mlkem/mlkem_unittest.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: mlkem_unittest.c,v 1.6 2024/12/26 12:35:25 tb Exp $ */ | 1 | /* $OpenBSD: mlkem_unittest.c,v 1.16 2026/01/01 12:47:52 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Google Inc. | 3 | * Copyright (c) 2024 Google Inc. |
| 4 | * Copyright (c) 2024 Bob Beck <beck@obtuse.com> | 4 | * Copyright (c) 2024 Bob Beck <beck@obtuse.com> |
| @@ -22,132 +22,201 @@ | |||
| 22 | #include <stdlib.h> | 22 | #include <stdlib.h> |
| 23 | #include <string.h> | 23 | #include <string.h> |
| 24 | 24 | ||
| 25 | #include "bytestring.h" | 25 | #include <openssl/mlkem.h> |
| 26 | #include "mlkem.h" | ||
| 27 | 26 | ||
| 27 | #include "mlkem_internal.h" | ||
| 28 | #include "mlkem_tests_util.h" | 28 | #include "mlkem_tests_util.h" |
| 29 | 29 | ||
| 30 | struct unittest_ctx { | ||
| 31 | void *priv; | ||
| 32 | void *pub; | ||
| 33 | void *priv2; | ||
| 34 | void *pub2; | ||
| 35 | uint8_t *encoded_public_key; | ||
| 36 | size_t encoded_public_key_len; | ||
| 37 | uint8_t *ciphertext; | ||
| 38 | size_t ciphertext_len; | ||
| 39 | mlkem_decap_fn decap; | ||
| 40 | mlkem_encap_fn encap; | ||
| 41 | mlkem_generate_key_fn generate_key; | ||
| 42 | mlkem_parse_private_key_fn parse_private_key; | ||
| 43 | mlkem_parse_public_key_fn parse_public_key; | ||
| 44 | mlkem_encode_private_key_fn encode_private_key; | ||
| 45 | mlkem_encode_public_key_fn encode_public_key; | ||
| 46 | mlkem_public_from_private_fn public_from_private; | ||
| 47 | }; | ||
| 48 | |||
| 49 | static int | 30 | static int |
| 50 | MlKemUnitTest(struct unittest_ctx *ctx) | 31 | MlKemUnitTest(int rank) |
| 51 | { | 32 | { |
| 52 | uint8_t shared_secret1[MLKEM_SHARED_SECRET_BYTES]; | 33 | MLKEM_private_key *priv = NULL, *priv2 = NULL, *priv3 = NULL; |
| 53 | uint8_t shared_secret2[MLKEM_SHARED_SECRET_BYTES]; | 34 | MLKEM_public_key *pub = NULL, *pub2 = NULL, *pub3 = NULL; |
| 35 | uint8_t *encoded_public_key = NULL, *ciphertext = NULL, | ||
| 36 | *shared_secret2 = NULL, *shared_secret1 = NULL, | ||
| 37 | *encoded_private_key = NULL, *tmp_buf = NULL, *seed_buf = NULL; | ||
| 38 | size_t encoded_public_key_len, ciphertext_len, | ||
| 39 | encoded_private_key_len, tmp_buf_len; | ||
| 54 | uint8_t first_two_bytes[2]; | 40 | uint8_t first_two_bytes[2]; |
| 55 | uint8_t *encoded_private_key = NULL, *tmp_buf = NULL; | 41 | size_t s_len = 0; |
| 56 | size_t encoded_private_key_len, tmp_buf_len; | ||
| 57 | CBS cbs; | ||
| 58 | int failed = 0; | 42 | int failed = 0; |
| 59 | 43 | ||
| 60 | ctx->generate_key(ctx->encoded_public_key, NULL, ctx->priv); | 44 | if ((pub = MLKEM_public_key_new(rank)) == NULL) { |
| 45 | warnx("public_key_new"); | ||
| 46 | failed |= 1; | ||
| 47 | } | ||
| 48 | |||
| 49 | if ((pub2 = MLKEM_public_key_new(rank)) == NULL) { | ||
| 50 | warnx("public_key_new"); | ||
| 51 | failed |= 1; | ||
| 52 | } | ||
| 53 | |||
| 54 | if ((priv = MLKEM_private_key_new(rank)) == NULL) { | ||
| 55 | warnx("private_key_new"); | ||
| 56 | failed |= 1; | ||
| 57 | } | ||
| 58 | |||
| 59 | if ((priv2 = MLKEM_private_key_new(rank)) == NULL) { | ||
| 60 | warnx("private_key_new"); | ||
| 61 | failed |= 1; | ||
| 62 | } | ||
| 63 | |||
| 64 | if (!MLKEM_generate_key(priv, &encoded_public_key, | ||
| 65 | &encoded_public_key_len, &seed_buf, &s_len)) { | ||
| 66 | warnx("generate_key failed"); | ||
| 67 | failed |= 1; | ||
| 68 | } | ||
| 69 | |||
| 70 | if (s_len != MLKEM_SEED_LENGTH) { | ||
| 71 | warnx("seed length %zu != %d", s_len, MLKEM_SEED_LENGTH); | ||
| 72 | failed |= 1; | ||
| 73 | } | ||
| 74 | |||
| 75 | if ((priv3 = MLKEM_private_key_new(rank)) == NULL) { | ||
| 76 | warnx("private_key_new"); | ||
| 77 | failed |= 1; | ||
| 78 | } | ||
| 79 | |||
| 80 | if ((pub3 = MLKEM_public_key_new(rank)) == NULL) { | ||
| 81 | warnx("public_key_new"); | ||
| 82 | failed |= 1; | ||
| 83 | } | ||
| 61 | 84 | ||
| 62 | memcpy(first_two_bytes, ctx->encoded_public_key, sizeof(first_two_bytes)); | 85 | if (!MLKEM_private_key_from_seed(priv3, seed_buf, s_len)) { |
| 63 | memset(ctx->encoded_public_key, 0xff, sizeof(first_two_bytes)); | 86 | warnx("private_key_from_seed failed"); |
| 87 | failed |= 1; | ||
| 88 | } | ||
| 89 | |||
| 90 | free(seed_buf); | ||
| 91 | seed_buf = NULL; | ||
| 64 | 92 | ||
| 65 | CBS_init(&cbs, ctx->encoded_public_key, ctx->encoded_public_key_len); | 93 | if (!MLKEM_public_from_private(priv3, pub3)) { |
| 94 | warnx("public_from_private"); | ||
| 95 | failed |= 1; | ||
| 96 | } | ||
| 97 | |||
| 98 | memcpy(first_two_bytes, encoded_public_key, sizeof(first_two_bytes)); | ||
| 99 | memset(encoded_public_key, 0xff, sizeof(first_two_bytes)); | ||
| 66 | 100 | ||
| 67 | /* Parsing should fail because the first coefficient is >= kPrime. */ | 101 | /* Parsing should fail because the first coefficient is >= kPrime. */ |
| 68 | if (ctx->parse_public_key(ctx->pub, &cbs)) { | 102 | if (MLKEM_parse_public_key(pub, encoded_public_key, |
| 103 | encoded_public_key_len)) { | ||
| 69 | warnx("parse_public_key should have failed"); | 104 | warnx("parse_public_key should have failed"); |
| 70 | failed |= 1; | 105 | failed |= 1; |
| 71 | } | 106 | } |
| 72 | 107 | ||
| 73 | memcpy(ctx->encoded_public_key, first_two_bytes, sizeof(first_two_bytes)); | 108 | memcpy(encoded_public_key, first_two_bytes, sizeof(first_two_bytes)); |
| 74 | CBS_init(&cbs, ctx->encoded_public_key, ctx->encoded_public_key_len); | 109 | |
| 75 | if (!ctx->parse_public_key(ctx->pub, &cbs)) { | 110 | MLKEM_public_key_free(pub); |
| 76 | warnx("MLKEM768_parse_public_key"); | 111 | if ((pub = MLKEM_public_key_new(rank)) == NULL) { |
| 112 | warnx("public_key_new"); | ||
| 113 | failed |= 1; | ||
| 114 | } | ||
| 115 | if (!MLKEM_parse_public_key(pub, encoded_public_key, | ||
| 116 | encoded_public_key_len)) { | ||
| 117 | warnx("MLKEM_parse_public_key"); | ||
| 77 | failed |= 1; | 118 | failed |= 1; |
| 78 | } | 119 | } |
| 79 | 120 | ||
| 80 | if (CBS_len(&cbs) != 0u) { | 121 | if (!MLKEM_marshal_public_key(pub, &tmp_buf, &tmp_buf_len)) { |
| 81 | warnx("CBS_len must be 0"); | 122 | warnx("marshal_public_key"); |
| 123 | failed |= 1; | ||
| 124 | } | ||
| 125 | if (encoded_public_key_len != tmp_buf_len) { | ||
| 126 | warnx("encoded public key lengths differ %d != %d", | ||
| 127 | (int) encoded_public_key_len, (int) tmp_buf_len); | ||
| 82 | failed |= 1; | 128 | failed |= 1; |
| 83 | } | 129 | } |
| 84 | 130 | ||
| 85 | if (!ctx->encode_public_key(ctx->pub, &tmp_buf, &tmp_buf_len)) { | 131 | if (compare_data(encoded_public_key, tmp_buf, tmp_buf_len, |
| 86 | warnx("encode_public_key"); | 132 | "encoded public keys") != 0) { |
| 133 | warnx("compare_data"); | ||
| 87 | failed |= 1; | 134 | failed |= 1; |
| 88 | } | 135 | } |
| 89 | if (ctx->encoded_public_key_len != tmp_buf_len) { | 136 | free(tmp_buf); |
| 90 | warnx("encoded public key lengths differ"); | 137 | tmp_buf = NULL; |
| 138 | tmp_buf_len = 0; | ||
| 139 | |||
| 140 | if (!MLKEM_marshal_public_key(pub3, &tmp_buf, &tmp_buf_len)) { | ||
| 141 | warnx("marshal_public_key"); | ||
| 142 | failed |= 1; | ||
| 143 | } | ||
| 144 | if (encoded_public_key_len != tmp_buf_len) { | ||
| 145 | warnx("encoded public key lengths differ %d != %d", | ||
| 146 | (int) encoded_public_key_len, (int) tmp_buf_len); | ||
| 91 | failed |= 1; | 147 | failed |= 1; |
| 92 | } | 148 | } |
| 93 | 149 | ||
| 94 | if (compare_data(ctx->encoded_public_key, tmp_buf, tmp_buf_len, | 150 | if (compare_data(encoded_public_key, tmp_buf, tmp_buf_len, |
| 95 | "encoded public keys") != 0) { | 151 | "encoded public keys") != 0) { |
| 96 | warnx("compare_data"); | 152 | warnx("compare_data"); |
| 97 | failed |= 1; | 153 | failed |= 1; |
| 98 | } | 154 | } |
| 99 | free(tmp_buf); | 155 | free(tmp_buf); |
| 100 | tmp_buf = NULL; | 156 | tmp_buf = NULL; |
| 157 | tmp_buf_len = 0; | ||
| 101 | 158 | ||
| 102 | ctx->public_from_private(ctx->pub2, ctx->priv); | 159 | if (!MLKEM_public_from_private(priv, pub2)) { |
| 103 | if (!ctx->encode_public_key(ctx->pub2, &tmp_buf, &tmp_buf_len)) { | 160 | warnx("public_from_private"); |
| 104 | warnx("encode_public_key"); | 161 | failed |= 1; |
| 162 | } | ||
| 163 | if (!MLKEM_marshal_public_key(pub2, &tmp_buf, &tmp_buf_len)) { | ||
| 164 | warnx("marshal_public_key"); | ||
| 105 | failed |= 1; | 165 | failed |= 1; |
| 106 | } | 166 | } |
| 107 | if (ctx->encoded_public_key_len != tmp_buf_len) { | 167 | if (encoded_public_key_len != tmp_buf_len) { |
| 108 | warnx("encoded public key lengths differ"); | 168 | warnx("encoded public key lengths differ %d %d", |
| 169 | (int) encoded_public_key_len, (int) tmp_buf_len); | ||
| 109 | failed |= 1; | 170 | failed |= 1; |
| 110 | } | 171 | } |
| 111 | 172 | ||
| 112 | if (compare_data(ctx->encoded_public_key, tmp_buf, tmp_buf_len, | 173 | if (compare_data(encoded_public_key, tmp_buf, tmp_buf_len, |
| 113 | "encoded public keys") != 0) { | 174 | "encoded public keys") != 0) { |
| 114 | warnx("compare_data"); | 175 | warnx("compare_data"); |
| 115 | failed |= 1; | 176 | failed |= 1; |
| 116 | } | 177 | } |
| 117 | free(tmp_buf); | 178 | free(tmp_buf); |
| 118 | tmp_buf = NULL; | 179 | tmp_buf = NULL; |
| 180 | tmp_buf_len = 0; | ||
| 119 | 181 | ||
| 120 | if (!ctx->encode_private_key(ctx->priv, &encoded_private_key, | 182 | if (!MLKEM_marshal_private_key(priv, &encoded_private_key, |
| 121 | &encoded_private_key_len)) { | 183 | &encoded_private_key_len)) { |
| 122 | warnx("mlkem768_encode_private_key"); | 184 | warnx("marshal_private_key"); |
| 123 | failed |= 1; | 185 | failed |= 1; |
| 124 | } | 186 | } |
| 125 | 187 | ||
| 126 | memcpy(first_two_bytes, encoded_private_key, sizeof(first_two_bytes)); | 188 | memcpy(first_two_bytes, encoded_private_key, sizeof(first_two_bytes)); |
| 127 | memset(encoded_private_key, 0xff, sizeof(first_two_bytes)); | 189 | memset(encoded_private_key, 0xff, sizeof(first_two_bytes)); |
| 128 | CBS_init(&cbs, encoded_private_key, encoded_private_key_len); | ||
| 129 | 190 | ||
| 130 | /* Parsing should fail because the first coefficient is >= kPrime. */ | 191 | /* Parsing should fail because the first coefficient is >= kPrime. */ |
| 131 | if (ctx->parse_private_key(ctx->priv2, &cbs)) { | 192 | if (MLKEM_parse_private_key(priv2, encoded_private_key, |
| 132 | warnx("MLKEM768_parse_private_key should have failed"); | 193 | encoded_private_key_len)) { |
| 194 | warnx("parse_private_key should have failed"); | ||
| 133 | failed |= 1; | 195 | failed |= 1; |
| 134 | } | 196 | } |
| 135 | 197 | ||
| 136 | memcpy(encoded_private_key, first_two_bytes, sizeof(first_two_bytes)); | 198 | memcpy(encoded_private_key, first_two_bytes, sizeof(first_two_bytes)); |
| 137 | CBS_init(&cbs, encoded_private_key, encoded_private_key_len); | ||
| 138 | 199 | ||
| 139 | if (!ctx->parse_private_key(ctx->priv2, &cbs)) { | 200 | MLKEM_private_key_free(priv2); |
| 140 | warnx("MLKEM768_parse_private_key"); | 201 | priv2 = NULL; |
| 202 | |||
| 203 | if ((priv2 = MLKEM_private_key_new(rank)) == NULL) { | ||
| 204 | warnx("private_key_new"); | ||
| 205 | failed |= 1; | ||
| 206 | } | ||
| 207 | if (!MLKEM_parse_private_key(priv2, encoded_private_key, | ||
| 208 | encoded_private_key_len)) { | ||
| 209 | warnx("parse_private_key"); | ||
| 141 | failed |= 1; | 210 | failed |= 1; |
| 142 | } | 211 | } |
| 143 | 212 | ||
| 144 | if (!ctx->encode_private_key(ctx->priv2, &tmp_buf, &tmp_buf_len)) { | 213 | if (!MLKEM_marshal_private_key(priv2, &tmp_buf, &tmp_buf_len)) { |
| 145 | warnx("encode_private_key"); | 214 | warnx("marshal_private_key"); |
| 146 | failed |= 1; | 215 | failed |= 1; |
| 147 | } | 216 | } |
| 148 | 217 | ||
| 149 | if (encoded_private_key_len != tmp_buf_len) { | 218 | if (encoded_private_key_len != tmp_buf_len) { |
| 150 | warnx("encode private key lengths differ"); | 219 | warnx("encoded private key lengths differ"); |
| 151 | failed |= 1; | 220 | failed |= 1; |
| 152 | } | 221 | } |
| 153 | 222 | ||
| @@ -160,100 +229,79 @@ MlKemUnitTest(struct unittest_ctx *ctx) | |||
| 160 | free(tmp_buf); | 229 | free(tmp_buf); |
| 161 | tmp_buf = NULL; | 230 | tmp_buf = NULL; |
| 162 | 231 | ||
| 163 | ctx->encap(ctx->ciphertext, shared_secret1, ctx->pub); | 232 | if (!MLKEM_encap(pub, &ciphertext, &ciphertext_len, &shared_secret1, |
| 164 | ctx->decap(shared_secret2, ctx->ciphertext, ctx->ciphertext_len, | 233 | &s_len)) { |
| 165 | ctx->priv); | 234 | warnx("encap failed using pub"); |
| 166 | if (compare_data(shared_secret1, shared_secret2, MLKEM_SHARED_SECRET_BYTES, | 235 | failed |= 1; |
| 236 | } | ||
| 237 | |||
| 238 | if (s_len != MLKEM_SHARED_SECRET_LENGTH) { | ||
| 239 | warnx("seed length %zu != %d", s_len, | ||
| 240 | MLKEM_SHARED_SECRET_LENGTH); | ||
| 241 | failed |= 1; | ||
| 242 | } | ||
| 243 | |||
| 244 | if (!MLKEM_decap(priv, ciphertext, ciphertext_len, | ||
| 245 | &shared_secret2, &s_len)) { | ||
| 246 | warnx("decap() failed using priv"); | ||
| 247 | failed |= 1; | ||
| 248 | } | ||
| 249 | |||
| 250 | if (s_len != MLKEM_SHARED_SECRET_LENGTH) { | ||
| 251 | warnx("seed length %zu != %d", s_len, | ||
| 252 | MLKEM_SHARED_SECRET_LENGTH); | ||
| 253 | failed |= 1; | ||
| 254 | } | ||
| 255 | |||
| 256 | if (compare_data(shared_secret1, shared_secret2, s_len, | ||
| 167 | "shared secrets with priv") != 0) { | 257 | "shared secrets with priv") != 0) { |
| 168 | warnx("compare_data"); | 258 | warnx("compare_data"); |
| 169 | failed |= 1; | 259 | failed |= 1; |
| 170 | } | 260 | } |
| 171 | 261 | ||
| 172 | ctx->decap(shared_secret2, ctx->ciphertext, ctx->ciphertext_len, | 262 | free(shared_secret2); |
| 173 | ctx->priv2); | 263 | shared_secret2 = NULL; |
| 174 | if (compare_data(shared_secret1, shared_secret2, MLKEM_SHARED_SECRET_BYTES, | 264 | |
| 265 | if (!MLKEM_decap(priv2, ciphertext, ciphertext_len, | ||
| 266 | &shared_secret2, &s_len)){ | ||
| 267 | warnx("decap() failed using priv2"); | ||
| 268 | failed |= 1; | ||
| 269 | } | ||
| 270 | |||
| 271 | if (s_len != MLKEM_SHARED_SECRET_LENGTH) { | ||
| 272 | warnx("seed length %zu != %d", s_len, | ||
| 273 | MLKEM_SHARED_SECRET_LENGTH); | ||
| 274 | failed |= 1; | ||
| 275 | } | ||
| 276 | |||
| 277 | if (compare_data(shared_secret1, shared_secret2, s_len, | ||
| 175 | "shared secrets with priv2") != 0) { | 278 | "shared secrets with priv2") != 0) { |
| 176 | warnx("compare_data"); | 279 | warnx("compare_data"); |
| 177 | failed |= 1; | 280 | failed |= 1; |
| 178 | } | 281 | } |
| 179 | 282 | ||
| 283 | MLKEM_public_key_free(pub); | ||
| 284 | MLKEM_public_key_free(pub2); | ||
| 285 | MLKEM_public_key_free(pub3); | ||
| 286 | MLKEM_private_key_free(priv); | ||
| 287 | MLKEM_private_key_free(priv2); | ||
| 288 | MLKEM_private_key_free(priv3); | ||
| 289 | free(encoded_public_key); | ||
| 290 | free(ciphertext); | ||
| 180 | free(encoded_private_key); | 291 | free(encoded_private_key); |
| 292 | free(shared_secret1); | ||
| 293 | free(shared_secret2); | ||
| 181 | 294 | ||
| 182 | return failed; | 295 | return failed; |
| 183 | } | 296 | } |
| 184 | 297 | ||
| 185 | static int | ||
| 186 | mlkem768_unittest(void) | ||
| 187 | { | ||
| 188 | struct MLKEM768_private_key mlkem768_priv, mlkem768_priv2; | ||
| 189 | struct MLKEM768_public_key mlkem768_pub, mlkem768_pub2; | ||
| 190 | uint8_t mlkem768_encoded_public_key[MLKEM768_PUBLIC_KEY_BYTES]; | ||
| 191 | uint8_t mlkem768_ciphertext[MLKEM768_CIPHERTEXT_BYTES]; | ||
| 192 | struct unittest_ctx mlkem768_test = { | ||
| 193 | .priv = &mlkem768_priv, | ||
| 194 | .pub = &mlkem768_pub, | ||
| 195 | .priv2 = &mlkem768_priv2, | ||
| 196 | .pub2 = &mlkem768_pub2, | ||
| 197 | .encoded_public_key = mlkem768_encoded_public_key, | ||
| 198 | .encoded_public_key_len = sizeof(mlkem768_encoded_public_key), | ||
| 199 | .ciphertext = mlkem768_ciphertext, | ||
| 200 | .ciphertext_len = sizeof(mlkem768_ciphertext), | ||
| 201 | .decap = mlkem768_decap, | ||
| 202 | .encap = mlkem768_encap, | ||
| 203 | .generate_key = mlkem768_generate_key, | ||
| 204 | .parse_private_key = mlkem768_parse_private_key, | ||
| 205 | .parse_public_key = mlkem768_parse_public_key, | ||
| 206 | .encode_private_key = mlkem768_encode_private_key, | ||
| 207 | .encode_public_key = mlkem768_encode_public_key, | ||
| 208 | .public_from_private = mlkem768_public_from_private, | ||
| 209 | }; | ||
| 210 | |||
| 211 | return MlKemUnitTest(&mlkem768_test); | ||
| 212 | } | ||
| 213 | |||
| 214 | static int | ||
| 215 | mlkem1024_unittest(void) | ||
| 216 | { | ||
| 217 | struct MLKEM1024_private_key mlkem1024_priv, mlkem1024_priv2; | ||
| 218 | struct MLKEM1024_public_key mlkem1024_pub, mlkem1024_pub2; | ||
| 219 | uint8_t mlkem1024_encoded_public_key[MLKEM1024_PUBLIC_KEY_BYTES]; | ||
| 220 | uint8_t mlkem1024_ciphertext[MLKEM1024_CIPHERTEXT_BYTES]; | ||
| 221 | struct unittest_ctx mlkem1024_test = { | ||
| 222 | .priv = &mlkem1024_priv, | ||
| 223 | .pub = &mlkem1024_pub, | ||
| 224 | .priv2 = &mlkem1024_priv2, | ||
| 225 | .pub2 = &mlkem1024_pub2, | ||
| 226 | .encoded_public_key = mlkem1024_encoded_public_key, | ||
| 227 | .encoded_public_key_len = sizeof(mlkem1024_encoded_public_key), | ||
| 228 | .ciphertext = mlkem1024_ciphertext, | ||
| 229 | .ciphertext_len = sizeof(mlkem1024_ciphertext), | ||
| 230 | .decap = mlkem1024_decap, | ||
| 231 | .encap = mlkem1024_encap, | ||
| 232 | .generate_key = mlkem1024_generate_key, | ||
| 233 | .parse_private_key = mlkem1024_parse_private_key, | ||
| 234 | .parse_public_key = mlkem1024_parse_public_key, | ||
| 235 | .encode_private_key = mlkem1024_encode_private_key, | ||
| 236 | .encode_public_key = mlkem1024_encode_public_key, | ||
| 237 | .public_from_private = mlkem1024_public_from_private, | ||
| 238 | }; | ||
| 239 | |||
| 240 | return MlKemUnitTest(&mlkem1024_test); | ||
| 241 | } | ||
| 242 | |||
| 243 | int | 298 | int |
| 244 | main(void) | 299 | main(void) |
| 245 | { | 300 | { |
| 246 | int failed = 0; | 301 | int failed = 0; |
| 247 | 302 | ||
| 248 | /* | 303 | failed |= MlKemUnitTest(MLKEM768_RANK); |
| 249 | * XXX - this is split into two helper functions since having a few | 304 | failed |= MlKemUnitTest(MLKEM1024_RANK); |
| 250 | * ML-KEM key blobs on the stack makes Emscripten's stack explode, | ||
| 251 | * leading to inscrutable silent failures unles ASAN is enabled. | ||
| 252 | * Go figure. | ||
| 253 | */ | ||
| 254 | |||
| 255 | failed |= mlkem768_unittest(); | ||
| 256 | failed |= mlkem1024_unittest(); | ||
| 257 | 305 | ||
| 258 | return failed; | 306 | return failed; |
| 259 | } | 307 | } |
diff --git a/src/regress/lib/libcrypto/mlkem/parse_test_file.c b/src/regress/lib/libcrypto/mlkem/parse_test_file.c index b68dc50431..9f3e5f3a1a 100644 --- a/src/regress/lib/libcrypto/mlkem/parse_test_file.c +++ b/src/regress/lib/libcrypto/mlkem/parse_test_file.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: parse_test_file.c,v 1.4 2025/04/13 09:14:56 tb Exp $ */ | 1 | /* $OpenBSD: parse_test_file.c,v 1.6 2025/06/03 10:29:37 tb Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> |
| @@ -646,7 +646,8 @@ parse_reinit(struct parse *p) | |||
| 646 | p->state.running_test_case = 0; | 646 | p->state.running_test_case = 0; |
| 647 | parse_line_data_clear(p); | 647 | parse_line_data_clear(p); |
| 648 | tctx->finish(p->ctx); | 648 | tctx->finish(p->ctx); |
| 649 | tctx->init(p->ctx, p); | 649 | if (!tctx->init(p->ctx, p)) |
| 650 | parse_errx(p, "init failed"); | ||
| 650 | } | 651 | } |
| 651 | 652 | ||
| 652 | static int | 653 | static int |
| @@ -708,7 +709,8 @@ parse_init(struct parse *p, const char *fn, const struct test_parse *tctx, | |||
| 708 | parse_state_init(&p->state, tctx->num_states, tctx->num_instructions); | 709 | parse_state_init(&p->state, tctx->num_states, tctx->num_instructions); |
| 709 | p->tctx = tctx; | 710 | p->tctx = tctx; |
| 710 | p->ctx = ctx; | 711 | p->ctx = ctx; |
| 711 | tctx->init(ctx, p); | 712 | if (!tctx->init(p->ctx, p)) |
| 713 | parse_errx(p, "init failed"); | ||
| 712 | } | 714 | } |
| 713 | 715 | ||
| 714 | static int | 716 | static int |
| @@ -734,7 +736,10 @@ parse_next_line(struct parse *p) | |||
| 734 | static void | 736 | static void |
| 735 | parse_finish(struct parse *p) | 737 | parse_finish(struct parse *p) |
| 736 | { | 738 | { |
| 739 | const struct test_parse *tctx = p->tctx; | ||
| 740 | |||
| 737 | parse_state_finish(&p->state); | 741 | parse_state_finish(&p->state); |
| 742 | tctx->finish(p->ctx); | ||
| 738 | 743 | ||
| 739 | free(p->buf); | 744 | free(p->buf); |
| 740 | 745 | ||
diff --git a/src/regress/lib/libcrypto/rsa/rsa_method_test.c b/src/regress/lib/libcrypto/rsa/rsa_method_test.c index d9c1cc4f9a..9d0a4c3592 100644 --- a/src/regress/lib/libcrypto/rsa/rsa_method_test.c +++ b/src/regress/lib/libcrypto/rsa/rsa_method_test.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_method_test.c,v 1.5 2025/01/05 18:21:36 tb Exp $ */ | 1 | /* $OpenBSD: rsa_method_test.c,v 1.6 2025/08/26 05:07:50 tb Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (c) 2025 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2025 Theo Buehler <tb@openbsd.org> |
| @@ -221,7 +221,7 @@ sign_and_verify_test(void) | |||
| 221 | errx(1, "%s: RSA_set_ex_data", __func__); | 221 | errx(1, "%s: RSA_set_ex_data", __func__); |
| 222 | 222 | ||
| 223 | if ((sign_verify_method = RSA_meth_dup(RSA_get_default_method())) == NULL) | 223 | if ((sign_verify_method = RSA_meth_dup(RSA_get_default_method())) == NULL) |
| 224 | errx(1, "%s: RSA_get_default_method", __func__); | 224 | errx(1, "%s: RSA_meth_dup", __func__); |
| 225 | if (!RSA_meth_set0_app_data(sign_verify_method, rsa_priv)) | 225 | if (!RSA_meth_set0_app_data(sign_verify_method, rsa_priv)) |
| 226 | errx(1, "%s: RSA_meth_set0_app_data", __func__); | 226 | errx(1, "%s: RSA_meth_set0_app_data", __func__); |
| 227 | 227 | ||
diff --git a/src/regress/lib/libcrypto/sha/Makefile b/src/regress/lib/libcrypto/sha/Makefile index 6ec223116d..c6ab0398ba 100644 --- a/src/regress/lib/libcrypto/sha/Makefile +++ b/src/regress/lib/libcrypto/sha/Makefile | |||
| @@ -1,9 +1,15 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.5 2022/09/01 14:02:41 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.6 2025/05/22 03:35:40 joshua Exp $ |
| 2 | 2 | ||
| 3 | PROG = sha_test | 3 | PROG = sha_test |
| 4 | LDADD = -lcrypto | 4 | LDADD = -lcrypto |
| 5 | DPADD = ${LIBCRYPTO} | 5 | DPADD = ${LIBCRYPTO} |
| 6 | WARNINGS = Yes | 6 | WARNINGS = Yes |
| 7 | CFLAGS += -DLIBRESSL_INTERNAL -Werror | 7 | CFLAGS += -DLIBRESSL_INTERNAL -Werror |
| 8 | CFLAGS += -I${.CURDIR}/../test | ||
| 9 | SRCS += sha_test.c | ||
| 10 | SRCS += test.c | ||
| 11 | SRCS += test_util.c | ||
| 12 | |||
| 13 | .PATH: ${.CURDIR}/../test | ||
| 8 | 14 | ||
| 9 | .include <bsd.regress.mk> | 15 | .include <bsd.regress.mk> |
diff --git a/src/regress/lib/libcrypto/sha/sha_test.c b/src/regress/lib/libcrypto/sha/sha_test.c index 82a0c4cceb..904924c890 100644 --- a/src/regress/lib/libcrypto/sha/sha_test.c +++ b/src/regress/lib/libcrypto/sha/sha_test.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* $OpenBSD: sha_test.c,v 1.6 2023/07/19 15:11:42 joshua Exp $ */ | 1 | /* $OpenBSD: sha_test.c,v 1.7 2025/05/22 03:35:40 joshua Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2022, 2023 Joshua Sing <joshua@hypera.dev> | 3 | * Copyright (c) 2022, 2023, 2025 Joshua Sing <joshua@joshuasing.dev> |
| 4 | * | 4 | * |
| 5 | * Permission to use, copy, modify, and distribute this software for any | 5 | * Permission to use, copy, modify, and distribute this software for any |
| 6 | * purpose with or without fee is hereby granted, provided that the above | 6 | * purpose with or without fee is hereby granted, provided that the above |
| @@ -21,6 +21,8 @@ | |||
| 21 | #include <stdint.h> | 21 | #include <stdint.h> |
| 22 | #include <string.h> | 22 | #include <string.h> |
| 23 | 23 | ||
| 24 | #include "test.h" | ||
| 25 | |||
| 24 | struct sha_test { | 26 | struct sha_test { |
| 25 | const int algorithm; | 27 | const int algorithm; |
| 26 | const uint8_t in[128]; | 28 | const uint8_t in[128]; |
| @@ -677,260 +679,240 @@ typedef unsigned char *(*sha_hash_func)(const unsigned char *, size_t, | |||
| 677 | unsigned char *); | 679 | unsigned char *); |
| 678 | 680 | ||
| 679 | static int | 681 | static int |
| 680 | sha_hash_from_algorithm(int algorithm, const char **out_label, | 682 | sha_hash_from_algorithm(int algorithm, sha_hash_func *out_func, |
| 681 | sha_hash_func *out_func, const EVP_MD **out_md, size_t *out_len) | 683 | const EVP_MD **out_md) |
| 682 | { | 684 | { |
| 683 | const char *label; | ||
| 684 | sha_hash_func sha_func; | 685 | sha_hash_func sha_func; |
| 685 | const EVP_MD *md; | 686 | const EVP_MD *md; |
| 686 | size_t len; | ||
| 687 | 687 | ||
| 688 | switch (algorithm) { | 688 | switch (algorithm) { |
| 689 | case NID_sha1: | 689 | case NID_sha1: |
| 690 | label = SN_sha1; | ||
| 691 | sha_func = SHA1; | 690 | sha_func = SHA1; |
| 692 | md = EVP_sha1(); | 691 | md = EVP_sha1(); |
| 693 | len = SHA_DIGEST_LENGTH; | ||
| 694 | break; | 692 | break; |
| 695 | case NID_sha224: | 693 | case NID_sha224: |
| 696 | label = SN_sha224; | ||
| 697 | sha_func = SHA224; | 694 | sha_func = SHA224; |
| 698 | md = EVP_sha224(); | 695 | md = EVP_sha224(); |
| 699 | len = SHA224_DIGEST_LENGTH; | ||
| 700 | break; | 696 | break; |
| 701 | case NID_sha256: | 697 | case NID_sha256: |
| 702 | label = SN_sha256; | ||
| 703 | sha_func = SHA256; | 698 | sha_func = SHA256; |
| 704 | md = EVP_sha256(); | 699 | md = EVP_sha256(); |
| 705 | len = SHA256_DIGEST_LENGTH; | ||
| 706 | break; | 700 | break; |
| 707 | case NID_sha384: | 701 | case NID_sha384: |
| 708 | label = SN_sha384; | ||
| 709 | sha_func = SHA384; | 702 | sha_func = SHA384; |
| 710 | md = EVP_sha384(); | 703 | md = EVP_sha384(); |
| 711 | len = SHA384_DIGEST_LENGTH; | ||
| 712 | break; | 704 | break; |
| 713 | case NID_sha512: | 705 | case NID_sha512: |
| 714 | label = SN_sha512; | ||
| 715 | sha_func = SHA512; | 706 | sha_func = SHA512; |
| 716 | md = EVP_sha512(); | 707 | md = EVP_sha512(); |
| 717 | len = SHA512_DIGEST_LENGTH; | ||
| 718 | break; | 708 | break; |
| 719 | case NID_sha3_224: | 709 | case NID_sha3_224: |
| 720 | label = SN_sha3_224; | ||
| 721 | sha_func = NULL; | 710 | sha_func = NULL; |
| 722 | md = EVP_sha3_224(); | 711 | md = EVP_sha3_224(); |
| 723 | len = 224 / 8; | ||
| 724 | break; | 712 | break; |
| 725 | case NID_sha3_256: | 713 | case NID_sha3_256: |
| 726 | label = SN_sha3_256; | ||
| 727 | sha_func = NULL; | 714 | sha_func = NULL; |
| 728 | md = EVP_sha3_256(); | 715 | md = EVP_sha3_256(); |
| 729 | len = 256 / 8; | ||
| 730 | break; | 716 | break; |
| 731 | case NID_sha3_384: | 717 | case NID_sha3_384: |
| 732 | label = SN_sha3_384; | ||
| 733 | sha_func = NULL; | 718 | sha_func = NULL; |
| 734 | md = EVP_sha3_384(); | 719 | md = EVP_sha3_384(); |
| 735 | len = 384 / 8; | ||
| 736 | break; | 720 | break; |
| 737 | case NID_sha3_512: | 721 | case NID_sha3_512: |
| 738 | label = SN_sha3_512; | ||
| 739 | sha_func = NULL; | 722 | sha_func = NULL; |
| 740 | md = EVP_sha3_512(); | 723 | md = EVP_sha3_512(); |
| 741 | len = 512 / 8; | ||
| 742 | break; | 724 | break; |
| 743 | default: | 725 | default: |
| 744 | fprintf(stderr, "FAIL: unknown algorithm (%d)\n", | ||
| 745 | algorithm); | ||
| 746 | return 0; | 726 | return 0; |
| 747 | } | 727 | } |
| 748 | 728 | ||
| 749 | if (out_label != NULL) | ||
| 750 | *out_label = label; | ||
| 751 | if (out_func != NULL) | 729 | if (out_func != NULL) |
| 752 | *out_func = sha_func; | 730 | *out_func = sha_func; |
| 753 | if (out_md != NULL) | 731 | if (out_md != NULL) |
| 754 | *out_md = md; | 732 | *out_md = md; |
| 755 | if (out_len != NULL) | ||
| 756 | *out_len = len; | ||
| 757 | 733 | ||
| 758 | return 1; | 734 | return 1; |
| 759 | } | 735 | } |
| 760 | 736 | ||
| 761 | static int | 737 | static void |
| 762 | sha_test(void) | 738 | test_sha_tv(struct test *t, const void *arg) |
| 763 | { | 739 | { |
| 740 | const struct sha_test *st = arg; | ||
| 764 | sha_hash_func sha_func; | 741 | sha_hash_func sha_func; |
| 765 | const struct sha_test *st; | ||
| 766 | EVP_MD_CTX *hash = NULL; | 742 | EVP_MD_CTX *hash = NULL; |
| 767 | const EVP_MD *md; | 743 | const EVP_MD *md; |
| 768 | uint8_t out[EVP_MAX_MD_SIZE]; | 744 | uint8_t out[EVP_MAX_MD_SIZE]; |
| 769 | size_t in_len, out_len; | 745 | size_t in_len, out_len; |
| 770 | size_t i; | ||
| 771 | const char *label; | ||
| 772 | int failed = 1; | ||
| 773 | 746 | ||
| 774 | if ((hash = EVP_MD_CTX_new()) == NULL) { | 747 | if ((hash = EVP_MD_CTX_new()) == NULL) { |
| 775 | fprintf(stderr, "FAIL: EVP_MD_CTX_new() failed\n"); | 748 | test_errorf(t, "EVP_MD_CTX_new()"); |
| 776 | goto failed; | 749 | goto fail; |
| 777 | } | 750 | } |
| 778 | 751 | ||
| 779 | for (i = 0; i < N_SHA_TESTS; i++) { | 752 | if (!sha_hash_from_algorithm(st->algorithm, &sha_func, &md)) |
| 780 | st = &sha_tests[i]; | 753 | goto fail; |
| 781 | if (!sha_hash_from_algorithm(st->algorithm, &label, &sha_func, | ||
| 782 | &md, &out_len)) | ||
| 783 | goto failed; | ||
| 784 | |||
| 785 | /* Digest */ | ||
| 786 | if (sha_func != NULL) { | ||
| 787 | memset(out, 0, sizeof(out)); | ||
| 788 | sha_func(st->in, st->in_len, out); | ||
| 789 | if (memcmp(st->out, out, out_len) != 0) { | ||
| 790 | fprintf(stderr, "FAIL (%s:%zu): mismatch\n", | ||
| 791 | label, i); | ||
| 792 | goto failed; | ||
| 793 | } | ||
| 794 | } | ||
| 795 | 754 | ||
| 796 | /* EVP single-shot digest */ | 755 | out_len = EVP_MD_size(md); |
| 797 | memset(out, 0, sizeof(out)); | ||
| 798 | if (!EVP_Digest(st->in, st->in_len, out, NULL, md, NULL)) { | ||
| 799 | fprintf(stderr, "FAIL (%s:%zu): EVP_Digest failed\n", | ||
| 800 | label, i); | ||
| 801 | goto failed; | ||
| 802 | } | ||
| 803 | 756 | ||
| 757 | /* Digest */ | ||
| 758 | if (sha_func != NULL) { | ||
| 759 | memset(out, 0, sizeof(out)); | ||
| 760 | sha_func(st->in, st->in_len, out); | ||
| 804 | if (memcmp(st->out, out, out_len) != 0) { | 761 | if (memcmp(st->out, out, out_len) != 0) { |
| 805 | fprintf(stderr, | 762 | test_errorf(t, "SHA: digest output mismatch"); |
| 806 | "FAIL (%s:%zu): EVP single-shot mismatch\n", | 763 | test_hexdiff(t, out, out_len, st->out); |
| 807 | label, i); | ||
| 808 | goto failed; | ||
| 809 | } | 764 | } |
| 765 | } | ||
| 810 | 766 | ||
| 811 | /* EVP digest */ | 767 | /* EVP single-shot digest */ |
| 812 | memset(out, 0, sizeof(out)); | 768 | memset(out, 0, sizeof(out)); |
| 813 | if (!EVP_DigestInit_ex(hash, md, NULL)) { | 769 | if (!EVP_Digest(st->in, st->in_len, out, NULL, md, NULL)) { |
| 814 | fprintf(stderr, | 770 | test_errorf(t, "EVP_Digest()"); |
| 815 | "FAIL (%s:%zu): EVP_DigestInit_ex failed\n", | 771 | goto fail; |
| 816 | label, i); | 772 | } |
| 817 | goto failed; | ||
| 818 | } | ||
| 819 | 773 | ||
| 820 | in_len = st->in_len / 2; | 774 | if (memcmp(st->out, out, out_len) != 0) { |
| 821 | if (!EVP_DigestUpdate(hash, st->in, in_len)) { | 775 | test_errorf(t, "EVP single-shot: output diget mismatch"); |
| 822 | fprintf(stderr, | 776 | test_hexdiff(t, out, out_len, st->out); |
| 823 | "FAIL (%s:%zu): EVP_DigestUpdate first half " | 777 | } |
| 824 | "failed\n", label, i); | ||
| 825 | goto failed; | ||
| 826 | } | ||
| 827 | 778 | ||
| 828 | if (!EVP_DigestUpdate(hash, st->in + in_len, | 779 | /* EVP digest */ |
| 829 | st->in_len - in_len)) { | 780 | memset(out, 0, sizeof(out)); |
| 830 | fprintf(stderr, | 781 | if (!EVP_DigestInit_ex(hash, md, NULL)) { |
| 831 | "FAIL (%s:%zu): EVP_DigestUpdate second half " | 782 | test_errorf(t, "EVP_DigestInit_ex() "); |
| 832 | "failed\n", label, i); | 783 | goto fail; |
| 833 | goto failed; | 784 | } |
| 834 | } | ||
| 835 | 785 | ||
| 836 | if (!EVP_DigestFinal_ex(hash, out, NULL)) { | 786 | in_len = st->in_len / 2; |
| 837 | fprintf(stderr, | 787 | if (!EVP_DigestUpdate(hash, st->in, in_len)) { |
| 838 | "FAIL (%s:%zu): EVP_DigestFinal_ex failed\n", | 788 | test_errorf(t, "EVP_DigestUpdate() first half"); |
| 839 | label, i); | 789 | goto fail; |
| 840 | goto failed; | 790 | } |
| 841 | } | ||
| 842 | 791 | ||
| 843 | if (memcmp(st->out, out, out_len) != 0) { | 792 | if (!EVP_DigestUpdate(hash, st->in + in_len, |
| 844 | fprintf(stderr, "FAIL (%s:%zu): EVP mismatch\n", | 793 | st->in_len - in_len)) { |
| 845 | label, i); | 794 | test_errorf(t, "EVP_DigestUpdate() second half"); |
| 846 | goto failed; | 795 | goto fail; |
| 847 | } | ||
| 848 | } | 796 | } |
| 849 | 797 | ||
| 850 | failed = 0; | 798 | if (!EVP_DigestFinal_ex(hash, out, NULL)) { |
| 799 | test_errorf(t, "EVP_DigestFinal_ex()"); | ||
| 800 | goto fail; | ||
| 801 | } | ||
| 851 | 802 | ||
| 852 | failed: | 803 | if (memcmp(st->out, out, out_len) != 0) { |
| 804 | test_errorf(t, "EVP: digest output mismatch"); | ||
| 805 | test_hexdiff(t, out, out_len, st->out); | ||
| 806 | } | ||
| 807 | |||
| 808 | |||
| 809 | fail: | ||
| 853 | EVP_MD_CTX_free(hash); | 810 | EVP_MD_CTX_free(hash); |
| 854 | return failed; | ||
| 855 | } | 811 | } |
| 856 | 812 | ||
| 857 | static int | 813 | static void |
| 858 | sha_repetition_test(void) | 814 | test_sha(struct test *t, const void *arg) |
| 859 | { | 815 | { |
| 860 | const struct sha_repetition_test *st; | 816 | const struct sha_test *st; |
| 817 | size_t i; | ||
| 818 | char *name; | ||
| 819 | |||
| 820 | for (i = 0; i < N_SHA_TESTS; i++) { | ||
| 821 | st = &sha_tests[i]; | ||
| 822 | if (asprintf(&name, "%s: '%s'", OBJ_nid2sn(st->algorithm), st->in) == -1) { | ||
| 823 | test_errorf(t, "create test name failed"); | ||
| 824 | return; | ||
| 825 | } | ||
| 826 | |||
| 827 | test_run(t, name, test_sha_tv, st); | ||
| 828 | free(name); | ||
| 829 | } | ||
| 830 | } | ||
| 831 | |||
| 832 | static void | ||
| 833 | test_sha_repetition_tv(struct test *t, const void *arg) | ||
| 834 | { | ||
| 835 | const struct sha_repetition_test *st = arg; | ||
| 861 | EVP_MD_CTX *hash = NULL; | 836 | EVP_MD_CTX *hash = NULL; |
| 862 | const EVP_MD *md; | 837 | const EVP_MD *md; |
| 863 | uint8_t buf[1024]; | 838 | uint8_t buf[1024]; |
| 864 | uint8_t out[EVP_MAX_MD_SIZE]; | 839 | uint8_t out[EVP_MAX_MD_SIZE]; |
| 865 | size_t out_len, part_len; | 840 | size_t out_len, part_len; |
| 866 | size_t i, j; | 841 | size_t i; |
| 867 | const char *label; | ||
| 868 | int failed = 1; | ||
| 869 | 842 | ||
| 870 | if ((hash = EVP_MD_CTX_new()) == NULL) { | 843 | if ((hash = EVP_MD_CTX_new()) == NULL) { |
| 871 | fprintf(stderr, "FAIL: EVP_MD_CTX_new() failed\n"); | 844 | test_errorf(t, "EVP_MD_CTX_new()"); |
| 872 | goto failed; | 845 | goto fail; |
| 873 | } | 846 | } |
| 874 | 847 | ||
| 875 | for (i = 0; i < N_SHA_REPETITION_TESTS; i++) { | 848 | if (!sha_hash_from_algorithm(st->algorithm, NULL, &md)) |
| 876 | st = &sha_repetition_tests[i]; | 849 | goto fail; |
| 877 | if (!sha_hash_from_algorithm(st->algorithm, &label, NULL, &md, | ||
| 878 | &out_len)) | ||
| 879 | goto failed; | ||
| 880 | |||
| 881 | /* EVP digest */ | ||
| 882 | if (!EVP_DigestInit_ex(hash, md, NULL)) { | ||
| 883 | fprintf(stderr, | ||
| 884 | "FAIL (%s:%zu): EVP_DigestInit_ex failed\n", | ||
| 885 | label, i); | ||
| 886 | goto failed; | ||
| 887 | } | ||
| 888 | 850 | ||
| 889 | memset(buf, st->in, sizeof(buf)); | 851 | out_len = EVP_MD_size(md); |
| 890 | 852 | ||
| 891 | for (j = 0; j < st->in_repetitions;) { | 853 | /* EVP digest */ |
| 892 | part_len = arc4random_uniform(sizeof(buf)); | 854 | if (!EVP_DigestInit_ex(hash, md, NULL)) { |
| 893 | if (part_len > st->in_repetitions - j) | 855 | test_errorf(t, "EVP_DigestInit_ex()"); |
| 894 | part_len = st->in_repetitions - j; | 856 | goto fail; |
| 857 | } | ||
| 895 | 858 | ||
| 896 | if (!EVP_DigestUpdate(hash, buf, part_len)) { | 859 | memset(buf, st->in, sizeof(buf)); |
| 897 | fprintf(stderr, | ||
| 898 | "FAIL (%s:%zu): EVP_DigestUpdate failed\n", | ||
| 899 | label, i); | ||
| 900 | goto failed; | ||
| 901 | } | ||
| 902 | 860 | ||
| 903 | j += part_len; | 861 | for (i = 0; i < st->in_repetitions;) { |
| 904 | } | 862 | part_len = arc4random_uniform(sizeof(buf)); |
| 863 | if (part_len > st->in_repetitions - i) | ||
| 864 | part_len = st->in_repetitions - i; | ||
| 905 | 865 | ||
| 906 | if (!EVP_DigestFinal_ex(hash, out, NULL)) { | 866 | if (!EVP_DigestUpdate(hash, buf, part_len)) { |
| 907 | fprintf(stderr, | 867 | test_errorf(t, "EVP_DigestUpdate()"); |
| 908 | "FAIL (%s:%zu): EVP_DigestFinal_ex failed\n", | 868 | goto fail; |
| 909 | label, i); | ||
| 910 | goto failed; | ||
| 911 | } | 869 | } |
| 912 | 870 | ||
| 913 | if (memcmp(st->out, out, out_len) != 0) { | 871 | i += part_len; |
| 914 | fprintf(stderr, "FAIL (%s:%zu): EVP mismatch\n", | 872 | } |
| 915 | label, i); | 873 | |
| 916 | goto failed; | 874 | if (!EVP_DigestFinal_ex(hash, out, NULL)) { |
| 917 | } | 875 | test_errorf(t, "EVP_DigestFinal_ex()"); |
| 876 | goto fail; | ||
| 918 | } | 877 | } |
| 919 | 878 | ||
| 920 | failed = 0; | 879 | if (memcmp(st->out, out, out_len) != 0) { |
| 880 | test_errorf(t, "EVP: digest output mismatch"); | ||
| 881 | test_hexdiff(t, out, out_len, st->out); | ||
| 882 | goto fail; | ||
| 883 | } | ||
| 921 | 884 | ||
| 922 | failed: | 885 | fail: |
| 923 | EVP_MD_CTX_free(hash); | 886 | EVP_MD_CTX_free(hash); |
| 924 | return failed; | 887 | } |
| 888 | |||
| 889 | static void | ||
| 890 | test_sha_repetition(struct test *t, const void *arg) | ||
| 891 | { | ||
| 892 | const struct sha_repetition_test *st; | ||
| 893 | size_t i; | ||
| 894 | char *name; | ||
| 895 | |||
| 896 | for (i = 0; i < N_SHA_REPETITION_TESTS; i++) { | ||
| 897 | st = &sha_repetition_tests[i]; | ||
| 898 | if (asprintf(&name, "%s: '%hhu' x %zu", OBJ_nid2sn(st->algorithm), | ||
| 899 | st->in, st->in_repetitions) == -1) { | ||
| 900 | test_errorf(t, "create test name failed"); | ||
| 901 | return; | ||
| 902 | } | ||
| 903 | |||
| 904 | test_run(t, name, test_sha_repetition_tv, st); | ||
| 905 | free(name); | ||
| 906 | } | ||
| 925 | } | 907 | } |
| 926 | 908 | ||
| 927 | int | 909 | int |
| 928 | main(int argc, char **argv) | 910 | main(int argc, char **argv) |
| 929 | { | 911 | { |
| 930 | int failed = 0; | 912 | struct test *t = test_init(); |
| 931 | 913 | ||
| 932 | failed |= sha_test(); | 914 | test_run(t, "sha", test_sha, NULL); |
| 933 | failed |= sha_repetition_test(); | 915 | test_run(t, "sha repetition", test_sha_repetition, NULL); |
| 934 | 916 | ||
| 935 | return failed; | 917 | return test_result(t); |
| 936 | } | 918 | } |
diff --git a/src/regress/lib/libcrypto/symbols/symbols.awk b/src/regress/lib/libcrypto/symbols/symbols.awk index 8ea68b681e..253658e7a0 100644 --- a/src/regress/lib/libcrypto/symbols/symbols.awk +++ b/src/regress/lib/libcrypto/symbols/symbols.awk | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: symbols.awk,v 1.13 2024/09/01 17:20:37 tb Exp $ | 1 | # $OpenBSD: symbols.awk,v 1.15 2025/08/22 15:52:34 tb Exp $ |
| 2 | 2 | ||
| 3 | # Copyright (c) 2018,2020 Theo Buehler <tb@openbsd.org> | 3 | # Copyright (c) 2018,2020 Theo Buehler <tb@openbsd.org> |
| 4 | # | 4 | # |
| @@ -26,7 +26,7 @@ BEGIN { | |||
| 26 | # Undefine aliases, so we don't accidentally leave them in Symbols.list. | 26 | # Undefine aliases, so we don't accidentally leave them in Symbols.list. |
| 27 | printf("#ifdef %s\n#undef %s\n#endif\n", $0, $0) | 27 | printf("#ifdef %s\n#undef %s\n#endif\n", $0, $0) |
| 28 | 28 | ||
| 29 | printf("static typeof(%s) *_libre_%s;\n", $0, $0); | 29 | printf("extern typeof(%s) *_libre_%s;\n", $0, $0); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | END { | 32 | END { |
| @@ -51,8 +51,12 @@ END { | |||
| 51 | 51 | ||
| 52 | printf("\t\};\n\n") | 52 | printf("\t\};\n\n") |
| 53 | 53 | ||
| 54 | printf("\tfor (i = 0; i < sizeof(symbols) / sizeof(symbols[0]); i++)\n") | 54 | printf("\tfor (i = 0; i < sizeof(symbols) / sizeof(symbols[0]); i++) {\n") |
| 55 | printf("\t\tfprintf(stderr, \"%%s: %%p\\n\", symbols[i].name, symbols[i].addr);\n") | 55 | printf("\t\tfprintf(stderr, \"%%s: %%p\\n\", symbols[i].name, symbols[i].addr);\n") |
| 56 | printf("#if defined(USE_LIBRESSL_NAMESPACE)\n") | ||
| 57 | printf("\t\tfprintf(stderr, \"_libre_%%s: %%p\\n\", symbols[i].name, symbols[i].libre_addr);\n") | ||
| 58 | printf("#endif\n") | ||
| 59 | printf("\t}\n") | ||
| 56 | printf("\n\tprintf(\"OK\\n\");\n") | 60 | printf("\n\tprintf(\"OK\\n\");\n") |
| 57 | printf("\n\treturn 0;\n}\n") | 61 | printf("\n\treturn 0;\n}\n") |
| 58 | } | 62 | } |
diff --git a/src/regress/lib/libcrypto/test/test.c b/src/regress/lib/libcrypto/test/test.c new file mode 100644 index 0000000000..c99e2c6acc --- /dev/null +++ b/src/regress/lib/libcrypto/test/test.c | |||
| @@ -0,0 +1,226 @@ | |||
| 1 | /* $OpenBSD: test.c,v 1.6 2025/10/07 15:41:19 tb Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2025 Joshua Sing <joshua@joshuasing.dev> | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <err.h> | ||
| 19 | #include <stdarg.h> | ||
| 20 | #include <stdio.h> | ||
| 21 | #include <stdlib.h> | ||
| 22 | #include <string.h> | ||
| 23 | #include <unistd.h> | ||
| 24 | |||
| 25 | #include "test.h" | ||
| 26 | |||
| 27 | struct test { | ||
| 28 | struct test *parent; | ||
| 29 | char *name; | ||
| 30 | FILE *out; | ||
| 31 | int skipped; | ||
| 32 | int failed; | ||
| 33 | }; | ||
| 34 | |||
| 35 | static struct test * | ||
| 36 | test_new(struct test *pt, const char *name) | ||
| 37 | { | ||
| 38 | struct test *t; | ||
| 39 | |||
| 40 | if ((t = calloc(1, sizeof(*t))) == NULL) | ||
| 41 | err(1, "calloc"); | ||
| 42 | |||
| 43 | if (name != NULL) { | ||
| 44 | if ((t->name = strdup(name)) == NULL) | ||
| 45 | err(1, "strdup"); | ||
| 46 | } | ||
| 47 | |||
| 48 | if (pt != NULL) | ||
| 49 | t->out = pt->out; | ||
| 50 | t->parent = pt; | ||
| 51 | |||
| 52 | return t; | ||
| 53 | } | ||
| 54 | |||
| 55 | struct test * | ||
| 56 | test_init(void) | ||
| 57 | { | ||
| 58 | struct test *t; | ||
| 59 | char *tmp_file; | ||
| 60 | int out_fd; | ||
| 61 | char *v; | ||
| 62 | |||
| 63 | t = test_new(NULL, NULL); | ||
| 64 | t->out = stderr; | ||
| 65 | |||
| 66 | if (((v = getenv("TEST_VERBOSE")) != NULL) && strcmp(v, "0") != 0) | ||
| 67 | return t; | ||
| 68 | |||
| 69 | /* Create a temporary file for logging in non-verbose mode */ | ||
| 70 | if ((tmp_file = strdup("/tmp/libressl-test.XXXXXXXX")) == NULL) | ||
| 71 | err(1, "strdup"); | ||
| 72 | if ((out_fd = mkstemp(tmp_file)) == -1) | ||
| 73 | err(1, "mkstemp"); | ||
| 74 | |||
| 75 | unlink(tmp_file); | ||
| 76 | free(tmp_file); | ||
| 77 | if ((t->out = fdopen(out_fd, "w+")) == NULL) | ||
| 78 | err(1, "fdopen"); | ||
| 79 | |||
| 80 | return t; | ||
| 81 | } | ||
| 82 | |||
| 83 | static void | ||
| 84 | test_cleanup(struct test *t) | ||
| 85 | { | ||
| 86 | free(t->name); | ||
| 87 | free(t); | ||
| 88 | } | ||
| 89 | |||
| 90 | int | ||
| 91 | test_result(struct test *t) | ||
| 92 | { | ||
| 93 | int failed = t->failed; | ||
| 94 | |||
| 95 | if (t->parent == NULL && t->out != stderr) | ||
| 96 | fclose(t->out); | ||
| 97 | |||
| 98 | test_cleanup(t); | ||
| 99 | |||
| 100 | return failed; | ||
| 101 | } | ||
| 102 | |||
| 103 | void | ||
| 104 | test_fail(struct test *t) | ||
| 105 | { | ||
| 106 | t->failed = 1; | ||
| 107 | |||
| 108 | /* Also fail parent. */ | ||
| 109 | if (t->parent != NULL) | ||
| 110 | test_fail(t->parent); | ||
| 111 | } | ||
| 112 | |||
| 113 | static void | ||
| 114 | test_vprintf(struct test *t, const char *fmt, va_list ap) | ||
| 115 | { | ||
| 116 | if (vfprintf(t->out, fmt, ap) == -1) | ||
| 117 | err(1, "vfprintf"); | ||
| 118 | } | ||
| 119 | |||
| 120 | void | ||
| 121 | test_printf(struct test *t, const char *fmt, ...) | ||
| 122 | { | ||
| 123 | va_list ap; | ||
| 124 | |||
| 125 | va_start(ap, fmt); | ||
| 126 | test_vprintf(t, fmt, ap); | ||
| 127 | va_end(ap); | ||
| 128 | } | ||
| 129 | |||
| 130 | static void | ||
| 131 | test_vlogf_internal(struct test *t, const char *label, const char *func, | ||
| 132 | const char *file, int line, const char *fmt, va_list ap) | ||
| 133 | { | ||
| 134 | char *msg = NULL; | ||
| 135 | char *l = ": "; | ||
| 136 | const char *filename; | ||
| 137 | |||
| 138 | if (label == NULL) { | ||
| 139 | label = ""; | ||
| 140 | l = ""; | ||
| 141 | } | ||
| 142 | |||
| 143 | if (vasprintf(&msg, fmt, ap) == -1) | ||
| 144 | err(1, "vasprintf"); | ||
| 145 | |||
| 146 | if ((filename = strrchr(file, '/')) != NULL) | ||
| 147 | filename++; | ||
| 148 | else | ||
| 149 | filename = file; | ||
| 150 | |||
| 151 | test_printf(t, "%s [%s:%d]%s%s: %s\n", | ||
| 152 | func, filename, line, l, label, msg); | ||
| 153 | |||
| 154 | free(msg); | ||
| 155 | } | ||
| 156 | |||
| 157 | void | ||
| 158 | test_logf_internal(struct test *t, const char *label, const char *func, | ||
| 159 | const char *file, int line, const char *fmt, ...) | ||
| 160 | { | ||
| 161 | va_list ap; | ||
| 162 | |||
| 163 | va_start(ap, fmt); | ||
| 164 | test_vlogf_internal(t, label, func, file, line, fmt, ap); | ||
| 165 | va_end(ap); | ||
| 166 | } | ||
| 167 | |||
| 168 | void | ||
| 169 | test_skip(struct test *t, const char *reason) | ||
| 170 | { | ||
| 171 | t->skipped = 1; | ||
| 172 | test_printf(t, "%s\n", reason); | ||
| 173 | } | ||
| 174 | |||
| 175 | void | ||
| 176 | test_skipf(struct test *t, const char *fmt, ...) | ||
| 177 | { | ||
| 178 | va_list ap; | ||
| 179 | |||
| 180 | t->skipped = 1; | ||
| 181 | |||
| 182 | va_start(ap, fmt); | ||
| 183 | test_vprintf(t, fmt, ap); | ||
| 184 | if (fputc('\n', t->out) == EOF) | ||
| 185 | err(1, "fputc"); | ||
| 186 | va_end(ap); | ||
| 187 | } | ||
| 188 | |||
| 189 | void | ||
| 190 | test_run(struct test *pt, const char *name, test_run_func *fn, const void *arg) | ||
| 191 | { | ||
| 192 | struct test *t = test_new(pt, name); | ||
| 193 | char *status = "PASS"; | ||
| 194 | char buf[1024]; | ||
| 195 | size_t buflen; | ||
| 196 | int ferr; | ||
| 197 | |||
| 198 | /* Run test */ | ||
| 199 | test_printf(t, "=== RUN %s\n", t->name); | ||
| 200 | fn(t, arg); | ||
| 201 | |||
| 202 | if (t->skipped) | ||
| 203 | status = "SKIP"; | ||
| 204 | if (t->failed) | ||
| 205 | status = "FAIL"; | ||
| 206 | |||
| 207 | test_printf(t, "--- %s: %s\n\n", status, t->name); | ||
| 208 | |||
| 209 | /* Print result of test */ | ||
| 210 | if (t->failed && t->out != stderr) { | ||
| 211 | /* Copy logs to stderr */ | ||
| 212 | rewind(t->out); | ||
| 213 | while ((buflen = fread(buf, 1, sizeof(buf), t->out)) > 0) | ||
| 214 | fwrite(buf, 1, buflen, stderr); | ||
| 215 | if ((ferr = ferror(t->out)) != 0) | ||
| 216 | errx(1, "ferror: %d", ferr); | ||
| 217 | } | ||
| 218 | |||
| 219 | if (t->out != NULL && t->out != stderr) { | ||
| 220 | /* Reset output file */ | ||
| 221 | rewind(t->out); | ||
| 222 | ftruncate(fileno(t->out), 0); | ||
| 223 | } | ||
| 224 | |||
| 225 | test_cleanup(t); | ||
| 226 | } | ||
diff --git a/src/regress/lib/libcrypto/test/test.h b/src/regress/lib/libcrypto/test/test.h new file mode 100644 index 0000000000..5df19b9be4 --- /dev/null +++ b/src/regress/lib/libcrypto/test/test.h | |||
| @@ -0,0 +1,137 @@ | |||
| 1 | /* $OpenBSD: test.h,v 1.5 2025/12/25 02:40:53 tb Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2025 Joshua Sing <joshua@joshuasing.dev> | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef HEADER_TEST_H | ||
| 19 | #define HEADER_TEST_H | ||
| 20 | |||
| 21 | #include <stddef.h> | ||
| 22 | #include <stdint.h> | ||
| 23 | |||
| 24 | struct test; | ||
| 25 | |||
| 26 | /* | ||
| 27 | * test_init creates a new root test struct. | ||
| 28 | * | ||
| 29 | * Additional tests may be run under the root test struct by calling test_run. | ||
| 30 | * | ||
| 31 | * If the TEST_VERBOSE environment variable is set and not equal to "0", then | ||
| 32 | * verbose mode will be enabled and all test logs will be written to stderr. | ||
| 33 | */ | ||
| 34 | struct test *test_init(void); | ||
| 35 | |||
| 36 | /* | ||
| 37 | * test_result cleans up after all tests have completed and returns an | ||
| 38 | * appropriate exit code indicating the result of the tests. | ||
| 39 | */ | ||
| 40 | int test_result(struct test *_t); | ||
| 41 | |||
| 42 | /* | ||
| 43 | * test_run_func is an individual test function. It is passed the test struct | ||
| 44 | * and an arbitrary argument which may be passed when test_run is called. | ||
| 45 | */ | ||
| 46 | typedef void (test_run_func)(struct test *_t, const void *_arg); | ||
| 47 | |||
| 48 | /* | ||
| 49 | * test_fail marks the test and its parents as failed. | ||
| 50 | */ | ||
| 51 | void test_fail(struct test *_t); | ||
| 52 | |||
| 53 | /* | ||
| 54 | * test_printf prints a test log message. When in verbose mode, the log message | ||
| 55 | * will be written to stderr, otherwise it will be buffered and only written to | ||
| 56 | * stderr if the test fails. | ||
| 57 | * | ||
| 58 | * This printf will write directly, without any additional formatting. | ||
| 59 | */ | ||
| 60 | void test_printf(struct test *_t, const char *_fmt, ...) | ||
| 61 | __attribute__((__format__ (printf, 2, 3))) | ||
| 62 | __attribute__((__nonnull__ (2))); | ||
| 63 | |||
| 64 | /* | ||
| 65 | * test_logf_internal prints a test log message. When in verbose mode, the | ||
| 66 | * log message will be written to stderr, otherwise it will be buffered and | ||
| 67 | * only written to stderr if the test fails. | ||
| 68 | * | ||
| 69 | * label is an optional label indicating the severity of the log. | ||
| 70 | * func, file and line are used to show where the log comes from and are | ||
| 71 | * automatically set in the test log macros. | ||
| 72 | * | ||
| 73 | * This function should never be called directly. | ||
| 74 | */ | ||
| 75 | void test_logf_internal(struct test *_t, const char *_label, const char *_func, | ||
| 76 | const char *_file, int _line, const char *_fmt, ...) | ||
| 77 | __attribute__((__format__ (printf, 6, 7))) | ||
| 78 | __attribute__((__nonnull__ (6))); | ||
| 79 | |||
| 80 | /* | ||
| 81 | * test_logf prints an informational log message. When in verbose mode, the log | ||
| 82 | * will be written to stderr, otherwise it will be buffered and only written to | ||
| 83 | * stderr if the test fails. | ||
| 84 | */ | ||
| 85 | #define test_logf(t, fmt, ...) \ | ||
| 86 | do { \ | ||
| 87 | test_logf_internal(t, NULL, __func__, __FILE__, __LINE__, fmt, ##__VA_ARGS__); \ | ||
| 88 | } while (0) | ||
| 89 | |||
| 90 | /* | ||
| 91 | * test_errorf prints an error message. It will also cause the test to fail. | ||
| 92 | * If the test cannot proceed, it is recommended to return or goto a cleanup | ||
| 93 | * label. | ||
| 94 | * | ||
| 95 | * Tests should not fail-fast if continuing will provide more detailed | ||
| 96 | * information about what is broken. | ||
| 97 | */ | ||
| 98 | #define test_errorf(t, fmt, ...) \ | ||
| 99 | do { \ | ||
| 100 | test_logf_internal(t, "ERROR", __func__, __FILE__, __LINE__, fmt, ##__VA_ARGS__); \ | ||
| 101 | test_fail(t); \ | ||
| 102 | } while (0) | ||
| 103 | |||
| 104 | /* | ||
| 105 | * test_skip marks the test as skipped. Once called, the test should return. | ||
| 106 | */ | ||
| 107 | void test_skip(struct test *_t, const char *_reason); | ||
| 108 | |||
| 109 | /* | ||
| 110 | * test_skipf marks the test as skipped with a formatted reason. Once called, | ||
| 111 | * the test should return. | ||
| 112 | */ | ||
| 113 | void test_skipf(struct test *_t, const char *_fmt, ...) | ||
| 114 | __attribute__((__format__ (printf, 2, 3))) | ||
| 115 | __attribute__((__nonnull__ (2))); | ||
| 116 | |||
| 117 | /* | ||
| 118 | * test_run runs a test function. It will create a new test struct with the | ||
| 119 | * given test as the parent. An argument may be provided to pass data to the | ||
| 120 | * test function, otherwise NULL should be passed. | ||
| 121 | * | ||
| 122 | * Each test should have a unique and informational name. | ||
| 123 | */ | ||
| 124 | void test_run(struct test *_t, const char *_name, test_run_func *_fn, const void *_arg); | ||
| 125 | |||
| 126 | /* | ||
| 127 | * test_hexdump prints the given data as hexadecimal. | ||
| 128 | */ | ||
| 129 | void test_hexdump(struct test *_t, const unsigned char *_buf, size_t _len); | ||
| 130 | |||
| 131 | /* | ||
| 132 | * test_hexdiff prints the given data as hexadecimal. If a second comparison | ||
| 133 | * buffer is not NULL, any differing bytes will be marked with an asterisk. | ||
| 134 | */ | ||
| 135 | void test_hexdiff(struct test *_t, const uint8_t *_buf, size_t _len, const uint8_t *_compare); | ||
| 136 | |||
| 137 | #endif /* HEADER_TEST_H */ | ||
diff --git a/src/regress/lib/libcrypto/test/test_util.c b/src/regress/lib/libcrypto/test/test_util.c new file mode 100644 index 0000000000..6ecb574788 --- /dev/null +++ b/src/regress/lib/libcrypto/test/test_util.c | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | /* $OpenBSD: test_util.c,v 1.1 2025/05/21 08:57:13 joshua Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2017 Joel Sing <jsing@openbsd.org> | ||
| 4 | * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> | ||
| 5 | * | ||
| 6 | * Permission to use, copy, modify, and distribute this software for any | ||
| 7 | * purpose with or without fee is hereby granted, provided that the above | ||
| 8 | * copyright notice and this permission notice appear in all copies. | ||
| 9 | * | ||
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <stdio.h> | ||
| 20 | #include <stdint.h> | ||
| 21 | |||
| 22 | #include "test.h" | ||
| 23 | |||
| 24 | void | ||
| 25 | test_hexdump(struct test *t, const unsigned char *buf, size_t len) | ||
| 26 | { | ||
| 27 | size_t i; | ||
| 28 | |||
| 29 | for (i = 1; i <= len; i++) | ||
| 30 | test_printf(t, " 0x%02x,%s", buf[i - 1], i % 8 ? "" : "\n"); | ||
| 31 | |||
| 32 | if ((len % 8) != 0) | ||
| 33 | test_printf(t, "\n"); | ||
| 34 | } | ||
| 35 | |||
| 36 | void | ||
| 37 | test_hexdiff(struct test *t, const uint8_t *buf, size_t len, const uint8_t *compare) | ||
| 38 | { | ||
| 39 | const char *mark = "", *newline; | ||
| 40 | size_t i; | ||
| 41 | |||
| 42 | for (i = 1; i <= len; i++) { | ||
| 43 | if (compare != NULL) | ||
| 44 | mark = (buf[i - 1] != compare[i - 1]) ? "*" : " "; | ||
| 45 | newline = i % 8 ? "" : "\n"; | ||
| 46 | test_printf(t, " %s0x%02x,%s", mark, buf[i - 1], newline); | ||
| 47 | } | ||
| 48 | |||
| 49 | if ((len % 8) != 0) | ||
| 50 | test_printf(t, "\n"); | ||
| 51 | } | ||
diff --git a/src/regress/lib/libcrypto/wycheproof/Makefile b/src/regress/lib/libcrypto/wycheproof/Makefile index f2f7910b5b..ec737822b5 100644 --- a/src/regress/lib/libcrypto/wycheproof/Makefile +++ b/src/regress/lib/libcrypto/wycheproof/Makefile | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.9 2023/07/08 19:41:07 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.11 2025/09/05 14:41:29 tb Exp $ |
| 2 | 2 | ||
| 3 | WYCHEPROOF_TESTVECTORS = /usr/local/share/wycheproof/testvectors/ | 3 | WYCHEPROOF_TESTVECTORS = /usr/local/share/wycheproof/testvectors_v1/ |
| 4 | 4 | ||
| 5 | .if !exists(${WYCHEPROOF_TESTVECTORS}) | 5 | .if !exists(${WYCHEPROOF_TESTVECTORS}) |
| 6 | regress: | 6 | regress: |
| @@ -18,11 +18,17 @@ REGRESS_TARGETS += regress-wycheproof | |||
| 18 | CLEANFILES += wycheproof | 18 | CLEANFILES += wycheproof |
| 19 | 19 | ||
| 20 | wycheproof: wycheproof.go | 20 | wycheproof: wycheproof.go |
| 21 | go build -o wycheproof ${.CURDIR}/wycheproof.go | 21 | env GOCACHE=${.OBJDIR}/go-build go build -o wycheproof ${.CURDIR}/wycheproof.go |
| 22 | 22 | ||
| 23 | regress-wycheproof: wycheproof | 23 | regress-wycheproof: wycheproof |
| 24 | ./wycheproof | 24 | ./wycheproof |
| 25 | 25 | ||
| 26 | REGRESS_CLEANUP = clean-go-cache | ||
| 27 | |||
| 28 | clean-go-cache: | ||
| 29 | env GOCACHE=${.OBJDIR}/go-build go clean -cache | ||
| 30 | rm -rf ${.OBJDIR}/go-build | ||
| 31 | |||
| 26 | . endif | 32 | . endif |
| 27 | 33 | ||
| 28 | PROGS += wycheproof-primes | 34 | PROGS += wycheproof-primes |
diff --git a/src/regress/lib/libcrypto/wycheproof/wycheproof-json.pl b/src/regress/lib/libcrypto/wycheproof/wycheproof-json.pl index 45c7542b59..0eea14752c 100644 --- a/src/regress/lib/libcrypto/wycheproof/wycheproof-json.pl +++ b/src/regress/lib/libcrypto/wycheproof/wycheproof-json.pl | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: wycheproof-json.pl,v 1.2 2022/07/08 14:33:56 tb Exp $ | 1 | # $OpenBSD: wycheproof-json.pl,v 1.3 2025/09/05 14:36:03 tb Exp $ |
| 2 | 2 | ||
| 3 | # Copyright (c) 2022 Joel Sing <jsing@openbsd.org> | 3 | # Copyright (c) 2022 Joel Sing <jsing@openbsd.org> |
| 4 | # Copyright (c) 2022 Theo Buehler <tb@openbsd.org> | 4 | # Copyright (c) 2022 Theo Buehler <tb@openbsd.org> |
| @@ -17,7 +17,7 @@ | |||
| 17 | 17 | ||
| 18 | use JSON::PP; | 18 | use JSON::PP; |
| 19 | 19 | ||
| 20 | $test_vector_path = "/usr/local/share/wycheproof/testvectors"; | 20 | $test_vector_path = "/usr/local/share/wycheproof/testvectors_v1"; |
| 21 | 21 | ||
| 22 | open JSON, "$test_vector_path/primality_test.json" or die; | 22 | open JSON, "$test_vector_path/primality_test.json" or die; |
| 23 | @json = <JSON>; | 23 | @json = <JSON>; |
diff --git a/src/regress/lib/libcrypto/wycheproof/wycheproof-primes.c b/src/regress/lib/libcrypto/wycheproof/wycheproof-primes.c index 57bd7a53da..e54fd484f9 100644 --- a/src/regress/lib/libcrypto/wycheproof/wycheproof-primes.c +++ b/src/regress/lib/libcrypto/wycheproof/wycheproof-primes.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: wycheproof-primes.c,v 1.2 2022/12/01 13:49:12 tb Exp $ */ | 1 | /* $OpenBSD: wycheproof-primes.c,v 1.3 2025/09/05 14:36:03 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> | 3 | * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> |
| 4 | * | 4 | * |
| @@ -16,7 +16,9 @@ | |||
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include <err.h> | 18 | #include <err.h> |
| 19 | #include <limits.h> | ||
| 19 | #include <stdio.h> | 20 | #include <stdio.h> |
| 21 | #include <string.h> | ||
| 20 | 22 | ||
| 21 | #include <openssl/bn.h> | 23 | #include <openssl/bn.h> |
| 22 | 24 | ||
| @@ -26,12 +28,31 @@ int | |||
| 26 | primality_test(struct wycheproof_testcase *test) | 28 | primality_test(struct wycheproof_testcase *test) |
| 27 | { | 29 | { |
| 28 | BIGNUM *value = NULL; | 30 | BIGNUM *value = NULL; |
| 31 | size_t len; | ||
| 29 | int ret; | 32 | int ret; |
| 30 | int failed = 1; | 33 | int failed = 1; |
| 31 | 34 | ||
| 32 | if (!BN_hex2bn(&value, test->value)) | 35 | if (!BN_hex2bn(&value, test->value)) |
| 33 | errx(1, "%d: failed to set value \"%s\"", test->id, test->value); | 36 | errx(1, "%d: failed to set value \"%s\"", test->id, test->value); |
| 34 | 37 | ||
| 38 | if ((len = strlen(test->value)) > INT_MAX / 4) | ||
| 39 | errx(1, "%d: overlong test string %zu", test->id, len); | ||
| 40 | |||
| 41 | if (len > 0 && test->value[0] >= '8') { | ||
| 42 | BIGNUM *pow2; | ||
| 43 | |||
| 44 | if ((pow2 = BN_new()) == NULL) | ||
| 45 | errx(1, "BN_new"); | ||
| 46 | |||
| 47 | if (!BN_set_bit(pow2, 4 * len)) | ||
| 48 | errx(1, "BN_set_bit"); | ||
| 49 | |||
| 50 | if (!BN_sub(value, value, pow2)) | ||
| 51 | errx(1, "BN_sub"); | ||
| 52 | |||
| 53 | BN_free(pow2); | ||
| 54 | } | ||
| 55 | |||
| 35 | if ((ret = BN_is_prime_ex(value, BN_prime_checks, NULL, NULL)) < 0) | 56 | if ((ret = BN_is_prime_ex(value, BN_prime_checks, NULL, NULL)) < 0) |
| 36 | errx(1, "%d: BN_is_prime_ex errored", test->id); | 57 | errx(1, "%d: BN_is_prime_ex errored", test->id); |
| 37 | 58 | ||
diff --git a/src/regress/lib/libcrypto/wycheproof/wycheproof.go b/src/regress/lib/libcrypto/wycheproof/wycheproof.go index 8f0dfc8b2e..397958ac15 100644 --- a/src/regress/lib/libcrypto/wycheproof/wycheproof.go +++ b/src/regress/lib/libcrypto/wycheproof/wycheproof.go | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* $OpenBSD: wycheproof.go,v 1.161 2024/11/24 10:13:16 tb Exp $ */ | 1 | /* $OpenBSD: wycheproof.go,v 1.196 2026/01/01 12:47:52 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2018,2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2018,2023 Joel Sing <jsing@openbsd.org> |
| 4 | * Copyright (c) 2018,2019,2022-2024 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2018,2019,2022-2025 Theo Buehler <tb@openbsd.org> |
| 5 | * | 5 | * |
| 6 | * Permission to use, copy, modify, and distribute this software for any | 6 | * Permission to use, copy, modify, and distribute this software for any |
| 7 | * purpose with or without fee is hereby granted, provided that the above | 7 | * purpose with or without fee is hereby granted, provided that the above |
| @@ -36,6 +36,7 @@ package main | |||
| 36 | #include <openssl/evp.h> | 36 | #include <openssl/evp.h> |
| 37 | #include <openssl/kdf.h> | 37 | #include <openssl/kdf.h> |
| 38 | #include <openssl/hmac.h> | 38 | #include <openssl/hmac.h> |
| 39 | #include <openssl/mlkem.h> | ||
| 39 | #include <openssl/objects.h> | 40 | #include <openssl/objects.h> |
| 40 | #include <openssl/pem.h> | 41 | #include <openssl/pem.h> |
| 41 | #include <openssl/x509.h> | 42 | #include <openssl/x509.h> |
| @@ -81,16 +82,16 @@ import ( | |||
| 81 | "fmt" | 82 | "fmt" |
| 82 | "io/ioutil" | 83 | "io/ioutil" |
| 83 | "log" | 84 | "log" |
| 85 | "math/big" | ||
| 84 | "os" | 86 | "os" |
| 85 | "path/filepath" | 87 | "path/filepath" |
| 86 | "regexp" | ||
| 87 | "runtime" | 88 | "runtime" |
| 88 | "strings" | 89 | "strings" |
| 89 | "sync" | 90 | "sync" |
| 90 | "unsafe" | 91 | "unsafe" |
| 91 | ) | 92 | ) |
| 92 | 93 | ||
| 93 | const testVectorPath = "/usr/local/share/wycheproof/testvectors" | 94 | const testVectorPath = "/usr/local/share/wycheproof/testvectors_v1" |
| 94 | 95 | ||
| 95 | type testVariant int | 96 | type testVariant int |
| 96 | 97 | ||
| @@ -125,6 +126,59 @@ func wycheproofFormatTestCase(tcid int, comment string, flags []string, result s | |||
| 125 | 126 | ||
| 126 | var testc *testCoordinator | 127 | var testc *testCoordinator |
| 127 | 128 | ||
| 129 | type BigInt struct { | ||
| 130 | *big.Int | ||
| 131 | } | ||
| 132 | |||
| 133 | func mustConvertBigIntToBigNum(bi *BigInt) *C.BIGNUM { | ||
| 134 | value := bi.Bytes() | ||
| 135 | if len(value) == 0 { | ||
| 136 | value = append(value, 0) | ||
| 137 | } | ||
| 138 | bn := C.BN_new() | ||
| 139 | if bn == nil { | ||
| 140 | log.Fatal("BN_new failed") | ||
| 141 | } | ||
| 142 | if C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&value[0])), C.int(len(value)), bn) == nil { | ||
| 143 | log.Fatal("BN_bin2bn failed") | ||
| 144 | } | ||
| 145 | if bi.Sign() == -1 { | ||
| 146 | C.BN_set_negative(bn, C.int(1)) | ||
| 147 | } | ||
| 148 | return bn | ||
| 149 | } | ||
| 150 | |||
| 151 | func (bi *BigInt) UnmarshalJSON(data []byte) error { | ||
| 152 | if len(data) < 2 || data[0] != '"' || data[len(data)-1] != '"' { | ||
| 153 | log.Fatalf("Failed to decode %q: too short or unquoted", data) | ||
| 154 | } | ||
| 155 | data = data[1 : len(data)-1] | ||
| 156 | if len(data)%2 == 1 { | ||
| 157 | pad := make([]byte, 1, len(data)+1) | ||
| 158 | if data[0] >= '0' && data[0] <= '7' { | ||
| 159 | pad[0] = '0' | ||
| 160 | } else { | ||
| 161 | pad[0] = 'f' | ||
| 162 | } | ||
| 163 | data = append(pad, data...) | ||
| 164 | } | ||
| 165 | |||
| 166 | src := make([]byte, hex.DecodedLen(len(data))) | ||
| 167 | _, err := hex.Decode(src, data) | ||
| 168 | if err != nil { | ||
| 169 | log.Fatalf("Failed to decode %q: %v", data, err) | ||
| 170 | } | ||
| 171 | |||
| 172 | bi.Int = &big.Int{} | ||
| 173 | bi.Int.SetBytes(src) | ||
| 174 | if data[0] >= '8' { | ||
| 175 | y := &big.Int{} | ||
| 176 | y.SetBit(y, 4*len(data), 1) | ||
| 177 | bi.Int.Sub(bi.Int, y) | ||
| 178 | } | ||
| 179 | return nil | ||
| 180 | } | ||
| 181 | |||
| 128 | type wycheproofJWKPublic struct { | 182 | type wycheproofJWKPublic struct { |
| 129 | Crv string `json:"crv"` | 183 | Crv string `json:"crv"` |
| 130 | KID string `json:"kid"` | 184 | KID string `json:"kid"` |
| @@ -236,9 +290,9 @@ func (wt *wycheproofTestDSA) String() string { | |||
| 236 | } | 290 | } |
| 237 | 291 | ||
| 238 | type wycheproofTestGroupDSA struct { | 292 | type wycheproofTestGroupDSA struct { |
| 239 | Key *wycheproofDSAKey `json:"key"` | 293 | Key *wycheproofDSAKey `json:"publicKey"` |
| 240 | KeyDER string `json:"keyDer"` | 294 | KeyDER string `json:"publicKeyDer"` |
| 241 | KeyPEM string `json:"keyPem"` | 295 | KeyPEM string `json:"publicKeyPem"` |
| 242 | SHA string `json:"sha"` | 296 | SHA string `json:"sha"` |
| 243 | Type string `json:"type"` | 297 | Type string `json:"type"` |
| 244 | Tests []*wycheproofTestDSA `json:"tests"` | 298 | Tests []*wycheproofTestDSA `json:"tests"` |
| @@ -309,22 +363,38 @@ func (wt *wycheproofTestECDSA) String() string { | |||
| 309 | } | 363 | } |
| 310 | 364 | ||
| 311 | type wycheproofTestGroupECDSA struct { | 365 | type wycheproofTestGroupECDSA struct { |
| 312 | Key *wycheproofECDSAKey `json:"key"` | 366 | Key *wycheproofECDSAKey `json:"publicKey"` |
| 313 | KeyDER string `json:"keyDer"` | 367 | KeyDER string `json:"publicKeyDer"` |
| 314 | KeyPEM string `json:"keyPem"` | 368 | KeyPEM string `json:"publicKeyPem"` |
| 315 | SHA string `json:"sha"` | 369 | SHA string `json:"sha"` |
| 316 | Type string `json:"type"` | 370 | Type string `json:"type"` |
| 317 | Tests []*wycheproofTestECDSA `json:"tests"` | 371 | Tests []*wycheproofTestECDSA `json:"tests"` |
| 318 | } | 372 | } |
| 319 | 373 | ||
| 320 | type wycheproofTestGroupECDSAWebCrypto struct { | 374 | type wycheproofTestEcCurve struct { |
| 321 | JWK *wycheproofJWKPublic `json:"jwk"` | 375 | TCID int `json:"tcId"` |
| 322 | Key *wycheproofECDSAKey `json:"key"` | 376 | Comment string `json:"comment"` |
| 323 | KeyDER string `json:"keyDer"` | 377 | Flags []string `json:"flags"` |
| 324 | KeyPEM string `json:"keyPem"` | 378 | Name string `json:"name"` |
| 325 | SHA string `json:"sha"` | 379 | OID string `json:"oid"` |
| 326 | Type string `json:"type"` | 380 | Ref string `json:"ref"` |
| 327 | Tests []*wycheproofTestECDSA `json:"tests"` | 381 | P *BigInt `json:"p"` |
| 382 | N *BigInt `json:"n"` | ||
| 383 | A *BigInt `json:"a"` | ||
| 384 | B *BigInt `json:"b"` | ||
| 385 | Gx *BigInt `json:"gx"` | ||
| 386 | Gy *BigInt `json:"gy"` | ||
| 387 | H int `json:"h"` | ||
| 388 | Result string `json:"result"` | ||
| 389 | } | ||
| 390 | |||
| 391 | func (wt *wycheproofTestEcCurve) String() string { | ||
| 392 | return wycheproofFormatTestCase(wt.TCID, wt.Comment, wt.Flags, wt.Result) | ||
| 393 | } | ||
| 394 | |||
| 395 | type wycheproofTestGroupEcCurve struct { | ||
| 396 | Type string `json:"type"` | ||
| 397 | Tests []*wycheproofTestEcCurve `json:"tests"` | ||
| 328 | } | 398 | } |
| 329 | 399 | ||
| 330 | type wycheproofJWKEdDSA struct { | 400 | type wycheproofJWKEdDSA struct { |
| @@ -357,10 +427,10 @@ func (wt *wycheproofTestEdDSA) String() string { | |||
| 357 | } | 427 | } |
| 358 | 428 | ||
| 359 | type wycheproofTestGroupEdDSA struct { | 429 | type wycheproofTestGroupEdDSA struct { |
| 360 | JWK *wycheproofJWKEdDSA `json:"jwk"` | 430 | JWK *wycheproofJWKEdDSA `json:"publicKeyJwk"` |
| 361 | Key *wycheproofEdDSAKey `json:"key"` | 431 | Key *wycheproofEdDSAKey `json:"publicKey"` |
| 362 | KeyDer string `json:"keyDer"` | 432 | KeyDer string `json:"publicKeyDer"` |
| 363 | KeyPem string `json:"keyPem"` | 433 | KeyPem string `json:"publicKeyPem"` |
| 364 | Type string `json:"type"` | 434 | Type string `json:"type"` |
| 365 | Tests []*wycheproofTestEdDSA `json:"tests"` | 435 | Tests []*wycheproofTestEdDSA `json:"tests"` |
| 366 | } | 436 | } |
| @@ -428,10 +498,54 @@ type wycheproofTestGroupKW struct { | |||
| 428 | Tests []*wycheproofTestKW `json:"tests"` | 498 | Tests []*wycheproofTestKW `json:"tests"` |
| 429 | } | 499 | } |
| 430 | 500 | ||
| 501 | type wycheproofTestMLKEM struct { | ||
| 502 | TCID int `json:"tcId"` | ||
| 503 | Comment string `json:"comment"` | ||
| 504 | Seed string `json:"seed"` | ||
| 505 | Ek string `json:"ek"` | ||
| 506 | Dk string `json:"dk"` | ||
| 507 | M string `json:"m"` | ||
| 508 | C string `json:"c"` | ||
| 509 | K string `json:"K"` | ||
| 510 | Result string `json:"result"` | ||
| 511 | Flags []string `json:"flags"` | ||
| 512 | } | ||
| 513 | |||
| 514 | func (wt *wycheproofTestMLKEM) String() string { | ||
| 515 | return wycheproofFormatTestCase(wt.TCID, wt.Comment, wt.Flags, wt.Result) | ||
| 516 | } | ||
| 517 | |||
| 518 | type wycheproofTestGroupMLKEM struct { | ||
| 519 | Type string `json:"type"` | ||
| 520 | ParameterSet string `json:"parameterSet"` | ||
| 521 | Tests []*wycheproofTestMLKEM `json:"tests"` | ||
| 522 | } | ||
| 523 | |||
| 524 | type wycheproofTestPbkdf struct { | ||
| 525 | TCID int `json:"tcId"` | ||
| 526 | Comment string `json:"comment"` | ||
| 527 | Flags []string `json:"string"` | ||
| 528 | Password string `json:"password"` | ||
| 529 | Salt string `json:"salt"` | ||
| 530 | IterationCount int `json:"iterationCount"` | ||
| 531 | DkLen int `json:"dkLen"` | ||
| 532 | Dk string `json:"dk"` | ||
| 533 | Result string `json:"result"` | ||
| 534 | } | ||
| 535 | |||
| 536 | func (wt *wycheproofTestPbkdf) String() string { | ||
| 537 | return wycheproofFormatTestCase(wt.TCID, wt.Comment, wt.Flags, wt.Result) | ||
| 538 | } | ||
| 539 | |||
| 540 | type wycheproofTestGroupPbkdf2HmacSha struct { | ||
| 541 | Type string `json:"type"` | ||
| 542 | Tests []*wycheproofTestPbkdf `json:"tests"` | ||
| 543 | } | ||
| 544 | |||
| 431 | type wycheproofTestPrimality struct { | 545 | type wycheproofTestPrimality struct { |
| 432 | TCID int `json:"tcId"` | 546 | TCID int `json:"tcId"` |
| 433 | Comment string `json:"comment"` | 547 | Comment string `json:"comment"` |
| 434 | Value string `json:"value"` | 548 | Value *BigInt `json:"value"` |
| 435 | Result string `json:"result"` | 549 | Result string `json:"result"` |
| 436 | Flags []string `json:"flags"` | 550 | Flags []string `json:"flags"` |
| 437 | } | 551 | } |
| @@ -460,15 +574,31 @@ func (wt *wycheproofTestRSA) String() string { | |||
| 460 | } | 574 | } |
| 461 | 575 | ||
| 462 | type wycheproofTestGroupRSA struct { | 576 | type wycheproofTestGroupRSA struct { |
| 463 | E string `json:"e"` | 577 | PrivateKey *wycheproofRSAPrivateKey `json:"privateKey"` |
| 464 | KeyASN string `json:"keyAsn"` | 578 | PublicKey *wycheproofRSAPublicKey `json:"publicKey"` |
| 465 | KeyDER string `json:"keyDer"` | 579 | KeyASN string `json:"keyAsn"` |
| 466 | KeyPEM string `json:"keyPem"` | 580 | KeyDER string `json:"keyDer"` |
| 467 | KeySize int `json:"keysize"` | 581 | KeyPEM string `json:"keyPem"` |
| 468 | N string `json:"n"` | 582 | KeySize int `json:"keysize"` |
| 469 | SHA string `json:"sha"` | 583 | SHA string `json:"sha"` |
| 470 | Type string `json:"type"` | 584 | Type string `json:"type"` |
| 471 | Tests []*wycheproofTestRSA `json:"tests"` | 585 | Tests []*wycheproofTestRSA `json:"tests"` |
| 586 | } | ||
| 587 | |||
| 588 | type wycheproofRSAPublicKey struct { | ||
| 589 | Modulus string `json:"modulus"` | ||
| 590 | PublicExponent string `json:"publicExponent"` | ||
| 591 | } | ||
| 592 | |||
| 593 | type wycheproofRSAPrivateKey struct { | ||
| 594 | Modulus string `json:"modulus"` | ||
| 595 | PrivateExponent string `json:"privateExponent"` | ||
| 596 | PublicExponent string `json:"publicExponent"` | ||
| 597 | Prime1 string `json:"prime1"` | ||
| 598 | Prime2 string `json:"prime2"` | ||
| 599 | Exponent1 string `json:"exponent1"` | ||
| 600 | Exponent2 string `json:"exponent2"` | ||
| 601 | Coefficient string `json:"coefficient"` | ||
| 472 | } | 602 | } |
| 473 | 603 | ||
| 474 | type wycheproofPrivateKeyJwk struct { | 604 | type wycheproofPrivateKeyJwk struct { |
| @@ -500,29 +630,25 @@ func (wt *wycheproofTestRsaes) String() string { | |||
| 500 | } | 630 | } |
| 501 | 631 | ||
| 502 | type wycheproofTestGroupRsaesOaep struct { | 632 | type wycheproofTestGroupRsaesOaep struct { |
| 503 | D string `json:"d"` | 633 | Type string `json:"type"` |
| 504 | E string `json:"e"` | ||
| 505 | KeySize int `json:"keysize"` | 634 | KeySize int `json:"keysize"` |
| 635 | SHA string `json:"sha"` | ||
| 506 | MGF string `json:"mgf"` | 636 | MGF string `json:"mgf"` |
| 507 | MGFSHA string `json:"mgfSha"` | 637 | MGFSHA string `json:"mgfSha"` |
| 508 | N string `json:"n"` | 638 | PrivateKey *wycheproofRSAPrivateKey `json:"privateKey"` |
| 509 | PrivateKeyJwk *wycheproofPrivateKeyJwk `json:"privateKeyJwk"` | 639 | PrivateKeyJwk *wycheproofPrivateKeyJwk `json:"privateKeyJwk"` |
| 510 | PrivateKeyPem string `json:"privateKeyPem"` | 640 | PrivateKeyPem string `json:"privateKeyPem"` |
| 511 | PrivateKeyPkcs8 string `json:"privateKeyPkcs8"` | 641 | PrivateKeyPkcs8 string `json:"privateKeyPkcs8"` |
| 512 | SHA string `json:"sha"` | ||
| 513 | Type string `json:"type"` | ||
| 514 | Tests []*wycheproofTestRsaes `json:"tests"` | 642 | Tests []*wycheproofTestRsaes `json:"tests"` |
| 515 | } | 643 | } |
| 516 | 644 | ||
| 517 | type wycheproofTestGroupRsaesPkcs1 struct { | 645 | type wycheproofTestGroupRsaesPkcs1 struct { |
| 518 | D string `json:"d"` | 646 | Type string `json:"type"` |
| 519 | E string `json:"e"` | 647 | PrivateKey *wycheproofRSAPrivateKey `json:"privateKey"` |
| 520 | KeySize int `json:"keysize"` | ||
| 521 | N string `json:"n"` | ||
| 522 | PrivateKeyJwk *wycheproofPrivateKeyJwk `json:"privateKeyJwk"` | 648 | PrivateKeyJwk *wycheproofPrivateKeyJwk `json:"privateKeyJwk"` |
| 523 | PrivateKeyPem string `json:"privateKeyPem"` | 649 | PrivateKeyPem string `json:"privateKeyPem"` |
| 524 | PrivateKeyPkcs8 string `json:"privateKeyPkcs8"` | 650 | PrivateKeyPkcs8 string `json:"privateKeyPkcs8"` |
| 525 | Type string `json:"type"` | 651 | KeySize int `json:"keysize"` |
| 526 | Tests []*wycheproofTestRsaes `json:"tests"` | 652 | Tests []*wycheproofTestRsaes `json:"tests"` |
| 527 | } | 653 | } |
| 528 | 654 | ||
| @@ -540,18 +666,18 @@ func (wt *wycheproofTestRsassa) String() string { | |||
| 540 | } | 666 | } |
| 541 | 667 | ||
| 542 | type wycheproofTestGroupRsassa struct { | 668 | type wycheproofTestGroupRsassa struct { |
| 543 | E string `json:"e"` | 669 | PrivateKey *wycheproofRSAPrivateKey `json:"privateKey"` |
| 544 | KeyASN string `json:"keyAsn"` | 670 | PublicKey *wycheproofRSAPublicKey `json:"publicKey"` |
| 545 | KeyDER string `json:"keyDer"` | 671 | KeyASN string `json:"keyAsn"` |
| 546 | KeyPEM string `json:"keyPem"` | 672 | KeyDER string `json:"keyDer"` |
| 547 | KeySize int `json:"keysize"` | 673 | KeyPEM string `json:"keyPem"` |
| 548 | MGF string `json:"mgf"` | 674 | KeySize int `json:"keysize"` |
| 549 | MGFSHA string `json:"mgfSha"` | 675 | MGF string `json:"mgf"` |
| 550 | N string `json:"n"` | 676 | MGFSHA string `json:"mgfSha"` |
| 551 | SLen int `json:"sLen"` | 677 | SLen int `json:"sLen"` |
| 552 | SHA string `json:"sha"` | 678 | SHA string `json:"sha"` |
| 553 | Type string `json:"type"` | 679 | Type string `json:"type"` |
| 554 | Tests []*wycheproofTestRsassa `json:"tests"` | 680 | Tests []*wycheproofTestRsassa `json:"tests"` |
| 555 | } | 681 | } |
| 556 | 682 | ||
| 557 | type wycheproofTestX25519 struct { | 683 | type wycheproofTestX25519 struct { |
| @@ -578,13 +704,13 @@ type wycheproofTestGroupRunner interface { | |||
| 578 | run(string, testVariant) bool | 704 | run(string, testVariant) bool |
| 579 | } | 705 | } |
| 580 | 706 | ||
| 581 | type wycheproofTestVectors struct { | 707 | type wycheproofTestVectorsV1 struct { |
| 582 | Algorithm string `json:"algorithm"` | 708 | Algorithm string `json:"algorithm"` |
| 583 | GeneratorVersion string `json:"generatorVersion"` | 709 | Schema string `json:"schema"` |
| 584 | Notes map[string]string `json:"notes"` | 710 | NumberOfTests int `json:"numberOfTests"` |
| 585 | NumberOfTests int `json:"numberOfTests"` | 711 | Header []string `json:"header"` |
| 586 | // Header | 712 | Notes json.RawMessage `json:"notes"` |
| 587 | TestGroups []json.RawMessage `json:"testGroups"` | 713 | TestGroups []json.RawMessage `json:"testGroups"` |
| 588 | } | 714 | } |
| 589 | 715 | ||
| 590 | var nids = map[string]int{ | 716 | var nids = map[string]int{ |
| @@ -641,10 +767,16 @@ func nidFromString(ns string) (int, error) { | |||
| 641 | return -1, fmt.Errorf("unknown NID %q", ns) | 767 | return -1, fmt.Errorf("unknown NID %q", ns) |
| 642 | } | 768 | } |
| 643 | 769 | ||
| 644 | func skipSmallCurve(nid int) bool { | 770 | func skipHash(hash string) bool { |
| 771 | return hash == "SHAKE128" || hash == "SHAKE256" | ||
| 772 | } | ||
| 773 | |||
| 774 | func skipCurve(nid int) bool { | ||
| 645 | switch C.int(nid) { | 775 | switch C.int(nid) { |
| 646 | case C.NID_secp160k1, C.NID_secp160r1, C.NID_secp160r2, C.NID_secp192k1, C.NID_X9_62_prime192v1: | 776 | case C.NID_secp160k1, C.NID_secp160r1, C.NID_secp160r2, C.NID_secp192k1, C.NID_X9_62_prime192v1: |
| 647 | return true | 777 | return true |
| 778 | case C.NID_sect283k1, C.NID_sect283r1, C.NID_sect409k1, C.NID_sect409r1, C.NID_sect571k1, C.NID_sect571r1: | ||
| 779 | return true | ||
| 648 | } | 780 | } |
| 649 | return false | 781 | return false |
| 650 | } | 782 | } |
| @@ -661,6 +793,7 @@ var evpMds = map[string]*C.EVP_MD{ | |||
| 661 | "SHA3-256": C.EVP_sha3_256(), | 793 | "SHA3-256": C.EVP_sha3_256(), |
| 662 | "SHA3-384": C.EVP_sha3_384(), | 794 | "SHA3-384": C.EVP_sha3_384(), |
| 663 | "SHA3-512": C.EVP_sha3_512(), | 795 | "SHA3-512": C.EVP_sha3_512(), |
| 796 | "SM3": C.EVP_sm3(), | ||
| 664 | } | 797 | } |
| 665 | 798 | ||
| 666 | func hashEvpMdFromString(hs string) (*C.EVP_MD, error) { | 799 | func hashEvpMdFromString(hs string) (*C.EVP_MD, error) { |
| @@ -1266,7 +1399,7 @@ func runEvpChaCha20Poly1305Test(ctx *C.EVP_CIPHER_CTX, algorithm string, wt *wyc | |||
| 1266 | log.Fatal("Failed EVP_EncryptUpdate aad") | 1399 | log.Fatal("Failed EVP_EncryptUpdate aad") |
| 1267 | } | 1400 | } |
| 1268 | 1401 | ||
| 1269 | sealed := make([]byte, ctLen + tagLen) | 1402 | sealed := make([]byte, ctLen+tagLen) |
| 1270 | copy(sealed, msg) | 1403 | copy(sealed, msg) |
| 1271 | if C.EVP_EncryptUpdate(ctx, (*C.uchar)(unsafe.Pointer(&sealed[0])), (*C.int)(unsafe.Pointer(&len)), (*C.uchar)(unsafe.Pointer(&sealed[0])), (C.int)(msgLen)) != 1 { | 1404 | if C.EVP_EncryptUpdate(ctx, (*C.uchar)(unsafe.Pointer(&sealed[0])), (*C.int)(unsafe.Pointer(&len)), (*C.uchar)(unsafe.Pointer(&sealed[0])), (C.int)(msgLen)) != 1 { |
| 1272 | log.Fatal("Failed EVP_EncryptUpdate msg") | 1405 | log.Fatal("Failed EVP_EncryptUpdate msg") |
| @@ -1281,7 +1414,7 @@ func runEvpChaCha20Poly1305Test(ctx *C.EVP_CIPHER_CTX, algorithm string, wt *wyc | |||
| 1281 | } | 1414 | } |
| 1282 | outLen += (C.int)(tagLen) | 1415 | outLen += (C.int)(tagLen) |
| 1283 | 1416 | ||
| 1284 | if (C.int)(ctLen + tagLen) != outLen { | 1417 | if (C.int)(ctLen+tagLen) != outLen { |
| 1285 | fmt.Printf("%s\n", wt) | 1418 | fmt.Printf("%s\n", wt) |
| 1286 | } | 1419 | } |
| 1287 | 1420 | ||
| @@ -1290,7 +1423,7 @@ func runEvpChaCha20Poly1305Test(ctx *C.EVP_CIPHER_CTX, algorithm string, wt *wyc | |||
| 1290 | tagMatch := bytes.Equal(tag, sealed[ctLen:]) | 1423 | tagMatch := bytes.Equal(tag, sealed[ctLen:]) |
| 1291 | if (ctMatch && tagMatch) == (wt.Result != "invalid") { | 1424 | if (ctMatch && tagMatch) == (wt.Result != "invalid") { |
| 1292 | sealSuccess = true | 1425 | sealSuccess = true |
| 1293 | } else { | 1426 | } else { |
| 1294 | fmt.Printf("%s - ct match: %t tag match: %t\n", wt, ctMatch, tagMatch) | 1427 | fmt.Printf("%s - ct match: %t tag match: %t\n", wt, ctMatch, tagMatch) |
| 1295 | } | 1428 | } |
| 1296 | 1429 | ||
| @@ -1316,9 +1449,9 @@ func runEvpChaCha20Poly1305Test(ctx *C.EVP_CIPHER_CTX, algorithm string, wt *wyc | |||
| 1316 | ct = append(ct, 0) | 1449 | ct = append(ct, 0) |
| 1317 | } | 1450 | } |
| 1318 | 1451 | ||
| 1319 | opened := make([]byte, msgLen + tagLen) | 1452 | opened := make([]byte, msgLen+tagLen) |
| 1320 | copy(opened, ct) | 1453 | copy(opened, ct) |
| 1321 | if msgLen + aadLen == 0 { | 1454 | if msgLen+aadLen == 0 { |
| 1322 | opened = append(opened, 0) | 1455 | opened = append(opened, 0) |
| 1323 | } | 1456 | } |
| 1324 | 1457 | ||
| @@ -1622,7 +1755,7 @@ func runECDHTest(nid int, variant testVariant, wt *wycheproofTestECDH) bool { | |||
| 1622 | 1755 | ||
| 1623 | shared, sharedLen := mustDecodeHexString(wt.Shared, "shared secret") | 1756 | shared, sharedLen := mustDecodeHexString(wt.Shared, "shared secret") |
| 1624 | 1757 | ||
| 1625 | // XXX The shared fields of the secp224k1 test cases have a 0 byte preprended. | 1758 | // XXX The shared fields of the secp224k1 test cases have a 0 byte prepended. |
| 1626 | if sharedLen == int(secLen)+1 && shared[0] == 0 { | 1759 | if sharedLen == int(secLen)+1 && shared[0] == 0 { |
| 1627 | fmt.Printf("INFO: %s - prepending 0 byte.\n", wt) | 1760 | fmt.Printf("INFO: %s - prepending 0 byte.\n", wt) |
| 1628 | // shared = shared[1:]; | 1761 | // shared = shared[1:]; |
| @@ -1645,7 +1778,7 @@ func (wtg *wycheproofTestGroupECDH) run(algorithm string, variant testVariant) b | |||
| 1645 | if err != nil { | 1778 | if err != nil { |
| 1646 | log.Fatalf("Failed to get nid for curve: %v", err) | 1779 | log.Fatalf("Failed to get nid for curve: %v", err) |
| 1647 | } | 1780 | } |
| 1648 | if skipSmallCurve(nid) { | 1781 | if skipCurve(nid) { |
| 1649 | return true | 1782 | return true |
| 1650 | } | 1783 | } |
| 1651 | 1784 | ||
| @@ -1766,7 +1899,16 @@ func runECDSATest(ecKey *C.EC_KEY, md *C.EVP_MD, nid int, variant testVariant, w | |||
| 1766 | msg, msgLen := mustHashHexMessage(md, wt.Msg) | 1899 | msg, msgLen := mustHashHexMessage(md, wt.Msg) |
| 1767 | 1900 | ||
| 1768 | var ret C.int | 1901 | var ret C.int |
| 1769 | if variant == Webcrypto || variant == P1363 { | 1902 | if variant == P1363 { |
| 1903 | order_bytes := int((C.EC_GROUP_order_bits(C.EC_KEY_get0_group(ecKey)) + 7) / 8) | ||
| 1904 | if len(wt.Sig)/2 != 2*order_bytes { | ||
| 1905 | if wt.Result == "valid" { | ||
| 1906 | fmt.Printf("FAIL: %s - incorrect signature length, %d, %d\n", wt, len(wt.Sig)/2, 2*order_bytes) | ||
| 1907 | return false | ||
| 1908 | } | ||
| 1909 | return true | ||
| 1910 | } | ||
| 1911 | |||
| 1770 | cDer, derLen := encodeECDSAWebCryptoSig(wt.Sig) | 1912 | cDer, derLen := encodeECDSAWebCryptoSig(wt.Sig) |
| 1771 | if cDer == nil { | 1913 | if cDer == nil { |
| 1772 | fmt.Print("FAIL: unable to decode signature") | 1914 | fmt.Print("FAIL: unable to decode signature") |
| @@ -1797,7 +1939,10 @@ func (wtg *wycheproofTestGroupECDSA) run(algorithm string, variant testVariant) | |||
| 1797 | if err != nil { | 1939 | if err != nil { |
| 1798 | log.Fatalf("Failed to get nid for curve: %v", err) | 1940 | log.Fatalf("Failed to get nid for curve: %v", err) |
| 1799 | } | 1941 | } |
| 1800 | if skipSmallCurve(nid) { | 1942 | if skipCurve(nid) { |
| 1943 | return true | ||
| 1944 | } | ||
| 1945 | if skipHash(wtg.SHA) { | ||
| 1801 | return true | 1946 | return true |
| 1802 | } | 1947 | } |
| 1803 | ecKey := C.EC_KEY_new_by_curve_name(C.int(nid)) | 1948 | ecKey := C.EC_KEY_new_by_curve_name(C.int(nid)) |
| @@ -1892,55 +2037,73 @@ func encodeECDSAWebCryptoSig(wtSig string) (*C.uchar, C.int) { | |||
| 1892 | return cDer, derLen | 2037 | return cDer, derLen |
| 1893 | } | 2038 | } |
| 1894 | 2039 | ||
| 1895 | func (wtg *wycheproofTestGroupECDSAWebCrypto) run(algorithm string, variant testVariant) bool { | 2040 | func runEcCurveTest(wt *wycheproofTestEcCurve) bool { |
| 1896 | fmt.Printf("Running %v test group %v with curve %v, key size %d and %v...\n", algorithm, wtg.Type, wtg.Key.Curve, wtg.Key.KeySize, wtg.SHA) | 2041 | oid := C.CString(wt.OID) |
| 2042 | defer C.free(unsafe.Pointer(oid)) | ||
| 1897 | 2043 | ||
| 1898 | nid, err := nidFromString(wtg.JWK.Crv) | 2044 | nid := C.OBJ_txt2nid(oid) |
| 1899 | if err != nil { | 2045 | if nid == C.NID_undef { |
| 1900 | log.Fatalf("Failed to get nid for curve: %v", err) | 2046 | fmt.Printf("INFO: %s: %s: unknown OID %s\n", wt, wt.Name, wt.OID) |
| 1901 | } | 2047 | return false |
| 1902 | ecKey := C.EC_KEY_new_by_curve_name(C.int(nid)) | ||
| 1903 | if ecKey == nil { | ||
| 1904 | log.Fatal("EC_KEY_new_by_curve_name failed") | ||
| 1905 | } | 2048 | } |
| 1906 | defer C.EC_KEY_free(ecKey) | ||
| 1907 | 2049 | ||
| 1908 | x, err := base64.RawURLEncoding.DecodeString(wtg.JWK.X) | 2050 | builtinGroup := C.EC_GROUP_new_by_curve_name(nid) |
| 1909 | if err != nil { | 2051 | defer C.EC_GROUP_free(builtinGroup) |
| 1910 | log.Fatalf("Failed to base64 decode X: %v", err) | 2052 | |
| 1911 | } | 2053 | if builtinGroup == nil { |
| 1912 | bnX := C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&x[0])), C.int(len(x)), nil) | 2054 | fmt.Printf("INFO: %s: %s: no builtin curve for OID %s\n", wt, wt.Name, wt.OID) |
| 1913 | if bnX == nil { | 2055 | return true |
| 1914 | log.Fatal("Failed to decode X") | ||
| 1915 | } | 2056 | } |
| 1916 | defer C.BN_free(bnX) | ||
| 1917 | 2057 | ||
| 1918 | y, err := base64.RawURLEncoding.DecodeString(wtg.JWK.Y) | 2058 | p := mustConvertBigIntToBigNum(wt.P) |
| 1919 | if err != nil { | 2059 | defer C.BN_free(p) |
| 1920 | log.Fatalf("Failed to base64 decode Y: %v", err) | 2060 | a := mustConvertBigIntToBigNum(wt.A) |
| 2061 | defer C.BN_free(a) | ||
| 2062 | b := mustConvertBigIntToBigNum(wt.B) | ||
| 2063 | defer C.BN_free(b) | ||
| 2064 | n := mustConvertBigIntToBigNum(wt.N) | ||
| 2065 | defer C.BN_free(n) | ||
| 2066 | x := mustConvertBigIntToBigNum(wt.Gx) | ||
| 2067 | defer C.BN_free(x) | ||
| 2068 | y := mustConvertBigIntToBigNum(wt.Gy) | ||
| 2069 | defer C.BN_free(y) | ||
| 2070 | |||
| 2071 | group := C.EC_GROUP_new_curve_GFp(p, a, b, (*C.BN_CTX)(nil)) | ||
| 2072 | defer C.EC_GROUP_free(group) | ||
| 2073 | |||
| 2074 | if group == nil { | ||
| 2075 | log.Fatalf("EC_GROUP_new_curve_GFp failed") | ||
| 1921 | } | 2076 | } |
| 1922 | bnY := C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&y[0])), C.int(len(y)), nil) | 2077 | |
| 1923 | if bnY == nil { | 2078 | point := C.EC_POINT_new(group) |
| 1924 | log.Fatal("Failed to decode Y") | 2079 | defer C.EC_POINT_free(point) |
| 2080 | |||
| 2081 | if point == nil { | ||
| 2082 | log.Fatalf("EC_POINT_new failed") | ||
| 1925 | } | 2083 | } |
| 1926 | defer C.BN_free(bnY) | ||
| 1927 | 2084 | ||
| 1928 | if C.EC_KEY_set_public_key_affine_coordinates(ecKey, bnX, bnY) != 1 { | 2085 | if C.EC_POINT_set_affine_coordinates(group, point, x, y, (*C.BN_CTX)(nil)) == 0 { |
| 1929 | log.Fatal("Failed to set EC public key") | 2086 | log.Fatalf("EC_POINT_set_affine_coordinates failed") |
| 1930 | } | 2087 | } |
| 1931 | 2088 | ||
| 1932 | nid, err = nidFromString(wtg.SHA) | 2089 | if C.EC_GROUP_set_generator(group, point, n, (*C.BIGNUM)(nil)) == 0 { |
| 1933 | if err != nil { | 2090 | log.Fatalf("EC_POINT_set_generator failed") |
| 1934 | log.Fatalf("Failed to get MD NID: %v", err) | ||
| 1935 | } | 2091 | } |
| 1936 | md, err := hashEvpMdFromString(wtg.SHA) | 2092 | |
| 1937 | if err != nil { | 2093 | success := true |
| 1938 | log.Fatalf("Failed to get hash: %v", err) | 2094 | if C.EC_GROUP_cmp(group, builtinGroup, (*C.BN_CTX)(nil)) != 0 { |
| 2095 | fmt.Printf("FAIL: %s %s builtin curve has wrong parameters\n", wt, wt.Name) | ||
| 2096 | success = false | ||
| 1939 | } | 2097 | } |
| 2098 | return success | ||
| 2099 | } | ||
| 2100 | |||
| 2101 | func (wtg *wycheproofTestGroupEcCurve) run(algorithm string, variant testVariant) bool { | ||
| 2102 | fmt.Printf("Running %v test group %v...\n", algorithm, wtg.Type) | ||
| 1940 | 2103 | ||
| 1941 | success := true | 2104 | success := true |
| 1942 | for _, wt := range wtg.Tests { | 2105 | for _, wt := range wtg.Tests { |
| 1943 | if !runECDSATest(ecKey, md, nid, Webcrypto, wt) { | 2106 | if !runEcCurveTest(wt) { |
| 1944 | success = false | 2107 | success = false |
| 1945 | } | 2108 | } |
| 1946 | } | 2109 | } |
| @@ -1972,11 +2135,11 @@ func runEdDSATest(pkey *C.EVP_PKEY, wt *wycheproofTestEdDSA) bool { | |||
| 1972 | } | 2135 | } |
| 1973 | 2136 | ||
| 1974 | func (wtg *wycheproofTestGroupEdDSA) run(algorithm string, variant testVariant) bool { | 2137 | func (wtg *wycheproofTestGroupEdDSA) run(algorithm string, variant testVariant) bool { |
| 1975 | fmt.Printf("Running %v test group %v...\n", algorithm, wtg.Type) | 2138 | if wtg.Key.Curve == "edwards25519" { |
| 1976 | 2139 | fmt.Printf("Running %v test group %v...\n", algorithm, wtg.Type) | |
| 1977 | if wtg.Key.Curve != "edwards25519" || wtg.Key.KeySize != 255 { | 2140 | } else { |
| 1978 | fmt.Printf("INFO: Unexpected curve or key size. want (\"edwards25519\", 255), got (%q, %d)\n", wtg.Key.Curve, wtg.Key.KeySize) | 2141 | fmt.Printf("INFO: Skipping %v test group %v for %v...\n", algorithm, wtg.Type, wtg.Key.Curve) |
| 1979 | return false | 2142 | return true |
| 1980 | } | 2143 | } |
| 1981 | 2144 | ||
| 1982 | pubKey, pubKeyLen := mustDecodeHexString(wtg.Key.Pk, "pubkey") | 2145 | pubKey, pubKeyLen := mustDecodeHexString(wtg.Key.Pk, "pubkey") |
| @@ -2110,6 +2273,10 @@ func (wtg *wycheproofTestGroupHmac) run(algorithm string, variant testVariant) b | |||
| 2110 | if strings.HasPrefix(algorithm, "HMACSHA3-") { | 2273 | if strings.HasPrefix(algorithm, "HMACSHA3-") { |
| 2111 | prefix = "SHA" | 2274 | prefix = "SHA" |
| 2112 | } | 2275 | } |
| 2276 | if algorithm == "HMACSM3" { | ||
| 2277 | prefix = "" | ||
| 2278 | algorithm = "SM3" | ||
| 2279 | } | ||
| 2113 | md, err := hashEvpMdFromString(prefix + strings.TrimPrefix(algorithm, "HMACSHA")) | 2280 | md, err := hashEvpMdFromString(prefix + strings.TrimPrefix(algorithm, "HMACSHA")) |
| 2114 | if err != nil { | 2281 | if err != nil { |
| 2115 | log.Fatalf("Failed to get hash: %v", err) | 2282 | log.Fatalf("Failed to get hash: %v", err) |
| @@ -2204,13 +2371,163 @@ func (wtg *wycheproofTestGroupKW) run(algorithm string, variant testVariant) boo | |||
| 2204 | return success | 2371 | return success |
| 2205 | } | 2372 | } |
| 2206 | 2373 | ||
| 2207 | func runPrimalityTest(wt *wycheproofTestPrimality) bool { | 2374 | func runMLKEMTestGroup(rank C.int, wt *wycheproofTestMLKEM) bool { |
| 2208 | var bnValue *C.BIGNUM | 2375 | privKey := C.MLKEM_private_key_new(rank) |
| 2209 | value := C.CString(wt.Value) | 2376 | defer C.MLKEM_private_key_free(privKey) |
| 2210 | if C.BN_hex2bn(&bnValue, value) == 0 { | 2377 | if privKey == nil { |
| 2211 | log.Fatal("Failed to set bnValue") | 2378 | log.Fatal("MLKEM_private_key_new failed") |
| 2212 | } | 2379 | } |
| 2213 | C.free(unsafe.Pointer(value)) | 2380 | pubKey := C.MLKEM_public_key_new(rank) |
| 2381 | defer C.MLKEM_public_key_free(pubKey) | ||
| 2382 | if pubKey == nil { | ||
| 2383 | log.Fatal("MLKEM_public_key_new failed") | ||
| 2384 | } | ||
| 2385 | |||
| 2386 | seed, seedLen := mustDecodeHexString(wt.Seed, "seed") | ||
| 2387 | ek, _ := mustDecodeHexString(wt.Ek, "ek") | ||
| 2388 | |||
| 2389 | if C.MLKEM_private_key_from_seed(privKey, (*C.uchar)(unsafe.Pointer(&seed[0])), C.size_t(seedLen)) != 1 { | ||
| 2390 | fmt.Printf("%s - MLKEM_private_key_from_seed failed\n", wt) | ||
| 2391 | return false | ||
| 2392 | } | ||
| 2393 | |||
| 2394 | if C.MLKEM_public_from_private(privKey, pubKey) != 1 { | ||
| 2395 | fmt.Printf("%s - MLKEM_public_from_private failed\n", wt) | ||
| 2396 | return false | ||
| 2397 | } | ||
| 2398 | |||
| 2399 | var marshalledPubKey *C.uchar | ||
| 2400 | var marshalledPubKeyLen C.size_t | ||
| 2401 | defer C.free(unsafe.Pointer(marshalledPubKey)) | ||
| 2402 | if C.MLKEM_marshal_public_key(pubKey, (**C.uchar)(unsafe.Pointer(&marshalledPubKey)), (*C.size_t)(unsafe.Pointer(&marshalledPubKeyLen))) != 1 { | ||
| 2403 | fmt.Printf("%s - MLKEM_marshal_private_key failed\n", wt) | ||
| 2404 | return false | ||
| 2405 | } | ||
| 2406 | gotEk := unsafe.Slice((*byte)(unsafe.Pointer(marshalledPubKey)), marshalledPubKeyLen) | ||
| 2407 | |||
| 2408 | if !bytes.Equal(ek, gotEk) { | ||
| 2409 | fmt.Printf("FAIL: %s marshalledPubKey mismatch\n", wt) | ||
| 2410 | return false | ||
| 2411 | } | ||
| 2412 | |||
| 2413 | c, cLen := mustDecodeHexString(wt.C, "c") | ||
| 2414 | |||
| 2415 | var sharedSecret *C.uchar | ||
| 2416 | var sharedSecretLen C.size_t | ||
| 2417 | defer C.free(unsafe.Pointer(sharedSecret)) | ||
| 2418 | if C.MLKEM_decap(privKey, (*C.uchar)(unsafe.Pointer(&c[0])), C.size_t(cLen), (**C.uchar)(unsafe.Pointer(&sharedSecret)), (*C.size_t)(unsafe.Pointer(&sharedSecretLen))) != 1 { | ||
| 2419 | fmt.Printf("%s - MLKEM_decap failed\n", wt) | ||
| 2420 | return false | ||
| 2421 | } | ||
| 2422 | gotK := unsafe.Slice((*byte)(unsafe.Pointer(sharedSecret)), sharedSecretLen) | ||
| 2423 | |||
| 2424 | k, _ := mustDecodeHexString(wt.K, "K") | ||
| 2425 | |||
| 2426 | if !bytes.Equal(k, gotK) { | ||
| 2427 | fmt.Printf("FAIL: %s sharedSecret mismatch\n", wt) | ||
| 2428 | return false | ||
| 2429 | } | ||
| 2430 | |||
| 2431 | return true | ||
| 2432 | } | ||
| 2433 | |||
| 2434 | func runMLKEMEncapsTestGroup(rank C.int, wt *wycheproofTestMLKEM) bool { | ||
| 2435 | pubKey := C.MLKEM_public_key_new(rank) | ||
| 2436 | defer C.MLKEM_public_key_free(pubKey) | ||
| 2437 | if pubKey == nil { | ||
| 2438 | log.Fatal("MLKEM_public_key_new failed") | ||
| 2439 | } | ||
| 2440 | |||
| 2441 | ek, ekLen := mustDecodeHexString(wt.C, "eK") | ||
| 2442 | |||
| 2443 | if C.MLKEM_parse_public_key(pubKey, (*C.uchar)(unsafe.Pointer(&ek[0])), (C.size_t)(ekLen)) != 0 || wt.Result != "invalid" { | ||
| 2444 | fmt.Printf("FAIL: %s MLKEM_parse_public_key succeeded\n", wt) | ||
| 2445 | return false | ||
| 2446 | } | ||
| 2447 | |||
| 2448 | return true | ||
| 2449 | } | ||
| 2450 | |||
| 2451 | func runMLKEMDecapsValidationTest(rank C.int, wt *wycheproofTestMLKEM) bool { | ||
| 2452 | return true | ||
| 2453 | } | ||
| 2454 | |||
| 2455 | func (wtg *wycheproofTestGroupMLKEM) run(algorithm string, variant testVariant) bool { | ||
| 2456 | var rank C.int | ||
| 2457 | |||
| 2458 | switch wtg.ParameterSet { | ||
| 2459 | case "ML-KEM-512": | ||
| 2460 | fmt.Printf("INFO: skipping %v test group of type %v for %s\n", algorithm, wtg.Type, wtg.ParameterSet) | ||
| 2461 | return true | ||
| 2462 | case "ML-KEM-768": | ||
| 2463 | rank = C.MLKEM768_RANK | ||
| 2464 | case "ML-KEM-1024": | ||
| 2465 | rank = C.MLKEM1024_RANK | ||
| 2466 | default: | ||
| 2467 | log.Fatalf("Unknown ML-KEM parameterSet %v", wtg.ParameterSet) | ||
| 2468 | } | ||
| 2469 | fmt.Printf("Running %v test group of type %v\n", algorithm, wtg.Type) | ||
| 2470 | |||
| 2471 | type MLKEMTestFunc func(C.int, *wycheproofTestMLKEM) bool | ||
| 2472 | var runTest MLKEMTestFunc | ||
| 2473 | |||
| 2474 | switch wtg.Type { | ||
| 2475 | case "MLKEMTest": | ||
| 2476 | runTest = runMLKEMTestGroup | ||
| 2477 | case "MLKEMEncapsTest": | ||
| 2478 | runTest = runMLKEMEncapsTestGroup | ||
| 2479 | case "MLKEMDecapsValidationTest": | ||
| 2480 | runTest = runMLKEMDecapsValidationTest | ||
| 2481 | default: | ||
| 2482 | log.Fatalf("Unknown ML-KEM test type %v", wtg.Type) | ||
| 2483 | } | ||
| 2484 | |||
| 2485 | success := true | ||
| 2486 | for _, wt := range wtg.Tests { | ||
| 2487 | if !runTest(rank, wt) { | ||
| 2488 | success = false | ||
| 2489 | } | ||
| 2490 | } | ||
| 2491 | return success | ||
| 2492 | } | ||
| 2493 | |||
| 2494 | func runPbkdfTest(md *C.EVP_MD, wt *wycheproofTestPbkdf) bool { | ||
| 2495 | pw, pwLen := mustDecodeHexString(wt.Password, "password") | ||
| 2496 | salt, saltLen := mustDecodeHexString(wt.Salt, "salt") | ||
| 2497 | dk, _ := mustDecodeHexString(wt.Dk, "dk") | ||
| 2498 | |||
| 2499 | out := make([]byte, wt.DkLen) | ||
| 2500 | |||
| 2501 | ret := C.PKCS5_PBKDF2_HMAC((*C.char)(unsafe.Pointer(&pw[0])), C.int(pwLen), (*C.uchar)(unsafe.Pointer(&salt[0])), C.int(saltLen), C.int(wt.IterationCount), md, C.int(wt.DkLen), (*C.uchar)(unsafe.Pointer(&out[0]))) | ||
| 2502 | |||
| 2503 | success := true | ||
| 2504 | if ret != 1 || !bytes.Equal(dk, out) || wt.Result != "valid" { | ||
| 2505 | fmt.Printf("%s - %d\n", wt, int(ret)) | ||
| 2506 | success = false | ||
| 2507 | } | ||
| 2508 | |||
| 2509 | return success | ||
| 2510 | } | ||
| 2511 | |||
| 2512 | func (wtg *wycheproofTestGroupPbkdf2HmacSha) run(algorithm string, variant testVariant) bool { | ||
| 2513 | fmt.Printf("Running %v test group of type %v...\n", algorithm, wtg.Type) | ||
| 2514 | |||
| 2515 | md, err := hashEvpMdFromString("SHA-" + strings.TrimPrefix(algorithm, "PBKDF2-HMACSHA")) | ||
| 2516 | if err != nil { | ||
| 2517 | log.Fatalf("Failed to get hash: %v", err) | ||
| 2518 | } | ||
| 2519 | |||
| 2520 | success := true | ||
| 2521 | for _, wt := range wtg.Tests { | ||
| 2522 | if !runPbkdfTest(md, wt) { | ||
| 2523 | success = false | ||
| 2524 | } | ||
| 2525 | } | ||
| 2526 | return success | ||
| 2527 | } | ||
| 2528 | |||
| 2529 | func runPrimalityTest(wt *wycheproofTestPrimality) bool { | ||
| 2530 | bnValue := mustConvertBigIntToBigNum(wt.Value) | ||
| 2214 | defer C.BN_free(bnValue) | 2531 | defer C.BN_free(bnValue) |
| 2215 | 2532 | ||
| 2216 | ret := C.BN_is_prime_ex(bnValue, C.BN_prime_checks, (*C.BN_CTX)(unsafe.Pointer(nil)), (*C.BN_GENCB)(unsafe.Pointer(nil))) | 2533 | ret := C.BN_is_prime_ex(bnValue, C.BN_prime_checks, (*C.BN_CTX)(unsafe.Pointer(nil)), (*C.BN_GENCB)(unsafe.Pointer(nil))) |
| @@ -2280,13 +2597,17 @@ func runRsaesOaepTest(rsa *C.RSA, sha *C.EVP_MD, mgfSha *C.EVP_MD, wt *wycheproo | |||
| 2280 | func (wtg *wycheproofTestGroupRsaesOaep) run(algorithm string, variant testVariant) bool { | 2597 | func (wtg *wycheproofTestGroupRsaesOaep) run(algorithm string, variant testVariant) bool { |
| 2281 | fmt.Printf("Running %v test group %v with key size %d MGF %v and %v...\n", algorithm, wtg.Type, wtg.KeySize, wtg.MGFSHA, wtg.SHA) | 2598 | fmt.Printf("Running %v test group %v with key size %d MGF %v and %v...\n", algorithm, wtg.Type, wtg.KeySize, wtg.MGFSHA, wtg.SHA) |
| 2282 | 2599 | ||
| 2600 | if skipHash(wtg.SHA) { | ||
| 2601 | return true | ||
| 2602 | } | ||
| 2603 | |||
| 2283 | rsa := C.RSA_new() | 2604 | rsa := C.RSA_new() |
| 2284 | if rsa == nil { | 2605 | if rsa == nil { |
| 2285 | log.Fatal("RSA_new failed") | 2606 | log.Fatal("RSA_new failed") |
| 2286 | } | 2607 | } |
| 2287 | defer C.RSA_free(rsa) | 2608 | defer C.RSA_free(rsa) |
| 2288 | 2609 | ||
| 2289 | d := C.CString(wtg.D) | 2610 | d := C.CString(wtg.PrivateKey.PrivateExponent) |
| 2290 | var rsaD *C.BIGNUM | 2611 | var rsaD *C.BIGNUM |
| 2291 | defer C.BN_free(rsaD) | 2612 | defer C.BN_free(rsaD) |
| 2292 | if C.BN_hex2bn(&rsaD, d) == 0 { | 2613 | if C.BN_hex2bn(&rsaD, d) == 0 { |
| @@ -2294,7 +2615,7 @@ func (wtg *wycheproofTestGroupRsaesOaep) run(algorithm string, variant testVaria | |||
| 2294 | } | 2615 | } |
| 2295 | C.free(unsafe.Pointer(d)) | 2616 | C.free(unsafe.Pointer(d)) |
| 2296 | 2617 | ||
| 2297 | e := C.CString(wtg.E) | 2618 | e := C.CString(wtg.PrivateKey.PublicExponent) |
| 2298 | var rsaE *C.BIGNUM | 2619 | var rsaE *C.BIGNUM |
| 2299 | defer C.BN_free(rsaE) | 2620 | defer C.BN_free(rsaE) |
| 2300 | if C.BN_hex2bn(&rsaE, e) == 0 { | 2621 | if C.BN_hex2bn(&rsaE, e) == 0 { |
| @@ -2302,7 +2623,7 @@ func (wtg *wycheproofTestGroupRsaesOaep) run(algorithm string, variant testVaria | |||
| 2302 | } | 2623 | } |
| 2303 | C.free(unsafe.Pointer(e)) | 2624 | C.free(unsafe.Pointer(e)) |
| 2304 | 2625 | ||
| 2305 | n := C.CString(wtg.N) | 2626 | n := C.CString(wtg.PrivateKey.Modulus) |
| 2306 | var rsaN *C.BIGNUM | 2627 | var rsaN *C.BIGNUM |
| 2307 | defer C.BN_free(rsaN) | 2628 | defer C.BN_free(rsaN) |
| 2308 | if C.BN_hex2bn(&rsaN, n) == 0 { | 2629 | if C.BN_hex2bn(&rsaN, n) == 0 { |
| @@ -2376,7 +2697,7 @@ func (wtg *wycheproofTestGroupRsaesPkcs1) run(algorithm string, variant testVari | |||
| 2376 | } | 2697 | } |
| 2377 | defer C.RSA_free(rsa) | 2698 | defer C.RSA_free(rsa) |
| 2378 | 2699 | ||
| 2379 | d := C.CString(wtg.D) | 2700 | d := C.CString(wtg.PrivateKey.PrivateExponent) |
| 2380 | var rsaD *C.BIGNUM | 2701 | var rsaD *C.BIGNUM |
| 2381 | defer C.BN_free(rsaD) | 2702 | defer C.BN_free(rsaD) |
| 2382 | if C.BN_hex2bn(&rsaD, d) == 0 { | 2703 | if C.BN_hex2bn(&rsaD, d) == 0 { |
| @@ -2384,7 +2705,7 @@ func (wtg *wycheproofTestGroupRsaesPkcs1) run(algorithm string, variant testVari | |||
| 2384 | } | 2705 | } |
| 2385 | C.free(unsafe.Pointer(d)) | 2706 | C.free(unsafe.Pointer(d)) |
| 2386 | 2707 | ||
| 2387 | e := C.CString(wtg.E) | 2708 | e := C.CString(wtg.PrivateKey.PublicExponent) |
| 2388 | var rsaE *C.BIGNUM | 2709 | var rsaE *C.BIGNUM |
| 2389 | defer C.BN_free(rsaE) | 2710 | defer C.BN_free(rsaE) |
| 2390 | if C.BN_hex2bn(&rsaE, e) == 0 { | 2711 | if C.BN_hex2bn(&rsaE, e) == 0 { |
| @@ -2392,7 +2713,7 @@ func (wtg *wycheproofTestGroupRsaesPkcs1) run(algorithm string, variant testVari | |||
| 2392 | } | 2713 | } |
| 2393 | C.free(unsafe.Pointer(e)) | 2714 | C.free(unsafe.Pointer(e)) |
| 2394 | 2715 | ||
| 2395 | n := C.CString(wtg.N) | 2716 | n := C.CString(wtg.PrivateKey.Modulus) |
| 2396 | var rsaN *C.BIGNUM | 2717 | var rsaN *C.BIGNUM |
| 2397 | defer C.BN_free(rsaN) | 2718 | defer C.BN_free(rsaN) |
| 2398 | if C.BN_hex2bn(&rsaN, n) == 0 { | 2719 | if C.BN_hex2bn(&rsaN, n) == 0 { |
| @@ -2451,13 +2772,30 @@ func runRsassaTest(rsa *C.RSA, sha *C.EVP_MD, mgfSha *C.EVP_MD, sLen int, wt *wy | |||
| 2451 | 2772 | ||
| 2452 | func (wtg *wycheproofTestGroupRsassa) run(algorithm string, variant testVariant) bool { | 2773 | func (wtg *wycheproofTestGroupRsassa) run(algorithm string, variant testVariant) bool { |
| 2453 | fmt.Printf("Running %v test group %v with key size %d and %v...\n", algorithm, wtg.Type, wtg.KeySize, wtg.SHA) | 2774 | fmt.Printf("Running %v test group %v with key size %d and %v...\n", algorithm, wtg.Type, wtg.KeySize, wtg.SHA) |
| 2775 | |||
| 2776 | if skipHash(wtg.SHA) { | ||
| 2777 | return true | ||
| 2778 | } | ||
| 2779 | |||
| 2454 | rsa := C.RSA_new() | 2780 | rsa := C.RSA_new() |
| 2455 | if rsa == nil { | 2781 | if rsa == nil { |
| 2456 | log.Fatal("RSA_new failed") | 2782 | log.Fatal("RSA_new failed") |
| 2457 | } | 2783 | } |
| 2458 | defer C.RSA_free(rsa) | 2784 | defer C.RSA_free(rsa) |
| 2459 | 2785 | ||
| 2460 | e := C.CString(wtg.E) | 2786 | var publicExponent, modulus string |
| 2787 | if wtg.PublicKey != nil { | ||
| 2788 | publicExponent = wtg.PublicKey.PublicExponent | ||
| 2789 | modulus = wtg.PublicKey.Modulus | ||
| 2790 | } else if wtg.PrivateKey != nil { | ||
| 2791 | publicExponent = wtg.PrivateKey.PublicExponent | ||
| 2792 | modulus = wtg.PrivateKey.Modulus | ||
| 2793 | } | ||
| 2794 | if publicExponent == "" || modulus == "" { | ||
| 2795 | return true | ||
| 2796 | } | ||
| 2797 | |||
| 2798 | e := C.CString(publicExponent) | ||
| 2461 | var rsaE *C.BIGNUM | 2799 | var rsaE *C.BIGNUM |
| 2462 | defer C.BN_free(rsaE) | 2800 | defer C.BN_free(rsaE) |
| 2463 | if C.BN_hex2bn(&rsaE, e) == 0 { | 2801 | if C.BN_hex2bn(&rsaE, e) == 0 { |
| @@ -2465,7 +2803,7 @@ func (wtg *wycheproofTestGroupRsassa) run(algorithm string, variant testVariant) | |||
| 2465 | } | 2803 | } |
| 2466 | C.free(unsafe.Pointer(e)) | 2804 | C.free(unsafe.Pointer(e)) |
| 2467 | 2805 | ||
| 2468 | n := C.CString(wtg.N) | 2806 | n := C.CString(modulus) |
| 2469 | var rsaN *C.BIGNUM | 2807 | var rsaN *C.BIGNUM |
| 2470 | defer C.BN_free(rsaN) | 2808 | defer C.BN_free(rsaN) |
| 2471 | if C.BN_hex2bn(&rsaN, n) == 0 { | 2809 | if C.BN_hex2bn(&rsaN, n) == 0 { |
| @@ -2522,7 +2860,19 @@ func (wtg *wycheproofTestGroupRSA) run(algorithm string, variant testVariant) bo | |||
| 2522 | } | 2860 | } |
| 2523 | defer C.RSA_free(rsa) | 2861 | defer C.RSA_free(rsa) |
| 2524 | 2862 | ||
| 2525 | e := C.CString(wtg.E) | 2863 | var publicExponent, modulus string |
| 2864 | if wtg.PublicKey != nil { | ||
| 2865 | publicExponent = wtg.PublicKey.PublicExponent | ||
| 2866 | modulus = wtg.PublicKey.Modulus | ||
| 2867 | } else if wtg.PrivateKey != nil { | ||
| 2868 | publicExponent = wtg.PrivateKey.PublicExponent | ||
| 2869 | modulus = wtg.PrivateKey.Modulus | ||
| 2870 | } | ||
| 2871 | if publicExponent == "" || modulus == "" { | ||
| 2872 | return true | ||
| 2873 | } | ||
| 2874 | |||
| 2875 | e := C.CString(publicExponent) | ||
| 2526 | var rsaE *C.BIGNUM | 2876 | var rsaE *C.BIGNUM |
| 2527 | defer C.BN_free(rsaE) | 2877 | defer C.BN_free(rsaE) |
| 2528 | if C.BN_hex2bn(&rsaE, e) == 0 { | 2878 | if C.BN_hex2bn(&rsaE, e) == 0 { |
| @@ -2530,7 +2880,7 @@ func (wtg *wycheproofTestGroupRSA) run(algorithm string, variant testVariant) bo | |||
| 2530 | } | 2880 | } |
| 2531 | C.free(unsafe.Pointer(e)) | 2881 | C.free(unsafe.Pointer(e)) |
| 2532 | 2882 | ||
| 2533 | n := C.CString(wtg.N) | 2883 | n := C.CString(modulus) |
| 2534 | var rsaN *C.BIGNUM | 2884 | var rsaN *C.BIGNUM |
| 2535 | defer C.BN_free(rsaN) | 2885 | defer C.BN_free(rsaN) |
| 2536 | if C.BN_hex2bn(&rsaN, n) == 0 { | 2886 | if C.BN_hex2bn(&rsaN, n) == 0 { |
| @@ -2586,7 +2936,12 @@ func runX25519Test(wt *wycheproofTestX25519) bool { | |||
| 2586 | } | 2936 | } |
| 2587 | 2937 | ||
| 2588 | func (wtg *wycheproofTestGroupX25519) run(algorithm string, variant testVariant) bool { | 2938 | func (wtg *wycheproofTestGroupX25519) run(algorithm string, variant testVariant) bool { |
| 2589 | fmt.Printf("Running %v test group with curve %v...\n", algorithm, wtg.Curve) | 2939 | if wtg.Curve == "curve25519" { |
| 2940 | fmt.Printf("Running %v test group with curve %v...\n", algorithm, wtg.Curve) | ||
| 2941 | } else { | ||
| 2942 | fmt.Printf("INFO: Skipping %v test group with curve %v...\n", algorithm, wtg.Curve) | ||
| 2943 | return true | ||
| 2944 | } | ||
| 2590 | 2945 | ||
| 2591 | success := true | 2946 | success := true |
| 2592 | for _, wt := range wtg.Tests { | 2947 | for _, wt := range wtg.Tests { |
| @@ -2597,59 +2952,119 @@ func (wtg *wycheproofTestGroupX25519) run(algorithm string, variant testVariant) | |||
| 2597 | return success | 2952 | return success |
| 2598 | } | 2953 | } |
| 2599 | 2954 | ||
| 2600 | func testGroupFromAlgorithm(algorithm string, variant testVariant) wycheproofTestGroupRunner { | 2955 | func testGroupFromTestVector(wtv *wycheproofTestVectorsV1) (wycheproofTestGroupRunner, testVariant) { |
| 2601 | if algorithm == "ECDH" && variant == Webcrypto { | 2956 | variant := Normal |
| 2602 | return &wycheproofTestGroupECDHWebCrypto{} | 2957 | |
| 2603 | } | 2958 | switch wtv.Algorithm { |
| 2604 | if algorithm == "ECDSA" && variant == Webcrypto { | 2959 | case "A128CBC-HS256", "A192CBC-HS384", "A256CBC-HS512": |
| 2605 | return &wycheproofTestGroupECDSAWebCrypto{} | 2960 | return nil, Skip |
| 2606 | } | 2961 | case "AEGIS128", "AEGIS128L", "AEGIS256": |
| 2607 | switch algorithm { | 2962 | return nil, Skip |
| 2963 | case "AEAD-AES-SIV-CMAC": | ||
| 2964 | return nil, Skip | ||
| 2608 | case "AES-CBC-PKCS5": | 2965 | case "AES-CBC-PKCS5": |
| 2609 | return &wycheproofTestGroupAesCbcPkcs5{} | 2966 | return &wycheproofTestGroupAesCbcPkcs5{}, variant |
| 2610 | case "AES-CCM", "AES-GCM": | 2967 | case "AES-CCM", "AES-GCM": |
| 2611 | return &wycheproofTestGroupAesAead{} | 2968 | return &wycheproofTestGroupAesAead{}, variant |
| 2612 | case "AES-CMAC": | 2969 | case "AES-CMAC": |
| 2613 | return &wycheproofTestGroupAesCmac{} | 2970 | return &wycheproofTestGroupAesCmac{}, variant |
| 2971 | case "AES-EAX", "AES-FF1", "AES-GCM-SIV", "AES-GMAC", "AES-KWP", "AES-SIV-CMAC", "AES-XTS": | ||
| 2972 | return nil, Skip | ||
| 2973 | case "AES-WRAP": | ||
| 2974 | return &wycheproofTestGroupKW{}, variant | ||
| 2975 | case "ARIA-CBC-PKCS5", "ARIA-CCM", "ARIA-CMAC", "ARIA-GCM", "ARIA-KWP", "ARIA-WRAP": | ||
| 2976 | return nil, Skip | ||
| 2977 | case "ASCON128", "ASCON128A", "ASCON80PQ": | ||
| 2978 | return nil, Skip | ||
| 2979 | case "CAMELLIA-CBC-PKCS5", "CAMELLIA-CCM", "CAMELLIA-CMAC", "CAMELLIA-WRAP": | ||
| 2980 | return nil, Skip | ||
| 2614 | case "CHACHA20-POLY1305", "XCHACHA20-POLY1305": | 2981 | case "CHACHA20-POLY1305", "XCHACHA20-POLY1305": |
| 2615 | return &wycheproofTestGroupChaCha{} | 2982 | return &wycheproofTestGroupChaCha{}, variant |
| 2616 | case "DSA": | 2983 | case "DSA": |
| 2617 | return &wycheproofTestGroupDSA{} | 2984 | if wtv.Schema == "dsa_p1363_verify_schema_v1.json" { |
| 2985 | variant = P1363 | ||
| 2986 | } | ||
| 2987 | return &wycheproofTestGroupDSA{}, variant | ||
| 2988 | case "EcCurveTest": | ||
| 2989 | return &wycheproofTestGroupEcCurve{}, variant | ||
| 2618 | case "ECDH": | 2990 | case "ECDH": |
| 2619 | return &wycheproofTestGroupECDH{} | 2991 | if wtv.Schema == "ecdh_webcrypto_test_schema_v1.json" { |
| 2992 | return &wycheproofTestGroupECDHWebCrypto{}, Webcrypto | ||
| 2993 | } | ||
| 2994 | if wtv.Schema == "ecdh_ecpoint_test_schema_v1.json" { | ||
| 2995 | variant = EcPoint | ||
| 2996 | } | ||
| 2997 | if wtv.Schema == "ecdh_pem_test_schema_v1.json" { | ||
| 2998 | variant = Skip | ||
| 2999 | } | ||
| 3000 | return &wycheproofTestGroupECDH{}, variant | ||
| 2620 | case "ECDSA": | 3001 | case "ECDSA": |
| 2621 | return &wycheproofTestGroupECDSA{} | 3002 | if wtv.Schema == "ecdsa_bitcoin_verify_schema.json" { |
| 3003 | variant = Skip | ||
| 3004 | } | ||
| 3005 | if wtv.Schema == "ecdsa_p1363_verify_schema_v1.json" { | ||
| 3006 | variant = P1363 | ||
| 3007 | } | ||
| 3008 | return &wycheproofTestGroupECDSA{}, variant | ||
| 2622 | case "EDDSA": | 3009 | case "EDDSA": |
| 2623 | return &wycheproofTestGroupEdDSA{} | 3010 | return &wycheproofTestGroupEdDSA{}, variant |
| 2624 | case "HKDF-SHA-1", "HKDF-SHA-256", "HKDF-SHA-384", "HKDF-SHA-512": | 3011 | case "HKDF-SHA-1", "HKDF-SHA-256", "HKDF-SHA-384", "HKDF-SHA-512": |
| 2625 | return &wycheproofTestGroupHkdf{} | 3012 | return &wycheproofTestGroupHkdf{}, variant |
| 2626 | case "HMACSHA1", "HMACSHA224", "HMACSHA256", "HMACSHA384", "HMACSHA512", "HMACSHA3-224", "HMACSHA3-256", "HMACSHA3-384", "HMACSHA3-512": | 3013 | case "HMACSHA1", "HMACSHA224", "HMACSHA256", "HMACSHA384", "HMACSHA512", "HMACSHA512/224", "HMACSHA512/256", "HMACSHA3-224", "HMACSHA3-256", "HMACSHA3-384", "HMACSHA3-512", "HMACSM3": |
| 2627 | return &wycheproofTestGroupHmac{} | 3014 | return &wycheproofTestGroupHmac{}, variant |
| 2628 | case "KW": | 3015 | case "KMAC128", "KMAC256": |
| 2629 | return &wycheproofTestGroupKW{} | 3016 | return nil, Skip |
| 3017 | case "ML-DSA-44", "ML-DSA-65", "ML-DSA-87": | ||
| 3018 | return nil, Skip | ||
| 3019 | case "ML-KEM": | ||
| 3020 | return &wycheproofTestGroupMLKEM{}, Normal | ||
| 3021 | case "MORUS640", "MORUS1280": | ||
| 3022 | return nil, Skip | ||
| 3023 | case "PbeWithHmacSha1AndAes_128", "PbeWithHmacSha1AndAes_192", "PbeWithHmacSha1AndAes_256", "PbeWithHmacSha224AndAes_128", "PbeWithHmacSha224AndAes_192", "PbeWithHmacSha224AndAes_256", "PbeWithHmacSha256AndAes_128", "PbeWithHmacSha256AndAes_192", "PbeWithHmacSha256AndAes_256", "PbeWithHmacSha384AndAes_128", "PbeWithHmacSha384AndAes_192", "PbeWithHmacSha384AndAes_256", "PbeWithHmacSha512AndAes_128", "PbeWithHmacSha512AndAes_192", "PbeWithHmacSha512AndAes_256": | ||
| 3024 | return nil, Skip | ||
| 3025 | case "PBKDF2-HMACSHA1", "PBKDF2-HMACSHA224", "PBKDF2-HMACSHA256", "PBKDF2-HMACSHA384", "PBKDF2-HMACSHA512": | ||
| 3026 | return &wycheproofTestGroupPbkdf2HmacSha{}, Skip | ||
| 2630 | case "PrimalityTest": | 3027 | case "PrimalityTest": |
| 2631 | return &wycheproofTestGroupPrimality{} | 3028 | return &wycheproofTestGroupPrimality{}, variant |
| 2632 | case "RSAES-OAEP": | 3029 | case "RSAES-OAEP": |
| 2633 | return &wycheproofTestGroupRsaesOaep{} | 3030 | return &wycheproofTestGroupRsaesOaep{}, variant |
| 2634 | case "RSAES-PKCS1-v1_5": | 3031 | case "RSAES-PKCS1-v1_5": |
| 2635 | return &wycheproofTestGroupRsaesPkcs1{} | 3032 | return &wycheproofTestGroupRsaesPkcs1{}, variant |
| 2636 | case "RSASSA-PSS": | 3033 | case "RSASSA-PSS": |
| 2637 | return &wycheproofTestGroupRsassa{} | 3034 | return &wycheproofTestGroupRsassa{}, variant |
| 2638 | case "RSASSA-PKCS1-v1_5", "RSASig": | 3035 | case "RSASSA-PKCS1-v1_5", "RSASig": |
| 2639 | return &wycheproofTestGroupRSA{} | 3036 | return &wycheproofTestGroupRSA{}, variant |
| 2640 | case "XDH", "X25519": | 3037 | case "SEED-CCM", "SEED-GCM", "SEED-WRAP": |
| 2641 | return &wycheproofTestGroupX25519{} | 3038 | return nil, Skip |
| 3039 | case "SipHash-1-3", "SipHash-2-4", "SipHash-4-8", "SipHashX-2-4", "SipHashX-4-8": | ||
| 3040 | return nil, Skip | ||
| 3041 | case "SM4-CCM", "SM4-GCM": | ||
| 3042 | return nil, Skip | ||
| 3043 | case "VMAC-AES": | ||
| 3044 | return nil, Skip | ||
| 3045 | case "XDH": | ||
| 3046 | switch wtv.Schema { | ||
| 3047 | case "xdh_asn_comp_schema_v1.json", "xdh_jwk_comp_schema_v1.json", "xdh_pem_comp_schema_v1.json": | ||
| 3048 | variant = Skip | ||
| 3049 | case "xdh_comp_schema_v1.json": | ||
| 3050 | variant = Normal | ||
| 3051 | } | ||
| 3052 | return &wycheproofTestGroupX25519{}, variant | ||
| 2642 | default: | 3053 | default: |
| 2643 | return nil | 3054 | // XXX - JOSE tests don't set an Algorithm... |
| 3055 | if strings.HasPrefix(wtv.Schema, "json_web_") { | ||
| 3056 | return nil, Skip | ||
| 3057 | } | ||
| 3058 | return nil, Normal | ||
| 2644 | } | 3059 | } |
| 2645 | } | 3060 | } |
| 2646 | 3061 | ||
| 2647 | func runTestVectors(path string, variant testVariant) bool { | 3062 | func runTestVectors(path string) bool { |
| 2648 | b, err := ioutil.ReadFile(path) | 3063 | b, err := ioutil.ReadFile(path) |
| 2649 | if err != nil { | 3064 | if err != nil { |
| 2650 | log.Fatalf("Failed to read test vectors: %v", err) | 3065 | log.Fatalf("Failed to read test vectors: %v", err) |
| 2651 | } | 3066 | } |
| 2652 | wtv := &wycheproofTestVectors{} | 3067 | wtv := &wycheproofTestVectorsV1{} |
| 2653 | if err := json.Unmarshal(b, wtv); err != nil { | 3068 | if err := json.Unmarshal(b, wtv); err != nil { |
| 2654 | log.Fatalf("Failed to unmarshal JSON: %v", err) | 3069 | log.Fatalf("Failed to unmarshal JSON: %v", err) |
| 2655 | } | 3070 | } |
| @@ -2657,10 +3072,13 @@ func runTestVectors(path string, variant testVariant) bool { | |||
| 2657 | 3072 | ||
| 2658 | success := true | 3073 | success := true |
| 2659 | for _, tg := range wtv.TestGroups { | 3074 | for _, tg := range wtv.TestGroups { |
| 2660 | wtg := testGroupFromAlgorithm(wtv.Algorithm, variant) | 3075 | wtg, variant := testGroupFromTestVector(wtv) |
| 3076 | if variant == Skip { | ||
| 3077 | fmt.Printf("INFO: Skipping tests from \"%s\"\n", filepath.Base(path)) | ||
| 3078 | return true | ||
| 3079 | } | ||
| 2661 | if wtg == nil { | 3080 | if wtg == nil { |
| 2662 | log.Printf("INFO: Unknown test vector algorithm %q", wtv.Algorithm) | 3081 | log.Fatalf("INFO: Unknown test vector algorithm %qin \"%s\"", wtv.Algorithm, filepath.Base(path)) |
| 2663 | return false | ||
| 2664 | } | 3082 | } |
| 2665 | if err := json.Unmarshal(tg, wtg); err != nil { | 3083 | if err := json.Unmarshal(tg, wtg); err != nil { |
| 2666 | log.Fatalf("Failed to unmarshal test groups JSON: %v", err) | 3084 | log.Fatalf("Failed to unmarshal test groups JSON: %v", err) |
| @@ -2714,44 +3132,13 @@ func (tc *testCoordinator) shutdown() { | |||
| 2714 | } | 3132 | } |
| 2715 | 3133 | ||
| 2716 | func main() { | 3134 | func main() { |
| 2717 | if _, err := os.Stat(testVectorPath); os.IsNotExist(err) { | 3135 | path := testVectorPath |
| 3136 | if _, err := os.Stat(path); os.IsNotExist(err) { | ||
| 2718 | fmt.Printf("package wycheproof-testvectors is required for this regress\n") | 3137 | fmt.Printf("package wycheproof-testvectors is required for this regress\n") |
| 2719 | fmt.Printf("SKIPPED\n") | 3138 | fmt.Printf("SKIPPED\n") |
| 2720 | os.Exit(0) | 3139 | os.Exit(0) |
| 2721 | } | 3140 | } |
| 2722 | 3141 | ||
| 2723 | tests := []struct { | ||
| 2724 | name string | ||
| 2725 | pattern string | ||
| 2726 | variant testVariant | ||
| 2727 | }{ | ||
| 2728 | {"AES", "aes_[cg]*[^xv]_test.json", Normal}, // Skip AES-EAX, AES-GCM-SIV and AES-SIV-CMAC. | ||
| 2729 | {"ChaCha20-Poly1305", "chacha20_poly1305_test.json", Normal}, | ||
| 2730 | {"DSA", "dsa_*test.json", Normal}, | ||
| 2731 | {"DSA", "dsa_*_p1363_test.json", P1363}, | ||
| 2732 | {"ECDH", "ecdh_test.json", Normal}, | ||
| 2733 | {"ECDH", "ecdh_[^w_]*_test.json", Normal}, | ||
| 2734 | {"ECDH EcPoint", "ecdh_*_ecpoint_test.json", EcPoint}, | ||
| 2735 | {"ECDH webcrypto", "ecdh_webcrypto_test.json", Webcrypto}, | ||
| 2736 | {"ECDSA", "ecdsa_test.json", Normal}, | ||
| 2737 | {"ECDSA", "ecdsa_[^w]*test.json", Normal}, | ||
| 2738 | {"ECDSA P1363", "ecdsa_*_p1363_test.json", P1363}, | ||
| 2739 | {"ECDSA webcrypto", "ecdsa_webcrypto_test.json", Webcrypto}, | ||
| 2740 | {"EDDSA", "eddsa_test.json", Normal}, | ||
| 2741 | {"ED448", "ed448_test.json", Skip}, | ||
| 2742 | {"HKDF", "hkdf_sha*_test.json", Normal}, | ||
| 2743 | {"HMAC", "hmac_sha*_test.json", Normal}, | ||
| 2744 | {"JSON webcrypto", "json_web_*_test.json", Skip}, | ||
| 2745 | {"KW", "kw_test.json", Normal}, | ||
| 2746 | {"Primality test", "primality_test.json", Normal}, | ||
| 2747 | {"RSA", "rsa_*test.json", Normal}, | ||
| 2748 | {"X25519", "x25519_test.json", Normal}, | ||
| 2749 | {"X25519 ASN", "x25519_asn_test.json", Skip}, | ||
| 2750 | {"X25519 JWK", "x25519_jwk_test.json", Skip}, | ||
| 2751 | {"X25519 PEM", "x25519_pem_test.json", Skip}, | ||
| 2752 | {"XCHACHA20-POLY1305", "xchacha20_poly1305_test.json", Normal}, | ||
| 2753 | } | ||
| 2754 | |||
| 2755 | success := true | 3142 | success := true |
| 2756 | 3143 | ||
| 2757 | var wg sync.WaitGroup | 3144 | var wg sync.WaitGroup |
| @@ -2764,33 +3151,25 @@ func main() { | |||
| 2764 | 3151 | ||
| 2765 | testc = newTestCoordinator() | 3152 | testc = newTestCoordinator() |
| 2766 | 3153 | ||
| 2767 | skipNormal := regexp.MustCompile(`_(ecpoint|p1363|sect\d{3}[rk]1|secp(160|192))_`) | 3154 | tvs, err := filepath.Glob(filepath.Join(path, "*.json")) |
| 2768 | 3155 | if err != nil { | |
| 2769 | for _, test := range tests { | 3156 | log.Fatalf("Failed to glob test vectors: %v", err) |
| 2770 | tvs, err := filepath.Glob(filepath.Join(testVectorPath, test.pattern)) | 3157 | } |
| 2771 | if err != nil { | 3158 | if len(tvs) == 0 { |
| 2772 | log.Fatalf("Failed to glob %v test vectors: %v", test.name, err) | 3159 | log.Fatalf("Failed to find test vectors at %q\n", path) |
| 2773 | } | 3160 | } |
| 2774 | if len(tvs) == 0 { | 3161 | for _, tv := range tvs { |
| 2775 | log.Fatalf("Failed to find %v test vectors at %q\n", test.name, testVectorPath) | 3162 | wg.Add(1) |
| 2776 | } | 3163 | <-vectorsRateLimitCh |
| 2777 | for _, tv := range tvs { | 3164 | go func(tv string) { |
| 2778 | if test.variant == Skip || (test.variant == Normal && skipNormal.Match([]byte(tv))) { | 3165 | select { |
| 2779 | fmt.Printf("INFO: Skipping tests from \"%s\"\n", strings.TrimPrefix(tv, testVectorPath+"/")) | 3166 | case resultCh <- runTestVectors(tv): |
| 2780 | continue | 3167 | default: |
| 3168 | log.Fatal("result channel is full") | ||
| 2781 | } | 3169 | } |
| 2782 | wg.Add(1) | 3170 | vectorsRateLimitCh <- true |
| 2783 | <-vectorsRateLimitCh | 3171 | wg.Done() |
| 2784 | go func(tv string, variant testVariant) { | 3172 | }(tv) |
| 2785 | select { | ||
| 2786 | case resultCh <- runTestVectors(tv, variant): | ||
| 2787 | default: | ||
| 2788 | log.Fatal("result channel is full") | ||
| 2789 | } | ||
| 2790 | vectorsRateLimitCh <- true | ||
| 2791 | wg.Done() | ||
| 2792 | }(tv, test.variant) | ||
| 2793 | } | ||
| 2794 | } | 3173 | } |
| 2795 | 3174 | ||
| 2796 | wg.Wait() | 3175 | wg.Wait() |
diff --git a/src/regress/lib/libcrypto/x509/Makefile b/src/regress/lib/libcrypto/x509/Makefile index 19e65efddd..94e9e476a0 100644 --- a/src/regress/lib/libcrypto/x509/Makefile +++ b/src/regress/lib/libcrypto/x509/Makefile | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.24 2025/03/15 06:37:49 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.25 2025/05/05 06:33:34 tb Exp $ |
| 2 | 2 | ||
| 3 | PROGS = constraints verify x509attribute x509name x509req_ext callback | 3 | PROGS = constraints verify x509attribute x509req_ext callback |
| 4 | PROGS += expirecallback callbackfailures x509_asn1 x509_extensions_test | 4 | PROGS += expirecallback callbackfailures x509_asn1 x509_extensions_test |
| 5 | PROGS += x509_name_test | 5 | PROGS += x509_name_test |
| 6 | LDADD = -lcrypto | 6 | LDADD = -lcrypto |
| @@ -16,7 +16,7 @@ CFLAGS += -I${.CURDIR}/../../../../lib/libcrypto/bytestring | |||
| 16 | 16 | ||
| 17 | SUBDIR += bettertls policy rfc3779 | 17 | SUBDIR += bettertls policy rfc3779 |
| 18 | 18 | ||
| 19 | CLEANFILES += x509name.result callback.out | 19 | CLEANFILES += callback.out |
| 20 | 20 | ||
| 21 | .if make(clean) || make(cleandir) | 21 | .if make(clean) || make(cleandir) |
| 22 | . if ${.OBJDIR} != ${.CURDIR} | 22 | . if ${.OBJDIR} != ${.CURDIR} |
| @@ -29,10 +29,6 @@ run-regress-verify: verify | |||
| 29 | perl ${.CURDIR}/make-dir-roots.pl ${.CURDIR}/../certs . | 29 | perl ${.CURDIR}/make-dir-roots.pl ${.CURDIR}/../certs . |
| 30 | ./verify ${.CURDIR}/../certs | 30 | ./verify ${.CURDIR}/../certs |
| 31 | 31 | ||
| 32 | run-regress-x509name: x509name | ||
| 33 | ./x509name > x509name.result | ||
| 34 | diff -u ${.CURDIR}/x509name.expected x509name.result | ||
| 35 | |||
| 36 | run-regress-callback: callback | 32 | run-regress-callback: callback |
| 37 | ./callback ${.CURDIR}/../certs | 33 | ./callback ${.CURDIR}/../certs |
| 38 | perl ${.CURDIR}/callback.pl callback.out | 34 | perl ${.CURDIR}/callback.pl callback.out |
diff --git a/src/regress/lib/libcrypto/x509/bettertls/Makefile b/src/regress/lib/libcrypto/x509/bettertls/Makefile index 2724140635..2a06239fc5 100644 --- a/src/regress/lib/libcrypto/x509/bettertls/Makefile +++ b/src/regress/lib/libcrypto/x509/bettertls/Makefile | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.6 2024/12/27 08:02:27 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.7 2025/07/23 07:46:12 tb Exp $ |
| 2 | 2 | ||
| 3 | PROGS = verify | 3 | PROGS = verify |
| 4 | 4 | ||
| 5 | .ifdef EOPENSSL33 | 5 | .ifdef EOPENSSL35 |
| 6 | LDADD += -Wl,-rpath,/usr/local/lib/eopenssl33 -L/usr/local/lib/eopenssl33 | 6 | LDADD += -Wl,-rpath,/usr/local/lib/eopenssl35 -L/usr/local/lib/eopenssl35 |
| 7 | CFLAGS += -I/usr/local/include/eopenssl33/ | 7 | CFLAGS += -I/usr/local/include/eopenssl35/ |
| 8 | .endif | 8 | .endif |
| 9 | 9 | ||
| 10 | LDADD += -lcrypto | 10 | LDADD += -lcrypto |
diff --git a/src/regress/lib/libcrypto/x509/x509_extensions_test.c b/src/regress/lib/libcrypto/x509/x509_extensions_test.c index 2961b0612b..1a7dfe2019 100644 --- a/src/regress/lib/libcrypto/x509/x509_extensions_test.c +++ b/src/regress/lib/libcrypto/x509/x509_extensions_test.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_extensions_test.c,v 1.3 2024/06/17 05:04:54 tb Exp $ */ | 1 | /* $OpenBSD: x509_extensions_test.c,v 1.4 2025/12/31 17:04:22 tb Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> |
| @@ -215,7 +215,7 @@ test_x509v3_add1_i2d_single_nid(STACK_OF(X509_EXTENSION) **extensions) | |||
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | if ((got = X509v3_get_ext_count(*extensions)) != 1) { | 217 | if ((got = X509v3_get_ext_count(*extensions)) != 1) { |
| 218 | fprintf(stderr, "%s: FAIL: X509V3_ADD_DEFAULT second contraints " | 218 | fprintf(stderr, "%s: FAIL: X509V3_ADD_DEFAULT second constraints " |
| 219 | "expected 1 extension, have %d.\n", __func__, got); | 219 | "expected 1 extension, have %d.\n", __func__, got); |
| 220 | goto err; | 220 | goto err; |
| 221 | } | 221 | } |
diff --git a/src/regress/lib/libcrypto/x509/x509_name_test.c b/src/regress/lib/libcrypto/x509/x509_name_test.c index eaf7076d74..24e62cc766 100644 --- a/src/regress/lib/libcrypto/x509/x509_name_test.c +++ b/src/regress/lib/libcrypto/x509/x509_name_test.c | |||
| @@ -1,7 +1,9 @@ | |||
| 1 | /* $OpenBSD: x509_name_test.c,v 1.2 2025/03/19 11:19:17 tb Exp $ */ | 1 | /* $OpenBSD: x509_name_test.c,v 1.3 2025/05/05 06:33:34 tb Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (c) 2025 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2025 Theo Buehler <tb@openbsd.org> |
| 5 | * Copyright (c) 2025 Kenjiro Nakayama <nakayamakenjiro@gmail.com> | ||
| 6 | * Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org> | ||
| 5 | * | 7 | * |
| 6 | * Permission to use, copy, modify, and distribute this software for any | 8 | * Permission to use, copy, modify, and distribute this software for any |
| 7 | * purpose with or without fee is hereby granted, provided that the above | 9 | * purpose with or without fee is hereby granted, provided that the above |
| @@ -288,12 +290,131 @@ x509_name_compat_test(void) | |||
| 288 | return failed; | 290 | return failed; |
| 289 | } | 291 | } |
| 290 | 292 | ||
| 293 | static const struct x509_name_entry_test { | ||
| 294 | const char *field; | ||
| 295 | const char *value; | ||
| 296 | int loc; | ||
| 297 | int set; | ||
| 298 | const char *expected_str; | ||
| 299 | const int expected_set[4]; | ||
| 300 | const int expected_count; | ||
| 301 | } entry_tests[] = { | ||
| 302 | { | ||
| 303 | .field = "ST", | ||
| 304 | .value = "BaWue", | ||
| 305 | .loc = -1, | ||
| 306 | .set = 0, | ||
| 307 | .expected_str = "ST=BaWue", | ||
| 308 | .expected_set = { 0 }, | ||
| 309 | .expected_count = 1, | ||
| 310 | }, | ||
| 311 | { | ||
| 312 | .field = "O", | ||
| 313 | .value = "KIT", | ||
| 314 | .loc = -1, | ||
| 315 | .set = 0, | ||
| 316 | .expected_str = "ST=BaWue, O=KIT", | ||
| 317 | .expected_set = { 0, 1 }, | ||
| 318 | .expected_count = 2, | ||
| 319 | }, | ||
| 320 | { | ||
| 321 | .field = "L", | ||
| 322 | .value = "Karlsruhe", | ||
| 323 | .loc = 1, | ||
| 324 | .set = 0, | ||
| 325 | .expected_str = "ST=BaWue, L=Karlsruhe, O=KIT", | ||
| 326 | .expected_set = { 0, 1, 2 }, | ||
| 327 | .expected_count = 3, | ||
| 328 | }, | ||
| 329 | { | ||
| 330 | .field = "C", | ||
| 331 | .value = "DE", | ||
| 332 | .loc = 0, | ||
| 333 | .set = 1, | ||
| 334 | .expected_str = "C=DE + ST=BaWue, L=Karlsruhe, O=KIT", | ||
| 335 | .expected_set = { 0, 0, 1, 2 }, | ||
| 336 | .expected_count = 4, | ||
| 337 | }, | ||
| 338 | }; | ||
| 339 | |||
| 340 | #define N_ENTRY_TESTS (sizeof(entry_tests) / sizeof(entry_tests[0])) | ||
| 341 | |||
| 342 | static int | ||
| 343 | verify_x509_name_output(X509_NAME *name, const struct x509_name_entry_test *tc) | ||
| 344 | { | ||
| 345 | BIO *bio; | ||
| 346 | char *got; | ||
| 347 | long got_len; | ||
| 348 | int loc, ret; | ||
| 349 | int failed = 1; | ||
| 350 | |||
| 351 | if ((bio = BIO_new(BIO_s_mem())) == NULL) | ||
| 352 | goto fail; | ||
| 353 | |||
| 354 | if ((ret = X509_NAME_print_ex(bio, name, 0, XN_FLAG_SEP_CPLUS_SPC)) == -1) | ||
| 355 | goto fail; | ||
| 356 | |||
| 357 | if ((got_len = BIO_get_mem_data(bio, &got)) < 0) | ||
| 358 | goto fail; | ||
| 359 | |||
| 360 | if (ret != got_len || strlen(tc->expected_str) != (size_t)ret) | ||
| 361 | goto fail; | ||
| 362 | |||
| 363 | if (strncmp(tc->expected_str, got, got_len) != 0) | ||
| 364 | goto fail; | ||
| 365 | |||
| 366 | if (X509_NAME_entry_count(name) != tc->expected_count) | ||
| 367 | goto fail; | ||
| 368 | |||
| 369 | for (loc = 0; loc < X509_NAME_entry_count(name); loc++) { | ||
| 370 | X509_NAME_ENTRY *e = X509_NAME_get_entry(name, loc); | ||
| 371 | if (e == NULL || X509_NAME_ENTRY_set(e) != tc->expected_set[loc]) | ||
| 372 | goto fail; | ||
| 373 | } | ||
| 374 | |||
| 375 | failed = 0; | ||
| 376 | |||
| 377 | fail: | ||
| 378 | BIO_free(bio); | ||
| 379 | |||
| 380 | return failed; | ||
| 381 | } | ||
| 382 | |||
| 383 | static int | ||
| 384 | x509_name_add_entry_test(void) | ||
| 385 | { | ||
| 386 | X509_NAME *name; | ||
| 387 | int failed = 1; | ||
| 388 | |||
| 389 | if ((name = X509_NAME_new()) == NULL) | ||
| 390 | goto done; | ||
| 391 | |||
| 392 | for (size_t i = 0; i < N_ENTRY_TESTS; i++) { | ||
| 393 | const struct x509_name_entry_test *t = &entry_tests[i]; | ||
| 394 | |||
| 395 | if (!X509_NAME_add_entry_by_txt(name, t->field, MBSTRING_ASC, | ||
| 396 | (const unsigned char *)t->value, -1, t->loc, t->set)) | ||
| 397 | goto done; | ||
| 398 | |||
| 399 | if (verify_x509_name_output(name, t)) | ||
| 400 | goto done; | ||
| 401 | } | ||
| 402 | |||
| 403 | failed = 0; | ||
| 404 | |||
| 405 | done: | ||
| 406 | X509_NAME_free(name); | ||
| 407 | |||
| 408 | return failed; | ||
| 409 | } | ||
| 410 | |||
| 291 | int | 411 | int |
| 292 | main(void) | 412 | main(void) |
| 293 | { | 413 | { |
| 294 | int failed = 0; | 414 | int failed = 0; |
| 295 | 415 | ||
| 296 | failed |= x509_name_compat_test(); | 416 | failed |= x509_name_compat_test(); |
| 417 | failed |= x509_name_add_entry_test(); | ||
| 297 | 418 | ||
| 298 | return failed; | 419 | return failed; |
| 299 | } | 420 | } |
diff --git a/src/regress/lib/libcrypto/x509/x509name.c b/src/regress/lib/libcrypto/x509/x509name.c deleted file mode 100644 index 9deeeb2986..0000000000 --- a/src/regress/lib/libcrypto/x509/x509name.c +++ /dev/null | |||
| @@ -1,62 +0,0 @@ | |||
| 1 | /* $OpenBSD: x509name.c,v 1.3 2021/10/31 08:27:15 tb Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org> | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <err.h> | ||
| 19 | #include <stdio.h> | ||
| 20 | |||
| 21 | #include <openssl/x509.h> | ||
| 22 | |||
| 23 | static void debug_print(X509_NAME *); | ||
| 24 | |||
| 25 | static void | ||
| 26 | debug_print(X509_NAME *name) | ||
| 27 | { | ||
| 28 | int loc; | ||
| 29 | |||
| 30 | for (loc = 0; loc < X509_NAME_entry_count(name); loc++) | ||
| 31 | printf("%d:", | ||
| 32 | X509_NAME_ENTRY_set(X509_NAME_get_entry(name, loc))); | ||
| 33 | putchar(' '); | ||
| 34 | X509_NAME_print_ex_fp(stdout, name, 0, XN_FLAG_SEP_CPLUS_SPC); | ||
| 35 | putchar('\n'); | ||
| 36 | } | ||
| 37 | |||
| 38 | int | ||
| 39 | main(void) | ||
| 40 | { | ||
| 41 | X509_NAME *name; | ||
| 42 | |||
| 43 | if ((name = X509_NAME_new()) == NULL) | ||
| 44 | err(1, NULL); | ||
| 45 | X509_NAME_add_entry_by_txt(name, "ST", MBSTRING_ASC, | ||
| 46 | "BaWue", -1, -1, 0); | ||
| 47 | X509_NAME_add_entry_by_txt(name, "O", MBSTRING_ASC, | ||
| 48 | "KIT", -1, -1, 0); | ||
| 49 | debug_print(name); | ||
| 50 | |||
| 51 | X509_NAME_add_entry_by_txt(name, "L", MBSTRING_ASC, | ||
| 52 | "Karlsruhe", -1, 1, 0); | ||
| 53 | debug_print(name); | ||
| 54 | |||
| 55 | X509_NAME_add_entry_by_txt(name, "C", MBSTRING_ASC, | ||
| 56 | "DE", -1, 0, 1); | ||
| 57 | debug_print(name); | ||
| 58 | |||
| 59 | X509_NAME_free(name); | ||
| 60 | |||
| 61 | return 0; | ||
| 62 | } | ||
diff --git a/src/regress/lib/libcrypto/x509/x509name.expected b/src/regress/lib/libcrypto/x509/x509name.expected deleted file mode 100644 index 6cee7cc435..0000000000 --- a/src/regress/lib/libcrypto/x509/x509name.expected +++ /dev/null | |||
| @@ -1,3 +0,0 @@ | |||
| 1 | 0:1: ST=BaWue, O=KIT | ||
| 2 | 0:1:2: ST=BaWue, L=Karlsruhe, O=KIT | ||
| 3 | 0:0:1:2: C=DE + ST=BaWue, L=Karlsruhe, O=KIT | ||
diff --git a/src/regress/lib/libssl/asn1/asn1test.c b/src/regress/lib/libssl/asn1/asn1test.c index a81c502655..ad2301eace 100644 --- a/src/regress/lib/libssl/asn1/asn1test.c +++ b/src/regress/lib/libssl/asn1/asn1test.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: asn1test.c,v 1.13 2024/07/22 14:50:45 jsing Exp $ */ | 1 | /* $OpenBSD: asn1test.c,v 1.14 2025/10/24 11:45:08 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014, 2016 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014, 2016 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -371,7 +371,7 @@ session_cmp(SSL_SESSION *s1, SSL_SESSION *s2) | |||
| 371 | static int | 371 | static int |
| 372 | do_ssl_asn1_test(int test_no, struct ssl_asn1_test *sat) | 372 | do_ssl_asn1_test(int test_no, struct ssl_asn1_test *sat) |
| 373 | { | 373 | { |
| 374 | SSL_SESSION *sp = NULL; | 374 | SSL_SESSION *sp = NULL, *sp_copy = NULL; |
| 375 | unsigned char *ap, *asn1 = NULL; | 375 | unsigned char *ap, *asn1 = NULL; |
| 376 | const unsigned char *pp; | 376 | const unsigned char *pp; |
| 377 | int i, len, rv = 1; | 377 | int i, len, rv = 1; |
| @@ -440,11 +440,31 @@ do_ssl_asn1_test(int test_no, struct ssl_asn1_test *sat) | |||
| 440 | goto failed; | 440 | goto failed; |
| 441 | } | 441 | } |
| 442 | 442 | ||
| 443 | if ((sp_copy = SSL_SESSION_dup(sp)) == NULL) { | ||
| 444 | fprintf(stderr, "FAIL: test %d - session dup failed\n", test_no); | ||
| 445 | goto failed; | ||
| 446 | } | ||
| 447 | |||
| 448 | if (session_cmp(sp, sp_copy) != 0) { | ||
| 449 | fprintf(stderr, "FAIL: test %d - sp and sp_dup differ\n", test_no); | ||
| 450 | goto failed; | ||
| 451 | } | ||
| 452 | |||
| 453 | /* | ||
| 454 | * session_cmp() checks that the certs compare as equal. Part of the | ||
| 455 | * documented API contract is that the certs are equal as pointers. | ||
| 456 | */ | ||
| 457 | if (SSL_SESSION_get0_peer(sp) != SSL_SESSION_get0_peer(sp_copy)) { | ||
| 458 | fprintf(stderr, "FAIL: test %d - peer certs differ\n", test_no); | ||
| 459 | goto failed; | ||
| 460 | } | ||
| 461 | |||
| 443 | rv = 0; | 462 | rv = 0; |
| 444 | 463 | ||
| 445 | failed: | 464 | failed: |
| 446 | ERR_print_errors_fp(stderr); | 465 | ERR_print_errors_fp(stderr); |
| 447 | SSL_SESSION_free(sp); | 466 | SSL_SESSION_free(sp); |
| 467 | SSL_SESSION_free(sp_copy); | ||
| 448 | free(asn1); | 468 | free(asn1); |
| 449 | 469 | ||
| 450 | return (rv); | 470 | return (rv); |
diff --git a/src/regress/lib/libssl/client/clienttest.c b/src/regress/lib/libssl/client/clienttest.c index 7e96944fce..f9258105f8 100644 --- a/src/regress/lib/libssl/client/clienttest.c +++ b/src/regress/lib/libssl/client/clienttest.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: clienttest.c,v 1.45 2024/08/31 12:47:24 jsing Exp $ */ | 1 | /* $OpenBSD: clienttest.c,v 1.46 2025/12/04 21:16:17 beck Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -36,8 +36,8 @@ | |||
| 36 | #define TLS13_RANDOM_OFFSET (TLS13_HM_OFFSET + 2) | 36 | #define TLS13_RANDOM_OFFSET (TLS13_HM_OFFSET + 2) |
| 37 | #define TLS13_SESSION_OFFSET (TLS13_HM_OFFSET + 34) | 37 | #define TLS13_SESSION_OFFSET (TLS13_HM_OFFSET + 34) |
| 38 | #define TLS13_CIPHER_OFFSET (TLS13_HM_OFFSET + 69) | 38 | #define TLS13_CIPHER_OFFSET (TLS13_HM_OFFSET + 69) |
| 39 | #define TLS13_KEY_SHARE_OFFSET (TLS13_HM_OFFSET + 198) | 39 | #define TLS13_KEY_SHARE_OFFSET (TLS13_HM_OFFSET + 200) |
| 40 | #define TLS13_ONLY_KEY_SHARE_OFFSET (TLS13_HM_OFFSET + 112) | 40 | #define TLS13_ONLY_KEY_SHARE_OFFSET (TLS13_HM_OFFSET + 114) |
| 41 | 41 | ||
| 42 | #define TLS1_3_VERSION_ONLY (TLS1_3_VERSION | 0x10000) | 42 | #define TLS1_3_VERSION_ONLY (TLS1_3_VERSION | 0x10000) |
| 43 | 43 | ||
| @@ -265,8 +265,8 @@ static const uint8_t cipher_list_tls13_chacha[] = { | |||
| 265 | }; | 265 | }; |
| 266 | 266 | ||
| 267 | static const uint8_t client_hello_tls13[] = { | 267 | static const uint8_t client_hello_tls13[] = { |
| 268 | 0x16, 0x03, 0x03, 0x01, 0x10, 0x01, 0x00, 0x01, | 268 | 0x16, 0x03, 0x03, 0x05, 0xd6, 0x01, 0x00, 0x05, |
| 269 | 0x0c, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, | 269 | 0xd2, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 270 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 270 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 271 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 271 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 272 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 272 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| @@ -286,20 +286,173 @@ static const uint8_t client_hello_tls13[] = { | |||
| 286 | 0x00, 0x45, 0x00, 0x9c, 0x00, 0x3c, 0x00, 0x2f, | 286 | 0x00, 0x45, 0x00, 0x9c, 0x00, 0x3c, 0x00, 0x2f, |
| 287 | 0x00, 0xba, 0x00, 0x41, 0xc0, 0x11, 0xc0, 0x07, | 287 | 0x00, 0xba, 0x00, 0x41, 0xc0, 0x11, 0xc0, 0x07, |
| 288 | 0x00, 0x05, 0xc0, 0x12, 0xc0, 0x08, 0x00, 0x16, | 288 | 0x00, 0x05, 0xc0, 0x12, 0xc0, 0x08, 0x00, 0x16, |
| 289 | 0x00, 0x0a, 0x01, 0x00, 0x00, 0x67, 0x00, 0x2b, | 289 | 0x00, 0x0a, 0x01, 0x00, 0x05, 0x2d, 0x00, 0x2b, |
| 290 | 0x00, 0x05, 0x04, 0x03, 0x04, 0x03, 0x03, 0x00, | 290 | 0x00, 0x05, 0x04, 0x03, 0x04, 0x03, 0x03, 0x00, |
| 291 | 0x0a, 0x00, 0x0a, 0x00, 0x08, 0x00, 0x1d, 0x00, | 291 | 0x0a, 0x00, 0x0c, 0x00, 0x0a, 0x11, 0xec, 0x00, |
| 292 | 0x17, 0x00, 0x18, 0x00, 0x19, 0x00, 0x33, 0x00, | 292 | 0x1d, 0x00, 0x17, 0x00, 0x18, 0x00, 0x19, 0x00, |
| 293 | 0x26, 0x00, 0x24, 0x00, 0x1d, 0x00, 0x20, 0x00, | 293 | 0x33, 0x04, 0xea, 0x04, 0xe8, 0x11, 0xec, 0x04, |
| 294 | 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 294 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 295 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 295 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 296 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 296 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 297 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 297 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 298 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 298 | 0x0b, 0x00, 0x02, 0x01, 0x00, 0x00, 0x23, 0x00, | 299 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 299 | 0x00, 0x00, 0x0d, 0x00, 0x18, 0x00, 0x16, 0x08, | 300 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 300 | 0x06, 0x06, 0x01, 0x06, 0x03, 0x08, 0x05, 0x05, | 301 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 301 | 0x01, 0x05, 0x03, 0x08, 0x04, 0x04, 0x01, 0x04, | 302 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 302 | 0x03, 0x02, 0x01, 0x02, 0x03, | 303 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 304 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 305 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 306 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 307 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 308 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 309 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 310 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 311 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 312 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 313 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 314 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 315 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 316 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 317 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 318 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 319 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 320 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 321 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 322 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 323 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 324 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 325 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 326 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 327 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 328 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 329 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 330 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 331 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 332 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 333 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 334 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 335 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 336 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 337 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 338 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 339 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 340 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 341 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 342 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 343 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 344 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 345 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 346 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 347 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 348 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 349 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 350 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 351 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 352 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 353 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 354 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 355 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 356 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 357 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 358 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 359 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 360 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 361 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 362 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 363 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 364 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 365 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 366 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 367 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 368 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 369 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 370 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 371 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 372 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 373 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 374 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 375 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 376 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 377 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 378 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 379 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 380 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 381 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 382 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 383 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 384 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 385 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 386 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 387 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 388 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 389 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 390 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 391 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 392 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 393 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 394 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 395 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 396 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 397 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 398 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 399 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 400 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 401 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 402 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 403 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 404 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 405 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 406 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 407 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 408 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 409 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 410 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 411 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 412 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 413 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 414 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 415 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 416 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 417 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 418 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 419 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 420 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 421 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 422 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 423 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 424 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 425 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 426 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 427 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 428 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 429 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 430 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 431 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 432 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 433 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 434 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 435 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 436 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 437 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 438 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 439 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 440 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 441 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 442 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 443 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 444 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 445 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 446 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 447 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 448 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 449 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 450 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, | ||
| 451 | 0x02, 0x01, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, | ||
| 452 | 0x0d, 0x00, 0x18, 0x00, 0x16, 0x08, 0x06, 0x06, | ||
| 453 | 0x01, 0x06, 0x03, 0x08, 0x05, 0x05, 0x01, 0x05, | ||
| 454 | 0x03, 0x08, 0x04, 0x04, 0x01, 0x04, 0x03, 0x02, | ||
| 455 | 0x01, 0x02, 0x03, | ||
| 303 | }; | 456 | }; |
| 304 | 457 | ||
| 305 | static const uint8_t cipher_list_tls13_only_aes[] = { | 458 | static const uint8_t cipher_list_tls13_only_aes[] = { |
| @@ -311,8 +464,8 @@ static const uint8_t cipher_list_tls13_only_chacha[] = { | |||
| 311 | }; | 464 | }; |
| 312 | 465 | ||
| 313 | static const uint8_t client_hello_tls13_only[] = { | 466 | static const uint8_t client_hello_tls13_only[] = { |
| 314 | 0x16, 0x03, 0x03, 0x00, 0xb6, 0x01, 0x00, 0x00, | 467 | 0x16, 0x03, 0x03, 0x05, 0x7c, 0x01, 0x00, 0x05, |
| 315 | 0xb2, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, | 468 | 0x78, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 316 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 469 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 317 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 470 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 318 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 471 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| @@ -322,19 +475,172 @@ static const uint8_t client_hello_tls13_only[] = { | |||
| 322 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 475 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 323 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x13, 0x03, | 476 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x13, 0x03, |
| 324 | 0x13, 0x02, 0x13, 0x01, 0x00, 0xff, 0x01, 0x00, | 477 | 0x13, 0x02, 0x13, 0x01, 0x00, 0xff, 0x01, 0x00, |
| 325 | 0x00, 0x61, 0x00, 0x2b, 0x00, 0x03, 0x02, 0x03, | 478 | 0x05, 0x27, 0x00, 0x2b, 0x00, 0x03, 0x02, 0x03, |
| 326 | 0x04, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x08, 0x00, | 479 | 0x04, 0x00, 0x0a, 0x00, 0x0c, 0x00, 0x0a, 0x11, |
| 327 | 0x1d, 0x00, 0x17, 0x00, 0x18, 0x00, 0x19, 0x00, | 480 | 0xec, 0x00, 0x1d, 0x00, 0x17, 0x00, 0x18, 0x00, |
| 328 | 0x33, 0x00, 0x26, 0x00, 0x24, 0x00, 0x1d, 0x00, | 481 | 0x19, 0x00, 0x33, 0x04, 0xea, 0x04, 0xe8, 0x11, |
| 329 | 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 482 | 0xec, 0x04, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 330 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 483 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 331 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 484 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 332 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 485 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 333 | 0x00, 0x00, 0x0b, 0x00, 0x02, 0x01, 0x00, 0x00, | 486 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 334 | 0x23, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x14, 0x00, | 487 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 335 | 0x12, 0x08, 0x06, 0x06, 0x01, 0x06, 0x03, 0x08, | 488 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 336 | 0x05, 0x05, 0x01, 0x05, 0x03, 0x08, 0x04, 0x04, | 489 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 337 | 0x01, 0x04, 0x03, | 490 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 491 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 492 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 493 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 494 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 495 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 496 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 497 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 498 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 499 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 500 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 501 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 502 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 503 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 504 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 505 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 506 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 507 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 508 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 509 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 510 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 511 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 512 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 513 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 514 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 515 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 516 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 517 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 518 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 519 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 520 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 521 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 522 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 523 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 524 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 525 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 526 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 527 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 528 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 529 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 530 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 531 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 532 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 533 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 534 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 535 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 536 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 537 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 538 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 539 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 540 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 541 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 542 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 543 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 544 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 545 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 546 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 547 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 548 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 549 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 550 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 551 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 552 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 553 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 554 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 555 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 556 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 557 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 558 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 559 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 560 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 561 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 562 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 563 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 564 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 565 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 566 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 567 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 568 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 569 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 570 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 571 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 572 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 573 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 574 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 575 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 576 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 577 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 578 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 579 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 580 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 581 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 582 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 583 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 584 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 585 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 586 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 587 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 588 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 589 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 590 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 591 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 592 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 593 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 594 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 595 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 596 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 597 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 598 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 599 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 600 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 601 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 602 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 603 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 604 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 605 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 606 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 607 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 608 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 609 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 610 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 611 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 612 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 613 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 614 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 615 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 616 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 617 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 618 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 619 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 620 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 621 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 622 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 623 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 624 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 625 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 626 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 627 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 628 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 629 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 630 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 631 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 632 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 633 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 634 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 635 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 636 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 637 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 638 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 639 | 0x0b, 0x00, 0x02, 0x01, 0x00, 0x00, 0x23, 0x00, | ||
| 640 | 0x00, 0x00, 0x0d, 0x00, 0x14, 0x00, 0x12, 0x08, | ||
| 641 | 0x06, 0x06, 0x01, 0x06, 0x03, 0x08, 0x05, 0x05, | ||
| 642 | 0x01, 0x05, 0x03, 0x08, 0x04, 0x04, 0x01, 0x04, | ||
| 643 | 0x03, | ||
| 338 | }; | 644 | }; |
| 339 | 645 | ||
| 340 | struct client_hello_test { | 646 | struct client_hello_test { |
| @@ -702,7 +1008,7 @@ client_hello_test(int testno, const struct client_hello_test *cht) | |||
| 702 | memset(&wbuf[cht->session_start + 1], 0, session_len); | 1008 | memset(&wbuf[cht->session_start + 1], 0, session_len); |
| 703 | } | 1009 | } |
| 704 | if (cht->key_share_start > 0) | 1010 | if (cht->key_share_start > 0) |
| 705 | memset(&wbuf[cht->key_share_start], 0, 32); | 1011 | memset(&wbuf[cht->key_share_start], 0, 1252); |
| 706 | 1012 | ||
| 707 | if (memcmp(client_hello, wbuf, client_hello_len) != 0) { | 1013 | if (memcmp(client_hello, wbuf, client_hello_len) != 0) { |
| 708 | fprintf(stderr, "FAIL: ClientHello differs:\n"); | 1014 | fprintf(stderr, "FAIL: ClientHello differs:\n"); |
diff --git a/src/regress/lib/libssl/interop/Makefile b/src/regress/lib/libssl/interop/Makefile index bdc67f627a..e1e9633d37 100644 --- a/src/regress/lib/libssl/interop/Makefile +++ b/src/regress/lib/libssl/interop/Makefile | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.21 2025/01/15 10:54:17 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.23 2025/07/25 16:33:15 tb Exp $ |
| 2 | 2 | ||
| 3 | SUBDIR = libressl openssl33 openssl34 | 3 | SUBDIR = libressl openssl35 |
| 4 | 4 | ||
| 5 | # the above binaries must have been built before we can continue | 5 | # the above binaries must have been built before we can continue |
| 6 | SUBDIR += netcat | 6 | SUBDIR += netcat |
diff --git a/src/regress/lib/libssl/interop/botan/Makefile b/src/regress/lib/libssl/interop/botan/Makefile index 85877d4290..56bcdaf4bd 100644 --- a/src/regress/lib/libssl/interop/botan/Makefile +++ b/src/regress/lib/libssl/interop/botan/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.10 2025/01/15 10:54:17 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.12 2025/07/25 16:33:15 tb Exp $ |
| 2 | 2 | ||
| 3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> |
| 4 | 4 | ||
| @@ -20,11 +20,8 @@ CXX = /usr/local/bin/eg++ | |||
| 20 | .endif | 20 | .endif |
| 21 | 21 | ||
| 22 | LIBRARIES = libressl | 22 | LIBRARIES = libressl |
| 23 | .if exists(/usr/local/bin/eopenssl33) | 23 | .if exists(/usr/local/bin/eopenssl35) |
| 24 | LIBRARIES += openssl33 | 24 | LIBRARIES += openssl35 |
| 25 | .endif | ||
| 26 | .if exists(/usr/local/bin/eopenssl34) | ||
| 27 | LIBRARIES += openssl34 | ||
| 28 | .endif | 25 | .endif |
| 29 | 26 | ||
| 30 | PROGS = client | 27 | PROGS = client |
diff --git a/src/regress/lib/libssl/interop/cert/Makefile b/src/regress/lib/libssl/interop/cert/Makefile index 74c63c86a8..9698c56acd 100644 --- a/src/regress/lib/libssl/interop/cert/Makefile +++ b/src/regress/lib/libssl/interop/cert/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.14 2025/01/15 10:54:17 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.16 2025/07/25 16:33:15 tb Exp $ |
| 2 | 2 | ||
| 3 | # Connect a client to a server. Both can be current libressl, or | 3 | # Connect a client to a server. Both can be current libressl, or |
| 4 | # openssl 3.x. Create client and server certificates | 4 | # openssl 3.x. Create client and server certificates |
| @@ -7,11 +7,8 @@ | |||
| 7 | # and check the result of certificate verification. | 7 | # and check the result of certificate verification. |
| 8 | 8 | ||
| 9 | LIBRARIES = libressl | 9 | LIBRARIES = libressl |
| 10 | .if exists(/usr/local/bin/eopenssl33) | 10 | .if exists(/usr/local/bin/eopenssl35) |
| 11 | LIBRARIES += openssl33 | 11 | LIBRARIES += openssl35 |
| 12 | .endif | ||
| 13 | .if exists(/usr/local/bin/eopenssl34) | ||
| 14 | LIBRARIES += openssl34 | ||
| 15 | .endif | 12 | .endif |
| 16 | 13 | ||
| 17 | .for cca in noca ca fakeca | 14 | .for cca in noca ca fakeca |
diff --git a/src/regress/lib/libssl/interop/cipher/Makefile b/src/regress/lib/libssl/interop/cipher/Makefile index fa7e25f9ee..5bdc9089fe 100644 --- a/src/regress/lib/libssl/interop/cipher/Makefile +++ b/src/regress/lib/libssl/interop/cipher/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.17 2025/01/15 10:54:17 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.19 2025/07/25 16:33:15 tb Exp $ |
| 2 | 2 | ||
| 3 | # Connect a client to a server. Both can be current libressl, or | 3 | # Connect a client to a server. Both can be current libressl, or |
| 4 | # openssl 1.1 or 3.0. Create lists of supported ciphers | 4 | # openssl 1.1 or 3.0. Create lists of supported ciphers |
| @@ -7,11 +7,8 @@ | |||
| 7 | # have used correct cipher by grepping in their session print out. | 7 | # have used correct cipher by grepping in their session print out. |
| 8 | 8 | ||
| 9 | LIBRARIES = libressl | 9 | LIBRARIES = libressl |
| 10 | .if exists(/usr/local/bin/eopenssl33) | 10 | .if exists(/usr/local/bin/eopenssl35) |
| 11 | LIBRARIES += openssl33 | 11 | LIBRARIES += openssl35 |
| 12 | .endif | ||
| 13 | .if exists(/usr/local/bin/eopenssl34) | ||
| 14 | LIBRARIES += openssl34 | ||
| 15 | .endif | 12 | .endif |
| 16 | 13 | ||
| 17 | CLEANFILES = *.tmp *.ciphers ciphers.mk | 14 | CLEANFILES = *.tmp *.ciphers ciphers.mk |
| @@ -41,8 +38,7 @@ client-${clib}-server-${slib}.ciphers: \ | |||
| 41 | uniq -d <$@.tmp >$@ | 38 | uniq -d <$@.tmp >$@ |
| 42 | # we are only interested in ciphers supported by libressl | 39 | # we are only interested in ciphers supported by libressl |
| 43 | sort $@ client-libressl.ciphers >$@.tmp | 40 | sort $@ client-libressl.ciphers >$@.tmp |
| 44 | . if "${clib}" == "openssl33" || "${slib}" == "openssl33" || \ | 41 | . if "${clib}" == "openssl35" || "${slib}" == "openssl35" |
| 45 | "${clib}" == "openssl34" || "${slib}" == "openssl34" | ||
| 46 | # OpenSSL's SSL_CTX_set_cipher_list doesn't accept TLSv1.3 ciphers | 42 | # OpenSSL's SSL_CTX_set_cipher_list doesn't accept TLSv1.3 ciphers |
| 47 | sed -i '/^TLS_/d' $@.tmp | 43 | sed -i '/^TLS_/d' $@.tmp |
| 48 | . endif | 44 | . endif |
| @@ -70,8 +66,7 @@ regress: ciphers.mk | |||
| 70 | .endif | 66 | .endif |
| 71 | 67 | ||
| 72 | LEVEL_libressl = | 68 | LEVEL_libressl = |
| 73 | LEVEL_openssl33 = ,@SECLEVEL=0 | 69 | LEVEL_openssl35 = ,@SECLEVEL=0 |
| 74 | LEVEL_openssl34 = ,@SECLEVEL=0 | ||
| 75 | 70 | ||
| 76 | .for clib in ${LIBRARIES} | 71 | .for clib in ${LIBRARIES} |
| 77 | .for slib in ${LIBRARIES} | 72 | .for slib in ${LIBRARIES} |
| @@ -132,7 +127,7 @@ check-cipher-${cipher}-client-${clib}-server-${slib}: \ | |||
| 132 | . endif | 127 | . endif |
| 133 | . if "${clib}" == "libressl" | 128 | . if "${clib}" == "libressl" |
| 134 | # libressl client may prefer chacha-poly if aes-ni is not supported | 129 | # libressl client may prefer chacha-poly if aes-ni is not supported |
| 135 | . if "${slib}" == "openssl33" || "${slib}" == "openssl34" | 130 | . if "${slib}" == "openssl35" |
| 136 | egrep -q ' Cipher *: TLS_(AES_256_GCM_SHA384|CHACHA20_POLY1305_SHA256)$$' ${@:S/^check/server/}.out | 131 | egrep -q ' Cipher *: TLS_(AES_256_GCM_SHA384|CHACHA20_POLY1305_SHA256)$$' ${@:S/^check/server/}.out |
| 137 | . else | 132 | . else |
| 138 | egrep -q ' Cipher *: TLS_(AES_256_GCM_SHA384|CHACHA20_POLY1305_SHA256)$$' ${@:S/^check/server/}.out | 133 | egrep -q ' Cipher *: TLS_(AES_256_GCM_SHA384|CHACHA20_POLY1305_SHA256)$$' ${@:S/^check/server/}.out |
diff --git a/src/regress/lib/libssl/interop/netcat/Makefile b/src/regress/lib/libssl/interop/netcat/Makefile index 3b8e3f95be..cff6b7ea76 100644 --- a/src/regress/lib/libssl/interop/netcat/Makefile +++ b/src/regress/lib/libssl/interop/netcat/Makefile | |||
| @@ -1,11 +1,8 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.10 2025/01/15 10:54:17 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.12 2025/07/25 16:33:15 tb Exp $ |
| 2 | 2 | ||
| 3 | LIBRARIES = libressl | 3 | LIBRARIES = libressl |
| 4 | .if exists(/usr/local/bin/eopenssl33) | 4 | .if exists(/usr/local/bin/eopenssl35) |
| 5 | LIBRARIES += openssl33 | 5 | LIBRARIES += openssl35 |
| 6 | .endif | ||
| 7 | .if exists(/usr/local/bin/eopenssl34) | ||
| 8 | LIBRARIES += openssl34 | ||
| 9 | .endif | 6 | .endif |
| 10 | 7 | ||
| 11 | # run netcat server and connect with test client | 8 | # run netcat server and connect with test client |
diff --git a/src/regress/lib/libssl/interop/openssl33/Makefile b/src/regress/lib/libssl/interop/openssl33/Makefile deleted file mode 100644 index eff61704d0..0000000000 --- a/src/regress/lib/libssl/interop/openssl33/Makefile +++ /dev/null | |||
| @@ -1,44 +0,0 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.1 2025/01/15 10:54:17 tb Exp $ | ||
| 2 | |||
| 3 | .if ! exists(/usr/local/bin/eopenssl33) | ||
| 4 | regress: | ||
| 5 | # install openssl-3.3 from ports for interop tests | ||
| 6 | @echo 'Run "pkg_add openssl--%3.3" to run tests against OpenSSL 3.3' | ||
| 7 | @echo SKIPPED | ||
| 8 | .else | ||
| 9 | |||
| 10 | PROGS = client server | ||
| 11 | CFLAGS += -DOPENSSL_SUPPRESS_DEPRECATED | ||
| 12 | CPPFLAGS = -I /usr/local/include/eopenssl33 | ||
| 13 | LDFLAGS = -L /usr/local/lib/eopenssl33 | ||
| 14 | LDADD = -lssl -lcrypto | ||
| 15 | DPADD = /usr/local/lib/eopenssl33/libssl.a \ | ||
| 16 | /usr/local/lib/eopenssl33/libcrypto.a | ||
| 17 | LD_LIBRARY_PATH = /usr/local/lib/eopenssl33 | ||
| 18 | REGRESS_TARGETS = run-self-client-server | ||
| 19 | .for p in ${PROGS} | ||
| 20 | REGRESS_TARGETS += run-ldd-$p run-version-$p run-protocol-$p | ||
| 21 | .endfor | ||
| 22 | |||
| 23 | .for p in ${PROGS} | ||
| 24 | |||
| 25 | run-ldd-$p: ldd-$p.out | ||
| 26 | # check that $p is linked with OpenSSL 3.3 | ||
| 27 | grep -q /usr/local/lib/eopenssl33/libcrypto.so ldd-$p.out | ||
| 28 | grep -q /usr/local/lib/eopenssl33/libssl.so ldd-$p.out | ||
| 29 | # check that $p is not linked with LibreSSL | ||
| 30 | ! grep -v libc.so ldd-$p.out | grep /usr/lib/ | ||
| 31 | |||
| 32 | run-version-$p: $p-self.out | ||
| 33 | # check that runtime version is OpenSSL 3.3 | ||
| 34 | grep 'SSLEAY_VERSION: OpenSSL 3.3' $p-self.out | ||
| 35 | |||
| 36 | run-protocol-$p: $p-self.out | ||
| 37 | # check that OpenSSL 3.3 protocol version is TLS 1.3 | ||
| 38 | grep 'Protocol *: TLSv1.3' $p-self.out | ||
| 39 | |||
| 40 | .endfor | ||
| 41 | |||
| 42 | .endif # exists(/usr/local/bin/eopenssl33) | ||
| 43 | |||
| 44 | .include <bsd.regress.mk> | ||
diff --git a/src/regress/lib/libssl/interop/openssl34/Makefile b/src/regress/lib/libssl/interop/openssl34/Makefile deleted file mode 100644 index 72246bb621..0000000000 --- a/src/regress/lib/libssl/interop/openssl34/Makefile +++ /dev/null | |||
| @@ -1,44 +0,0 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.1 2025/01/15 10:54:17 tb Exp $ | ||
| 2 | |||
| 3 | .if ! exists(/usr/local/bin/eopenssl34) | ||
| 4 | regress: | ||
| 5 | # install openssl-3.4 from ports for interop tests | ||
| 6 | @echo 'Run "pkg_add openssl--%3.4" to run tests against OpenSSL 3.4' | ||
| 7 | @echo SKIPPED | ||
| 8 | .else | ||
| 9 | |||
| 10 | PROGS = client server | ||
| 11 | CFLAGS += -DOPENSSL_SUPPRESS_DEPRECATED | ||
| 12 | CPPFLAGS = -I /usr/local/include/eopenssl34 | ||
| 13 | LDFLAGS = -L /usr/local/lib/eopenssl34 | ||
| 14 | LDADD = -lssl -lcrypto | ||
| 15 | DPADD = /usr/local/lib/eopenssl34/libssl.a \ | ||
| 16 | /usr/local/lib/eopenssl34/libcrypto.a | ||
| 17 | LD_LIBRARY_PATH = /usr/local/lib/eopenssl34 | ||
| 18 | REGRESS_TARGETS = run-self-client-server | ||
| 19 | .for p in ${PROGS} | ||
| 20 | REGRESS_TARGETS += run-ldd-$p run-version-$p run-protocol-$p | ||
| 21 | .endfor | ||
| 22 | |||
| 23 | .for p in ${PROGS} | ||
| 24 | |||
| 25 | run-ldd-$p: ldd-$p.out | ||
| 26 | # check that $p is linked with OpenSSL 3.4 | ||
| 27 | grep -q /usr/local/lib/eopenssl34/libcrypto.so ldd-$p.out | ||
| 28 | grep -q /usr/local/lib/eopenssl34/libssl.so ldd-$p.out | ||
| 29 | # check that $p is not linked with LibreSSL | ||
| 30 | ! grep -v libc.so ldd-$p.out | grep /usr/lib/ | ||
| 31 | |||
| 32 | run-version-$p: $p-self.out | ||
| 33 | # check that runtime version is OpenSSL 3.4 | ||
| 34 | grep 'SSLEAY_VERSION: OpenSSL 3.4' $p-self.out | ||
| 35 | |||
| 36 | run-protocol-$p: $p-self.out | ||
| 37 | # check that OpenSSL 3.4 protocol version is TLS 1.3 | ||
| 38 | grep 'Protocol *: TLSv1.3' $p-self.out | ||
| 39 | |||
| 40 | .endfor | ||
| 41 | |||
| 42 | .endif # exists(/usr/local/bin/eopenssl34) | ||
| 43 | |||
| 44 | .include <bsd.regress.mk> | ||
diff --git a/src/regress/lib/libssl/interop/openssl35/Makefile b/src/regress/lib/libssl/interop/openssl35/Makefile new file mode 100644 index 0000000000..e11ad5dd20 --- /dev/null +++ b/src/regress/lib/libssl/interop/openssl35/Makefile | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.1 2025/07/09 17:48:02 tb Exp $ | ||
| 2 | |||
| 3 | .if ! exists(/usr/local/bin/eopenssl35) | ||
| 4 | regress: | ||
| 5 | # install openssl-3.5 from ports for interop tests | ||
| 6 | @echo 'Run "pkg_add openssl--%3.5" to run tests against OpenSSL 3.5' | ||
| 7 | @echo SKIPPED | ||
| 8 | .else | ||
| 9 | |||
| 10 | PROGS = client server | ||
| 11 | CFLAGS += -DOPENSSL_SUPPRESS_DEPRECATED | ||
| 12 | CPPFLAGS = -I /usr/local/include/eopenssl35 | ||
| 13 | LDFLAGS = -L /usr/local/lib/eopenssl35 | ||
| 14 | LDADD = -lssl -lcrypto | ||
| 15 | DPADD = /usr/local/lib/eopenssl35/libssl.a \ | ||
| 16 | /usr/local/lib/eopenssl35/libcrypto.a | ||
| 17 | LD_LIBRARY_PATH = /usr/local/lib/eopenssl35 | ||
| 18 | REGRESS_TARGETS = run-self-client-server | ||
| 19 | .for p in ${PROGS} | ||
| 20 | REGRESS_TARGETS += run-ldd-$p run-version-$p run-protocol-$p | ||
| 21 | .endfor | ||
| 22 | |||
| 23 | .for p in ${PROGS} | ||
| 24 | |||
| 25 | run-ldd-$p: ldd-$p.out | ||
| 26 | # check that $p is linked with OpenSSL 3.5 | ||
| 27 | grep -q /usr/local/lib/eopenssl35/libcrypto.so ldd-$p.out | ||
| 28 | grep -q /usr/local/lib/eopenssl35/libssl.so ldd-$p.out | ||
| 29 | # check that $p is not linked with LibreSSL | ||
| 30 | ! grep -v -e libc.so -e libpthread.so ldd-$p.out | grep /usr/lib/ | ||
| 31 | |||
| 32 | run-version-$p: $p-self.out | ||
| 33 | # check that runtime version is OpenSSL 3.5 | ||
| 34 | grep 'SSLEAY_VERSION: OpenSSL 3.5' $p-self.out | ||
| 35 | |||
| 36 | run-protocol-$p: $p-self.out | ||
| 37 | # check that OpenSSL 3.5 protocol version is TLS 1.3 | ||
| 38 | grep 'Protocol *: TLSv1.3' $p-self.out | ||
| 39 | |||
| 40 | .endfor | ||
| 41 | |||
| 42 | .endif # exists(/usr/local/bin/eopenssl35) | ||
| 43 | |||
| 44 | .include <bsd.regress.mk> | ||
diff --git a/src/regress/lib/libssl/interop/session/Makefile b/src/regress/lib/libssl/interop/session/Makefile index e9a353f99e..fff66b169b 100644 --- a/src/regress/lib/libssl/interop/session/Makefile +++ b/src/regress/lib/libssl/interop/session/Makefile | |||
| @@ -1,11 +1,8 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.12 2025/01/15 10:54:17 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.14 2025/07/25 16:33:15 tb Exp $ |
| 2 | 2 | ||
| 3 | LIBRARIES = libressl | 3 | LIBRARIES = libressl |
| 4 | .if exists(/usr/local/bin/eopenssl33) | 4 | .if exists(/usr/local/bin/eopenssl35) |
| 5 | #LIBRARIES += openssl33 | 5 | #LIBRARIES += openssl35 |
| 6 | .endif | ||
| 7 | .if exists(/usr/local/bin/eopenssl34) | ||
| 8 | #LIBRARIES += openssl34 | ||
| 9 | .endif | 6 | .endif |
| 10 | 7 | ||
| 11 | run-session-client-libressl-server-libressl: | 8 | run-session-client-libressl-server-libressl: |
diff --git a/src/regress/lib/libssl/interop/version/Makefile b/src/regress/lib/libssl/interop/version/Makefile index 605fba252f..5ee7d4c4f3 100644 --- a/src/regress/lib/libssl/interop/version/Makefile +++ b/src/regress/lib/libssl/interop/version/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.10 2025/01/15 10:54:17 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.12 2025/07/25 16:33:15 tb Exp $ |
| 2 | 2 | ||
| 3 | # Connect a client to a server. Both can be current libressl, or | 3 | # Connect a client to a server. Both can be current libressl, or |
| 4 | # openssl 1.1 or openssl 3.0. Pin client or server to a fixed TLS | 4 | # openssl 1.1 or openssl 3.0. Pin client or server to a fixed TLS |
| @@ -7,11 +7,8 @@ | |||
| 7 | # print out. | 7 | # print out. |
| 8 | 8 | ||
| 9 | LIBRARIES = libressl | 9 | LIBRARIES = libressl |
| 10 | .if exists(/usr/local/bin/eopenssl33) | 10 | .if exists(/usr/local/bin/eopenssl35) |
| 11 | LIBRARIES += openssl33 | 11 | LIBRARIES += openssl35 |
| 12 | .endif | ||
| 13 | .if exists(/usr/local/bin/eopenssl34) | ||
| 14 | LIBRARIES += openssl34 | ||
| 15 | .endif | 12 | .endif |
| 16 | 13 | ||
| 17 | VERSIONS = any TLS1_2 TLS1_3 | 14 | VERSIONS = any TLS1_2 TLS1_3 |
| @@ -29,8 +26,7 @@ FAIL_${cver}_${sver} = ! | |||
| 29 | .for slib in ${LIBRARIES} | 26 | .for slib in ${LIBRARIES} |
| 30 | 27 | ||
| 31 | .if ("${cver}" != TLS1_3 && "${sver}" != TLS1_3) && \ | 28 | .if ("${cver}" != TLS1_3 && "${sver}" != TLS1_3) && \ |
| 32 | ((("${clib}" != openssl33 && "${slib}" != openssl33)) || \ | 29 | ((("${clib}" != openssl35 && "${slib}" != openssl35)) || \ |
| 33 | (("${clib}" != openssl34 && "${slib}" != openssl34)) || \ | ||
| 34 | (("${cver}" != any && "${sver}" != any) && \ | 30 | (("${cver}" != any && "${sver}" != any) && \ |
| 35 | ("${cver}" != TLS1 && "${sver}" != TLS1) && \ | 31 | ("${cver}" != TLS1 && "${sver}" != TLS1) && \ |
| 36 | ("${cver}" != TLS1_1 && "${sver}" != TLS1_1))) | 32 | ("${cver}" != TLS1_1 && "${sver}" != TLS1_1))) |
diff --git a/src/regress/lib/libssl/openssl-ruby/Makefile b/src/regress/lib/libssl/openssl-ruby/Makefile index af8083f662..19d2f2fc40 100644 --- a/src/regress/lib/libssl/openssl-ruby/Makefile +++ b/src/regress/lib/libssl/openssl-ruby/Makefile | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.14 2024/08/31 11:14:58 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.17 2025/06/27 03:32:08 tb Exp $ |
| 2 | 2 | ||
| 3 | OPENSSL_RUBY_TESTS = /usr/local/share/openssl-ruby-tests | 3 | OPENSSL_RUBY_TESTS = /usr/local/share/openssl-ruby-tests |
| 4 | .if exists(/usr/local/bin/ruby32) | 4 | .if exists(/usr/local/bin/ruby33) |
| 5 | RUBY_BINREV = 32 | ||
| 6 | .else | ||
| 7 | RUBY_BINREV = 33 | 5 | RUBY_BINREV = 33 |
| 6 | .else | ||
| 7 | RUBY_BINREV = 34 | ||
| 8 | .endif | 8 | .endif |
| 9 | RUBY = ruby${RUBY_BINREV} | 9 | RUBY = ruby${RUBY_BINREV} |
| 10 | 10 | ||
| @@ -71,6 +71,21 @@ ${_t}: ${_BUILD_COOKIE} | |||
| 71 | -n ${_t} | 71 | -n ${_t} |
| 72 | .endfor | 72 | .endfor |
| 73 | 73 | ||
| 74 | # These tests can be a pain to run. To run a small set of individual | ||
| 75 | # ssl tests, set the test names separated by spaces in the environment | ||
| 76 | # variable RUBY_SSL_TEST_TARGETS - then you can type "make <test_name>" | ||
| 77 | # to run a single ruby ssl test. | ||
| 78 | .for _t in ${RUBY_SSL_TEST_TARGETS} | ||
| 79 | REGRESS_TARGETS += ${_t} | ||
| 80 | REGRESS_EXPECTED_FAILURES += ${_t} | ||
| 81 | ${_t}: ${_BUILD_COOKIE} | ||
| 82 | cd ${BUILDDIR} && \ | ||
| 83 | ${RUBY} -I. -I${OPENSSL_RUBY_TESTS}/test/openssl \ | ||
| 84 | -I${OPENSSL_RUBY_TESTS}/lib \ | ||
| 85 | ${OPENSSL_RUBY_TESTS}/test/openssl/test_ssl.rb \ | ||
| 86 | -n ${_t} | ||
| 87 | .endfor | ||
| 88 | |||
| 74 | CLEANFILES += ${_BUILD_COOKIE} ${_TEST_COOKIE} ${_BUILDDIR_COOKIE} | 89 | CLEANFILES += ${_BUILD_COOKIE} ${_TEST_COOKIE} ${_BUILDDIR_COOKIE} |
| 75 | 90 | ||
| 76 | . if make(clean) || make(cleandir) | 91 | . if make(clean) || make(cleandir) |
diff --git a/src/regress/lib/libssl/pqueue/Makefile b/src/regress/lib/libssl/pqueue/Makefile index 48c2cb7e61..05fe9a268d 100644 --- a/src/regress/lib/libssl/pqueue/Makefile +++ b/src/regress/lib/libssl/pqueue/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.1 2016/11/04 19:45:12 jsing Exp $ | 1 | # $OpenBSD: Makefile,v 1.2 2025/05/04 11:04:02 tb Exp $ |
| 2 | 2 | ||
| 3 | PROG= pq_test | 3 | PROG= pq_test |
| 4 | SRC= ${.CURDIR}/../../../../lib/libssl | 4 | SRC= ${.CURDIR}/../../../../lib/libssl |
| @@ -9,9 +9,4 @@ DPADD= ${LIBSSL} ${LIBCRYPTO} | |||
| 9 | WARNINGS= Yes | 9 | WARNINGS= Yes |
| 10 | CFLAGS+= -DLIBRESSL_INTERNAL -Werror | 10 | CFLAGS+= -DLIBRESSL_INTERNAL -Werror |
| 11 | 11 | ||
| 12 | REGRESS_TARGETS= regress-pq_test | ||
| 13 | |||
| 14 | regress-pq_test: ${PROG} | ||
| 15 | ${.OBJDIR}/pq_test | cmp -s ${.CURDIR}/expected.txt /dev/stdin | ||
| 16 | |||
| 17 | .include <bsd.regress.mk> | 12 | .include <bsd.regress.mk> |
diff --git a/src/regress/lib/libssl/pqueue/expected.txt b/src/regress/lib/libssl/pqueue/expected.txt deleted file mode 100644 index c59d6cd838..0000000000 --- a/src/regress/lib/libssl/pqueue/expected.txt +++ /dev/null | |||
| @@ -1,3 +0,0 @@ | |||
| 1 | item 6966726167696c69 | ||
| 2 | item 7374696365787069 | ||
| 3 | item 737570657263616c | ||
diff --git a/src/regress/lib/libssl/pqueue/pq_test.c b/src/regress/lib/libssl/pqueue/pq_test.c index a078ba5366..822fdea961 100644 --- a/src/regress/lib/libssl/pqueue/pq_test.c +++ b/src/regress/lib/libssl/pqueue/pq_test.c | |||
| @@ -59,60 +59,77 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
| 61 | #include <string.h> | 61 | #include <string.h> |
| 62 | |||
| 62 | #include "pqueue.h" | 63 | #include "pqueue.h" |
| 63 | 64 | ||
| 64 | /* remember to change expected.txt if you change these values */ | 65 | static const unsigned char *pq_expected[3] = { |
| 65 | unsigned char prio1[8] = "supercal"; | 66 | "ifragili", |
| 66 | unsigned char prio2[8] = "ifragili"; | 67 | "sticexpi", |
| 67 | unsigned char prio3[8] = "sticexpi"; | 68 | "supercal" |
| 69 | }; | ||
| 68 | 70 | ||
| 69 | static void | 71 | static int |
| 70 | pqueue_print(pqueue pq) | 72 | test_pqueue(void) |
| 71 | { | 73 | { |
| 72 | pitem *iter, *item; | 74 | const unsigned char *prio1 = pq_expected[2]; |
| 73 | 75 | const unsigned char *prio2 = pq_expected[0]; | |
| 74 | iter = pqueue_iterator(pq); | 76 | const unsigned char *prio3 = pq_expected[1]; |
| 75 | for (item = pqueue_next(&iter); item != NULL; | 77 | pqueue pq = NULL; |
| 76 | item = pqueue_next(&iter)) { | 78 | pitem *item = NULL; |
| 77 | printf("item\t%02x%02x%02x%02x%02x%02x%02x%02x\n", | 79 | pitem *iter = NULL; |
| 78 | item->priority[0], item->priority[1], | 80 | int i = 0; |
| 79 | item->priority[2], item->priority[3], | 81 | int failed = 1; |
| 80 | item->priority[4], item->priority[5], | ||
| 81 | item->priority[6], item->priority[7]); | ||
| 82 | } | ||
| 83 | } | ||
| 84 | 82 | ||
| 85 | int | 83 | if ((pq = pqueue_new()) == NULL) |
| 86 | main(void) | 84 | goto failure; |
| 87 | { | ||
| 88 | pitem *item; | ||
| 89 | pqueue pq; | ||
| 90 | 85 | ||
| 91 | pq = pqueue_new(); | 86 | if (!pqueue_insert(pq, pitem_new(prio3, NULL))) |
| 87 | goto failure; | ||
| 88 | if (!pqueue_insert(pq, pitem_new(prio1, NULL))) | ||
| 89 | goto failure; | ||
| 90 | if (!pqueue_insert(pq, pitem_new(prio2, NULL))) | ||
| 91 | goto failure; | ||
| 92 | 92 | ||
| 93 | item = pitem_new(prio3, NULL); | 93 | if (pqueue_size(pq) != 3) |
| 94 | pqueue_insert(pq, item); | 94 | goto failure; |
| 95 | 95 | ||
| 96 | item = pitem_new(prio1, NULL); | 96 | if ((item = pqueue_find(pq, prio1)) == NULL) |
| 97 | pqueue_insert(pq, item); | 97 | goto failure; |
| 98 | if ((item = pqueue_find(pq, prio2)) == NULL) | ||
| 99 | goto failure; | ||
| 100 | if ((item = pqueue_find(pq, prio3)) == NULL) | ||
| 101 | goto failure; | ||
| 98 | 102 | ||
| 99 | item = pitem_new(prio2, NULL); | 103 | if ((item = pqueue_peek(pq)) == NULL) |
| 100 | pqueue_insert(pq, item); | 104 | goto failure; |
| 101 | 105 | ||
| 102 | item = pqueue_find(pq, prio1); | 106 | if (memcmp(item->priority, pq_expected[0], 8)) |
| 103 | fprintf(stderr, "found %p\n", item->priority); | 107 | goto failure; |
| 104 | 108 | ||
| 105 | item = pqueue_find(pq, prio2); | 109 | iter = pqueue_iterator(pq); |
| 106 | fprintf(stderr, "found %p\n", item->priority); | 110 | for (item = pqueue_next(&iter); item != NULL; item = pqueue_next(&iter)) { |
| 111 | if (memcmp(item->priority, pq_expected[i], 8) != 0) | ||
| 112 | goto failure; | ||
| 113 | i++; | ||
| 114 | } | ||
| 107 | 115 | ||
| 108 | item = pqueue_find(pq, prio3); | 116 | failed = (i != 3); |
| 109 | fprintf(stderr, "found %p\n", item ? item->priority: 0); | ||
| 110 | 117 | ||
| 111 | pqueue_print(pq); | 118 | failure: |
| 112 | 119 | ||
| 113 | for (item = pqueue_pop(pq); item != NULL; item = pqueue_pop(pq)) | 120 | for (item = pqueue_pop(pq); item != NULL; item = pqueue_pop(pq)) |
| 114 | pitem_free(item); | 121 | pitem_free(item); |
| 115 | |||
| 116 | pqueue_free(pq); | 122 | pqueue_free(pq); |
| 117 | return 0; | 123 | |
| 124 | return failed; | ||
| 125 | } | ||
| 126 | |||
| 127 | int | ||
| 128 | main(void) | ||
| 129 | { | ||
| 130 | int failed = 0; | ||
| 131 | |||
| 132 | failed |= test_pqueue(); | ||
| 133 | |||
| 134 | return failed; | ||
| 118 | } | 135 | } |
diff --git a/src/regress/lib/libssl/tlsext/tlsexttest.c b/src/regress/lib/libssl/tlsext/tlsexttest.c index 4adf27421d..4c3701a63d 100644 --- a/src/regress/lib/libssl/tlsext/tlsexttest.c +++ b/src/regress/lib/libssl/tlsext/tlsexttest.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tlsexttest.c,v 1.92 2024/09/11 15:04:16 tb Exp $ */ | 1 | /* $OpenBSD: tlsexttest.c,v 1.95 2025/12/04 21:03:42 beck Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2017 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2017 Joel Sing <jsing@openbsd.org> |
| 4 | * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> | 4 | * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> |
| @@ -3665,7 +3665,7 @@ test_tlsext_keyshare_client(void) | |||
| 3665 | if ((ssl->s3->hs.key_share = | 3665 | if ((ssl->s3->hs.key_share = |
| 3666 | tls_key_share_new_nid(NID_X25519)) == NULL) | 3666 | tls_key_share_new_nid(NID_X25519)) == NULL) |
| 3667 | errx(1, "failed to create key share"); | 3667 | errx(1, "failed to create key share"); |
| 3668 | if (!tls_key_share_generate(ssl->s3->hs.key_share)) | 3668 | if (!tls_key_share_client_generate(ssl->s3->hs.key_share)) |
| 3669 | errx(1, "failed to generate key share"); | 3669 | errx(1, "failed to generate key share"); |
| 3670 | 3670 | ||
| 3671 | ssl->s3->hs.our_max_tls_version = TLS1_2_VERSION; | 3671 | ssl->s3->hs.our_max_tls_version = TLS1_2_VERSION; |
| @@ -3740,6 +3740,11 @@ test_tlsext_keyshare_client(void) | |||
| 3740 | FAIL("Did not select a key share"); | 3740 | FAIL("Did not select a key share"); |
| 3741 | goto done; | 3741 | goto done; |
| 3742 | } | 3742 | } |
| 3743 | if (tls_key_share_group(ssl->s3->hs.key_share) != 29) { | ||
| 3744 | FAIL("wrong key share group: got %d, expected 29\n", | ||
| 3745 | tls_key_share_group(ssl->s3->hs.key_share)); | ||
| 3746 | goto done; | ||
| 3747 | } | ||
| 3743 | 3748 | ||
| 3744 | /* | 3749 | /* |
| 3745 | * Pretend the client did not send the supported groups extension. We | 3750 | * Pretend the client did not send the supported groups extension. We |
| @@ -3885,14 +3890,14 @@ test_tlsext_keyshare_server(void) | |||
| 3885 | goto done; | 3890 | goto done; |
| 3886 | } | 3891 | } |
| 3887 | 3892 | ||
| 3888 | if (!tls_key_share_generate(ssl->s3->hs.key_share)) { | 3893 | if (!tls_key_share_server_generate(ssl->s3->hs.key_share)) { |
| 3889 | FAIL("failed to generate key share"); | 3894 | FAIL("failed to generate key share"); |
| 3890 | goto done; | 3895 | goto done; |
| 3891 | } | 3896 | } |
| 3892 | 3897 | ||
| 3893 | CBS_init(&cbs, bogokey, sizeof(bogokey)); | 3898 | CBS_init(&cbs, bogokey, sizeof(bogokey)); |
| 3894 | 3899 | ||
| 3895 | if (!tls_key_share_peer_public(ssl->s3->hs.key_share, &cbs, | 3900 | if (!tls_key_share_server_peer_public(ssl->s3->hs.key_share, &cbs, |
| 3896 | &decode_error, NULL)) { | 3901 | &decode_error, NULL)) { |
| 3897 | FAIL("failed to load peer public key\n"); | 3902 | FAIL("failed to load peer public key\n"); |
| 3898 | goto done; | 3903 | goto done; |
| @@ -3921,7 +3926,7 @@ test_tlsext_keyshare_server(void) | |||
| 3921 | FAIL("failed to create key share"); | 3926 | FAIL("failed to create key share"); |
| 3922 | goto done; | 3927 | goto done; |
| 3923 | } | 3928 | } |
| 3924 | if (!tls_key_share_generate(ssl->s3->hs.key_share)) { | 3929 | if (!tls_key_share_server_generate(ssl->s3->hs.key_share)) { |
| 3925 | FAIL("failed to generate key share"); | 3930 | FAIL("failed to generate key share"); |
| 3926 | goto done; | 3931 | goto done; |
| 3927 | } | 3932 | } |
| @@ -4542,12 +4547,10 @@ test_tlsext_valid_hostnames(void) | |||
| 4542 | #define N_TLSEXT_RANDOMIZATION_TESTS 1000 | 4547 | #define N_TLSEXT_RANDOMIZATION_TESTS 1000 |
| 4543 | 4548 | ||
| 4544 | static int | 4549 | static int |
| 4545 | test_tlsext_check_extension_order(SSL *ssl) | 4550 | test_tlsext_check_psk_is_last_extension(SSL *ssl) |
| 4546 | { | 4551 | { |
| 4547 | const struct tls_extension *ext; | 4552 | const struct tls_extension *ext; |
| 4548 | uint16_t type; | 4553 | uint16_t type; |
| 4549 | size_t alpn_idx, sni_idx; | ||
| 4550 | size_t i; | ||
| 4551 | 4554 | ||
| 4552 | if (ssl->tlsext_build_order_len == 0) { | 4555 | if (ssl->tlsext_build_order_len == 0) { |
| 4553 | FAIL("Unexpected zero build order length"); | 4556 | FAIL("Unexpected zero build order length"); |
| @@ -4560,34 +4563,6 @@ test_tlsext_check_extension_order(SSL *ssl) | |||
| 4560 | return 1; | 4563 | return 1; |
| 4561 | } | 4564 | } |
| 4562 | 4565 | ||
| 4563 | if (ssl->server) | ||
| 4564 | return 0; | ||
| 4565 | |||
| 4566 | alpn_idx = sni_idx = ssl->tlsext_build_order_len; | ||
| 4567 | for (i = 0; i < ssl->tlsext_build_order_len; i++) { | ||
| 4568 | ext = ssl->tlsext_build_order[i]; | ||
| 4569 | if (tls_extension_type(ext) == TLSEXT_TYPE_alpn) | ||
| 4570 | alpn_idx = i; | ||
| 4571 | if (tls_extension_type(ext) == TLSEXT_TYPE_server_name) | ||
| 4572 | sni_idx = i; | ||
| 4573 | } | ||
| 4574 | |||
| 4575 | if (alpn_idx == ssl->tlsext_build_order_len) { | ||
| 4576 | FAIL("could not find alpn extension\n"); | ||
| 4577 | return 1; | ||
| 4578 | } | ||
| 4579 | |||
| 4580 | if (sni_idx == ssl->tlsext_build_order_len) { | ||
| 4581 | FAIL("could not find alpn extension\n"); | ||
| 4582 | return 1; | ||
| 4583 | } | ||
| 4584 | |||
| 4585 | if (sni_idx >= alpn_idx) { | ||
| 4586 | FAIL("sni does not precede alpn: %zu >= %zu\n", | ||
| 4587 | sni_idx, alpn_idx); | ||
| 4588 | return 1; | ||
| 4589 | } | ||
| 4590 | |||
| 4591 | return 0; | 4566 | return 0; |
| 4592 | } | 4567 | } |
| 4593 | 4568 | ||
| @@ -4600,7 +4575,7 @@ test_tlsext_randomized_extensions(SSL *ssl) | |||
| 4600 | for (i = 0; i < N_TLSEXT_RANDOMIZATION_TESTS; i++) { | 4575 | for (i = 0; i < N_TLSEXT_RANDOMIZATION_TESTS; i++) { |
| 4601 | if (!tlsext_randomize_build_order(ssl)) | 4576 | if (!tlsext_randomize_build_order(ssl)) |
| 4602 | errx(1, "failed to randomize extensions"); | 4577 | errx(1, "failed to randomize extensions"); |
| 4603 | failed |= test_tlsext_check_extension_order(ssl); | 4578 | failed |= test_tlsext_check_psk_is_last_extension(ssl); |
| 4604 | } | 4579 | } |
| 4605 | 4580 | ||
| 4606 | return failed; | 4581 | return failed; |
diff --git a/src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py b/src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py index 91aedad165..ff678ec9a8 100644 --- a/src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py +++ b/src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: tlsfuzzer.py,v 1.56 2024/09/18 19:12:37 tb Exp $ | 1 | # $OpenBSD: tlsfuzzer.py,v 1.57 2025/06/15 09:44:57 tb Exp $ |
| 2 | # | 2 | # |
| 3 | # Copyright (c) 2020 Theo Buehler <tb@openbsd.org> | 3 | # Copyright (c) 2020 Theo Buehler <tb@openbsd.org> |
| 4 | # | 4 | # |
| @@ -72,7 +72,7 @@ def substitute_alert(want, got): | |||
| 72 | return f"Expected alert description \"{want}\" " \ | 72 | return f"Expected alert description \"{want}\" " \ |
| 73 | + f"does not match received \"{got}\"" | 73 | + f"does not match received \"{got}\"" |
| 74 | 74 | ||
| 75 | # test-tls13-finished.py has 70 failing tests that expect a "decode_error" | 75 | # test_tls13_finished.py has 70 failing tests that expect a "decode_error" |
| 76 | # instead of the "decrypt_error" sent by tls13_server_finished_recv(). | 76 | # instead of the "decrypt_error" sent by tls13_server_finished_recv(). |
| 77 | # Both alerts appear to be reasonable in this context, so work around this | 77 | # Both alerts appear to be reasonable in this context, so work around this |
| 78 | # in the test instead of the library. | 78 | # in the test instead of the library. |
| @@ -164,46 +164,46 @@ def generate_test_tls13_finished_args(): | |||
| 164 | return args | 164 | return args |
| 165 | 165 | ||
| 166 | tls13_tests = TestGroup("TLSv1.3 tests", [ | 166 | tls13_tests = TestGroup("TLSv1.3 tests", [ |
| 167 | Test("test-tls13-ccs.py"), | 167 | Test("test_tls13_ccs.py"), |
| 168 | Test("test-tls13-conversation.py"), | 168 | Test("test_tls13_conversation.py"), |
| 169 | Test("test-tls13-count-tickets.py"), | 169 | Test("test_tls13_count_tickets.py"), |
| 170 | Test("test-tls13-empty-alert.py"), | 170 | Test("test_tls13_empty_alert.py"), |
| 171 | Test("test-tls13-finished.py", generate_test_tls13_finished_args()), | 171 | Test("test_tls13_finished.py", generate_test_tls13_finished_args()), |
| 172 | Test("test-tls13-finished-plaintext.py"), | 172 | Test("test_tls13_finished_plaintext.py"), |
| 173 | Test("test-tls13-hrr.py"), | 173 | Test("test_tls13_hrr.py"), |
| 174 | Test("test-tls13-keyshare-omitted.py"), | 174 | Test("test_tls13_keyshare_omitted.py"), |
| 175 | Test("test-tls13-legacy-version.py"), | 175 | Test("test_tls13_legacy_version.py"), |
| 176 | Test("test-tls13-nociphers.py"), | 176 | Test("test_tls13_nociphers.py"), |
| 177 | Test("test-tls13-record-padding.py"), | 177 | Test("test_tls13_record_padding.py"), |
| 178 | # Exclude QUIC transport parameters | 178 | # Exclude QUIC transport parameters |
| 179 | Test("test-tls13-shuffled-extentions.py", [ "--exc", "57" ]), | 179 | Test("test_tls13_shuffled_extentions.py", [ "--exc", "57" ]), |
| 180 | Test("test-tls13-zero-content-type.py"), | 180 | Test("test_tls13_zero_content_type.py"), |
| 181 | 181 | ||
| 182 | # The skipped tests fail due to a bug in BIO_gets() which masks the retry | 182 | # The skipped tests fail due to a bug in BIO_gets() which masks the retry |
| 183 | # signalled from an SSL_read() failure. Testing with httpd(8) shows we're | 183 | # signalled from an SSL_read() failure. Testing with httpd(8) shows we're |
| 184 | # handling these corner cases correctly since tls13_record_layer.c -r1.47. | 184 | # handling these corner cases correctly since tls13_record_layer.c -r1.47. |
| 185 | Test("test-tls13-zero-length-data.py", [ | 185 | Test("test_tls13_zero_length_data.py", [ |
| 186 | "-e", "zero-length app data", | 186 | "-e", "zero-length app data", |
| 187 | "-e", "zero-length app data with large padding", | 187 | "-e", "zero-length app data with large padding", |
| 188 | "-e", "zero-length app data with padding", | 188 | "-e", "zero-length app data with padding", |
| 189 | ]), | 189 | ]), |
| 190 | 190 | ||
| 191 | # We don't currently handle NSTs | 191 | # We don't currently handle NSTs |
| 192 | Test("test-tls13-connection-abort.py", ["-e", "After NewSessionTicket"]), | 192 | Test("test_tls13_connection_abort.py", ["-e", "After NewSessionTicket"]), |
| 193 | ]) | 193 | ]) |
| 194 | 194 | ||
| 195 | # Tests that take a lot of time (> ~30s on an x280) | 195 | # Tests that take a lot of time (> ~30s on an x280) |
| 196 | tls13_slow_tests = TestGroup("slow TLSv1.3 tests", [ | 196 | tls13_slow_tests = TestGroup("slow TLSv1.3 tests", [ |
| 197 | # XXX: Investigate the occasional message | 197 | # XXX: Investigate the occasional message |
| 198 | # "Got shared secret with 1 most significant bytes equal to zero." | 198 | # "Got shared secret with 1 most significant bytes equal to zero." |
| 199 | Test("test-tls13-dhe-shared-secret-padding.py", tls13_unsupported_ciphers), | 199 | Test("test_tls13_dhe_shared_secret_padding.py", tls13_unsupported_ciphers), |
| 200 | 200 | ||
| 201 | Test("test-tls13-invalid-ciphers.py"), | 201 | Test("test_tls13_invalid_ciphers.py"), |
| 202 | Test("test-tls13-serverhello-random.py", tls13_unsupported_ciphers), | 202 | Test("test_tls13_serverhello_random.py", tls13_unsupported_ciphers), |
| 203 | 203 | ||
| 204 | # Mark two tests cases as xfail for now. The tests expect an arguably | 204 | # Mark two tests cases as xfail for now. The tests expect an arguably |
| 205 | # correct decode_error while we send a decrypt_error (like fizz/boring). | 205 | # correct decode_error while we send a decrypt_error (like fizz/boring). |
| 206 | Test("test-tls13-record-layer-limits.py", [ | 206 | Test("test_tls13_record_layer_limits.py", [ |
| 207 | "-x", "max size payload (2**14) of Finished msg, with 16348 bytes of left padding, cipher TLS_AES_128_GCM_SHA256", | 207 | "-x", "max size payload (2**14) of Finished msg, with 16348 bytes of left padding, cipher TLS_AES_128_GCM_SHA256", |
| 208 | "-X", substitute_alert("decode_error", "decrypt_error"), | 208 | "-X", substitute_alert("decode_error", "decrypt_error"), |
| 209 | "-x", "max size payload (2**14) of Finished msg, with 16348 bytes of left padding, cipher TLS_CHACHA20_POLY1305_SHA256", | 209 | "-x", "max size payload (2**14) of Finished msg, with 16348 bytes of left padding, cipher TLS_CHACHA20_POLY1305_SHA256", |
| @@ -212,22 +212,22 @@ tls13_slow_tests = TestGroup("slow TLSv1.3 tests", [ | |||
| 212 | # We don't accept an empty ECPF extension since it must advertise the | 212 | # We don't accept an empty ECPF extension since it must advertise the |
| 213 | # uncompressed point format. Exclude this extension type from the test. | 213 | # uncompressed point format. Exclude this extension type from the test. |
| 214 | Test( | 214 | Test( |
| 215 | "test-tls13-large-number-of-extensions.py", | 215 | "test_tls13_large_number_of_extensions.py", |
| 216 | tls13_args = ["--exc", "11"], | 216 | tls13_args = ["--exc", "11"], |
| 217 | ), | 217 | ), |
| 218 | ]) | 218 | ]) |
| 219 | 219 | ||
| 220 | tls13_extra_cert_tests = TestGroup("TLSv1.3 certificate tests", [ | 220 | tls13_extra_cert_tests = TestGroup("TLSv1.3 certificate tests", [ |
| 221 | # need to set up client certs to run these | 221 | # need to set up client certs to run these |
| 222 | Test("test-tls13-certificate-request.py"), | 222 | Test("test_tls13_certificate_request.py"), |
| 223 | Test("test-tls13-certificate-verify.py"), | 223 | Test("test_tls13_certificate_verify.py"), |
| 224 | Test("test-tls13-ecdsa-in-certificate-verify.py"), | 224 | Test("test_tls13_ecdsa_in_certificate_verify.py"), |
| 225 | Test("test-tls13-eddsa-in-certificate-verify.py"), | 225 | Test("test_tls13_eddsa_in_certificate_verify.py"), |
| 226 | 226 | ||
| 227 | # Test expects the server to have installed three certificates: | 227 | # Test expects the server to have installed three certificates: |
| 228 | # with P-256, P-384 and P-521 curve. Also SHA1+ECDSA is verified | 228 | # with P-256, P-384 and P-521 curve. Also SHA1+ECDSA is verified |
| 229 | # to not work. | 229 | # to not work. |
| 230 | Test("test-tls13-ecdsa-support.py"), | 230 | Test("test_tls13_ecdsa_support.py"), |
| 231 | ]) | 231 | ]) |
| 232 | 232 | ||
| 233 | tls13_failing_tests = TestGroup("failing TLSv1.3 tests", [ | 233 | tls13_failing_tests = TestGroup("failing TLSv1.3 tests", [ |
| @@ -235,7 +235,7 @@ tls13_failing_tests = TestGroup("failing TLSv1.3 tests", [ | |||
| 235 | # With X25519, we accept weak peer public keys and fail when we actually | 235 | # With X25519, we accept weak peer public keys and fail when we actually |
| 236 | # compute the keyshare. Other tests seem to indicate that we could be | 236 | # compute the keyshare. Other tests seem to indicate that we could be |
| 237 | # stricter about what keyshares we accept. | 237 | # stricter about what keyshares we accept. |
| 238 | Test("test-tls13-crfg-curves.py", [ | 238 | Test("test_tls13_crfg_curves.py", [ |
| 239 | '-e', 'all zero x448 key share', | 239 | '-e', 'all zero x448 key share', |
| 240 | '-e', 'empty x448 key share', | 240 | '-e', 'empty x448 key share', |
| 241 | '-e', 'sanity x448 with compression ansiX962_compressed_char2', | 241 | '-e', 'sanity x448 with compression ansiX962_compressed_char2', |
| @@ -245,7 +245,7 @@ tls13_failing_tests = TestGroup("failing TLSv1.3 tests", [ | |||
| 245 | '-e', 'too small x448 key share', | 245 | '-e', 'too small x448 key share', |
| 246 | '-e', 'x448 key share of "1"', | 246 | '-e', 'x448 key share of "1"', |
| 247 | ]), | 247 | ]), |
| 248 | Test("test-tls13-ecdhe-curves.py", [ | 248 | Test("test_tls13_ecdhe_curves.py", [ |
| 249 | '-e', 'sanity - x448', | 249 | '-e', 'sanity - x448', |
| 250 | '-e', 'x448 - key share from other curve', | 250 | '-e', 'x448 - key share from other curve', |
| 251 | '-e', 'x448 - point at infinity', | 251 | '-e', 'x448 - point at infinity', |
| @@ -258,21 +258,21 @@ tls13_failing_tests = TestGroup("failing TLSv1.3 tests", [ | |||
| 258 | # We have the logic corresponding to NSS's fix for CVE-2020-25648 | 258 | # We have the logic corresponding to NSS's fix for CVE-2020-25648 |
| 259 | # https://hg.mozilla.org/projects/nss/rev/57bbefa793232586d27cee83e74411171e128361 | 259 | # https://hg.mozilla.org/projects/nss/rev/57bbefa793232586d27cee83e74411171e128361 |
| 260 | # so should not be affected by this issue. | 260 | # so should not be affected by this issue. |
| 261 | Test("test-tls13-multiple-ccs-messages.py"), | 261 | Test("test_tls13_multiple_ccs_messages.py"), |
| 262 | 262 | ||
| 263 | # https://github.com/openssl/openssl/issues/8369 | 263 | # https://github.com/openssl/openssl/issues/8369 |
| 264 | Test("test-tls13-obsolete-curves.py"), | 264 | Test("test_tls13_obsolete_curves.py"), |
| 265 | 265 | ||
| 266 | # 3 failing rsa_pss_pss tests | 266 | # 3 failing rsa_pss_pss tests |
| 267 | Test("test-tls13-rsa-signatures.py"), | 267 | Test("test_tls13_rsa_signatures.py"), |
| 268 | 268 | ||
| 269 | # The failing tests all expect an ri extension. What's up with that? | 269 | # The failing tests all expect an ri extension. What's up with that? |
| 270 | Test("test-tls13-version-negotiation.py"), | 270 | Test("test_tls13_version_negotiation.py"), |
| 271 | ]) | 271 | ]) |
| 272 | 272 | ||
| 273 | tls13_slow_failing_tests = TestGroup("slow, failing TLSv1.3 tests", [ | 273 | tls13_slow_failing_tests = TestGroup("slow, failing TLSv1.3 tests", [ |
| 274 | # Other test failures bugs in keyshare/tlsext negotiation? | 274 | # Other test failures bugs in keyshare/tlsext negotiation? |
| 275 | Test("test-tls13-unrecognised-groups.py"), # unexpected closure | 275 | Test("test_tls13_unrecognised_groups.py"), # unexpected closure |
| 276 | 276 | ||
| 277 | # 5 occasional failures: | 277 | # 5 occasional failures: |
| 278 | # 'app data split, conversation with KeyUpdate msg' | 278 | # 'app data split, conversation with KeyUpdate msg' |
| @@ -280,43 +280,43 @@ tls13_slow_failing_tests = TestGroup("slow, failing TLSv1.3 tests", [ | |||
| 280 | # 'multiple KeyUpdate messages' | 280 | # 'multiple KeyUpdate messages' |
| 281 | # 'post-handshake KeyUpdate msg with update_not_request' | 281 | # 'post-handshake KeyUpdate msg with update_not_request' |
| 282 | # 'post-handshake KeyUpdate msg with update_request' | 282 | # 'post-handshake KeyUpdate msg with update_request' |
| 283 | Test("test-tls13-keyupdate.py"), | 283 | Test("test_tls13_keyupdate.py"), |
| 284 | 284 | ||
| 285 | Test("test-tls13-symetric-ciphers.py"), # unexpected message from peer | 285 | Test("test_tls13_symetric_ciphers.py"), # unexpected message from peer |
| 286 | 286 | ||
| 287 | # 6 tests fail: 'rsa_pkcs1_{md5,sha{1,224,256,384,512}} signature' | 287 | # 6 tests fail: 'rsa_pkcs1_{md5,sha{1,224,256,384,512}} signature' |
| 288 | # We send server hello, but the test expects handshake_failure | 288 | # We send server hello, but the test expects handshake_failure |
| 289 | Test("test-tls13-pkcs-signature.py"), | 289 | Test("test_tls13_pkcs_signature.py"), |
| 290 | # 8 tests fail: 'tls13 signature rsa_pss_{pss,rsae}_sha{256,384,512} | 290 | # 8 tests fail: 'tls13 signature rsa_pss_{pss,rsae}_sha{256,384,512} |
| 291 | Test("test-tls13-rsapss-signatures.py"), | 291 | Test("test_tls13_rsapss_signatures.py"), |
| 292 | ]) | 292 | ]) |
| 293 | 293 | ||
| 294 | tls13_unsupported_tests = TestGroup("TLSv1.3 tests for unsupported features", [ | 294 | tls13_unsupported_tests = TestGroup("TLSv1.3 tests for unsupported features", [ |
| 295 | # Tests for features we don't support | 295 | # Tests for features we don't support |
| 296 | Test("test-tls13-0rtt-garbage.py"), | 296 | Test("test_tls13_0rtt_garbage.py"), |
| 297 | Test("test-tls13-ffdhe-groups.py"), | 297 | Test("test_tls13_ffdhe_groups.py"), |
| 298 | Test("test-tls13-ffdhe-sanity.py"), | 298 | Test("test_tls13_ffdhe_sanity.py"), |
| 299 | Test("test-tls13-psk_dhe_ke.py"), | 299 | Test("test_tls13_psk_dhe_ke.py"), |
| 300 | Test("test-tls13-psk_ke.py"), | 300 | Test("test_tls13_psk_ke.py"), |
| 301 | 301 | ||
| 302 | # need server to react to HTTP GET for /keyupdate | 302 | # need server to react to HTTP GET for /keyupdate |
| 303 | Test("test-tls13-keyupdate-from-server.py"), | 303 | Test("test_tls13_keyupdate_from_server.py"), |
| 304 | 304 | ||
| 305 | # needs an echo server | 305 | # needs an echo server |
| 306 | Test("test-tls13-lengths.py"), | 306 | Test("test_tls13_lengths.py"), |
| 307 | 307 | ||
| 308 | # Weird test: tests servers that don't support 1.3 | 308 | # Weird test: tests servers that don't support 1.3 |
| 309 | Test("test-tls13-non-support.py"), | 309 | Test("test_tls13_non_support.py"), |
| 310 | 310 | ||
| 311 | # broken test script | 311 | # broken test script |
| 312 | # UnboundLocalError: local variable 'cert' referenced before assignment | 312 | # UnboundLocalError: local variable 'cert' referenced before assignment |
| 313 | Test("test-tls13-post-handshake-auth.py"), | 313 | Test("test_tls13_post_handshake_auth.py"), |
| 314 | 314 | ||
| 315 | # ExpectNewSessionTicket | 315 | # ExpectNewSessionTicket |
| 316 | Test("test-tls13-session-resumption.py"), | 316 | Test("test_tls13_session_resumption.py"), |
| 317 | 317 | ||
| 318 | # Server must be configured to support only rsa_pss_rsae_sha512 | 318 | # Server must be configured to support only rsa_pss_rsae_sha512 |
| 319 | Test("test-tls13-signature-algorithms.py"), | 319 | Test("test_tls13_signature_algorithms.py"), |
| 320 | ]) | 320 | ]) |
| 321 | 321 | ||
| 322 | tls12_exclude_legacy_protocols = [ | 322 | tls12_exclude_legacy_protocols = [ |
| @@ -345,52 +345,52 @@ tls12_exclude_legacy_protocols = [ | |||
| 345 | 345 | ||
| 346 | tls12_tests = TestGroup("TLSv1.2 tests", [ | 346 | tls12_tests = TestGroup("TLSv1.2 tests", [ |
| 347 | # Tests that pass as they are. | 347 | # Tests that pass as they are. |
| 348 | Test("test-aes-gcm-nonces.py"), | 348 | Test("test_aes_gcm_nonces.py"), |
| 349 | Test("test-connection-abort.py"), | 349 | Test("test_connection_abort.py"), |
| 350 | Test("test-conversation.py"), | 350 | Test("test_conversation.py"), |
| 351 | Test("test-cve-2016-2107.py"), | 351 | Test("test_cve_2016_2107.py"), |
| 352 | Test("test-cve-2016-6309.py"), | 352 | Test("test_cve_2016_6309.py"), |
| 353 | Test("test-dhe-rsa-key-exchange.py"), | 353 | Test("test_dhe_rsa_key_exchange.py"), |
| 354 | Test("test-early-application-data.py"), | 354 | Test("test_early_application_data.py"), |
| 355 | Test("test-empty-extensions.py"), | 355 | Test("test_empty_extensions.py"), |
| 356 | Test("test-extensions.py"), | 356 | Test("test_extensions.py"), |
| 357 | Test("test-fuzzed-MAC.py"), | 357 | Test("test_fuzzed_MAC.py"), |
| 358 | Test("test-fuzzed-ciphertext.py"), | 358 | Test("test_fuzzed_ciphertext.py"), |
| 359 | Test("test-fuzzed-finished.py"), | 359 | Test("test_fuzzed_finished.py"), |
| 360 | Test("test-fuzzed-padding.py"), | 360 | Test("test_fuzzed_padding.py"), |
| 361 | Test("test-fuzzed-plaintext.py"), # fails once in a while | 361 | Test("test_fuzzed_plaintext.py"), # fails once in a while |
| 362 | Test("test-hello-request-by-client.py"), | 362 | Test("test_hello_request_by_client.py"), |
| 363 | Test("test-invalid-cipher-suites.py"), | 363 | Test("test_invalid_cipher_suites.py"), |
| 364 | Test("test-invalid-content-type.py"), | 364 | Test("test_invalid_content_type.py"), |
| 365 | Test("test-invalid-session-id.py"), | 365 | Test("test_invalid_session_id.py"), |
| 366 | Test("test-invalid-version.py"), | 366 | Test("test_invalid_version.py"), |
| 367 | Test("test-large-number-of-extensions.py"), | 367 | Test("test_large_number_of_extensions.py"), |
| 368 | Test("test-lucky13.py"), | 368 | Test("test_lucky13.py"), |
| 369 | Test("test-message-skipping.py"), | 369 | Test("test_message_skipping.py"), |
| 370 | Test("test-no-heartbeat.py"), | 370 | Test("test_no_heartbeat.py"), |
| 371 | Test("test-record-layer-fragmentation.py"), | 371 | Test("test_record_layer_fragmentation.py"), |
| 372 | Test("test-sslv2-connection.py"), | 372 | Test("test_sslv2_connection.py"), |
| 373 | Test("test-truncating-of-finished.py"), | 373 | Test("test_truncating_of_finished.py"), |
| 374 | Test("test-truncating-of-kRSA-client-key-exchange.py"), | 374 | Test("test_truncating_of_kRSA_client_key_exchange.py"), |
| 375 | Test("test-unsupported-curve-fallback.py"), | 375 | Test("test_unsupported_curve_fallback.py"), |
| 376 | Test("test-version-numbers.py"), | 376 | Test("test_version_numbers.py"), |
| 377 | Test("test-zero-length-data.py"), | 377 | Test("test_zero_length_data.py"), |
| 378 | 378 | ||
| 379 | # Tests that need tweaking for unsupported features and ciphers. | 379 | # Tests that need tweaking for unsupported features and ciphers. |
| 380 | Test( | 380 | Test( |
| 381 | "test-atypical-padding.py", [ | 381 | "test_atypical_padding.py", [ |
| 382 | "-e", "sanity - encrypt then MAC", | 382 | "-e", "sanity - encrypt then MAC", |
| 383 | "-e", "2^14 bytes of AppData with 256 bytes of padding (SHA1 + Encrypt then MAC)", | 383 | "-e", "2^14 bytes of AppData with 256 bytes of padding (SHA1 + Encrypt then MAC)", |
| 384 | ] | 384 | ] |
| 385 | ), | 385 | ), |
| 386 | Test( | 386 | Test( |
| 387 | "test-ccs.py", [ | 387 | "test_ccs.py", [ |
| 388 | "-x", "two bytes long CCS", | 388 | "-x", "two bytes long CCS", |
| 389 | "-X", substitute_alert("unexpected_message", "decode_error"), | 389 | "-X", substitute_alert("unexpected_message", "decode_error"), |
| 390 | ] | 390 | ] |
| 391 | ), | 391 | ), |
| 392 | Test( | 392 | Test( |
| 393 | "test-dhe-rsa-key-exchange-signatures.py", [ | 393 | "test_dhe_rsa_key_exchange_signatures.py", [ |
| 394 | "-e", "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA sha224 signature", | 394 | "-e", "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA sha224 signature", |
| 395 | "-e", "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 sha224 signature", | 395 | "-e", "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 sha224 signature", |
| 396 | "-e", "TLS_DHE_RSA_WITH_AES_128_CBC_SHA sha224 signature", | 396 | "-e", "TLS_DHE_RSA_WITH_AES_128_CBC_SHA sha224 signature", |
| @@ -398,14 +398,14 @@ tls12_tests = TestGroup("TLSv1.2 tests", [ | |||
| 398 | "-e", "TLS_DHE_RSA_WITH_AES_256_CBC_SHA sha224 signature", | 398 | "-e", "TLS_DHE_RSA_WITH_AES_256_CBC_SHA sha224 signature", |
| 399 | ] | 399 | ] |
| 400 | ), | 400 | ), |
| 401 | Test("test-dhe-rsa-key-exchange-with-bad-messages.py", [ | 401 | Test("test_dhe_rsa_key_exchange_with_bad_messages.py", [ |
| 402 | "-x", "invalid dh_Yc value - missing", | 402 | "-x", "invalid dh_Yc value - missing", |
| 403 | "-X", substitute_alert("decode_error", "illegal_parameter"), | 403 | "-X", substitute_alert("decode_error", "illegal_parameter"), |
| 404 | ]), | 404 | ]), |
| 405 | Test("test-dhe-key-share-random.py", tls12_exclude_legacy_protocols), | 405 | Test("test_dhe_key_share_random.py", tls12_exclude_legacy_protocols), |
| 406 | Test("test-export-ciphers-rejected.py", ["--min-ver", "TLSv1.2"]), | 406 | Test("test_export_ciphers_rejected.py", ["--min-ver", "TLSv1.2"]), |
| 407 | Test( | 407 | Test( |
| 408 | "test-downgrade-protection.py", | 408 | "test_downgrade_protection.py", |
| 409 | tls12_args = ["--server-max-protocol", "TLSv1.2"], | 409 | tls12_args = ["--server-max-protocol", "TLSv1.2"], |
| 410 | tls13_args = [ | 410 | tls13_args = [ |
| 411 | "--server-max-protocol", "TLSv1.3", | 411 | "--server-max-protocol", "TLSv1.3", |
| @@ -414,7 +414,7 @@ tls12_tests = TestGroup("TLSv1.2 tests", [ | |||
| 414 | ] | 414 | ] |
| 415 | ), | 415 | ), |
| 416 | Test( | 416 | Test( |
| 417 | "test-fallback-scsv.py", | 417 | "test_fallback_scsv.py", |
| 418 | tls13_args = [ | 418 | tls13_args = [ |
| 419 | "--tls-1.3", | 419 | "--tls-1.3", |
| 420 | "-e", "FALLBACK - hello TLSv1.1 - pos 0", | 420 | "-e", "FALLBACK - hello TLSv1.1 - pos 0", |
| @@ -428,7 +428,7 @@ tls12_tests = TestGroup("TLSv1.2 tests", [ | |||
| 428 | ] | 428 | ] |
| 429 | ), | 429 | ), |
| 430 | 430 | ||
| 431 | Test("test-invalid-compression-methods.py", [ | 431 | Test("test_invalid_compression_methods.py", [ |
| 432 | "-x", "invalid compression methods", | 432 | "-x", "invalid compression methods", |
| 433 | "-X", substitute_alert("illegal_parameter", "decode_error"), | 433 | "-X", substitute_alert("illegal_parameter", "decode_error"), |
| 434 | "-x", "only deflate compression method", | 434 | "-x", "only deflate compression method", |
| @@ -437,134 +437,134 @@ tls12_tests = TestGroup("TLSv1.2 tests", [ | |||
| 437 | 437 | ||
| 438 | # Skip extended_master_secret test. Since we don't support this | 438 | # Skip extended_master_secret test. Since we don't support this |
| 439 | # extension, we don't notice that it was dropped. | 439 | # extension, we don't notice that it was dropped. |
| 440 | Test("test-renegotiation-changed-clienthello.py", [ | 440 | Test("test_renegotiation_changed_clienthello.py", [ |
| 441 | "-e", "drop extended_master_secret in renegotiation", | 441 | "-e", "drop extended_master_secret in renegotiation", |
| 442 | ]), | 442 | ]), |
| 443 | 443 | ||
| 444 | Test("test-sessionID-resumption.py", [ | 444 | Test("test_sessionID_resumption.py", [ |
| 445 | "-x", "Client Hello too long session ID", | 445 | "-x", "Client Hello too long session ID", |
| 446 | "-X", substitute_alert("decode_error", "illegal_parameter"), | 446 | "-X", substitute_alert("decode_error", "illegal_parameter"), |
| 447 | ]), | 447 | ]), |
| 448 | 448 | ||
| 449 | # Without --sig-algs-drop-ok, two tests fail since we do not currently | 449 | # Without --sig-algs-drop-ok, two tests fail since we do not currently |
| 450 | # implement the signature_algorithms_cert extension (although we MUST). | 450 | # implement the signature_algorithms_cert extension (although we MUST). |
| 451 | Test("test-sig-algs-renegotiation-resumption.py", ["--sig-algs-drop-ok"]), | 451 | Test("test_sig_algs_renegotiation_resumption.py", ["--sig-algs-drop-ok"]), |
| 452 | 452 | ||
| 453 | Test("test-serverhello-random.py", args = tls12_exclude_legacy_protocols), | 453 | Test("test_serverhello_random.py", args = tls12_exclude_legacy_protocols), |
| 454 | 454 | ||
| 455 | Test("test-chacha20.py", [ "-e", "Chacha20 in TLS1.1" ]), | 455 | Test("test_chacha20.py", [ "-e", "Chacha20 in TLS1.1" ]), |
| 456 | ]) | 456 | ]) |
| 457 | 457 | ||
| 458 | tls12_slow_tests = TestGroup("slow TLSv1.2 tests", [ | 458 | tls12_slow_tests = TestGroup("slow TLSv1.2 tests", [ |
| 459 | Test("test-cve-2016-7054.py"), | 459 | Test("test_cve_2016_7054.py"), |
| 460 | Test("test-dhe-no-shared-secret-padding.py", tls12_exclude_legacy_protocols), | 460 | Test("test_dhe_no_shared_secret_padding.py", tls12_exclude_legacy_protocols), |
| 461 | Test("test-ecdhe-padded-shared-secret.py", tls12_exclude_legacy_protocols), | 461 | Test("test_ecdhe_padded_shared_secret.py", tls12_exclude_legacy_protocols), |
| 462 | Test("test-ecdhe-rsa-key-share-random.py", tls12_exclude_legacy_protocols), | 462 | Test("test_ecdhe_rsa_key_share_random.py", tls12_exclude_legacy_protocols), |
| 463 | # Start at extension number 58 to avoid QUIC transport parameters (57) | 463 | # Start at extension number 58 to avoid QUIC transport parameters (57) |
| 464 | Test("test-large-hello.py", [ "-m", "58" ]), | 464 | Test("test_large_hello.py", [ "-m", "58" ]), |
| 465 | ]) | 465 | ]) |
| 466 | 466 | ||
| 467 | tls12_failing_tests = TestGroup("failing TLSv1.2 tests", [ | 467 | tls12_failing_tests = TestGroup("failing TLSv1.2 tests", [ |
| 468 | # no shared cipher | 468 | # no shared cipher |
| 469 | Test("test-aesccm.py"), | 469 | Test("test_aesccm.py"), |
| 470 | # need server to set up alpn | 470 | # need server to set up alpn |
| 471 | Test("test-alpn-negotiation.py"), | 471 | Test("test_alpn_negotiation.py"), |
| 472 | # Failing on TLS_RSA_WITH_AES_128_CBC_SHA because server does not support it. | 472 | # Failing on TLS_RSA_WITH_AES_128_CBC_SHA because server does not support it. |
| 473 | Test("test-bleichenbacher-timing-pregenerate.py"), | 473 | Test("test_bleichenbacher_timing_pregenerate.py"), |
| 474 | # many tests fail due to unexpected server_name extension | 474 | # many tests fail due to unexpected server_name extension |
| 475 | Test("test-bleichenbacher-workaround.py"), | 475 | Test("test_bleichenbacher_workaround.py"), |
| 476 | 476 | ||
| 477 | # need client key and cert plus extra server setup | 477 | # need client key and cert plus extra server setup |
| 478 | Test("test-certificate-malformed.py"), | 478 | Test("test_certificate_malformed.py"), |
| 479 | Test("test-certificate-request.py"), | 479 | Test("test_certificate_request.py"), |
| 480 | Test("test-certificate-verify-malformed-sig.py"), | 480 | Test("test_certificate_verify_malformed_sig.py"), |
| 481 | Test("test-certificate-verify-malformed.py"), | 481 | Test("test_certificate_verify_malformed.py"), |
| 482 | Test("test-certificate-verify.py"), | 482 | Test("test_certificate_verify.py"), |
| 483 | Test("test-ecdsa-in-certificate-verify.py"), | 483 | Test("test_ecdsa_in_certificate_verify.py"), |
| 484 | Test("test-eddsa-in-certificate-verify.py"), | 484 | Test("test_eddsa_in_certificate_verify.py"), |
| 485 | Test("test-renegotiation-disabled-client-cert.py"), | 485 | Test("test_renegotiation_disabled_client_cert.py"), |
| 486 | Test("test-rsa-pss-sigs-on-certificate-verify.py"), | 486 | Test("test_rsa_pss_sigs_on_certificate_verify.py"), |
| 487 | Test("test-rsa-sigs-on-certificate-verify.py"), | 487 | Test("test_rsa_sigs_on_certificate_verify.py"), |
| 488 | 488 | ||
| 489 | # test doesn't expect session ticket | 489 | # test doesn't expect session ticket |
| 490 | Test("test-client-compatibility.py"), | 490 | Test("test_client_compatibility.py"), |
| 491 | # abrupt closure | 491 | # abrupt closure |
| 492 | Test("test-client-hello-max-size.py"), | 492 | Test("test_client_hello_max_size.py"), |
| 493 | # unknown signature algorithms | 493 | # unknown signature algorithms |
| 494 | Test("test-clienthello-md5.py"), | 494 | Test("test_clienthello_md5.py"), |
| 495 | 495 | ||
| 496 | # Tests expect an illegal_parameter or a decode_error alert. Should be | 496 | # Tests expect an illegal_parameter or a decode_error alert. Should be |
| 497 | # added to ssl3_get_client_key_exchange on kex function failure. | 497 | # added to ssl3_get_client_key_exchange on kex function failure. |
| 498 | Test("test-ecdhe-rsa-key-exchange-with-bad-messages.py"), | 498 | Test("test_ecdhe_rsa_key_exchange_with_bad_messages.py"), |
| 499 | 499 | ||
| 500 | # We send a handshake_failure due to no shared ciphers while the | 500 | # We send a handshake_failure due to no shared ciphers while the |
| 501 | # test expects to succeed. | 501 | # test expects to succeed. |
| 502 | Test("test-ecdhe-rsa-key-exchange.py"), | 502 | Test("test_ecdhe_rsa_key_exchange.py"), |
| 503 | 503 | ||
| 504 | # no shared cipher | 504 | # no shared cipher |
| 505 | Test("test-ecdsa-sig-flexibility.py"), | 505 | Test("test_ecdsa_sig_flexibility.py"), |
| 506 | 506 | ||
| 507 | # Tests expect SH but we send unexpected_message or handshake_failure | 507 | # Tests expect SH but we send unexpected_message or handshake_failure |
| 508 | # 'Application data inside Client Hello' | 508 | # 'Application data inside Client Hello' |
| 509 | # 'Application data inside Client Key Exchange' | 509 | # 'Application data inside Client Key Exchange' |
| 510 | # 'Application data inside Finished' | 510 | # 'Application data inside Finished' |
| 511 | Test("test-interleaved-application-data-and-fragmented-handshakes-in-renegotiation.py"), | 511 | Test("test_interleaved_application_data_and_fragmented_handshakes_in_renegotiation.py"), |
| 512 | # Tests expect SH but we send handshake_failure | 512 | # Tests expect SH but we send handshake_failure |
| 513 | # 'Application data before Change Cipher Spec' | 513 | # 'Application data before Change Cipher Spec' |
| 514 | # 'Application data before Client Key Exchange' | 514 | # 'Application data before Client Key Exchange' |
| 515 | # 'Application data before Finished' | 515 | # 'Application data before Finished' |
| 516 | Test("test-interleaved-application-data-in-renegotiation.py"), | 516 | Test("test_interleaved_application_data_in_renegotiation.py"), |
| 517 | 517 | ||
| 518 | # broken test script | 518 | # broken test script |
| 519 | # TypeError: '<' not supported between instances of 'int' and 'NoneType' | 519 | # TypeError: '<' not supported between instances of 'int' and 'NoneType' |
| 520 | Test("test-invalid-client-hello-w-record-overflow.py"), | 520 | Test("test_invalid_client_hello_w_record_overflow.py"), |
| 521 | 521 | ||
| 522 | # Lots of failures. abrupt closure | 522 | # Lots of failures. abrupt closure |
| 523 | Test("test-invalid-client-hello.py"), | 523 | Test("test_invalid_client_hello.py"), |
| 524 | 524 | ||
| 525 | # abrupt closure | 525 | # abrupt closure |
| 526 | # 'encrypted premaster set to all zero (n)' n in 256 384 512 | 526 | # 'encrypted premaster set to all zero (n)' n in 256 384 512 |
| 527 | Test("test-invalid-rsa-key-exchange-messages.py"), | 527 | Test("test_invalid_rsa_key_exchange_messages.py"), |
| 528 | 528 | ||
| 529 | # test expects illegal_parameter, we send unrecognized_name (which seems | 529 | # test expects illegal_parameter, we send unrecognized_name (which seems |
| 530 | # correct according to rfc 6066?) | 530 | # correct according to rfc 6066?) |
| 531 | Test("test-invalid-server-name-extension-resumption.py"), | 531 | Test("test_invalid_server_name_extension_resumption.py"), |
| 532 | # let through some server names without sending an alert | 532 | # let through some server names without sending an alert |
| 533 | # again illegal_parameter vs unrecognized_name | 533 | # again illegal_parameter vs unrecognized_name |
| 534 | Test("test-invalid-server-name-extension.py"), | 534 | Test("test_invalid_server_name_extension.py"), |
| 535 | 535 | ||
| 536 | # 4 failures: | 536 | # 4 failures: |
| 537 | # 'insecure (legacy) renegotiation with GET after 2nd handshake' | 537 | # 'insecure (legacy) renegotiation with GET after 2nd handshake' |
| 538 | # 'insecure (legacy) renegotiation with incomplete GET' | 538 | # 'insecure (legacy) renegotiation with incomplete GET' |
| 539 | # 'secure renegotiation with GET after 2nd handshake' | 539 | # 'secure renegotiation with GET after 2nd handshake' |
| 540 | # 'secure renegotiation with incomplete GET' | 540 | # 'secure renegotiation with incomplete GET' |
| 541 | Test("test-legacy-renegotiation.py"), | 541 | Test("test_legacy_renegotiation.py"), |
| 542 | 542 | ||
| 543 | # 1 failure (timeout): we don't send the unexpected_message alert | 543 | # 1 failure (timeout): we don't send the unexpected_message alert |
| 544 | # 'duplicate change cipher spec after Finished' | 544 | # 'duplicate change cipher spec after Finished' |
| 545 | Test("test-message-duplication.py"), | 545 | Test("test_message_duplication.py"), |
| 546 | 546 | ||
| 547 | # server should send status_request | 547 | # server should send status_request |
| 548 | Test("test-ocsp-stapling.py"), | 548 | Test("test_ocsp_stapling.py"), |
| 549 | 549 | ||
| 550 | # unexpected closure | 550 | # unexpected closure |
| 551 | Test("test-openssl-3712.py"), | 551 | Test("test_openssl_3712.py"), |
| 552 | 552 | ||
| 553 | # failed: 3 (expect an alert, we send AD) | 553 | # failed: 3 (expect an alert, we send AD) |
| 554 | # 'try insecure (legacy) renegotiation with incomplete GET' | 554 | # 'try insecure (legacy) renegotiation with incomplete GET' |
| 555 | # 'try secure renegotiation with GET after 2nd CH' | 555 | # 'try secure renegotiation with GET after 2nd CH' |
| 556 | # 'try secure renegotiation with incomplete GET' | 556 | # 'try secure renegotiation with incomplete GET' |
| 557 | Test("test-renegotiation-disabled.py"), | 557 | Test("test_renegotiation_disabled.py"), |
| 558 | 558 | ||
| 559 | # 'resumption of safe session with NULL cipher' | 559 | # 'resumption of safe session with NULL cipher' |
| 560 | # 'resumption with cipher from old CH but not selected by server' | 560 | # 'resumption with cipher from old CH but not selected by server' |
| 561 | Test("test-resumption-with-wrong-ciphers.py"), | 561 | Test("test_resumption_with_wrong_ciphers.py"), |
| 562 | 562 | ||
| 563 | # 'session resumption with empty session_id' | 563 | # 'session resumption with empty session_id' |
| 564 | # 'session resumption with random session_id' | 564 | # 'session resumption with random session_id' |
| 565 | # 'session resumption with renegotiation' | 565 | # 'session resumption with renegotiation' |
| 566 | # AssertionError: Server did not send extension(s): session_ticket | 566 | # AssertionError: Server did not send extension(s): session_ticket |
| 567 | Test("test-session-ticket-resumption.py"), | 567 | Test("test_session_ticket_resumption.py"), |
| 568 | 568 | ||
| 569 | # 5 failures: | 569 | # 5 failures: |
| 570 | # 'empty sigalgs' | 570 | # 'empty sigalgs' |
| @@ -572,7 +572,7 @@ tls12_failing_tests = TestGroup("failing TLSv1.2 tests", [ | |||
| 572 | # 'rsa_pss_pss_sha256 only' | 572 | # 'rsa_pss_pss_sha256 only' |
| 573 | # 'rsa_pss_pss_sha384 only' | 573 | # 'rsa_pss_pss_sha384 only' |
| 574 | # 'rsa_pss_pss_sha512 only' | 574 | # 'rsa_pss_pss_sha512 only' |
| 575 | Test("test-sig-algs.py"), | 575 | Test("test_sig_algs.py"), |
| 576 | 576 | ||
| 577 | # 13 failures: | 577 | # 13 failures: |
| 578 | # 'duplicated n non-rsa schemes' for n in 202 2342 8119 23741 32744 | 578 | # 'duplicated n non-rsa schemes' for n in 202 2342 8119 23741 32744 |
| @@ -581,51 +581,51 @@ tls12_failing_tests = TestGroup("failing TLSv1.2 tests", [ | |||
| 581 | # 'tolerance 32758 methods with sig_alg_cert' | 581 | # 'tolerance 32758 methods with sig_alg_cert' |
| 582 | # 'tolerance max 32744 number of methods with sig_alg_cert' | 582 | # 'tolerance max 32744 number of methods with sig_alg_cert' |
| 583 | # 'tolerance max (32760) number of methods' | 583 | # 'tolerance max (32760) number of methods' |
| 584 | Test("test-signature-algorithms.py"), | 584 | Test("test_signature_algorithms.py"), |
| 585 | 585 | ||
| 586 | # times out | 586 | # times out |
| 587 | Test("test-ssl-death-alert.py"), | 587 | Test("test_ssl_death_alert.py"), |
| 588 | 588 | ||
| 589 | # 17 pass, 13 fail. padding and truncation | 589 | # 17 pass, 13 fail. padding and truncation |
| 590 | Test("test-truncating-of-client-hello.py"), | 590 | Test("test_truncating_of_client_hello.py"), |
| 591 | 591 | ||
| 592 | # x448 tests need disabling plus x25519 corner cases need sorting out | 592 | # x448 tests need disabling plus x25519 corner cases need sorting out |
| 593 | Test("test-x25519.py"), | 593 | Test("test_x25519.py"), |
| 594 | 594 | ||
| 595 | # Needs TLS 1.0 or 1.1 | 595 | # Needs TLS 1.0 or 1.1 |
| 596 | Test("test-TLSv1_2-rejected-without-TLSv1_2.py"), | 596 | Test("test_TLSv1_2_rejected_without_TLSv1_2.py"), |
| 597 | ]) | 597 | ]) |
| 598 | 598 | ||
| 599 | tls12_unsupported_tests = TestGroup("TLSv1.2 for unsupported features", [ | 599 | tls12_unsupported_tests = TestGroup("TLSv1.2 for unsupported features", [ |
| 600 | # protocol_version | 600 | # protocol_version |
| 601 | Test("test-SSLv3-padding.py"), | 601 | Test("test_SSLv3_padding.py"), |
| 602 | # we don't do RSA key exchanges | 602 | # we don't do RSA key exchanges |
| 603 | Test("test-bleichenbacher-timing.py"), | 603 | Test("test_bleichenbacher_timing.py"), |
| 604 | # no encrypt-then-mac | 604 | # no encrypt-then-mac |
| 605 | Test("test-encrypt-then-mac-renegotiation.py"), | 605 | Test("test_encrypt_then_mac_renegotiation.py"), |
| 606 | Test("test-encrypt-then-mac.py"), | 606 | Test("test_encrypt_then_mac.py"), |
| 607 | # no EME support | 607 | # no EME support |
| 608 | Test("test-extended-master-secret-extension-with-client-cert.py"), | 608 | Test("test_extended_master_secret_extension_with_client_cert.py"), |
| 609 | Test("test-extended-master-secret-extension.py"), | 609 | Test("test_extended_master_secret_extension.py"), |
| 610 | # no ffdhe | 610 | # no ffdhe |
| 611 | Test("test-ffdhe-expected-params.py"), | 611 | Test("test_ffdhe_expected_params.py"), |
| 612 | Test("test-ffdhe-negotiation.py"), | 612 | Test("test_ffdhe_negotiation.py"), |
| 613 | # record_size_limit/max_fragment_length extension (RFC 8449) | 613 | # record_size_limit/max_fragment_length extension (RFC 8449) |
| 614 | Test("test-record-size-limit.py"), | 614 | Test("test_record_size_limit.py"), |
| 615 | # expects the server to send the heartbeat extension | 615 | # expects the server to send the heartbeat extension |
| 616 | Test("test-heartbeat.py"), | 616 | Test("test_heartbeat.py"), |
| 617 | # needs an echo server | 617 | # needs an echo server |
| 618 | Test("test-lengths.py"), | 618 | Test("test_lengths.py"), |
| 619 | ]) | 619 | ]) |
| 620 | 620 | ||
| 621 | # These tests take a ton of time to fail against an 1.3 server, | 621 | # These tests take a ton of time to fail against an 1.3 server, |
| 622 | # so don't run them against 1.3 pending further investigation. | 622 | # so don't run them against 1.3 pending further investigation. |
| 623 | legacy_tests = TestGroup("Legacy protocol tests", [ | 623 | legacy_tests = TestGroup("Legacy protocol tests", [ |
| 624 | Test("test-sslv2-force-cipher-3des.py"), | 624 | Test("test_sslv2_force_cipher_3des.py"), |
| 625 | Test("test-sslv2-force-cipher-non3des.py"), | 625 | Test("test_sslv2_force_cipher_non3des.py"), |
| 626 | Test("test-sslv2-force-cipher.py"), | 626 | Test("test_sslv2_force_cipher.py"), |
| 627 | Test("test-sslv2-force-export-cipher.py"), | 627 | Test("test_sslv2_force_export_cipher.py"), |
| 628 | Test("test-sslv2hello-protocol.py"), | 628 | Test("test_sslv2hello_protocol.py"), |
| 629 | ]) | 629 | ]) |
| 630 | 630 | ||
| 631 | all_groups = [ | 631 | all_groups = [ |
diff --git a/src/regress/lib/libssl/unit/Makefile b/src/regress/lib/libssl/unit/Makefile index 6a925069ca..edc0d910c4 100644 --- a/src/regress/lib/libssl/unit/Makefile +++ b/src/regress/lib/libssl/unit/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.16 2023/05/24 09:15:14 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.17 2025/10/24 11:44:08 tb Exp $ |
| 2 | 2 | ||
| 3 | PROGS += cipher_list | 3 | PROGS += cipher_list |
| 4 | PROGS += ssl_get_shared_ciphers | 4 | PROGS += ssl_get_shared_ciphers |
| @@ -16,6 +16,4 @@ CFLAGS+= -DLIBRESSL_INTERNAL -Wall -Wundef -Werror | |||
| 16 | CFLAGS+= -DCERTSDIR=\"${.CURDIR}/../certs\" | 16 | CFLAGS+= -DCERTSDIR=\"${.CURDIR}/../certs\" |
| 17 | CFLAGS+= -I${.CURDIR}/../../../../lib/libssl | 17 | CFLAGS+= -I${.CURDIR}/../../../../lib/libssl |
| 18 | 18 | ||
| 19 | LDADD_ssl_verify_param = ${LIBSSL} ${CRYPTO_INT} | ||
| 20 | |||
| 21 | .include <bsd.regress.mk> | 19 | .include <bsd.regress.mk> |
diff --git a/src/regress/lib/libssl/unit/ssl_verify_param.c b/src/regress/lib/libssl/unit/ssl_verify_param.c index cdb52c56a8..05af9be2be 100644 --- a/src/regress/lib/libssl/unit/ssl_verify_param.c +++ b/src/regress/lib/libssl/unit/ssl_verify_param.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_verify_param.c,v 1.1 2023/05/24 08:54:59 tb Exp $ */ | 1 | /* $OpenBSD: ssl_verify_param.c,v 1.3 2025/10/24 11:43:34 tb Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (c) 2023 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2023 Theo Buehler <tb@openbsd.org> |
| @@ -20,10 +20,9 @@ | |||
| 20 | #include <stdio.h> | 20 | #include <stdio.h> |
| 21 | 21 | ||
| 22 | #include <openssl/ssl.h> | 22 | #include <openssl/ssl.h> |
| 23 | #include <openssl/x509_vfy.h> | ||
| 23 | #include <openssl/x509v3.h> | 24 | #include <openssl/x509v3.h> |
| 24 | 25 | ||
| 25 | unsigned int X509_VERIFY_PARAM_get_hostflags(X509_VERIFY_PARAM *param); | ||
| 26 | |||
| 27 | static int | 26 | static int |
| 28 | ssl_verify_param_flags_inherited(void) | 27 | ssl_verify_param_flags_inherited(void) |
| 29 | { | 28 | { |
diff --git a/src/regress/lib/libtls/tls/tlstest.c b/src/regress/lib/libtls/tls/tlstest.c index b675c798b4..d52156128d 100644 --- a/src/regress/lib/libtls/tls/tlstest.c +++ b/src/regress/lib/libtls/tls/tlstest.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tlstest.c,v 1.16 2024/08/02 15:02:22 tb Exp $ */ | 1 | /* $OpenBSD: tlstest.c,v 1.17 2025/06/04 10:28:00 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2017 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2017 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -531,6 +531,142 @@ do_tls_version_tests(void) | |||
| 531 | return failure; | 531 | return failure; |
| 532 | } | 532 | } |
| 533 | 533 | ||
| 534 | static int | ||
| 535 | test_tls_alpn(const char *client_alpn, const char *server_alpn, | ||
| 536 | const char *selected) | ||
| 537 | { | ||
| 538 | struct tls_config *client_cfg, *server_cfg; | ||
| 539 | struct tls *client, *server, *server_cctx; | ||
| 540 | const char *got_server, *got_client; | ||
| 541 | int failed = 1; | ||
| 542 | |||
| 543 | if ((client = tls_client()) == NULL) | ||
| 544 | errx(1, "failed to create tls client"); | ||
| 545 | if ((client_cfg = tls_config_new()) == NULL) | ||
| 546 | errx(1, "failed to create tls client config"); | ||
| 547 | tls_config_insecure_noverifyname(client_cfg); | ||
| 548 | if (tls_config_set_alpn(client_cfg, client_alpn) == -1) | ||
| 549 | errx(1, "failed to set alpn: %s", tls_config_error(client_cfg)); | ||
| 550 | if (tls_config_set_ca_file(client_cfg, cafile) == -1) | ||
| 551 | errx(1, "failed to set ca: %s", tls_config_error(client_cfg)); | ||
| 552 | |||
| 553 | if ((server = tls_server()) == NULL) | ||
| 554 | errx(1, "failed to create tls server"); | ||
| 555 | if ((server_cfg = tls_config_new()) == NULL) | ||
| 556 | errx(1, "failed to create tls server config"); | ||
| 557 | if (tls_config_set_alpn(server_cfg, server_alpn) == -1) | ||
| 558 | errx(1, "failed to set alpn: %s", tls_config_error(server_cfg)); | ||
| 559 | if (tls_config_set_keypair_file(server_cfg, certfile, keyfile) == -1) | ||
| 560 | errx(1, "failed to set keypair: %s", | ||
| 561 | tls_config_error(server_cfg)); | ||
| 562 | |||
| 563 | if (tls_configure(client, client_cfg) == -1) | ||
| 564 | errx(1, "failed to configure client: %s", tls_error(client)); | ||
| 565 | tls_reset(server); | ||
| 566 | if (tls_configure(server, server_cfg) == -1) | ||
| 567 | errx(1, "failed to configure server: %s", tls_error(server)); | ||
| 568 | |||
| 569 | tls_config_free(client_cfg); | ||
| 570 | tls_config_free(server_cfg); | ||
| 571 | |||
| 572 | circular_init(); | ||
| 573 | |||
| 574 | if (tls_accept_cbs(server, &server_cctx, server_read, server_write, | ||
| 575 | NULL) == -1) | ||
| 576 | errx(1, "failed to accept: %s", tls_error(server)); | ||
| 577 | |||
| 578 | if (tls_connect_cbs(client, client_read, client_write, NULL, | ||
| 579 | "test") == -1) | ||
| 580 | errx(1, "failed to connect: %s", tls_error(client)); | ||
| 581 | |||
| 582 | if (do_client_server_test("alpn", client, server_cctx) != 0) | ||
| 583 | goto fail; | ||
| 584 | |||
| 585 | got_server = tls_conn_alpn_selected(server_cctx); | ||
| 586 | got_client = tls_conn_alpn_selected(client); | ||
| 587 | |||
| 588 | if (got_server == NULL || got_client == NULL) { | ||
| 589 | printf("FAIL: expected ALPN for server and client, got " | ||
| 590 | "server: %p, client %p\n", got_server, got_client); | ||
| 591 | goto fail; | ||
| 592 | } | ||
| 593 | |||
| 594 | if (strcmp(got_server, got_client) != 0) { | ||
| 595 | printf("FAIL: ALPN mismatch: server %s, client %s\n", | ||
| 596 | got_server, got_client); | ||
| 597 | goto fail; | ||
| 598 | } | ||
| 599 | |||
| 600 | if (strcmp(selected, got_server) != 0) { | ||
| 601 | printf("FAIL: ALPN mismatch: want %s, got %s\n", | ||
| 602 | selected, got_server); | ||
| 603 | goto fail; | ||
| 604 | } | ||
| 605 | |||
| 606 | failed = 0; | ||
| 607 | |||
| 608 | fail: | ||
| 609 | tls_free(client); | ||
| 610 | tls_free(server); | ||
| 611 | tls_free(server_cctx); | ||
| 612 | |||
| 613 | return (failed); | ||
| 614 | } | ||
| 615 | |||
| 616 | static const struct test_alpn { | ||
| 617 | const char *client; | ||
| 618 | const char *server; | ||
| 619 | const char *selected; | ||
| 620 | } tls_test_alpn[] = { | ||
| 621 | { | ||
| 622 | .client = "http/2,http/1.1", | ||
| 623 | .server = "http/1.1", | ||
| 624 | .selected = "http/1.1", | ||
| 625 | }, | ||
| 626 | { | ||
| 627 | .client = "http/2,http/1.1", | ||
| 628 | .server = "http/2,http/1.1", | ||
| 629 | .selected = "http/2", | ||
| 630 | }, | ||
| 631 | { | ||
| 632 | .client = "http/1.1,http/2", | ||
| 633 | .server = "http/2,http/1.1", | ||
| 634 | .selected = "http/2", | ||
| 635 | }, | ||
| 636 | { | ||
| 637 | .client = "http/2,http/1.1", | ||
| 638 | .server = "http/1.1,http/2", | ||
| 639 | .selected = "http/1.1", | ||
| 640 | }, | ||
| 641 | { | ||
| 642 | .client = "http/1.1", | ||
| 643 | .server = "http/2,http/1.1", | ||
| 644 | .selected = "http/1.1", | ||
| 645 | }, | ||
| 646 | }; | ||
| 647 | |||
| 648 | #define N_TLS_ALPN_TESTS (sizeof(tls_test_alpn) / sizeof(tls_test_alpn[0])) | ||
| 649 | |||
| 650 | static int | ||
| 651 | do_tls_alpn_tests(void) | ||
| 652 | { | ||
| 653 | const struct test_alpn *ta; | ||
| 654 | int failure = 0; | ||
| 655 | size_t i; | ||
| 656 | |||
| 657 | printf("== TLS alpn tests ==\n"); | ||
| 658 | |||
| 659 | for (i = 0; i < N_TLS_ALPN_TESTS; i++) { | ||
| 660 | ta = &tls_test_alpn[i]; | ||
| 661 | printf("INFO: alpn test %zu - client alpn '%s' " | ||
| 662 | "and server alpn '%s'\n", i, ta->client, ta->server); | ||
| 663 | failure |= test_tls_alpn(ta->client, ta->server, ta->selected); | ||
| 664 | printf("\n"); | ||
| 665 | } | ||
| 666 | |||
| 667 | return failure; | ||
| 668 | } | ||
| 669 | |||
| 534 | int | 670 | int |
| 535 | main(int argc, char **argv) | 671 | main(int argc, char **argv) |
| 536 | { | 672 | { |
| @@ -549,6 +685,7 @@ main(int argc, char **argv) | |||
| 549 | failure |= do_tls_tests(); | 685 | failure |= do_tls_tests(); |
| 550 | failure |= do_tls_ordering_tests(); | 686 | failure |= do_tls_ordering_tests(); |
| 551 | failure |= do_tls_version_tests(); | 687 | failure |= do_tls_version_tests(); |
| 688 | failure |= do_tls_alpn_tests(); | ||
| 552 | 689 | ||
| 553 | return (failure); | 690 | return (failure); |
| 554 | } | 691 | } |
diff --git a/src/regress/usr.bin/openssl/appstest.sh b/src/regress/usr.bin/openssl/appstest.sh index e394102f0d..d878a44a6a 100755 --- a/src/regress/usr.bin/openssl/appstest.sh +++ b/src/regress/usr.bin/openssl/appstest.sh | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | # | 2 | # |
| 3 | # $OpenBSD: appstest.sh,v 1.67 2025/01/19 11:04:35 tb Exp $ | 3 | # $OpenBSD: appstest.sh,v 1.69 2025/12/20 07:04:28 tb Exp $ |
| 4 | # | 4 | # |
| 5 | # Copyright (c) 2016 Kinichiro Inoguchi <inoguchi@openbsd.org> | 5 | # Copyright (c) 2016 Kinichiro Inoguchi <inoguchi@openbsd.org> |
| 6 | # | 6 | # |
| @@ -1189,10 +1189,6 @@ __EOF__ | |||
| 1189 | diff -b $cms_dgv $cms_txt | 1189 | diff -b $cms_dgv $cms_txt |
| 1190 | check_exit_status $? | 1190 | check_exit_status $? |
| 1191 | 1191 | ||
| 1192 | # compress | ||
| 1193 | |||
| 1194 | # uncompress | ||
| 1195 | |||
| 1196 | # EncryptedData_encrypt | 1192 | # EncryptedData_encrypt |
| 1197 | start_message "cms ... EncryptedData_encrypt" | 1193 | start_message "cms ... EncryptedData_encrypt" |
| 1198 | 1194 | ||
| @@ -1456,13 +1452,14 @@ function test_sc_by_protocol_version { | |||
| 1456 | check_exit_status $? | 1452 | check_exit_status $? |
| 1457 | fi | 1453 | fi |
| 1458 | 1454 | ||
| 1459 | # check HRR hash | 1455 | # This breaks since we added mlkem, I believe because the HRR value has changed. |
| 1460 | if [ $ver = "tls1_3" ] ; then | 1456 | # # check HRR hash |
| 1461 | perl -0ne \ | 1457 | # if [ $ver = "tls1_3" ] ; then |
| 1462 | 'exit (!/ServerHello\n.*cf 21 ad 74 e5 9a 61 11 be 1d\n.*8c 02 1e 65 b8 91 c2 a2 11 16 7a bb 8c 5e 07 9e\n.*09 e2 c8 a8 33 9c/m)' \ | 1458 | # perl -0ne \ |
| 1463 | $s_client_out | 1459 | ## 'exit (!/ServerHello\n.*cf 21 ad 74 e5 9a 61 11 be 1d\n.*8c 02 1e 65 b8 91 c2 a2 11 16 7a bb 8c #5e 07 9e\n.*09 e2 c8 a8 33 9c/m)' \ |
| 1464 | check_exit_status $? | 1460 | # $s_client_out |
| 1465 | fi | 1461 | # check_exit_status $? |
| 1462 | # fi | ||
| 1466 | 1463 | ||
| 1467 | if [ $ver = "tls1_3" ] ; then | 1464 | if [ $ver = "tls1_3" ] ; then |
| 1468 | grep 'Server Temp Key: ECDH, .*384.*, 384 bits' $s_client_out \ | 1465 | grep 'Server Temp Key: ECDH, .*384.*, 384 bits' $s_client_out \ |
diff --git a/src/usr.bin/nc/nc.1 b/src/usr.bin/nc/nc.1 index 76b6dc018e..2ffdcd1ea6 100644 --- a/src/usr.bin/nc/nc.1 +++ b/src/usr.bin/nc/nc.1 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: nc.1,v 1.98 2024/04/01 12:40:18 deraadt Exp $ | 1 | .\" $OpenBSD: nc.1,v 1.101 2025/06/24 13:37:39 tb Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 1996 David Sacerdote | 3 | .\" Copyright (c) 1996 David Sacerdote |
| 4 | .\" All rights reserved. | 4 | .\" All rights reserved. |
| @@ -25,7 +25,7 @@ | |||
| 25 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | .\" | 27 | .\" |
| 28 | .Dd $Mdocdate: April 1 2024 $ | 28 | .Dd $Mdocdate: June 24 2025 $ |
| 29 | .Dt NC 1 | 29 | .Dt NC 1 |
| 30 | .Os | 30 | .Os |
| 31 | .Sh NAME | 31 | .Sh NAME |
| @@ -257,6 +257,10 @@ with the handshake. | |||
| 257 | The following TLS options specify a value in the form of a | 257 | The following TLS options specify a value in the form of a |
| 258 | .Ar key Ns = Ns Ar value | 258 | .Ar key Ns = Ns Ar value |
| 259 | pair: | 259 | pair: |
| 260 | .Cm alpn , | ||
| 261 | which allows the TLS ALPN to be specified (see | ||
| 262 | .Xr tls_config_set_alpn 3 | ||
| 263 | for further details); | ||
| 260 | .Cm ciphers , | 264 | .Cm ciphers , |
| 261 | which allows the supported TLS ciphers to be specified (see | 265 | which allows the supported TLS ciphers to be specified (see |
| 262 | .Xr tls_config_set_ciphers 3 | 266 | .Xr tls_config_set_ciphers 3 |
| @@ -338,12 +342,18 @@ when talking to the proxy server. | |||
| 338 | Supported protocols are | 342 | Supported protocols are |
| 339 | .Cm 4 | 343 | .Cm 4 |
| 340 | (SOCKS v.4), | 344 | (SOCKS v.4), |
| 345 | .Cm 4A | ||
| 346 | (SOCKS v.4A), | ||
| 341 | .Cm 5 | 347 | .Cm 5 |
| 342 | (SOCKS v.5) | 348 | (SOCKS v.5) |
| 343 | and | 349 | and |
| 344 | .Cm connect | 350 | .Cm connect |
| 345 | (HTTPS proxy). | 351 | (HTTPS proxy). |
| 346 | If the protocol is not specified, SOCKS version 5 is used. | 352 | If the protocol is not specified, SOCKS version 5 is used. |
| 353 | Note that the SOCKS v.4 protocol is very limited and can only be used when | ||
| 354 | the destination host can be resolved to an IPv4 address. | ||
| 355 | The other protocols pass the destination as a string to be interpreted | ||
| 356 | by the remote proxy and do not have this limitation. | ||
| 347 | .It Fl x Ar proxy_address Ns Op : Ns Ar port | 357 | .It Fl x Ar proxy_address Ns Op : Ns Ar port |
| 348 | Connect to | 358 | Connect to |
| 349 | .Ar destination | 359 | .Ar destination |
diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c index 8c60fd1882..6438fbbc5d 100644 --- a/src/usr.bin/nc/netcat.c +++ b/src/usr.bin/nc/netcat.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: netcat.c,v 1.229 2024/11/02 17:19:27 tb Exp $ */ | 1 | /* $OpenBSD: netcat.c,v 1.237 2025/12/06 09:48:30 phessler Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> | 3 | * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> |
| 4 | * Copyright (c) 2015 Bob Beck. All rights reserved. | 4 | * Copyright (c) 2015 Bob Beck. All rights reserved. |
| @@ -108,6 +108,7 @@ char *tls_expectname; /* required name in peer cert */ | |||
| 108 | char *tls_expecthash; /* required hash of peer cert */ | 108 | char *tls_expecthash; /* required hash of peer cert */ |
| 109 | char *tls_ciphers; /* TLS ciphers */ | 109 | char *tls_ciphers; /* TLS ciphers */ |
| 110 | char *tls_protocols; /* TLS protocols */ | 110 | char *tls_protocols; /* TLS protocols */ |
| 111 | char *tls_alpn; /* TLS ALPN */ | ||
| 111 | FILE *Zflag; /* file to save peer cert */ | 112 | FILE *Zflag; /* file to save peer cert */ |
| 112 | 113 | ||
| 113 | int recvcount, recvlimit; | 114 | int recvcount, recvlimit; |
| @@ -190,6 +191,8 @@ main(int argc, char *argv[]) | |||
| 190 | socksv = -1; /* HTTP proxy CONNECT */ | 191 | socksv = -1; /* HTTP proxy CONNECT */ |
| 191 | else if (strcmp(optarg, "4") == 0) | 192 | else if (strcmp(optarg, "4") == 0) |
| 192 | socksv = 4; /* SOCKS v.4 */ | 193 | socksv = 4; /* SOCKS v.4 */ |
| 194 | else if (strcasecmp(optarg, "4A") == 0) | ||
| 195 | socksv = 44; /* SOCKS v.4A */ | ||
| 193 | else if (strcmp(optarg, "5") == 0) | 196 | else if (strcmp(optarg, "5") == 0) |
| 194 | socksv = 5; /* SOCKS v.5 */ | 197 | socksv = 5; /* SOCKS v.5 */ |
| 195 | else | 198 | else |
| @@ -532,6 +535,8 @@ main(int argc, char *argv[]) | |||
| 532 | errx(1, "%s", tls_config_error(tls_cfg)); | 535 | errx(1, "%s", tls_config_error(tls_cfg)); |
| 533 | if (tls_config_set_ciphers(tls_cfg, tls_ciphers) == -1) | 536 | if (tls_config_set_ciphers(tls_cfg, tls_ciphers) == -1) |
| 534 | errx(1, "%s", tls_config_error(tls_cfg)); | 537 | errx(1, "%s", tls_config_error(tls_cfg)); |
| 538 | if (tls_alpn != NULL && tls_config_set_alpn(tls_cfg, tls_alpn) == -1) | ||
| 539 | errx(1, "%s", tls_config_error(tls_cfg)); | ||
| 535 | if (!lflag && (TLSopt & TLS_CCERT)) | 540 | if (!lflag && (TLSopt & TLS_CCERT)) |
| 536 | errx(1, "clientcert is only valid with -l"); | 541 | errx(1, "clientcert is only valid with -l"); |
| 537 | if (TLSopt & TLS_NONAME) | 542 | if (TLSopt & TLS_NONAME) |
| @@ -1537,7 +1542,12 @@ connection_info(const char *host, const char *port, const char *proto, | |||
| 1537 | 1542 | ||
| 1538 | /* Look up service name unless -n. */ | 1543 | /* Look up service name unless -n. */ |
| 1539 | if (!nflag) { | 1544 | if (!nflag) { |
| 1540 | sv = getservbyport(ntohs(atoi(port)), proto); | 1545 | const char *errstr; |
| 1546 | |||
| 1547 | int p = strtonum(port, 1, PORT_MAX, &errstr); | ||
| 1548 | if (errstr) | ||
| 1549 | errx(1, "port number %s: %s", errstr, port); | ||
| 1550 | sv = getservbyport(htons(p), proto); | ||
| 1541 | if (sv != NULL) | 1551 | if (sv != NULL) |
| 1542 | service = sv->s_name; | 1552 | service = sv->s_name; |
| 1543 | } | 1553 | } |
| @@ -1645,6 +1655,7 @@ process_tos_opt(char *s, int *val) | |||
| 1645 | { "netcontrol", IPTOS_PREC_NETCONTROL }, | 1655 | { "netcontrol", IPTOS_PREC_NETCONTROL }, |
| 1646 | { "reliability", IPTOS_RELIABILITY }, | 1656 | { "reliability", IPTOS_RELIABILITY }, |
| 1647 | { "throughput", IPTOS_THROUGHPUT }, | 1657 | { "throughput", IPTOS_THROUGHPUT }, |
| 1658 | { "va", IPTOS_DSCP_VA }, | ||
| 1648 | { NULL, -1 }, | 1659 | { NULL, -1 }, |
| 1649 | }; | 1660 | }; |
| 1650 | 1661 | ||
| @@ -1669,11 +1680,12 @@ process_tls_opt(char *s, int *flags) | |||
| 1669 | int flag; | 1680 | int flag; |
| 1670 | char **value; | 1681 | char **value; |
| 1671 | } *t, tlskeywords[] = { | 1682 | } *t, tlskeywords[] = { |
| 1683 | { "alpn", -1, &tls_alpn }, | ||
| 1672 | { "ciphers", -1, &tls_ciphers }, | 1684 | { "ciphers", -1, &tls_ciphers }, |
| 1673 | { "clientcert", TLS_CCERT, NULL }, | 1685 | { "clientcert", TLS_CCERT, NULL }, |
| 1674 | { "muststaple", TLS_MUSTSTAPLE, NULL }, | 1686 | { "muststaple", TLS_MUSTSTAPLE, NULL }, |
| 1675 | { "noverify", TLS_NOVERIFY, NULL }, | ||
| 1676 | { "noname", TLS_NONAME, NULL }, | 1687 | { "noname", TLS_NONAME, NULL }, |
| 1688 | { "noverify", TLS_NOVERIFY, NULL }, | ||
| 1677 | { "protocols", -1, &tls_protocols }, | 1689 | { "protocols", -1, &tls_protocols }, |
| 1678 | { NULL, -1, NULL }, | 1690 | { NULL, -1, NULL }, |
| 1679 | }; | 1691 | }; |
| @@ -1692,6 +1704,8 @@ process_tls_opt(char *s, int *flags) | |||
| 1692 | errx(1, "invalid tls value `%s'", s); | 1704 | errx(1, "invalid tls value `%s'", s); |
| 1693 | *t->value = v; | 1705 | *t->value = v; |
| 1694 | } else { | 1706 | } else { |
| 1707 | if (v != NULL) | ||
| 1708 | errx(1, "invalid tls value `%s'", s); | ||
| 1695 | *flags |= t->flag; | 1709 | *flags |= t->flag; |
| 1696 | } | 1710 | } |
| 1697 | return 1; | 1711 | return 1; |
| @@ -1718,7 +1732,7 @@ void | |||
| 1718 | report_tls(struct tls *tls_ctx, char *host) | 1732 | report_tls(struct tls *tls_ctx, char *host) |
| 1719 | { | 1733 | { |
| 1720 | time_t t; | 1734 | time_t t; |
| 1721 | const char *ocsp_url; | 1735 | const char *alpn_proto, *ocsp_url; |
| 1722 | 1736 | ||
| 1723 | fprintf(stderr, "TLS handshake negotiated %s/%s with host %s\n", | 1737 | fprintf(stderr, "TLS handshake negotiated %s/%s with host %s\n", |
| 1724 | tls_conn_version(tls_ctx), tls_conn_cipher(tls_ctx), host); | 1738 | tls_conn_version(tls_ctx), tls_conn_cipher(tls_ctx), host); |
| @@ -1770,6 +1784,8 @@ report_tls(struct tls *tls_ctx, char *host) | |||
| 1770 | tls_peer_ocsp_result(tls_ctx)); | 1784 | tls_peer_ocsp_result(tls_ctx)); |
| 1771 | break; | 1785 | break; |
| 1772 | } | 1786 | } |
| 1787 | if ((alpn_proto = tls_conn_alpn_selected(tls_ctx)) != NULL) | ||
| 1788 | fprintf(stderr, "Application Layer Protocol: %s\n", alpn_proto); | ||
| 1773 | } | 1789 | } |
| 1774 | 1790 | ||
| 1775 | void | 1791 | void |
| @@ -1842,7 +1858,7 @@ help(void) | |||
| 1842 | \t-v Verbose\n\ | 1858 | \t-v Verbose\n\ |
| 1843 | \t-W recvlimit Terminate after receiving a number of packets\n\ | 1859 | \t-W recvlimit Terminate after receiving a number of packets\n\ |
| 1844 | \t-w timeout Timeout for connects and final net reads\n\ | 1860 | \t-w timeout Timeout for connects and final net reads\n\ |
| 1845 | \t-X proto Proxy protocol: \"4\", \"5\" (SOCKS) or \"connect\"\n\ | 1861 | \t-X proto Proxy protocol: \"4\", \"4A\", \"5\" (SOCKS) or \"connect\"\n\ |
| 1846 | \t-x addr[:port]\tSpecify proxy address and port\n\ | 1862 | \t-x addr[:port]\tSpecify proxy address and port\n\ |
| 1847 | \t-Z Peer certificate file\n\ | 1863 | \t-Z Peer certificate file\n\ |
| 1848 | \t-z Zero-I/O mode [used for scanning]\n\ | 1864 | \t-z Zero-I/O mode [used for scanning]\n\ |
diff --git a/src/usr.bin/nc/socks.c b/src/usr.bin/nc/socks.c index 7c7448c9c5..1f1fb96e2a 100644 --- a/src/usr.bin/nc/socks.c +++ b/src/usr.bin/nc/socks.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: socks.c,v 1.31 2022/06/08 20:20:26 djm Exp $ */ | 1 | /* $OpenBSD: socks.c,v 1.34 2025/05/22 06:40:26 djm Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (c) 1999 Niklas Hallqvist. All rights reserved. | 4 | * Copyright (c) 1999 Niklas Hallqvist. All rights reserved. |
| @@ -293,19 +293,33 @@ socks_connect(const char *host, const char *port, | |||
| 293 | default: | 293 | default: |
| 294 | errx(1, "connection failed, unsupported address type"); | 294 | errx(1, "connection failed, unsupported address type"); |
| 295 | } | 295 | } |
| 296 | } else if (socksv == 4) { | 296 | } else if (socksv == 4 || socksv == 44) { |
| 297 | /* This will exit on lookup failure */ | 297 | if (socksv == 4) { |
| 298 | decode_addrport(host, port, (struct sockaddr *)&addr, | 298 | /* This will exit on lookup failure */ |
| 299 | sizeof(addr), 1, 0); | 299 | decode_addrport(host, port, (struct sockaddr *)&addr, |
| 300 | sizeof(addr), 1, 0); | ||
| 301 | } | ||
| 300 | 302 | ||
| 301 | /* Version 4 */ | 303 | /* Version 4 */ |
| 302 | buf[0] = SOCKS_V4; | 304 | buf[0] = SOCKS_V4; |
| 303 | buf[1] = SOCKS_CONNECT; /* connect */ | 305 | buf[1] = SOCKS_CONNECT; /* connect */ |
| 304 | memcpy(buf + 2, &in4->sin_port, sizeof in4->sin_port); | 306 | memcpy(buf + 2, &in4->sin_port, sizeof in4->sin_port); |
| 305 | memcpy(buf + 4, &in4->sin_addr, sizeof in4->sin_addr); | 307 | if (socksv == 4) { |
| 308 | memcpy(buf + 4, &in4->sin_addr, sizeof in4->sin_addr); | ||
| 309 | } else { | ||
| 310 | /* SOCKS4A uses addr of 0.0.0.x, and hostname later */ | ||
| 311 | buf[4] = buf[5] = buf[6] = 0; | ||
| 312 | buf[7] = 1; | ||
| 313 | } | ||
| 306 | buf[8] = 0; /* empty username */ | 314 | buf[8] = 0; /* empty username */ |
| 307 | wlen = 9; | 315 | wlen = 9; |
| 308 | 316 | if (socksv == 44) { | |
| 317 | /* SOCKS4A has nul-terminated hostname after user */ | ||
| 318 | if (strlcpy(buf + 9, host, | ||
| 319 | sizeof(buf) - 9) >= sizeof(buf) - 9) | ||
| 320 | errx(1, "hostname too big"); | ||
| 321 | wlen = 9 + strlen(host) + 1; | ||
| 322 | } | ||
| 309 | cnt = atomicio(vwrite, proxyfd, buf, wlen); | 323 | cnt = atomicio(vwrite, proxyfd, buf, wlen); |
| 310 | if (cnt != wlen) | 324 | if (cnt != wlen) |
| 311 | err(1, "write failed (%zu/%zu)", cnt, wlen); | 325 | err(1, "write failed (%zu/%zu)", cnt, wlen); |
| @@ -373,16 +387,16 @@ socks_connect(const char *host, const char *port, | |||
| 373 | /* Read status reply */ | 387 | /* Read status reply */ |
| 374 | proxy_read_line(proxyfd, buf, sizeof(buf)); | 388 | proxy_read_line(proxyfd, buf, sizeof(buf)); |
| 375 | if (proxyuser != NULL && | 389 | if (proxyuser != NULL && |
| 376 | (strncmp(buf, "HTTP/1.0 407 ", 12) == 0 || | 390 | (strncmp(buf, "HTTP/1.0 407 ", 13) == 0 || |
| 377 | strncmp(buf, "HTTP/1.1 407 ", 12) == 0)) { | 391 | strncmp(buf, "HTTP/1.1 407 ", 13) == 0)) { |
| 378 | if (authretry > 1) { | 392 | if (authretry > 1) { |
| 379 | fprintf(stderr, "Proxy authentication " | 393 | fprintf(stderr, "Proxy authentication " |
| 380 | "failed\n"); | 394 | "failed\n"); |
| 381 | } | 395 | } |
| 382 | close(proxyfd); | 396 | close(proxyfd); |
| 383 | goto again; | 397 | goto again; |
| 384 | } else if (strncmp(buf, "HTTP/1.0 200 ", 12) != 0 && | 398 | } else if (strncmp(buf, "HTTP/1.0 200 ", 13) != 0 && |
| 385 | strncmp(buf, "HTTP/1.1 200 ", 12) != 0) | 399 | strncmp(buf, "HTTP/1.1 200 ", 13) != 0) |
| 386 | errx(1, "Proxy error: \"%s\"", buf); | 400 | errx(1, "Proxy error: \"%s\"", buf); |
| 387 | 401 | ||
| 388 | /* Headers continue until we hit an empty line */ | 402 | /* Headers continue until we hit an empty line */ |
diff --git a/src/usr.bin/openssl/asn1pars.c b/src/usr.bin/openssl/asn1pars.c index 355784169e..52991c392e 100644 --- a/src/usr.bin/openssl/asn1pars.c +++ b/src/usr.bin/openssl/asn1pars.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: asn1pars.c,v 1.17 2025/01/02 12:31:44 tb Exp $ */ | 1 | /* $OpenBSD: asn1pars.c,v 1.18 2025/11/27 08:22:32 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -241,7 +241,7 @@ asn1parse_main(int argc, char **argv) | |||
| 241 | BIO *in = NULL, *out = NULL, *b64 = NULL, *derout = NULL; | 241 | BIO *in = NULL, *out = NULL, *b64 = NULL, *derout = NULL; |
| 242 | char *str = NULL; | 242 | char *str = NULL; |
| 243 | const char *errstr = NULL; | 243 | const char *errstr = NULL; |
| 244 | unsigned char *tmpbuf; | 244 | const unsigned char *tmpbuf; |
| 245 | const unsigned char *ctmpbuf; | 245 | const unsigned char *ctmpbuf; |
| 246 | BUF_MEM *buf = NULL; | 246 | BUF_MEM *buf = NULL; |
| 247 | ASN1_TYPE *at = NULL; | 247 | ASN1_TYPE *at = NULL; |
| @@ -368,8 +368,8 @@ asn1parse_main(int argc, char **argv) | |||
| 368 | goto end; | 368 | goto end; |
| 369 | } | 369 | } |
| 370 | /* hmm... this is a little evil but it works */ | 370 | /* hmm... this is a little evil but it works */ |
| 371 | tmpbuf = at->value.asn1_string->data; | 371 | tmpbuf = ASN1_STRING_get0_data(at->value.asn1_string); |
| 372 | tmplen = at->value.asn1_string->length; | 372 | tmplen = ASN1_STRING_length(at->value.asn1_string); |
| 373 | } | 373 | } |
| 374 | str = (char *) tmpbuf; | 374 | str = (char *) tmpbuf; |
| 375 | num = tmplen; | 375 | num = tmplen; |
diff --git a/src/usr.bin/openssl/ca.c b/src/usr.bin/openssl/ca.c index b644b746b9..a2e8a68368 100644 --- a/src/usr.bin/openssl/ca.c +++ b/src/usr.bin/openssl/ca.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ca.c,v 1.62 2025/04/14 08:39:27 tb Exp $ */ | 1 | /* $OpenBSD: ca.c,v 1.64 2025/12/21 07:14:47 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -69,6 +69,7 @@ | |||
| 69 | 69 | ||
| 70 | #include "apps.h" | 70 | #include "apps.h" |
| 71 | 71 | ||
| 72 | #include <openssl/asn1.h> | ||
| 72 | #include <openssl/bio.h> | 73 | #include <openssl/bio.h> |
| 73 | #include <openssl/bn.h> | 74 | #include <openssl/bn.h> |
| 74 | #include <openssl/conf.h> | 75 | #include <openssl/conf.h> |
| @@ -1652,6 +1653,54 @@ certify_cert(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509, | |||
| 1652 | } | 1653 | } |
| 1653 | 1654 | ||
| 1654 | static int | 1655 | static int |
| 1656 | is_printablestring_octet(const uint8_t u8) | ||
| 1657 | { | ||
| 1658 | /* | ||
| 1659 | * X.680, 41.4, Table 10 lists the allowed characters in this order. | ||
| 1660 | */ | ||
| 1661 | |||
| 1662 | if (u8 >= 'A' && u8 <= 'Z') | ||
| 1663 | return 1; | ||
| 1664 | if (u8 >= 'a' && u8 <= 'z') | ||
| 1665 | return 1; | ||
| 1666 | if (u8 >= '0' && u8 <= '9') | ||
| 1667 | return 1; | ||
| 1668 | |||
| 1669 | return u8 == ' ' || u8 == '\'' || u8 == '(' || u8 == ')' || u8 == '+' || | ||
| 1670 | u8 == ',' || u8 == '-' || u8 == '.' || u8 == '/' || u8 == ':' || | ||
| 1671 | u8 == '=' || u8 == '?'; | ||
| 1672 | } | ||
| 1673 | |||
| 1674 | /* | ||
| 1675 | * Allows the high bit to be set only for UTF8, BMP and T61 strings, and | ||
| 1676 | * checks that a PrintableString only contains the specified characters. | ||
| 1677 | */ | ||
| 1678 | static int | ||
| 1679 | validate_octets(const ASN1_STRING *astr) | ||
| 1680 | { | ||
| 1681 | const uint8_t *buf = ASN1_STRING_get0_data(astr); | ||
| 1682 | int type = ASN1_STRING_type(astr); | ||
| 1683 | int i; | ||
| 1684 | |||
| 1685 | if (type == V_ASN1_BMPSTRING || type == V_ASN1_UTF8STRING || | ||
| 1686 | type == V_ASN1_T61STRING) | ||
| 1687 | return 1; | ||
| 1688 | |||
| 1689 | for (i = 0; i < ASN1_STRING_length(astr); i++) { | ||
| 1690 | if (is_printablestring_octet(buf[i])) | ||
| 1691 | continue; | ||
| 1692 | |||
| 1693 | if (type == V_ASN1_PRINTABLESTRING) | ||
| 1694 | return 0; | ||
| 1695 | |||
| 1696 | if ((buf[i] & 0x80) != 0) | ||
| 1697 | return 0; | ||
| 1698 | } | ||
| 1699 | |||
| 1700 | return 1; | ||
| 1701 | } | ||
| 1702 | |||
| 1703 | static int | ||
| 1655 | do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst, | 1704 | do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst, |
| 1656 | STACK_OF(OPENSSL_STRING) *sigopts, STACK_OF(CONF_VALUE) *policy, | 1705 | STACK_OF(OPENSSL_STRING) *sigopts, STACK_OF(CONF_VALUE) *policy, |
| 1657 | CA_DB *db, BIGNUM *serial, char *subj, unsigned long chtype, int multirdn, | 1706 | CA_DB *db, BIGNUM *serial, char *subj, unsigned long chtype, int multirdn, |
| @@ -1717,22 +1766,17 @@ do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst, | |||
| 1717 | 1766 | ||
| 1718 | /* check some things */ | 1767 | /* check some things */ |
| 1719 | if ((OBJ_obj2nid(obj) == NID_pkcs9_emailAddress) && | 1768 | if ((OBJ_obj2nid(obj) == NID_pkcs9_emailAddress) && |
| 1720 | (str->type != V_ASN1_IA5STRING)) { | 1769 | (ASN1_STRING_type(str) != V_ASN1_IA5STRING)) { |
| 1721 | BIO_printf(bio_err, | 1770 | BIO_printf(bio_err, |
| 1722 | "\nemailAddress type needs to be of type IA5STRING\n"); | 1771 | "\nemailAddress type needs to be of type IA5STRING\n"); |
| 1723 | goto err; | 1772 | goto err; |
| 1724 | } | 1773 | } |
| 1725 | if ((str->type != V_ASN1_BMPSTRING) && | 1774 | |
| 1726 | (str->type != V_ASN1_UTF8STRING)) { | 1775 | if (!validate_octets(str)) { |
| 1727 | j = ASN1_PRINTABLE_type(str->data, str->length); | 1776 | BIO_printf(bio_err, |
| 1728 | if (((j == V_ASN1_T61STRING) && | 1777 | "\nThe string contains characters that are illegal " |
| 1729 | (str->type != V_ASN1_T61STRING)) || | 1778 | "for the ASN.1 type\n"); |
| 1730 | ((j == V_ASN1_IA5STRING) && | 1779 | goto err; |
| 1731 | (str->type == V_ASN1_PRINTABLESTRING))) { | ||
| 1732 | BIO_printf(bio_err, | ||
| 1733 | "\nThe string contains characters that are illegal for the ASN.1 type\n"); | ||
| 1734 | goto err; | ||
| 1735 | } | ||
| 1736 | } | 1780 | } |
| 1737 | if (default_op) | 1781 | if (default_op) |
| 1738 | old_entry_print(bio_err, obj, str); | 1782 | old_entry_print(bio_err, obj, str); |
| @@ -1830,9 +1874,9 @@ do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst, | |||
| 1830 | BIO_printf(bio_err, | 1874 | BIO_printf(bio_err, |
| 1831 | "The %s field needed to be the same in the\nCA certificate (%s) and the request (%s)\n", | 1875 | "The %s field needed to be the same in the\nCA certificate (%s) and the request (%s)\n", |
| 1832 | cv->name, ((str2 == NULL) ? | 1876 | cv->name, ((str2 == NULL) ? |
| 1833 | "NULL" : (char *) str2->data), | 1877 | "NULL" : (const char *) ASN1_STRING_get0_data(str2)), |
| 1834 | ((str == NULL) ? | 1878 | ((str == NULL) ? |
| 1835 | "NULL" : (char *) str->data)); | 1879 | "NULL" : (const char *) ASN1_STRING_get0_data(str))); |
| 1836 | goto err; | 1880 | goto err; |
| 1837 | } | 1881 | } |
| 1838 | } else { | 1882 | } else { |
| @@ -2153,7 +2197,8 @@ do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst, | |||
| 2153 | 2197 | ||
| 2154 | if ((tm = X509_get_notAfter(ret)) == NULL) | 2198 | if ((tm = X509_get_notAfter(ret)) == NULL) |
| 2155 | goto err; | 2199 | goto err; |
| 2156 | row[DB_exp_date] = strndup(tm->data, tm->length); | 2200 | row[DB_exp_date] = strndup(ASN1_STRING_get0_data(tm), |
| 2201 | ASN1_STRING_length(tm)); | ||
| 2157 | if (row[DB_type] == NULL || row[DB_exp_date] == NULL) { | 2202 | if (row[DB_type] == NULL || row[DB_exp_date] == NULL) { |
| 2158 | BIO_printf(bio_err, "Memory allocation failure\n"); | 2203 | BIO_printf(bio_err, "Memory allocation failure\n"); |
| 2159 | goto err; | 2204 | goto err; |
| @@ -2280,7 +2325,8 @@ do_revoke(X509 *x509, CA_DB *db, int type, char *value) | |||
| 2280 | 2325 | ||
| 2281 | if ((tm = X509_get_notAfter(x509)) == NULL) | 2326 | if ((tm = X509_get_notAfter(x509)) == NULL) |
| 2282 | goto err; | 2327 | goto err; |
| 2283 | row[DB_exp_date] = strndup(tm->data, tm->length); | 2328 | row[DB_exp_date] = strndup(ASN1_STRING_get0_data(tm), |
| 2329 | ASN1_STRING_length(tm)); | ||
| 2284 | if (row[DB_type] == NULL || row[DB_exp_date] == NULL) { | 2330 | if (row[DB_type] == NULL || row[DB_exp_date] == NULL) { |
| 2285 | BIO_printf(bio_err, "Memory allocation failure\n"); | 2331 | BIO_printf(bio_err, "Memory allocation failure\n"); |
| 2286 | goto err; | 2332 | goto err; |
| @@ -2443,7 +2489,7 @@ do_updatedb(CA_DB *db) | |||
| 2443 | cnt = -1; | 2489 | cnt = -1; |
| 2444 | goto err; | 2490 | goto err; |
| 2445 | } | 2491 | } |
| 2446 | a_tm_s = strndup(a_tm->data, a_tm->length); | 2492 | a_tm_s = strndup(ASN1_STRING_get0_data(a_tm), ASN1_STRING_length(a_tm)); |
| 2447 | if (a_tm_s == NULL) { | 2493 | if (a_tm_s == NULL) { |
| 2448 | cnt = -1; | 2494 | cnt = -1; |
| 2449 | goto err; | 2495 | goto err; |
| @@ -2579,7 +2625,7 @@ make_revocation_str(int rev_type, char *rev_arg) | |||
| 2579 | if (revtm == NULL) | 2625 | if (revtm == NULL) |
| 2580 | return NULL; | 2626 | return NULL; |
| 2581 | 2627 | ||
| 2582 | if (asprintf(&str, "%s%s%s%s%s", revtm->data, | 2628 | if (asprintf(&str, "%s%s%s%s%s", ASN1_STRING_get0_data(revtm), |
| 2583 | reason ? "," : "", reason ? reason : "", | 2629 | reason ? "," : "", reason ? reason : "", |
| 2584 | other ? "," : "", other ? other : "") == -1) | 2630 | other ? "," : "", other ? other : "") == -1) |
| 2585 | str = NULL; | 2631 | str = NULL; |
| @@ -2652,7 +2698,8 @@ make_revoked(X509_REVOKED *rev, const char *str) | |||
| 2652 | int | 2698 | int |
| 2653 | old_entry_print(BIO *bp, ASN1_OBJECT *obj, ASN1_STRING *str) | 2699 | old_entry_print(BIO *bp, ASN1_OBJECT *obj, ASN1_STRING *str) |
| 2654 | { | 2700 | { |
| 2655 | char buf[25], *pbuf, *p; | 2701 | const char *p; |
| 2702 | char buf[25], *pbuf; | ||
| 2656 | int j; | 2703 | int j; |
| 2657 | 2704 | ||
| 2658 | j = i2a_ASN1_OBJECT(bp, obj); | 2705 | j = i2a_ASN1_OBJECT(bp, obj); |
| @@ -2663,19 +2710,19 @@ old_entry_print(BIO *bp, ASN1_OBJECT *obj, ASN1_STRING *str) | |||
| 2663 | *(pbuf++) = '\0'; | 2710 | *(pbuf++) = '\0'; |
| 2664 | BIO_puts(bp, buf); | 2711 | BIO_puts(bp, buf); |
| 2665 | 2712 | ||
| 2666 | if (str->type == V_ASN1_PRINTABLESTRING) | 2713 | if (ASN1_STRING_type(str) == V_ASN1_PRINTABLESTRING) |
| 2667 | BIO_printf(bp, "PRINTABLE:'"); | 2714 | BIO_printf(bp, "PRINTABLE:'"); |
| 2668 | else if (str->type == V_ASN1_T61STRING) | 2715 | else if (ASN1_STRING_type(str) == V_ASN1_T61STRING) |
| 2669 | BIO_printf(bp, "T61STRING:'"); | 2716 | BIO_printf(bp, "T61STRING:'"); |
| 2670 | else if (str->type == V_ASN1_IA5STRING) | 2717 | else if (ASN1_STRING_type(str) == V_ASN1_IA5STRING) |
| 2671 | BIO_printf(bp, "IA5STRING:'"); | 2718 | BIO_printf(bp, "IA5STRING:'"); |
| 2672 | else if (str->type == V_ASN1_UNIVERSALSTRING) | 2719 | else if (ASN1_STRING_type(str) == V_ASN1_UNIVERSALSTRING) |
| 2673 | BIO_printf(bp, "UNIVERSALSTRING:'"); | 2720 | BIO_printf(bp, "UNIVERSALSTRING:'"); |
| 2674 | else | 2721 | else |
| 2675 | BIO_printf(bp, "ASN.1 %2d:'", str->type); | 2722 | BIO_printf(bp, "ASN.1 %2d:'", ASN1_STRING_type(str)); |
| 2676 | 2723 | ||
| 2677 | p = (char *) str->data; | 2724 | p = (const char *) ASN1_STRING_get0_data(str); |
| 2678 | for (j = str->length; j > 0; j--) { | 2725 | for (j = ASN1_STRING_length(str); j > 0; j--) { |
| 2679 | if ((*p >= ' ') && (*p <= '~')) | 2726 | if ((*p >= ' ') && (*p <= '~')) |
| 2680 | BIO_printf(bp, "%c", *p); | 2727 | BIO_printf(bp, "%c", *p); |
| 2681 | else if (*p & 0x80) | 2728 | else if (*p & 0x80) |
diff --git a/src/usr.bin/openssl/certhash.c b/src/usr.bin/openssl/certhash.c index 5ee29b8d01..1ee1165516 100644 --- a/src/usr.bin/openssl/certhash.c +++ b/src/usr.bin/openssl/certhash.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: certhash.c,v 1.21 2023/03/06 14:32:05 tb Exp $ */ | 1 | /* $OpenBSD: certhash.c,v 1.22 2025/07/27 14:46:20 joshua Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014, 2015 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014, 2015 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -297,11 +297,10 @@ hashinfo_from_linkname(const char *linkname, const char *target) | |||
| 297 | } | 297 | } |
| 298 | 298 | ||
| 299 | static struct hashinfo * | 299 | static struct hashinfo * |
| 300 | certhash_cert(BIO *bio, const char *filename) | 300 | certhash_cert(BIO *bio, const char *filename, const EVP_MD *digest) |
| 301 | { | 301 | { |
| 302 | unsigned char fingerprint[EVP_MAX_MD_SIZE]; | 302 | unsigned char fingerprint[EVP_MAX_MD_SIZE]; |
| 303 | struct hashinfo *hi = NULL; | 303 | struct hashinfo *hi = NULL; |
| 304 | const EVP_MD *digest; | ||
| 305 | X509 *cert = NULL; | 304 | X509 *cert = NULL; |
| 306 | unsigned long hash; | 305 | unsigned long hash; |
| 307 | unsigned int len; | 306 | unsigned int len; |
| @@ -311,7 +310,6 @@ certhash_cert(BIO *bio, const char *filename) | |||
| 311 | 310 | ||
| 312 | hash = X509_subject_name_hash(cert); | 311 | hash = X509_subject_name_hash(cert); |
| 313 | 312 | ||
| 314 | digest = EVP_sha256(); | ||
| 315 | if (X509_digest(cert, digest, fingerprint, &len) != 1) { | 313 | if (X509_digest(cert, digest, fingerprint, &len) != 1) { |
| 316 | fprintf(stderr, "out of memory\n"); | 314 | fprintf(stderr, "out of memory\n"); |
| 317 | goto err; | 315 | goto err; |
| @@ -326,11 +324,10 @@ certhash_cert(BIO *bio, const char *filename) | |||
| 326 | } | 324 | } |
| 327 | 325 | ||
| 328 | static struct hashinfo * | 326 | static struct hashinfo * |
| 329 | certhash_crl(BIO *bio, const char *filename) | 327 | certhash_crl(BIO *bio, const char *filename, const EVP_MD *digest) |
| 330 | { | 328 | { |
| 331 | unsigned char fingerprint[EVP_MAX_MD_SIZE]; | 329 | unsigned char fingerprint[EVP_MAX_MD_SIZE]; |
| 332 | struct hashinfo *hi = NULL; | 330 | struct hashinfo *hi = NULL; |
| 333 | const EVP_MD *digest; | ||
| 334 | X509_CRL *crl = NULL; | 331 | X509_CRL *crl = NULL; |
| 335 | unsigned long hash; | 332 | unsigned long hash; |
| 336 | unsigned int len; | 333 | unsigned int len; |
| @@ -340,7 +337,6 @@ certhash_crl(BIO *bio, const char *filename) | |||
| 340 | 337 | ||
| 341 | hash = X509_NAME_hash(X509_CRL_get_issuer(crl)); | 338 | hash = X509_NAME_hash(X509_CRL_get_issuer(crl)); |
| 342 | 339 | ||
| 343 | digest = EVP_sha256(); | ||
| 344 | if (X509_CRL_digest(crl, digest, fingerprint, &len) != 1) { | 340 | if (X509_CRL_digest(crl, digest, fingerprint, &len) != 1) { |
| 345 | fprintf(stderr, "out of memory\n"); | 341 | fprintf(stderr, "out of memory\n"); |
| 346 | goto err; | 342 | goto err; |
| @@ -509,7 +505,7 @@ certhash_link(struct dirent *dep, struct hashinfo **links) | |||
| 509 | 505 | ||
| 510 | static int | 506 | static int |
| 511 | certhash_file(struct dirent *dep, struct hashinfo **certs, | 507 | certhash_file(struct dirent *dep, struct hashinfo **certs, |
| 512 | struct hashinfo **crls) | 508 | struct hashinfo **crls, const EVP_MD *digest) |
| 513 | { | 509 | { |
| 514 | struct hashinfo *hi = NULL; | 510 | struct hashinfo *hi = NULL; |
| 515 | int has_cert, has_crl; | 511 | int has_cert, has_crl; |
| @@ -529,7 +525,7 @@ certhash_file(struct dirent *dep, struct hashinfo **certs, | |||
| 529 | goto err; | 525 | goto err; |
| 530 | } | 526 | } |
| 531 | 527 | ||
| 532 | if ((hi = certhash_cert(bio, dep->d_name)) != NULL) { | 528 | if ((hi = certhash_cert(bio, dep->d_name, digest)) != NULL) { |
| 533 | has_cert = 1; | 529 | has_cert = 1; |
| 534 | *certs = hashinfo_chain(*certs, hi); | 530 | *certs = hashinfo_chain(*certs, hi); |
| 535 | } | 531 | } |
| @@ -539,7 +535,7 @@ certhash_file(struct dirent *dep, struct hashinfo **certs, | |||
| 539 | goto err; | 535 | goto err; |
| 540 | } | 536 | } |
| 541 | 537 | ||
| 542 | if ((hi = certhash_crl(bio, dep->d_name)) != NULL) { | 538 | if ((hi = certhash_crl(bio, dep->d_name, digest)) != NULL) { |
| 543 | has_crl = hi->is_crl = 1; | 539 | has_crl = hi->is_crl = 1; |
| 544 | *crls = hashinfo_chain(*crls, hi); | 540 | *crls = hashinfo_chain(*crls, hi); |
| 545 | } | 541 | } |
| @@ -557,7 +553,7 @@ certhash_file(struct dirent *dep, struct hashinfo **certs, | |||
| 557 | } | 553 | } |
| 558 | 554 | ||
| 559 | static int | 555 | static int |
| 560 | certhash_directory(const char *path) | 556 | certhash_directory(const char *path, const EVP_MD *digest) |
| 561 | { | 557 | { |
| 562 | struct hashinfo *links = NULL, *certs = NULL, *crls = NULL, *link; | 558 | struct hashinfo *links = NULL, *certs = NULL, *crls = NULL, *link; |
| 563 | int ret = 0; | 559 | int ret = 0; |
| @@ -579,7 +575,7 @@ certhash_directory(const char *path) | |||
| 579 | goto err; | 575 | goto err; |
| 580 | } | 576 | } |
| 581 | if (filename_is_pem(dep->d_name)) { | 577 | if (filename_is_pem(dep->d_name)) { |
| 582 | if (certhash_file(dep, &certs, &crls) == -1) | 578 | if (certhash_file(dep, &certs, &crls, digest) == -1) |
| 583 | goto err; | 579 | goto err; |
| 584 | } | 580 | } |
| 585 | } | 581 | } |
| @@ -678,7 +674,7 @@ certhash_main(int argc, char **argv) | |||
| 678 | ret = 1; | 674 | ret = 1; |
| 679 | continue; | 675 | continue; |
| 680 | } | 676 | } |
| 681 | ret |= certhash_directory(argv[i]); | 677 | ret |= certhash_directory(argv[i], EVP_sha256()); |
| 682 | if (fchdir(cwdfd) == -1) { | 678 | if (fchdir(cwdfd) == -1) { |
| 683 | perror("failed to restore current directory"); | 679 | perror("failed to restore current directory"); |
| 684 | ret = 1; | 680 | ret = 1; |
diff --git a/src/usr.bin/openssl/cms.c b/src/usr.bin/openssl/cms.c index 7420d0ab8c..7430f4c935 100644 --- a/src/usr.bin/openssl/cms.c +++ b/src/usr.bin/openssl/cms.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms.c,v 1.36 2024/08/12 15:34:58 job Exp $ */ | 1 | /* $OpenBSD: cms.c,v 1.40 2025/12/20 07:02:37 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project. | 3 | * project. |
| 4 | */ | 4 | */ |
| @@ -89,12 +89,10 @@ static int cms_set_pkey_param(EVP_PKEY_CTX *pctx, | |||
| 89 | #define SMIME_DATA_CREATE (8 | SMIME_OP) | 89 | #define SMIME_DATA_CREATE (8 | SMIME_OP) |
| 90 | #define SMIME_DIGEST_VERIFY (9 | SMIME_IP) | 90 | #define SMIME_DIGEST_VERIFY (9 | SMIME_IP) |
| 91 | #define SMIME_DIGEST_CREATE (10 | SMIME_OP) | 91 | #define SMIME_DIGEST_CREATE (10 | SMIME_OP) |
| 92 | #define SMIME_UNCOMPRESS (11 | SMIME_IP) | 92 | #define SMIME_ENCRYPTED_DECRYPT (11 | SMIME_IP) |
| 93 | #define SMIME_COMPRESS (12 | SMIME_OP) | 93 | #define SMIME_ENCRYPTED_ENCRYPT (12 | SMIME_OP) |
| 94 | #define SMIME_ENCRYPTED_DECRYPT (13 | SMIME_IP) | 94 | #define SMIME_SIGN_RECEIPT (13 | SMIME_IP | SMIME_OP) |
| 95 | #define SMIME_ENCRYPTED_ENCRYPT (14 | SMIME_OP) | 95 | #define SMIME_VERIFY_RECEIPT (14 | SMIME_IP) |
| 96 | #define SMIME_SIGN_RECEIPT (15 | SMIME_IP | SMIME_OP) | ||
| 97 | #define SMIME_VERIFY_RECEIPT (16 | SMIME_IP) | ||
| 98 | 96 | ||
| 99 | int verify_err = 0; | 97 | int verify_err = 0; |
| 100 | 98 | ||
| @@ -193,15 +191,33 @@ get_cipher_by_name(char *name) | |||
| 193 | static int | 191 | static int |
| 194 | cms_opt_cipher(int argc, char **argv, int *argsused) | 192 | cms_opt_cipher(int argc, char **argv, int *argsused) |
| 195 | { | 193 | { |
| 194 | const EVP_CIPHER *cipher; | ||
| 196 | char *name = argv[0]; | 195 | char *name = argv[0]; |
| 197 | 196 | ||
| 198 | if (*name++ != '-') | 197 | if (*name++ != '-') |
| 199 | return (1); | 198 | return (1); |
| 200 | 199 | ||
| 201 | if ((cfg.cipher = get_cipher_by_name(name)) == NULL) | 200 | if ((cipher = get_cipher_by_name(name)) == NULL) |
| 202 | if ((cfg.cipher = EVP_get_cipherbyname(name)) == NULL) | 201 | if ((cipher = EVP_get_cipherbyname(name)) == NULL) |
| 203 | return (1); | 202 | return (1); |
| 204 | 203 | ||
| 204 | /* | ||
| 205 | * XXX - this should really be done in CMS_{encrypt,decrypt}() until | ||
| 206 | * we have proper support for AuthEnvelopedData (RFC 5084), but this | ||
| 207 | * is good enough for now to avoid outputting garbage with this rusty | ||
| 208 | * swiss army knife. | ||
| 209 | */ | ||
| 210 | if ((EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER) != 0) { | ||
| 211 | BIO_printf(bio_err, "AuthEnvelopedData is not supported\n"); | ||
| 212 | return (1); | ||
| 213 | } | ||
| 214 | if (EVP_CIPHER_mode(cipher) == EVP_CIPH_XTS_MODE) { | ||
| 215 | BIO_printf(bio_err, "XTS mode not supported\n"); | ||
| 216 | return (1); | ||
| 217 | } | ||
| 218 | |||
| 219 | cfg.cipher = cipher; | ||
| 220 | |||
| 205 | *argsused = 1; | 221 | *argsused = 1; |
| 206 | return (0); | 222 | return (0); |
| 207 | } | 223 | } |
| @@ -475,7 +491,7 @@ static const struct option cms_options[] = { | |||
| 475 | }, | 491 | }, |
| 476 | { | 492 | { |
| 477 | .name = "aes256", | 493 | .name = "aes256", |
| 478 | .desc = "Encrypt PEM output with CBC AES", | 494 | .desc = "Encrypt PEM output with CBC AES (default)", |
| 479 | .type = OPTION_ARGV_FUNC, | 495 | .type = OPTION_ARGV_FUNC, |
| 480 | .opt.argvfunc = cms_opt_cipher, | 496 | .opt.argvfunc = cms_opt_cipher, |
| 481 | }, | 497 | }, |
| @@ -509,7 +525,7 @@ static const struct option cms_options[] = { | |||
| 509 | }, | 525 | }, |
| 510 | { | 526 | { |
| 511 | .name = "des3", | 527 | .name = "des3", |
| 512 | .desc = "Encrypt with triple DES (default)", | 528 | .desc = "Encrypt with triple DES", |
| 513 | .type = OPTION_ARGV_FUNC, | 529 | .type = OPTION_ARGV_FUNC, |
| 514 | .opt.argvfunc = cms_opt_cipher, | 530 | .opt.argvfunc = cms_opt_cipher, |
| 515 | }, | 531 | }, |
| @@ -584,13 +600,6 @@ static const struct option cms_options[] = { | |||
| 584 | .value = SMIME_CMSOUT, | 600 | .value = SMIME_CMSOUT, |
| 585 | }, | 601 | }, |
| 586 | { | 602 | { |
| 587 | .name = "compress", | ||
| 588 | .desc = "Create CMS CompressedData type", | ||
| 589 | .type = OPTION_VALUE, | ||
| 590 | .opt.value = &cfg.operation, | ||
| 591 | .value = SMIME_COMPRESS, | ||
| 592 | }, | ||
| 593 | { | ||
| 594 | .name = "content", | 603 | .name = "content", |
| 595 | .argname = "file", | 604 | .argname = "file", |
| 596 | .desc = "Supply or override content for detached signature", | 605 | .desc = "Supply or override content for detached signature", |
| @@ -980,13 +989,6 @@ static const struct option cms_options[] = { | |||
| 980 | .opt.arg = &cfg.to, | 989 | .opt.arg = &cfg.to, |
| 981 | }, | 990 | }, |
| 982 | { | 991 | { |
| 983 | .name = "uncompress", | ||
| 984 | .desc = "Uncompress CMS CompressedData type", | ||
| 985 | .type = OPTION_VALUE, | ||
| 986 | .opt.value = &cfg.operation, | ||
| 987 | .value = SMIME_UNCOMPRESS, | ||
| 988 | }, | ||
| 989 | { | ||
| 990 | .name = "verify", | 992 | .name = "verify", |
| 991 | .desc = "Verify signed message", | 993 | .desc = "Verify signed message", |
| 992 | .type = OPTION_VALUE, | 994 | .type = OPTION_VALUE, |
| @@ -1120,7 +1122,7 @@ cms_usage(void) | |||
| 1120 | " -camellia192 | -camellia256 | -des | -des3 |\n" | 1122 | " -camellia192 | -camellia256 | -des | -des3 |\n" |
| 1121 | " -rc2-40 | -rc2-64 | -rc2-128] [-CAfile file]\n" | 1123 | " -rc2-40 | -rc2-64 | -rc2-128] [-CAfile file]\n" |
| 1122 | " [-CApath directory] [-CRLfile file] [-binary]\n" | 1124 | " [-CApath directory] [-CRLfile file] [-binary]\n" |
| 1123 | " [-certfile file] [-certsout file] [-cmsout] [-compress]\n" | 1125 | " [-certfile file] [-certsout file] [-cmsout]\n" |
| 1124 | " [-content file] [-crlfeol] [-data_create] [-data_out]\n" | 1126 | " [-content file] [-crlfeol] [-data_create] [-data_out]\n" |
| 1125 | " [-debug_decrypt] [-decrypt] [-digest_create] [-digest_verify]\n" | 1127 | " [-debug_decrypt] [-decrypt] [-digest_create] [-digest_verify]\n" |
| 1126 | " [-econtent_type type] [-encrypt] [-EncryptedData_decrypt]\n" | 1128 | " [-econtent_type type] [-encrypt] [-EncryptedData_decrypt]\n" |
| @@ -1138,7 +1140,7 @@ cms_usage(void) | |||
| 1138 | " [-receipt_request_to addr] [-recip file] [-resign]\n" | 1140 | " [-receipt_request_to addr] [-recip file] [-resign]\n" |
| 1139 | " [-secretkey key] [-secretkeyid id] [-sign] [-sign_receipt]\n" | 1141 | " [-secretkey key] [-secretkeyid id] [-sign] [-sign_receipt]\n" |
| 1140 | " [-signer file] [-stream | -indef | -noindef] [-subject s]\n" | 1142 | " [-signer file] [-stream | -indef | -noindef] [-subject s]\n" |
| 1141 | " [-text] [-to addr] [-uncompress] [-verify]\n" | 1143 | " [-text] [-to addr] [-verify]\n" |
| 1142 | " [-verify_receipt file] [-verify_retcode] [cert.pem ...]\n\n"); | 1144 | " [-verify_receipt file] [-verify_retcode] [cert.pem ...]\n\n"); |
| 1143 | 1145 | ||
| 1144 | options_usage(cms_options); | 1146 | options_usage(cms_options); |
| @@ -1291,14 +1293,8 @@ cms_main(int argc, char **argv) | |||
| 1291 | } | 1293 | } |
| 1292 | 1294 | ||
| 1293 | if (cfg.operation == SMIME_ENCRYPT) { | 1295 | if (cfg.operation == SMIME_ENCRYPT) { |
| 1294 | if (cfg.cipher == NULL) { | 1296 | if (cfg.cipher == NULL) |
| 1295 | #ifndef OPENSSL_NO_DES | 1297 | cfg.cipher = EVP_aes_256_cbc(); |
| 1296 | cfg.cipher = EVP_des_ede3_cbc(); | ||
| 1297 | #else | ||
| 1298 | BIO_printf(bio_err, "No cipher selected\n"); | ||
| 1299 | goto end; | ||
| 1300 | #endif | ||
| 1301 | } | ||
| 1302 | if (cfg.secret_key != NULL && | 1298 | if (cfg.secret_key != NULL && |
| 1303 | cfg.secret_keyid == NULL) { | 1299 | cfg.secret_keyid == NULL) { |
| 1304 | BIO_printf(bio_err, "No secret key id\n"); | 1300 | BIO_printf(bio_err, "No secret key id\n"); |
| @@ -1470,8 +1466,6 @@ cms_main(int argc, char **argv) | |||
| 1470 | } else if (cfg.operation == SMIME_DIGEST_CREATE) { | 1466 | } else if (cfg.operation == SMIME_DIGEST_CREATE) { |
| 1471 | cms = CMS_digest_create(in, cfg.sign_md, | 1467 | cms = CMS_digest_create(in, cfg.sign_md, |
| 1472 | cfg.flags); | 1468 | cfg.flags); |
| 1473 | } else if (cfg.operation == SMIME_COMPRESS) { | ||
| 1474 | cms = CMS_compress(in, -1, cfg.flags); | ||
| 1475 | } else if (cfg.operation == SMIME_ENCRYPT) { | 1469 | } else if (cfg.operation == SMIME_ENCRYPT) { |
| 1476 | int i; | 1470 | int i; |
| 1477 | cfg.flags |= CMS_PARTIAL; | 1471 | cfg.flags |= CMS_PARTIAL; |
| @@ -1679,9 +1673,6 @@ cms_main(int argc, char **argv) | |||
| 1679 | } else if (cfg.operation == SMIME_DATAOUT) { | 1673 | } else if (cfg.operation == SMIME_DATAOUT) { |
| 1680 | if (!CMS_data(cms, out, cfg.flags)) | 1674 | if (!CMS_data(cms, out, cfg.flags)) |
| 1681 | goto end; | 1675 | goto end; |
| 1682 | } else if (cfg.operation == SMIME_UNCOMPRESS) { | ||
| 1683 | if (!CMS_uncompress(cms, indata, out, cfg.flags)) | ||
| 1684 | goto end; | ||
| 1685 | } else if (cfg.operation == SMIME_DIGEST_VERIFY) { | 1676 | } else if (cfg.operation == SMIME_DIGEST_VERIFY) { |
| 1686 | if (CMS_digest_verify(cms, indata, out, cfg.flags) > 0) | 1677 | if (CMS_digest_verify(cms, indata, out, cfg.flags) > 0) |
| 1687 | BIO_printf(bio_err, "Verification successful\n"); | 1678 | BIO_printf(bio_err, "Verification successful\n"); |
| @@ -1872,14 +1863,14 @@ receipt_request_print(BIO *out, CMS_ContentInfo *cms) | |||
| 1872 | BIO_puts(bio_err, " Receipt Request Parse Error\n"); | 1863 | BIO_puts(bio_err, " Receipt Request Parse Error\n"); |
| 1873 | ERR_print_errors(bio_err); | 1864 | ERR_print_errors(bio_err); |
| 1874 | } else { | 1865 | } else { |
| 1875 | char *id; | 1866 | const char *id; |
| 1876 | int idlen; | 1867 | int idlen; |
| 1877 | 1868 | ||
| 1878 | CMS_ReceiptRequest_get0_values(rr, &scid, &allorfirst, | 1869 | CMS_ReceiptRequest_get0_values(rr, &scid, &allorfirst, |
| 1879 | &rlist, &rto); | 1870 | &rlist, &rto); |
| 1880 | BIO_puts(out, " Signed Content ID:\n"); | 1871 | BIO_puts(out, " Signed Content ID:\n"); |
| 1881 | idlen = ASN1_STRING_length(scid); | 1872 | idlen = ASN1_STRING_length(scid); |
| 1882 | id = (char *) ASN1_STRING_data(scid); | 1873 | id = (const char *) ASN1_STRING_get0_data(scid); |
| 1883 | BIO_dump_indent(out, id, idlen, 4); | 1874 | BIO_dump_indent(out, id, idlen, 4); |
| 1884 | BIO_puts(out, " Receipts From"); | 1875 | BIO_puts(out, " Receipts From"); |
| 1885 | if (rlist != NULL) { | 1876 | if (rlist != NULL) { |
diff --git a/src/usr.bin/openssl/dgst.c b/src/usr.bin/openssl/dgst.c index 3979966481..30a0e50f62 100644 --- a/src/usr.bin/openssl/dgst.c +++ b/src/usr.bin/openssl/dgst.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dgst.c,v 1.21 2023/03/06 14:32:05 tb Exp $ */ | 1 | /* $OpenBSD: dgst.c,v 1.22 2026/01/02 00:05:48 kenjiro Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -85,7 +85,6 @@ static struct { | |||
| 85 | char *hmac_key; | 85 | char *hmac_key; |
| 86 | char *keyfile; | 86 | char *keyfile; |
| 87 | int keyform; | 87 | int keyform; |
| 88 | const EVP_MD *m; | ||
| 89 | char *mac_name; | 88 | char *mac_name; |
| 90 | STACK_OF(OPENSSL_STRING) *macopts; | 89 | STACK_OF(OPENSSL_STRING) *macopts; |
| 91 | const EVP_MD *md; | 90 | const EVP_MD *md; |
| @@ -122,11 +121,9 @@ dgst_opt_md(int argc, char **argv, int *argsused) | |||
| 122 | if (*name++ != '-') | 121 | if (*name++ != '-') |
| 123 | return (1); | 122 | return (1); |
| 124 | 123 | ||
| 125 | if ((cfg.m = EVP_get_digestbyname(name)) == NULL) | 124 | if ((cfg.md = EVP_get_digestbyname(name)) == NULL) |
| 126 | return (1); | 125 | return (1); |
| 127 | 126 | ||
| 128 | cfg.md = cfg.m; | ||
| 129 | |||
| 130 | *argsused = 1; | 127 | *argsused = 1; |
| 131 | return (0); | 128 | return (0); |
| 132 | } | 129 | } |
diff --git a/src/usr.bin/openssl/gendsa.c b/src/usr.bin/openssl/gendsa.c index 00635c4551..69a7994da7 100644 --- a/src/usr.bin/openssl/gendsa.c +++ b/src/usr.bin/openssl/gendsa.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: gendsa.c,v 1.17 2023/03/06 14:32:06 tb Exp $ */ | 1 | /* $OpenBSD: gendsa.c,v 1.18 2025/06/07 08:33:58 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -80,7 +80,8 @@ static struct { | |||
| 80 | char *passargout; | 80 | char *passargout; |
| 81 | } cfg; | 81 | } cfg; |
| 82 | 82 | ||
| 83 | static const EVP_CIPHER *get_cipher_by_name(char *name) | 83 | static const EVP_CIPHER * |
| 84 | get_cipher_by_name(char *name) | ||
| 84 | { | 85 | { |
| 85 | if (name == NULL || strcmp(name, "") == 0) | 86 | if (name == NULL || strcmp(name, "") == 0) |
| 86 | return (NULL); | 87 | return (NULL); |
diff --git a/src/usr.bin/openssl/genrsa.c b/src/usr.bin/openssl/genrsa.c index 0b5323fa5f..647780d8fa 100644 --- a/src/usr.bin/openssl/genrsa.c +++ b/src/usr.bin/openssl/genrsa.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: genrsa.c,v 1.22 2023/03/06 14:32:06 tb Exp $ */ | 1 | /* $OpenBSD: genrsa.c,v 1.23 2025/06/07 08:33:58 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -108,7 +108,8 @@ set_public_exponent(int argc, char **argv, int *argsused) | |||
| 108 | return (0); | 108 | return (0); |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | static const EVP_CIPHER *get_cipher_by_name(char *name) | 111 | static const EVP_CIPHER * |
| 112 | get_cipher_by_name(char *name) | ||
| 112 | { | 113 | { |
| 113 | if (name == NULL || strcmp(name, "") == 0) | 114 | if (name == NULL || strcmp(name, "") == 0) |
| 114 | return (NULL); | 115 | return (NULL); |
diff --git a/src/usr.bin/openssl/ocsp.c b/src/usr.bin/openssl/ocsp.c index d35940a7ae..01d28aa1f0 100644 --- a/src/usr.bin/openssl/ocsp.c +++ b/src/usr.bin/openssl/ocsp.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ocsp.c,v 1.26 2024/08/31 18:39:25 tb Exp $ */ | 1 | /* $OpenBSD: ocsp.c,v 1.27 2025/05/09 12:50:59 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -194,18 +194,18 @@ x509v3_add_value(const char *name, const char *value, | |||
| 194 | int ret = 0; | 194 | int ret = 0; |
| 195 | 195 | ||
| 196 | if ((conf_value = calloc(1, sizeof(*conf_value))) == NULL) { | 196 | if ((conf_value = calloc(1, sizeof(*conf_value))) == NULL) { |
| 197 | X509V3error(ERR_R_MALLOC_FAILURE); | 197 | perror("calloc"); |
| 198 | goto err; | 198 | goto err; |
| 199 | } | 199 | } |
| 200 | if (name != NULL) { | 200 | if (name != NULL) { |
| 201 | if ((conf_value->name = strdup(name)) == NULL) { | 201 | if ((conf_value->name = strdup(name)) == NULL) { |
| 202 | X509V3error(ERR_R_MALLOC_FAILURE); | 202 | perror("strdup"); |
| 203 | goto err; | 203 | goto err; |
| 204 | } | 204 | } |
| 205 | } | 205 | } |
| 206 | if (value != NULL) { | 206 | if (value != NULL) { |
| 207 | if ((conf_value->value = strdup(value)) == NULL) { | 207 | if ((conf_value->value = strdup(value)) == NULL) { |
| 208 | X509V3error(ERR_R_MALLOC_FAILURE); | 208 | perror("strdup"); |
| 209 | goto err; | 209 | goto err; |
| 210 | } | 210 | } |
| 211 | } | 211 | } |
| @@ -213,12 +213,12 @@ x509v3_add_value(const char *name, const char *value, | |||
| 213 | if ((extlist = *out_extlist) == NULL) | 213 | if ((extlist = *out_extlist) == NULL) |
| 214 | extlist = sk_CONF_VALUE_new_null(); | 214 | extlist = sk_CONF_VALUE_new_null(); |
| 215 | if (extlist == NULL) { | 215 | if (extlist == NULL) { |
| 216 | X509V3error(ERR_R_MALLOC_FAILURE); | 216 | perror("sk_CONF_VALUE_new_null"); |
| 217 | goto err; | 217 | goto err; |
| 218 | } | 218 | } |
| 219 | 219 | ||
| 220 | if (!sk_CONF_VALUE_push(extlist, conf_value)) { | 220 | if (!sk_CONF_VALUE_push(extlist, conf_value)) { |
| 221 | X509V3error(ERR_R_MALLOC_FAILURE); | 221 | perror("sk_CONF_VALUE_push"); |
| 222 | goto err; | 222 | goto err; |
| 223 | } | 223 | } |
| 224 | conf_value = NULL; | 224 | conf_value = NULL; |
diff --git a/src/usr.bin/openssl/openssl.1 b/src/usr.bin/openssl/openssl.1 index a095c01f0a..f3e0be15ed 100644 --- a/src/usr.bin/openssl/openssl.1 +++ b/src/usr.bin/openssl/openssl.1 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: openssl.1,v 1.163 2025/04/14 08:40:10 tb Exp $ | 1 | .\" $OpenBSD: openssl.1,v 1.168 2025/12/20 07:02:37 tb Exp $ |
| 2 | .\" ==================================================================== | 2 | .\" ==================================================================== |
| 3 | .\" Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | 3 | .\" Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. |
| 4 | .\" | 4 | .\" |
| @@ -110,7 +110,7 @@ | |||
| 110 | .\" copied and put under another distribution licence | 110 | .\" copied and put under another distribution licence |
| 111 | .\" [including the GNU Public Licence.] | 111 | .\" [including the GNU Public Licence.] |
| 112 | .\" | 112 | .\" |
| 113 | .Dd $Mdocdate: April 14 2025 $ | 113 | .Dd $Mdocdate: December 20 2025 $ |
| 114 | .Dt OPENSSL 1 | 114 | .Dt OPENSSL 1 |
| 115 | .Os | 115 | .Os |
| 116 | .Sh NAME | 116 | .Sh NAME |
| @@ -931,7 +931,6 @@ but without cipher suite codes. | |||
| 931 | .Op Fl certfile Ar file | 931 | .Op Fl certfile Ar file |
| 932 | .Op Fl certsout Ar file | 932 | .Op Fl certsout Ar file |
| 933 | .Op Fl cmsout | 933 | .Op Fl cmsout |
| 934 | .Op Fl compress | ||
| 935 | .Op Fl content Ar file | 934 | .Op Fl content Ar file |
| 936 | .Op Fl crlfeol | 935 | .Op Fl crlfeol |
| 937 | .Op Fl data_create | 936 | .Op Fl data_create |
| @@ -985,7 +984,6 @@ but without cipher suite codes. | |||
| 985 | .Op Fl subject Ar s | 984 | .Op Fl subject Ar s |
| 986 | .Op Fl text | 985 | .Op Fl text |
| 987 | .Op Fl to Ar addr | 986 | .Op Fl to Ar addr |
| 988 | .Op Fl uncompress | ||
| 989 | .Op Fl verify | 987 | .Op Fl verify |
| 990 | .Op Fl verify_receipt Ar file | 988 | .Op Fl verify_receipt Ar file |
| 991 | .Op Fl verify_retcode | 989 | .Op Fl verify_retcode |
| @@ -996,8 +994,7 @@ but without cipher suite codes. | |||
| 996 | The | 994 | The |
| 997 | .Nm cms | 995 | .Nm cms |
| 998 | command handles S/MIME v3.1 mail. | 996 | command handles S/MIME v3.1 mail. |
| 999 | It can encrypt, decrypt, sign and verify, compress and uncompress S/MIME | 997 | It can encrypt, decrypt, sign and verify S/MIME messages. |
| 1000 | messages. | ||
| 1001 | .Pp | 998 | .Pp |
| 1002 | The MIME message must be sent without any blank lines between the headers and | 999 | The MIME message must be sent without any blank lines between the headers and |
| 1003 | the output. | 1000 | the output. |
| @@ -1053,12 +1050,6 @@ Output a content from the input CMS Data type. | |||
| 1053 | Create a CMS DigestedData type. | 1050 | Create a CMS DigestedData type. |
| 1054 | .It Fl digest_verify | 1051 | .It Fl digest_verify |
| 1055 | Verify a CMS DigestedData type and output the content. | 1052 | Verify a CMS DigestedData type and output the content. |
| 1056 | .It Fl compress | ||
| 1057 | Create a CMS CompressedData type. | ||
| 1058 | Must be compiled with zlib support for this option to work. | ||
| 1059 | .It Fl uncompress | ||
| 1060 | Uncompress a CMS CompressedData type and output the content. | ||
| 1061 | Must be compiled with zlib support for this option to work. | ||
| 1062 | .It Fl EncryptedData_encrypt | 1053 | .It Fl EncryptedData_encrypt |
| 1063 | Encrypt a content using supplied symmetric key and algorithm using a | 1054 | Encrypt a content using supplied symmetric key and algorithm using a |
| 1064 | CMS EncryptedData type. | 1055 | CMS EncryptedData type. |
| @@ -1091,7 +1082,7 @@ The encryption algorithm to use. | |||
| 1091 | 128-, 192-, or 256-bit AES, 128-, 192-, or 256-bit CAMELLIA, | 1082 | 128-, 192-, or 256-bit AES, 128-, 192-, or 256-bit CAMELLIA, |
| 1092 | DES (56 bits), triple DES (168 bits), | 1083 | DES (56 bits), triple DES (168 bits), |
| 1093 | or 40-, 64-, or 128-bit RC2, respectively; | 1084 | or 40-, 64-, or 128-bit RC2, respectively; |
| 1094 | if not specified, triple DES is | 1085 | if not specified, 256-bit AES is |
| 1095 | used. | 1086 | used. |
| 1096 | Only used with | 1087 | Only used with |
| 1097 | .Fl encrypt | 1088 | .Fl encrypt |
| @@ -2973,9 +2964,6 @@ command processes private keys | |||
| 2973 | (both encrypted and unencrypted) | 2964 | (both encrypted and unencrypted) |
| 2974 | in PKCS#8 format | 2965 | in PKCS#8 format |
| 2975 | with a variety of PKCS#5 (v1.5 and v2.0) and PKCS#12 algorithms. | 2966 | with a variety of PKCS#5 (v1.5 and v2.0) and PKCS#12 algorithms. |
| 2976 | The default encryption is only 56 bits; | ||
| 2977 | keys encrypted using PKCS#5 v2.0 algorithms and high iteration counts | ||
| 2978 | are more secure. | ||
| 2979 | .Pp | 2967 | .Pp |
| 2980 | The options are as follows: | 2968 | The options are as follows: |
| 2981 | .Bl -tag -width Ds | 2969 | .Bl -tag -width Ds |
| @@ -3021,16 +3009,12 @@ which allow strong encryption algorithms like triple DES or 128-bit RC2. | |||
| 3021 | .El | 3009 | .El |
| 3022 | .It Fl v2 Ar alg | 3010 | .It Fl v2 Ar alg |
| 3023 | Use PKCS#5 v2.0 algorithms. | 3011 | Use PKCS#5 v2.0 algorithms. |
| 3024 | Supports algorithms such as 168-bit triple DES or 128-bit RC2, | 3012 | These are block ciphers used in CBC mode. |
| 3025 | however not many implementations support PKCS#5 v2.0 yet | 3013 | The default is AES-256-CBC. |
| 3026 | (if using private keys with | 3014 | With the exception of AES, the choices available in RFC 8018 |
| 3027 | .Nm openssl | 3015 | are considered decrepit. |
| 3028 | this doesn't matter). | 3016 | They can be enabled with des, des3, and rc2 |
| 3029 | .Pp | 3017 | (rc5 is no longer supported). |
| 3030 | .Ar alg | ||
| 3031 | is the encryption algorithm to use; | ||
| 3032 | valid values include des, des3, and rc2. | ||
| 3033 | It is recommended that des3 is used. | ||
| 3034 | .El | 3018 | .El |
| 3035 | .Tg pkcs12 | 3019 | .Tg pkcs12 |
| 3036 | .Sh PKCS12 | 3020 | .Sh PKCS12 |
| @@ -5105,7 +5089,7 @@ The remaining options are as follows: | |||
| 5105 | The encryption algorithm to use. | 5089 | The encryption algorithm to use. |
| 5106 | 128-, 192-, or 256-bit AES, DES (56 bits), triple DES (168 bits), | 5090 | 128-, 192-, or 256-bit AES, DES (56 bits), triple DES (168 bits), |
| 5107 | or 40-, 64-, or 128-bit RC2, respectively; | 5091 | or 40-, 64-, or 128-bit RC2, respectively; |
| 5108 | if not specified, 40-bit RC2 is | 5092 | if not specified, 256-bit AES is |
| 5109 | used. | 5093 | used. |
| 5110 | Only used with | 5094 | Only used with |
| 5111 | .Fl encrypt . | 5095 | .Fl encrypt . |
| @@ -6148,7 +6132,7 @@ either using a list of comma-separated options or by specifying | |||
| 6148 | .Fl nameopt | 6132 | .Fl nameopt |
| 6149 | multiple times. | 6133 | multiple times. |
| 6150 | The default behaviour is to use the | 6134 | The default behaviour is to use the |
| 6151 | .Cm oneline | 6135 | .Cm compat |
| 6152 | format. | 6136 | format. |
| 6153 | The options, | 6137 | The options, |
| 6154 | which can be preceded by a dash to turn them off, | 6138 | which can be preceded by a dash to turn them off, |
| @@ -6230,7 +6214,7 @@ A one line format which is more readable than | |||
| 6230 | .Cm RFC2253 . | 6214 | .Cm RFC2253 . |
| 6231 | Equivalent to | 6215 | Equivalent to |
| 6232 | .Cm esc_2253 , esc_ctrl , esc_msb , utf8 , | 6216 | .Cm esc_2253 , esc_ctrl , esc_msb , utf8 , |
| 6233 | .Cm dump_nostr , dump_der , use_quote , sep_comma_plus_spc , | 6217 | .Cm dump_nostr , dump_der , use_quote , sep_comma_plus_space , |
| 6234 | .Cm space_eq , | 6218 | .Cm space_eq , |
| 6235 | and | 6219 | and |
| 6236 | .Cm sname . | 6220 | .Cm sname . |
diff --git a/src/usr.bin/openssl/openssl.c b/src/usr.bin/openssl/openssl.c index 75a0e4d266..056912a9ed 100644 --- a/src/usr.bin/openssl/openssl.c +++ b/src/usr.bin/openssl/openssl.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: openssl.c,v 1.39 2025/01/02 13:10:03 tb Exp $ */ | 1 | /* $OpenBSD: openssl.c,v 1.41 2026/01/02 00:14:24 kenjiro Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -231,13 +231,14 @@ FUNCTION functions[] = { | |||
| 231 | #ifndef OPENSSL_NO_SHA512 | 231 | #ifndef OPENSSL_NO_SHA512 |
| 232 | { FUNC_TYPE_MD, "sha512", dgst_main }, | 232 | { FUNC_TYPE_MD, "sha512", dgst_main }, |
| 233 | #endif | 233 | #endif |
| 234 | { FUNC_TYPE_MD, "sha3-224", dgst_main }, | ||
| 235 | { FUNC_TYPE_MD, "sha3-256", dgst_main }, | ||
| 236 | { FUNC_TYPE_MD, "sha3-384", dgst_main }, | ||
| 237 | { FUNC_TYPE_MD, "sha3-512", dgst_main }, | ||
| 234 | #ifndef OPENSSL_NO_SM3 | 238 | #ifndef OPENSSL_NO_SM3 |
| 235 | { FUNC_TYPE_MD, "sm3", dgst_main }, | 239 | { FUNC_TYPE_MD, "sm3", dgst_main }, |
| 236 | { FUNC_TYPE_MD, "sm3WithRSAEncryption", dgst_main }, | 240 | { FUNC_TYPE_MD, "sm3WithRSAEncryption", dgst_main }, |
| 237 | #endif | 241 | #endif |
| 238 | #ifndef OPENSSL_NO_WHIRLPOOL | ||
| 239 | { FUNC_TYPE_MD, "whirlpool", dgst_main }, | ||
| 240 | #endif | ||
| 241 | 242 | ||
| 242 | /* Ciphers. */ | 243 | /* Ciphers. */ |
| 243 | { FUNC_TYPE_CIPHER, "base64", enc_main }, | 244 | { FUNC_TYPE_CIPHER, "base64", enc_main }, |
diff --git a/src/usr.bin/openssl/pkcs12.c b/src/usr.bin/openssl/pkcs12.c index 1407a96e03..d29a12ce60 100644 --- a/src/usr.bin/openssl/pkcs12.c +++ b/src/usr.bin/openssl/pkcs12.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pkcs12.c,v 1.29 2024/12/26 14:10:48 tb Exp $ */ | 1 | /* $OpenBSD: pkcs12.c,v 1.31 2025/11/27 08:26:32 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project. | 3 | * project. |
| 4 | */ | 4 | */ |
| @@ -88,7 +88,6 @@ static int dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bags, char *pass, | |||
| 88 | int passlen, int options, char *pempass); | 88 | int passlen, int options, char *pempass); |
| 89 | static int print_attribs(BIO *out, const STACK_OF(X509_ATTRIBUTE) *attrlst, | 89 | static int print_attribs(BIO *out, const STACK_OF(X509_ATTRIBUTE) *attrlst, |
| 90 | const char *name); | 90 | const char *name); |
| 91 | static void hex_prin(BIO *out, unsigned char *buf, int len); | ||
| 92 | static int alg_print(BIO *x, const X509_ALGOR *alg); | 91 | static int alg_print(BIO *x, const X509_ALGOR *alg); |
| 93 | static int set_pbe(BIO *err, int *ppbe, const char *str); | 92 | static int set_pbe(BIO *err, int *ppbe, const char *str); |
| 94 | 93 | ||
| @@ -152,7 +151,8 @@ pkcs12_opt_passarg(char *arg) | |||
| 152 | return (0); | 151 | return (0); |
| 153 | } | 152 | } |
| 154 | 153 | ||
| 155 | static const EVP_CIPHER *get_cipher_by_name(char *name) | 154 | static const EVP_CIPHER * |
| 155 | get_cipher_by_name(char *name) | ||
| 156 | { | 156 | { |
| 157 | if (name == NULL || strcmp(name, "") == 0) | 157 | if (name == NULL || strcmp(name, "") == 0) |
| 158 | return (NULL); | 158 | return (NULL); |
| @@ -1020,6 +1020,17 @@ alg_print(BIO *x, const X509_ALGOR *alg) | |||
| 1020 | return 1; | 1020 | return 1; |
| 1021 | } | 1021 | } |
| 1022 | 1022 | ||
| 1023 | static void | ||
| 1024 | hex_print(BIO *out, const ASN1_STRING *str) | ||
| 1025 | { | ||
| 1026 | const unsigned char *buf = ASN1_STRING_get0_data(str); | ||
| 1027 | int len = ASN1_STRING_length(str); | ||
| 1028 | int i; | ||
| 1029 | |||
| 1030 | for (i = 0; i < len; i++) | ||
| 1031 | BIO_printf(out, "%02X ", buf[i]); | ||
| 1032 | } | ||
| 1033 | |||
| 1023 | /* Generalised attribute print: handle PKCS#8 and bag attributes */ | 1034 | /* Generalised attribute print: handle PKCS#8 and bag attributes */ |
| 1024 | static void | 1035 | static void |
| 1025 | print_attribute(BIO *out, const ASN1_TYPE *av) | 1036 | print_attribute(BIO *out, const ASN1_TYPE *av) |
| @@ -1029,21 +1040,19 @@ print_attribute(BIO *out, const ASN1_TYPE *av) | |||
| 1029 | switch (av->type) { | 1040 | switch (av->type) { |
| 1030 | case V_ASN1_BMPSTRING: | 1041 | case V_ASN1_BMPSTRING: |
| 1031 | value = OPENSSL_uni2asc( | 1042 | value = OPENSSL_uni2asc( |
| 1032 | av->value.bmpstring->data, | 1043 | ASN1_STRING_get0_data(av->value.bmpstring), |
| 1033 | av->value.bmpstring->length); | 1044 | ASN1_STRING_length(av->value.bmpstring)); |
| 1034 | BIO_printf(out, "%s\n", value); | 1045 | BIO_printf(out, "%s\n", value != NULL ? value : "(null)"); |
| 1035 | free(value); | 1046 | free(value); |
| 1036 | break; | 1047 | break; |
| 1037 | 1048 | ||
| 1038 | case V_ASN1_OCTET_STRING: | 1049 | case V_ASN1_OCTET_STRING: |
| 1039 | hex_prin(out, av->value.octet_string->data, | 1050 | hex_print(out, av->value.octet_string); |
| 1040 | av->value.octet_string->length); | ||
| 1041 | BIO_printf(out, "\n"); | 1051 | BIO_printf(out, "\n"); |
| 1042 | break; | 1052 | break; |
| 1043 | 1053 | ||
| 1044 | case V_ASN1_BIT_STRING: | 1054 | case V_ASN1_BIT_STRING: |
| 1045 | hex_prin(out, av->value.bit_string->data, | 1055 | hex_print(out, av->value.bit_string); |
| 1046 | av->value.bit_string->length); | ||
| 1047 | BIO_printf(out, "\n"); | 1056 | BIO_printf(out, "\n"); |
| 1048 | break; | 1057 | break; |
| 1049 | 1058 | ||
| @@ -1095,15 +1104,6 @@ print_attribs(BIO *out, const STACK_OF(X509_ATTRIBUTE) *attrlst, | |||
| 1095 | return 1; | 1104 | return 1; |
| 1096 | } | 1105 | } |
| 1097 | 1106 | ||
| 1098 | static void | ||
| 1099 | hex_prin(BIO *out, unsigned char *buf, int len) | ||
| 1100 | { | ||
| 1101 | int i; | ||
| 1102 | |||
| 1103 | for (i = 0; i < len; i++) | ||
| 1104 | BIO_printf(out, "%02X ", buf[i]); | ||
| 1105 | } | ||
| 1106 | |||
| 1107 | static int | 1107 | static int |
| 1108 | set_pbe(BIO *err, int *ppbe, const char *str) | 1108 | set_pbe(BIO *err, int *ppbe, const char *str) |
| 1109 | { | 1109 | { |
diff --git a/src/usr.bin/openssl/pkcs8.c b/src/usr.bin/openssl/pkcs8.c index 10fad7aed1..5d7c52f865 100644 --- a/src/usr.bin/openssl/pkcs8.c +++ b/src/usr.bin/openssl/pkcs8.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pkcs8.c,v 1.18 2025/01/02 12:31:44 tb Exp $ */ | 1 | /* $OpenBSD: pkcs8.c,v 1.19 2025/05/24 02:35:25 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999-2004. | 3 | * project 1999-2004. |
| 4 | */ | 4 | */ |
| @@ -224,8 +224,8 @@ pkcs8_main(int argc, char **argv) | |||
| 224 | BIO_printf(bio_err, "Error getting passwords\n"); | 224 | BIO_printf(bio_err, "Error getting passwords\n"); |
| 225 | goto end; | 225 | goto end; |
| 226 | } | 226 | } |
| 227 | if ((cfg.pbe_nid == -1) && !cfg.cipher) | 227 | if (cfg.pbe_nid == -1 && cfg.cipher == NULL) |
| 228 | cfg.pbe_nid = NID_pbeWithMD5AndDES_CBC; | 228 | cfg.cipher = EVP_aes_256_cbc(); |
| 229 | 229 | ||
| 230 | if (cfg.infile) { | 230 | if (cfg.infile) { |
| 231 | if (!(in = BIO_new_file(cfg.infile, "rb"))) { | 231 | if (!(in = BIO_new_file(cfg.infile, "rb"))) { |
diff --git a/src/usr.bin/openssl/smime.c b/src/usr.bin/openssl/smime.c index 46bfa08679..f9d7049ff9 100644 --- a/src/usr.bin/openssl/smime.c +++ b/src/usr.bin/openssl/smime.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: smime.c,v 1.20 2023/04/14 15:27:13 tb Exp $ */ | 1 | /* $OpenBSD: smime.c,v 1.21 2025/06/07 08:28:49 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project. | 3 | * project. |
| 4 | */ | 4 | */ |
| @@ -271,7 +271,7 @@ static const struct option smime_options[] = { | |||
| 271 | }, | 271 | }, |
| 272 | { | 272 | { |
| 273 | .name = "aes256", | 273 | .name = "aes256", |
| 274 | .desc = "Encrypt PEM output with CBC AES", | 274 | .desc = "Encrypt PEM output with CBC AES (default)", |
| 275 | .type = OPTION_ARGV_FUNC, | 275 | .type = OPTION_ARGV_FUNC, |
| 276 | .opt.argvfunc = smime_opt_cipher, | 276 | .opt.argvfunc = smime_opt_cipher, |
| 277 | }, | 277 | }, |
| @@ -313,7 +313,7 @@ static const struct option smime_options[] = { | |||
| 313 | #ifndef OPENSSL_NO_RC2 | 313 | #ifndef OPENSSL_NO_RC2 |
| 314 | { | 314 | { |
| 315 | .name = "rc2-40", | 315 | .name = "rc2-40", |
| 316 | .desc = "Encrypt with RC2-40 (default)", | 316 | .desc = "Encrypt with RC2-40", |
| 317 | .type = OPTION_ARGV_FUNC, | 317 | .type = OPTION_ARGV_FUNC, |
| 318 | .opt.argvfunc = smime_opt_cipher, | 318 | .opt.argvfunc = smime_opt_cipher, |
| 319 | }, | 319 | }, |
| @@ -825,14 +825,8 @@ smime_main(int argc, char **argv) | |||
| 825 | } | 825 | } |
| 826 | 826 | ||
| 827 | if (cfg.operation == SMIME_ENCRYPT) { | 827 | if (cfg.operation == SMIME_ENCRYPT) { |
| 828 | if (cfg.cipher == NULL) { | 828 | if (cfg.cipher == NULL) |
| 829 | #ifndef OPENSSL_NO_RC2 | 829 | cfg.cipher = EVP_aes_256_cbc(); |
| 830 | cfg.cipher = EVP_rc2_40_cbc(); | ||
| 831 | #else | ||
| 832 | BIO_printf(bio_err, "No cipher selected\n"); | ||
| 833 | goto end; | ||
| 834 | #endif | ||
| 835 | } | ||
| 836 | if ((encerts = sk_X509_new_null()) == NULL) | 830 | if ((encerts = sk_X509_new_null()) == NULL) |
| 837 | goto end; | 831 | goto end; |
| 838 | while (*args != NULL) { | 832 | while (*args != NULL) { |
diff --git a/src/usr.bin/openssl/speed.c b/src/usr.bin/openssl/speed.c index 9d03c6516e..1ece133f2e 100644 --- a/src/usr.bin/openssl/speed.c +++ b/src/usr.bin/openssl/speed.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: speed.c,v 1.41 2025/01/02 13:37:43 tb Exp $ */ | 1 | /* $OpenBSD: speed.c,v 1.50 2025/12/13 01:58:53 kenjiro Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -142,9 +142,6 @@ | |||
| 142 | #ifndef OPENSSL_NO_SHA | 142 | #ifndef OPENSSL_NO_SHA |
| 143 | #include <openssl/sha.h> | 143 | #include <openssl/sha.h> |
| 144 | #endif | 144 | #endif |
| 145 | #ifndef OPENSSL_NO_WHIRLPOOL | ||
| 146 | #include <openssl/whrlpool.h> | ||
| 147 | #endif | ||
| 148 | 145 | ||
| 149 | #define BUFSIZE (1024*8+64) | 146 | #define BUFSIZE (1024*8+64) |
| 150 | volatile sig_atomic_t run; | 147 | volatile sig_atomic_t run; |
| @@ -152,29 +149,78 @@ volatile sig_atomic_t run; | |||
| 152 | static int mr = 0; | 149 | static int mr = 0; |
| 153 | static int usertime = 1; | 150 | static int usertime = 1; |
| 154 | 151 | ||
| 155 | static double Time_F(int s); | 152 | static void print_message(const char *s, int length); |
| 156 | static void print_message(const char *s, long num, int length); | ||
| 157 | static void | 153 | static void |
| 158 | pkey_print_message(const char *str, const char *str2, | 154 | pkey_print_message(const char *str, const char *str2, |
| 159 | long num, int bits, int sec); | 155 | int bits, int sec); |
| 160 | static void print_result(int alg, int run_no, int count, double time_used); | 156 | static void print_result(int alg, int run_no, int count, double time_used); |
| 161 | static int do_multi(int multi); | 157 | static int do_multi(int multi); |
| 162 | 158 | ||
| 163 | #define ALGOR_NUM 32 | ||
| 164 | #define SIZE_NUM 5 | 159 | #define SIZE_NUM 5 |
| 165 | #define RSA_NUM 4 | 160 | #define MAX_ECDH_SIZE 256 |
| 166 | #define DSA_NUM 3 | 161 | |
| 162 | enum { | ||
| 163 | D_MD4, | ||
| 164 | D_MD5, | ||
| 165 | D_HMAC, | ||
| 166 | D_SHA1, | ||
| 167 | D_RMD160, | ||
| 168 | D_RC4, | ||
| 169 | D_CBC_DES, | ||
| 170 | D_EDE3_DES, | ||
| 171 | D_CBC_IDEA, | ||
| 172 | D_CBC_RC2, | ||
| 173 | D_CBC_BF, | ||
| 174 | D_CBC_CAST, | ||
| 175 | D_CBC_128_AES, | ||
| 176 | D_CBC_192_AES, | ||
| 177 | D_CBC_256_AES, | ||
| 178 | D_CBC_128_CML, | ||
| 179 | D_CBC_192_CML, | ||
| 180 | D_CBC_256_CML, | ||
| 181 | D_EVP, | ||
| 182 | D_SHA256, | ||
| 183 | D_SHA512, | ||
| 184 | D_IGE_128_AES, | ||
| 185 | D_IGE_192_AES, | ||
| 186 | D_IGE_256_AES, | ||
| 187 | D_GHASH, | ||
| 188 | D_AES_128_GCM, | ||
| 189 | D_AES_256_GCM, | ||
| 190 | D_CHACHA20_POLY1305, | ||
| 191 | ALGOR_NUM, | ||
| 192 | }; | ||
| 193 | |||
| 194 | enum { | ||
| 195 | R_DSA_512, | ||
| 196 | R_DSA_1024, | ||
| 197 | R_DSA_2048, | ||
| 198 | DSA_NUM, | ||
| 199 | }; | ||
| 200 | |||
| 201 | enum { | ||
| 202 | R_RSA_512, | ||
| 203 | R_RSA_1024, | ||
| 204 | R_RSA_2048, | ||
| 205 | R_RSA_4096, | ||
| 206 | RSA_NUM, | ||
| 207 | }; | ||
| 167 | 208 | ||
| 168 | #define EC_NUM 4 | 209 | enum { |
| 169 | #define MAX_ECDH_SIZE 256 | 210 | R_EC_P224, |
| 211 | R_EC_P256, | ||
| 212 | R_EC_P384, | ||
| 213 | R_EC_P521, | ||
| 214 | EC_NUM, | ||
| 215 | }; | ||
| 170 | 216 | ||
| 171 | static const char *names[ALGOR_NUM] = { | 217 | static const char *names[ALGOR_NUM] = { |
| 172 | "md2", "md4", "md5", "hmac(md5)", "sha1", "rmd160", | 218 | "md4", "md5", "hmac(sha256)", "sha1", "rmd160", |
| 173 | "rc4", "des cbc", "des ede3", "idea cbc", "seed cbc", | 219 | "rc4", "des cbc", "des ede3", "idea cbc", |
| 174 | "rc2 cbc", "rc5-32/12 cbc", "blowfish cbc", "cast cbc", | 220 | "rc2 cbc", "blowfish cbc", "cast cbc", |
| 175 | "aes-128 cbc", "aes-192 cbc", "aes-256 cbc", | 221 | "aes-128 cbc", "aes-192 cbc", "aes-256 cbc", |
| 176 | "camellia-128 cbc", "camellia-192 cbc", "camellia-256 cbc", | 222 | "camellia-128 cbc", "camellia-192 cbc", "camellia-256 cbc", |
| 177 | "evp", "sha256", "sha512", "whirlpool", | 223 | "evp", "sha256", "sha512", |
| 178 | "aes-128 ige", "aes-192 ige", "aes-256 ige", "ghash", | 224 | "aes-128 ige", "aes-192 ige", "aes-256 ige", "ghash", |
| 179 | "aes-128 gcm", "aes-256 gcm", "chacha20 poly1305", | 225 | "aes-128 gcm", "aes-256 gcm", "chacha20 poly1305", |
| 180 | }; | 226 | }; |
| @@ -895,6 +941,22 @@ static const unsigned char test4096[] = { | |||
| 895 | 0xaf, 0xf8, 0x2a, 0x91, 0x9d, 0x50, 0x44, 0x21, 0x17, | 941 | 0xaf, 0xf8, 0x2a, 0x91, 0x9d, 0x50, 0x44, 0x21, 0x17, |
| 896 | }; | 942 | }; |
| 897 | 943 | ||
| 944 | static const unsigned char key16[] = { | ||
| 945 | 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, | ||
| 946 | 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, | ||
| 947 | }; | ||
| 948 | static const unsigned char key24[] = { | ||
| 949 | 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, | ||
| 950 | 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, | ||
| 951 | 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, | ||
| 952 | }; | ||
| 953 | static const unsigned char key32[] = { | ||
| 954 | 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, | ||
| 955 | 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, | ||
| 956 | 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, | ||
| 957 | 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56, | ||
| 958 | }; | ||
| 959 | |||
| 898 | static void | 960 | static void |
| 899 | sig_done(int sig) | 961 | sig_done(int sig) |
| 900 | { | 962 | { |
| @@ -904,16 +966,14 @@ sig_done(int sig) | |||
| 904 | #define START TM_RESET | 966 | #define START TM_RESET |
| 905 | #define STOP TM_GET | 967 | #define STOP TM_GET |
| 906 | 968 | ||
| 907 | |||
| 908 | static double | 969 | static double |
| 909 | Time_F(int s) | 970 | time_f(int s) |
| 910 | { | 971 | { |
| 911 | if (usertime) | 972 | if (usertime) |
| 912 | return app_timer_user(s); | 973 | return app_timer_user(s); |
| 913 | else | ||
| 914 | return app_timer_real(s); | ||
| 915 | } | ||
| 916 | 974 | ||
| 975 | return app_timer_real(s); | ||
| 976 | } | ||
| 917 | 977 | ||
| 918 | static const int KDF1_SHA1_len = 20; | 978 | static const int KDF1_SHA1_len = 20; |
| 919 | static void * | 979 | static void * |
| @@ -937,33 +997,12 @@ speed_main(int argc, char **argv) | |||
| 937 | unsigned char *buf = NULL, *buf2 = NULL; | 997 | unsigned char *buf = NULL, *buf2 = NULL; |
| 938 | size_t unaligned = 0; | 998 | size_t unaligned = 0; |
| 939 | int mret = 1; | 999 | int mret = 1; |
| 940 | long count = 0, save_count = 0; | 1000 | long count = 0; |
| 941 | int i, j, k; | 1001 | int i, j, k; |
| 942 | long rsa_count; | 1002 | long rsa_count; |
| 943 | unsigned rsa_num; | 1003 | unsigned rsa_num; |
| 944 | unsigned char md[EVP_MAX_MD_SIZE]; | 1004 | unsigned char md[EVP_MAX_MD_SIZE]; |
| 945 | #ifndef OPENSSL_NO_MD4 | 1005 | |
| 946 | unsigned char md4[MD4_DIGEST_LENGTH]; | ||
| 947 | #endif | ||
| 948 | #ifndef OPENSSL_NO_MD5 | ||
| 949 | unsigned char md5[MD5_DIGEST_LENGTH]; | ||
| 950 | unsigned char hmac[MD5_DIGEST_LENGTH]; | ||
| 951 | #endif | ||
| 952 | #ifndef OPENSSL_NO_SHA | ||
| 953 | unsigned char sha[SHA_DIGEST_LENGTH]; | ||
| 954 | #ifndef OPENSSL_NO_SHA256 | ||
| 955 | unsigned char sha256[SHA256_DIGEST_LENGTH]; | ||
| 956 | #endif | ||
| 957 | #ifndef OPENSSL_NO_SHA512 | ||
| 958 | unsigned char sha512[SHA512_DIGEST_LENGTH]; | ||
| 959 | #endif | ||
| 960 | #endif | ||
| 961 | #ifndef OPENSSL_NO_WHIRLPOOL | ||
| 962 | unsigned char whirlpool[WHIRLPOOL_DIGEST_LENGTH]; | ||
| 963 | #endif | ||
| 964 | #ifndef OPENSSL_NO_RIPEMD | ||
| 965 | unsigned char rmd160[RIPEMD160_DIGEST_LENGTH]; | ||
| 966 | #endif | ||
| 967 | #ifndef OPENSSL_NO_RC4 | 1006 | #ifndef OPENSSL_NO_RC4 |
| 968 | RC4_KEY rc4_ks; | 1007 | RC4_KEY rc4_ks; |
| 969 | #endif | 1008 | #endif |
| @@ -979,38 +1018,8 @@ speed_main(int argc, char **argv) | |||
| 979 | #ifndef OPENSSL_NO_CAST | 1018 | #ifndef OPENSSL_NO_CAST |
| 980 | CAST_KEY cast_ks; | 1019 | CAST_KEY cast_ks; |
| 981 | #endif | 1020 | #endif |
| 982 | static const unsigned char key16[16] = | ||
| 983 | {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, | ||
| 984 | 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12}; | ||
| 985 | #ifndef OPENSSL_NO_AES | ||
| 986 | static const unsigned char key24[24] = | ||
| 987 | {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, | ||
| 988 | 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, | ||
| 989 | 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34}; | ||
| 990 | static const unsigned char key32[32] = | ||
| 991 | {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, | ||
| 992 | 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, | ||
| 993 | 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, | ||
| 994 | 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56}; | ||
| 995 | #endif | ||
| 996 | #ifndef OPENSSL_NO_CAMELLIA | ||
| 997 | static const unsigned char ckey24[24] = | ||
| 998 | {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, | ||
| 999 | 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, | ||
| 1000 | 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34}; | ||
| 1001 | static const unsigned char ckey32[32] = | ||
| 1002 | {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, | ||
| 1003 | 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, | ||
| 1004 | 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, | ||
| 1005 | 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56}; | ||
| 1006 | #endif | ||
| 1007 | #ifndef OPENSSL_NO_AES | ||
| 1008 | #define MAX_BLOCK_SIZE 128 | ||
| 1009 | #else | ||
| 1010 | #define MAX_BLOCK_SIZE 64 | ||
| 1011 | #endif | ||
| 1012 | unsigned char DES_iv[8]; | 1021 | unsigned char DES_iv[8]; |
| 1013 | unsigned char iv[2 * MAX_BLOCK_SIZE / 8]; | 1022 | unsigned char iv[2 * 16]; |
| 1014 | #ifndef OPENSSL_NO_DES | 1023 | #ifndef OPENSSL_NO_DES |
| 1015 | static DES_cblock key = {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0}; | 1024 | static DES_cblock key = {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0}; |
| 1016 | static DES_cblock key2 = {0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12}; | 1025 | static DES_cblock key2 = {0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12}; |
| @@ -1025,55 +1034,9 @@ speed_main(int argc, char **argv) | |||
| 1025 | #ifndef OPENSSL_NO_CAMELLIA | 1034 | #ifndef OPENSSL_NO_CAMELLIA |
| 1026 | CAMELLIA_KEY camellia_ks1, camellia_ks2, camellia_ks3; | 1035 | CAMELLIA_KEY camellia_ks1, camellia_ks2, camellia_ks3; |
| 1027 | #endif | 1036 | #endif |
| 1028 | #define D_MD2 0 | ||
| 1029 | #define D_MD4 1 | ||
| 1030 | #define D_MD5 2 | ||
| 1031 | #define D_HMAC 3 | ||
| 1032 | #define D_SHA1 4 | ||
| 1033 | #define D_RMD160 5 | ||
| 1034 | #define D_RC4 6 | ||
| 1035 | #define D_CBC_DES 7 | ||
| 1036 | #define D_EDE3_DES 8 | ||
| 1037 | #define D_CBC_IDEA 9 | ||
| 1038 | #define D_CBC_SEED 10 | ||
| 1039 | #define D_CBC_RC2 11 | ||
| 1040 | #define D_CBC_RC5 12 | ||
| 1041 | #define D_CBC_BF 13 | ||
| 1042 | #define D_CBC_CAST 14 | ||
| 1043 | #define D_CBC_128_AES 15 | ||
| 1044 | #define D_CBC_192_AES 16 | ||
| 1045 | #define D_CBC_256_AES 17 | ||
| 1046 | #define D_CBC_128_CML 18 | ||
| 1047 | #define D_CBC_192_CML 19 | ||
| 1048 | #define D_CBC_256_CML 20 | ||
| 1049 | #define D_EVP 21 | ||
| 1050 | #define D_SHA256 22 | ||
| 1051 | #define D_SHA512 23 | ||
| 1052 | #define D_WHIRLPOOL 24 | ||
| 1053 | #define D_IGE_128_AES 25 | ||
| 1054 | #define D_IGE_192_AES 26 | ||
| 1055 | #define D_IGE_256_AES 27 | ||
| 1056 | #define D_GHASH 28 | ||
| 1057 | #define D_AES_128_GCM 29 | ||
| 1058 | #define D_AES_256_GCM 30 | ||
| 1059 | #define D_CHACHA20_POLY1305 31 | ||
| 1060 | double d = 0.0; | 1037 | double d = 0.0; |
| 1061 | long c[ALGOR_NUM][SIZE_NUM]; | ||
| 1062 | #define R_DSA_512 0 | ||
| 1063 | #define R_DSA_1024 1 | ||
| 1064 | #define R_DSA_2048 2 | ||
| 1065 | #define R_RSA_512 0 | ||
| 1066 | #define R_RSA_1024 1 | ||
| 1067 | #define R_RSA_2048 2 | ||
| 1068 | #define R_RSA_4096 3 | ||
| 1069 | |||
| 1070 | #define R_EC_P224 0 | ||
| 1071 | #define R_EC_P256 1 | ||
| 1072 | #define R_EC_P384 2 | ||
| 1073 | #define R_EC_P521 3 | ||
| 1074 | 1038 | ||
| 1075 | RSA *rsa_key[RSA_NUM]; | 1039 | RSA *rsa_key[RSA_NUM]; |
| 1076 | long rsa_c[RSA_NUM][2]; | ||
| 1077 | static unsigned int rsa_bits[RSA_NUM] = {512, 1024, 2048, 4096}; | 1040 | static unsigned int rsa_bits[RSA_NUM] = {512, 1024, 2048, 4096}; |
| 1078 | static const unsigned char *rsa_data[RSA_NUM] = | 1041 | static const unsigned char *rsa_data[RSA_NUM] = |
| 1079 | {test512, test1024, test2048, test4096}; | 1042 | {test512, test1024, test2048, test4096}; |
| @@ -1081,7 +1044,6 @@ speed_main(int argc, char **argv) | |||
| 1081 | sizeof(test512), sizeof(test1024), | 1044 | sizeof(test512), sizeof(test1024), |
| 1082 | sizeof(test2048), sizeof(test4096)}; | 1045 | sizeof(test2048), sizeof(test4096)}; |
| 1083 | DSA *dsa_key[DSA_NUM]; | 1046 | DSA *dsa_key[DSA_NUM]; |
| 1084 | long dsa_c[DSA_NUM][2]; | ||
| 1085 | static unsigned int dsa_bits[DSA_NUM] = {512, 1024, 2048}; | 1047 | static unsigned int dsa_bits[DSA_NUM] = {512, 1024, 2048}; |
| 1086 | #ifndef OPENSSL_NO_EC | 1048 | #ifndef OPENSSL_NO_EC |
| 1087 | /* | 1049 | /* |
| @@ -1111,14 +1073,12 @@ speed_main(int argc, char **argv) | |||
| 1111 | unsigned char ecdsasig[256]; | 1073 | unsigned char ecdsasig[256]; |
| 1112 | unsigned int ecdsasiglen; | 1074 | unsigned int ecdsasiglen; |
| 1113 | EC_KEY *ecdsa[EC_NUM]; | 1075 | EC_KEY *ecdsa[EC_NUM]; |
| 1114 | long ecdsa_c[EC_NUM][2]; | ||
| 1115 | 1076 | ||
| 1116 | EC_KEY *ecdh_a[EC_NUM], *ecdh_b[EC_NUM]; | 1077 | EC_KEY *ecdh_a[EC_NUM], *ecdh_b[EC_NUM]; |
| 1117 | unsigned char secret_a[MAX_ECDH_SIZE], secret_b[MAX_ECDH_SIZE]; | 1078 | unsigned char secret_a[MAX_ECDH_SIZE], secret_b[MAX_ECDH_SIZE]; |
| 1118 | int secret_size_a, secret_size_b; | 1079 | int secret_size_a, secret_size_b; |
| 1119 | int ecdh_checks = 0; | 1080 | int ecdh_checks = 0; |
| 1120 | int secret_idx = 0; | 1081 | int secret_idx = 0; |
| 1121 | long ecdh_c[EC_NUM][2]; | ||
| 1122 | 1082 | ||
| 1123 | int rsa_doit[RSA_NUM]; | 1083 | int rsa_doit[RSA_NUM]; |
| 1124 | int dsa_doit[DSA_NUM]; | 1084 | int dsa_doit[DSA_NUM]; |
| @@ -1161,7 +1121,6 @@ speed_main(int argc, char **argv) | |||
| 1161 | BIO_printf(bio_err, "out of memory\n"); | 1121 | BIO_printf(bio_err, "out of memory\n"); |
| 1162 | goto end; | 1122 | goto end; |
| 1163 | } | 1123 | } |
| 1164 | memset(c, 0, sizeof(c)); | ||
| 1165 | memset(DES_iv, 0, sizeof(DES_iv)); | 1124 | memset(DES_iv, 0, sizeof(DES_iv)); |
| 1166 | memset(iv, 0, sizeof(iv)); | 1125 | memset(iv, 0, sizeof(iv)); |
| 1167 | 1126 | ||
| @@ -1275,11 +1234,6 @@ speed_main(int argc, char **argv) | |||
| 1275 | else | 1234 | else |
| 1276 | #endif | 1235 | #endif |
| 1277 | #endif | 1236 | #endif |
| 1278 | #ifndef OPENSSL_NO_WHIRLPOOL | ||
| 1279 | if (strcmp(*argv, "whirlpool") == 0) | ||
| 1280 | doit[D_WHIRLPOOL] = 1; | ||
| 1281 | else | ||
| 1282 | #endif | ||
| 1283 | #ifndef OPENSSL_NO_RIPEMD | 1237 | #ifndef OPENSSL_NO_RIPEMD |
| 1284 | if (strcmp(*argv, "ripemd") == 0) | 1238 | if (strcmp(*argv, "ripemd") == 0) |
| 1285 | doit[D_RMD160] = 1; | 1239 | doit[D_RMD160] = 1; |
| @@ -1462,16 +1416,12 @@ speed_main(int argc, char **argv) | |||
| 1462 | #ifndef OPENSSL_NO_SHA512 | 1416 | #ifndef OPENSSL_NO_SHA512 |
| 1463 | BIO_printf(bio_err, "sha512 "); | 1417 | BIO_printf(bio_err, "sha512 "); |
| 1464 | #endif | 1418 | #endif |
| 1465 | #ifndef OPENSSL_NO_WHIRLPOOL | ||
| 1466 | BIO_printf(bio_err, "whirlpool"); | ||
| 1467 | #endif | ||
| 1468 | #ifndef OPENSSL_NO_RIPEMD160 | 1419 | #ifndef OPENSSL_NO_RIPEMD160 |
| 1469 | BIO_printf(bio_err, "rmd160"); | 1420 | BIO_printf(bio_err, "rmd160"); |
| 1470 | #endif | 1421 | #endif |
| 1471 | #if !defined(OPENSSL_NO_MD2) || \ | 1422 | #if !defined(OPENSSL_NO_MD2) || \ |
| 1472 | !defined(OPENSSL_NO_MD4) || !defined(OPENSSL_NO_MD5) || \ | 1423 | !defined(OPENSSL_NO_MD4) || !defined(OPENSSL_NO_MD5) || \ |
| 1473 | !defined(OPENSSL_NO_SHA1) || !defined(OPENSSL_NO_RIPEMD160) || \ | 1424 | !defined(OPENSSL_NO_SHA1) || !defined(OPENSSL_NO_RIPEMD160) |
| 1474 | !defined(OPENSSL_NO_WHIRLPOOL) | ||
| 1475 | BIO_printf(bio_err, "\n"); | 1425 | BIO_printf(bio_err, "\n"); |
| 1476 | #endif | 1426 | #endif |
| 1477 | 1427 | ||
| @@ -1602,8 +1552,8 @@ speed_main(int argc, char **argv) | |||
| 1602 | #endif | 1552 | #endif |
| 1603 | #ifndef OPENSSL_NO_CAMELLIA | 1553 | #ifndef OPENSSL_NO_CAMELLIA |
| 1604 | Camellia_set_key(key16, 128, &camellia_ks1); | 1554 | Camellia_set_key(key16, 128, &camellia_ks1); |
| 1605 | Camellia_set_key(ckey24, 192, &camellia_ks2); | 1555 | Camellia_set_key(key24, 192, &camellia_ks2); |
| 1606 | Camellia_set_key(ckey32, 256, &camellia_ks3); | 1556 | Camellia_set_key(key32, 256, &camellia_ks3); |
| 1607 | #endif | 1557 | #endif |
| 1608 | #ifndef OPENSSL_NO_IDEA | 1558 | #ifndef OPENSSL_NO_IDEA |
| 1609 | idea_set_encrypt_key(key16, &idea_ks); | 1559 | idea_set_encrypt_key(key16, &idea_ks); |
| @@ -1620,8 +1570,7 @@ speed_main(int argc, char **argv) | |||
| 1620 | #ifndef OPENSSL_NO_CAST | 1570 | #ifndef OPENSSL_NO_CAST |
| 1621 | CAST_set_key(&cast_ks, 16, key16); | 1571 | CAST_set_key(&cast_ks, 16, key16); |
| 1622 | #endif | 1572 | #endif |
| 1623 | memset(rsa_c, 0, sizeof(rsa_c)); | 1573 | #define COND (run && count<0x7fffffff) |
| 1624 | #define COND(c) (run && count<0x7fffffff) | ||
| 1625 | #define COUNT(d) (count) | 1574 | #define COUNT(d) (count) |
| 1626 | 1575 | ||
| 1627 | memset(&sa, 0, sizeof(sa)); | 1576 | memset(&sa, 0, sizeof(sa)); |
| @@ -1633,11 +1582,11 @@ speed_main(int argc, char **argv) | |||
| 1633 | #ifndef OPENSSL_NO_MD4 | 1582 | #ifndef OPENSSL_NO_MD4 |
| 1634 | if (doit[D_MD4]) { | 1583 | if (doit[D_MD4]) { |
| 1635 | for (j = 0; j < SIZE_NUM; j++) { | 1584 | for (j = 0; j < SIZE_NUM; j++) { |
| 1636 | print_message(names[D_MD4], c[D_MD4][j], lengths[j]); | 1585 | print_message(names[D_MD4], lengths[j]); |
| 1637 | Time_F(START); | 1586 | time_f(START); |
| 1638 | for (count = 0, run = 1; COND(c[D_MD4][j]); count++) | 1587 | for (count = 0, run = 1; COND; count++) |
| 1639 | EVP_Digest(&(buf[0]), (unsigned long) lengths[j], &(md4[0]), NULL, EVP_md4(), NULL); | 1588 | EVP_Digest(&(buf[0]), (unsigned long) lengths[j], md, NULL, EVP_md4(), NULL); |
| 1640 | d = Time_F(STOP); | 1589 | d = time_f(STOP); |
| 1641 | print_result(D_MD4, j, count, d); | 1590 | print_result(D_MD4, j, count, d); |
| 1642 | } | 1591 | } |
| 1643 | } | 1592 | } |
| @@ -1646,17 +1595,17 @@ speed_main(int argc, char **argv) | |||
| 1646 | #ifndef OPENSSL_NO_MD5 | 1595 | #ifndef OPENSSL_NO_MD5 |
| 1647 | if (doit[D_MD5]) { | 1596 | if (doit[D_MD5]) { |
| 1648 | for (j = 0; j < SIZE_NUM; j++) { | 1597 | for (j = 0; j < SIZE_NUM; j++) { |
| 1649 | print_message(names[D_MD5], c[D_MD5][j], lengths[j]); | 1598 | print_message(names[D_MD5], lengths[j]); |
| 1650 | Time_F(START); | 1599 | time_f(START); |
| 1651 | for (count = 0, run = 1; COND(c[D_MD5][j]); count++) | 1600 | for (count = 0, run = 1; COND; count++) |
| 1652 | EVP_Digest(&(buf[0]), (unsigned long) lengths[j], &(md5[0]), NULL, EVP_get_digestbyname("md5"), NULL); | 1601 | EVP_Digest(&(buf[0]), (unsigned long) lengths[j], md, NULL, EVP_get_digestbyname("md5"), NULL); |
| 1653 | d = Time_F(STOP); | 1602 | d = time_f(STOP); |
| 1654 | print_result(D_MD5, j, count, d); | 1603 | print_result(D_MD5, j, count, d); |
| 1655 | } | 1604 | } |
| 1656 | } | 1605 | } |
| 1657 | #endif | 1606 | #endif |
| 1658 | 1607 | ||
| 1659 | #if !defined(OPENSSL_NO_MD5) && !defined(OPENSSL_NO_HMAC) | 1608 | #if !defined(OPENSSL_NO_SHA256) && !defined(OPENSSL_NO_HMAC) |
| 1660 | if (doit[D_HMAC]) { | 1609 | if (doit[D_HMAC]) { |
| 1661 | HMAC_CTX *hctx; | 1610 | HMAC_CTX *hctx; |
| 1662 | 1611 | ||
| @@ -1666,12 +1615,12 @@ speed_main(int argc, char **argv) | |||
| 1666 | } | 1615 | } |
| 1667 | 1616 | ||
| 1668 | HMAC_Init_ex(hctx, (unsigned char *) "This is a key...", | 1617 | HMAC_Init_ex(hctx, (unsigned char *) "This is a key...", |
| 1669 | 16, EVP_md5(), NULL); | 1618 | 16, EVP_sha256(), NULL); |
| 1670 | 1619 | ||
| 1671 | for (j = 0; j < SIZE_NUM; j++) { | 1620 | for (j = 0; j < SIZE_NUM; j++) { |
| 1672 | print_message(names[D_HMAC], c[D_HMAC][j], lengths[j]); | 1621 | print_message(names[D_HMAC], lengths[j]); |
| 1673 | Time_F(START); | 1622 | time_f(START); |
| 1674 | for (count = 0, run = 1; COND(c[D_HMAC][j]); count++) { | 1623 | for (count = 0, run = 1; COND; count++) { |
| 1675 | if (!HMAC_Init_ex(hctx, NULL, 0, NULL, NULL)) { | 1624 | if (!HMAC_Init_ex(hctx, NULL, 0, NULL, NULL)) { |
| 1676 | HMAC_CTX_free(hctx); | 1625 | HMAC_CTX_free(hctx); |
| 1677 | goto end; | 1626 | goto end; |
| @@ -1680,12 +1629,12 @@ speed_main(int argc, char **argv) | |||
| 1680 | HMAC_CTX_free(hctx); | 1629 | HMAC_CTX_free(hctx); |
| 1681 | goto end; | 1630 | goto end; |
| 1682 | } | 1631 | } |
| 1683 | if (!HMAC_Final(hctx, &(hmac[0]), NULL)) { | 1632 | if (!HMAC_Final(hctx, md, NULL)) { |
| 1684 | HMAC_CTX_free(hctx); | 1633 | HMAC_CTX_free(hctx); |
| 1685 | goto end; | 1634 | goto end; |
| 1686 | } | 1635 | } |
| 1687 | } | 1636 | } |
| 1688 | d = Time_F(STOP); | 1637 | d = time_f(STOP); |
| 1689 | print_result(D_HMAC, j, count, d); | 1638 | print_result(D_HMAC, j, count, d); |
| 1690 | } | 1639 | } |
| 1691 | HMAC_CTX_free(hctx); | 1640 | HMAC_CTX_free(hctx); |
| @@ -1694,22 +1643,22 @@ speed_main(int argc, char **argv) | |||
| 1694 | #ifndef OPENSSL_NO_SHA | 1643 | #ifndef OPENSSL_NO_SHA |
| 1695 | if (doit[D_SHA1]) { | 1644 | if (doit[D_SHA1]) { |
| 1696 | for (j = 0; j < SIZE_NUM; j++) { | 1645 | for (j = 0; j < SIZE_NUM; j++) { |
| 1697 | print_message(names[D_SHA1], c[D_SHA1][j], lengths[j]); | 1646 | print_message(names[D_SHA1], lengths[j]); |
| 1698 | Time_F(START); | 1647 | time_f(START); |
| 1699 | for (count = 0, run = 1; COND(c[D_SHA1][j]); count++) | 1648 | for (count = 0, run = 1; COND; count++) |
| 1700 | EVP_Digest(buf, (unsigned long) lengths[j], &(sha[0]), NULL, EVP_sha1(), NULL); | 1649 | EVP_Digest(buf, (unsigned long) lengths[j], md, NULL, EVP_sha1(), NULL); |
| 1701 | d = Time_F(STOP); | 1650 | d = time_f(STOP); |
| 1702 | print_result(D_SHA1, j, count, d); | 1651 | print_result(D_SHA1, j, count, d); |
| 1703 | } | 1652 | } |
| 1704 | } | 1653 | } |
| 1705 | #ifndef OPENSSL_NO_SHA256 | 1654 | #ifndef OPENSSL_NO_SHA256 |
| 1706 | if (doit[D_SHA256]) { | 1655 | if (doit[D_SHA256]) { |
| 1707 | for (j = 0; j < SIZE_NUM; j++) { | 1656 | for (j = 0; j < SIZE_NUM; j++) { |
| 1708 | print_message(names[D_SHA256], c[D_SHA256][j], lengths[j]); | 1657 | print_message(names[D_SHA256], lengths[j]); |
| 1709 | Time_F(START); | 1658 | time_f(START); |
| 1710 | for (count = 0, run = 1; COND(c[D_SHA256][j]); count++) | 1659 | for (count = 0, run = 1; COND; count++) |
| 1711 | SHA256(buf, lengths[j], sha256); | 1660 | SHA256(buf, lengths[j], md); |
| 1712 | d = Time_F(STOP); | 1661 | d = time_f(STOP); |
| 1713 | print_result(D_SHA256, j, count, d); | 1662 | print_result(D_SHA256, j, count, d); |
| 1714 | } | 1663 | } |
| 1715 | } | 1664 | } |
| @@ -1718,38 +1667,25 @@ speed_main(int argc, char **argv) | |||
| 1718 | #ifndef OPENSSL_NO_SHA512 | 1667 | #ifndef OPENSSL_NO_SHA512 |
| 1719 | if (doit[D_SHA512]) { | 1668 | if (doit[D_SHA512]) { |
| 1720 | for (j = 0; j < SIZE_NUM; j++) { | 1669 | for (j = 0; j < SIZE_NUM; j++) { |
| 1721 | print_message(names[D_SHA512], c[D_SHA512][j], lengths[j]); | 1670 | print_message(names[D_SHA512], lengths[j]); |
| 1722 | Time_F(START); | 1671 | time_f(START); |
| 1723 | for (count = 0, run = 1; COND(c[D_SHA512][j]); count++) | 1672 | for (count = 0, run = 1; COND; count++) |
| 1724 | SHA512(buf, lengths[j], sha512); | 1673 | SHA512(buf, lengths[j], md); |
| 1725 | d = Time_F(STOP); | 1674 | d = time_f(STOP); |
| 1726 | print_result(D_SHA512, j, count, d); | 1675 | print_result(D_SHA512, j, count, d); |
| 1727 | } | 1676 | } |
| 1728 | } | 1677 | } |
| 1729 | #endif | 1678 | #endif |
| 1730 | #endif | 1679 | #endif |
| 1731 | 1680 | ||
| 1732 | #ifndef OPENSSL_NO_WHIRLPOOL | ||
| 1733 | if (doit[D_WHIRLPOOL]) { | ||
| 1734 | for (j = 0; j < SIZE_NUM; j++) { | ||
| 1735 | print_message(names[D_WHIRLPOOL], c[D_WHIRLPOOL][j], lengths[j]); | ||
| 1736 | Time_F(START); | ||
| 1737 | for (count = 0, run = 1; COND(c[D_WHIRLPOOL][j]); count++) | ||
| 1738 | WHIRLPOOL(buf, lengths[j], whirlpool); | ||
| 1739 | d = Time_F(STOP); | ||
| 1740 | print_result(D_WHIRLPOOL, j, count, d); | ||
| 1741 | } | ||
| 1742 | } | ||
| 1743 | #endif | ||
| 1744 | |||
| 1745 | #ifndef OPENSSL_NO_RIPEMD | 1681 | #ifndef OPENSSL_NO_RIPEMD |
| 1746 | if (doit[D_RMD160]) { | 1682 | if (doit[D_RMD160]) { |
| 1747 | for (j = 0; j < SIZE_NUM; j++) { | 1683 | for (j = 0; j < SIZE_NUM; j++) { |
| 1748 | print_message(names[D_RMD160], c[D_RMD160][j], lengths[j]); | 1684 | print_message(names[D_RMD160], lengths[j]); |
| 1749 | Time_F(START); | 1685 | time_f(START); |
| 1750 | for (count = 0, run = 1; COND(c[D_RMD160][j]); count++) | 1686 | for (count = 0, run = 1; COND; count++) |
| 1751 | EVP_Digest(buf, (unsigned long) lengths[j], &(rmd160[0]), NULL, EVP_ripemd160(), NULL); | 1687 | EVP_Digest(buf, (unsigned long) lengths[j], md, NULL, EVP_ripemd160(), NULL); |
| 1752 | d = Time_F(STOP); | 1688 | d = time_f(STOP); |
| 1753 | print_result(D_RMD160, j, count, d); | 1689 | print_result(D_RMD160, j, count, d); |
| 1754 | } | 1690 | } |
| 1755 | } | 1691 | } |
| @@ -1757,12 +1693,12 @@ speed_main(int argc, char **argv) | |||
| 1757 | #ifndef OPENSSL_NO_RC4 | 1693 | #ifndef OPENSSL_NO_RC4 |
| 1758 | if (doit[D_RC4]) { | 1694 | if (doit[D_RC4]) { |
| 1759 | for (j = 0; j < SIZE_NUM; j++) { | 1695 | for (j = 0; j < SIZE_NUM; j++) { |
| 1760 | print_message(names[D_RC4], c[D_RC4][j], lengths[j]); | 1696 | print_message(names[D_RC4], lengths[j]); |
| 1761 | Time_F(START); | 1697 | time_f(START); |
| 1762 | for (count = 0, run = 1; COND(c[D_RC4][j]); count++) | 1698 | for (count = 0, run = 1; COND; count++) |
| 1763 | RC4(&rc4_ks, (unsigned int) lengths[j], | 1699 | RC4(&rc4_ks, (unsigned int) lengths[j], |
| 1764 | buf, buf); | 1700 | buf, buf); |
| 1765 | d = Time_F(STOP); | 1701 | d = time_f(STOP); |
| 1766 | print_result(D_RC4, j, count, d); | 1702 | print_result(D_RC4, j, count, d); |
| 1767 | } | 1703 | } |
| 1768 | } | 1704 | } |
| @@ -1770,24 +1706,24 @@ speed_main(int argc, char **argv) | |||
| 1770 | #ifndef OPENSSL_NO_DES | 1706 | #ifndef OPENSSL_NO_DES |
| 1771 | if (doit[D_CBC_DES]) { | 1707 | if (doit[D_CBC_DES]) { |
| 1772 | for (j = 0; j < SIZE_NUM; j++) { | 1708 | for (j = 0; j < SIZE_NUM; j++) { |
| 1773 | print_message(names[D_CBC_DES], c[D_CBC_DES][j], lengths[j]); | 1709 | print_message(names[D_CBC_DES], lengths[j]); |
| 1774 | Time_F(START); | 1710 | time_f(START); |
| 1775 | for (count = 0, run = 1; COND(c[D_CBC_DES][j]); count++) | 1711 | for (count = 0, run = 1; COND; count++) |
| 1776 | DES_ncbc_encrypt(buf, buf, lengths[j], &sch, | 1712 | DES_ncbc_encrypt(buf, buf, lengths[j], &sch, |
| 1777 | &DES_iv, DES_ENCRYPT); | 1713 | &DES_iv, DES_ENCRYPT); |
| 1778 | d = Time_F(STOP); | 1714 | d = time_f(STOP); |
| 1779 | print_result(D_CBC_DES, j, count, d); | 1715 | print_result(D_CBC_DES, j, count, d); |
| 1780 | } | 1716 | } |
| 1781 | } | 1717 | } |
| 1782 | if (doit[D_EDE3_DES]) { | 1718 | if (doit[D_EDE3_DES]) { |
| 1783 | for (j = 0; j < SIZE_NUM; j++) { | 1719 | for (j = 0; j < SIZE_NUM; j++) { |
| 1784 | print_message(names[D_EDE3_DES], c[D_EDE3_DES][j], lengths[j]); | 1720 | print_message(names[D_EDE3_DES], lengths[j]); |
| 1785 | Time_F(START); | 1721 | time_f(START); |
| 1786 | for (count = 0, run = 1; COND(c[D_EDE3_DES][j]); count++) | 1722 | for (count = 0, run = 1; COND; count++) |
| 1787 | DES_ede3_cbc_encrypt(buf, buf, lengths[j], | 1723 | DES_ede3_cbc_encrypt(buf, buf, lengths[j], |
| 1788 | &sch, &sch2, &sch3, | 1724 | &sch, &sch2, &sch3, |
| 1789 | &DES_iv, DES_ENCRYPT); | 1725 | &DES_iv, DES_ENCRYPT); |
| 1790 | d = Time_F(STOP); | 1726 | d = time_f(STOP); |
| 1791 | print_result(D_EDE3_DES, j, count, d); | 1727 | print_result(D_EDE3_DES, j, count, d); |
| 1792 | } | 1728 | } |
| 1793 | } | 1729 | } |
| @@ -1795,73 +1731,73 @@ speed_main(int argc, char **argv) | |||
| 1795 | #ifndef OPENSSL_NO_AES | 1731 | #ifndef OPENSSL_NO_AES |
| 1796 | if (doit[D_CBC_128_AES]) { | 1732 | if (doit[D_CBC_128_AES]) { |
| 1797 | for (j = 0; j < SIZE_NUM; j++) { | 1733 | for (j = 0; j < SIZE_NUM; j++) { |
| 1798 | print_message(names[D_CBC_128_AES], c[D_CBC_128_AES][j], lengths[j]); | 1734 | print_message(names[D_CBC_128_AES], lengths[j]); |
| 1799 | Time_F(START); | 1735 | time_f(START); |
| 1800 | for (count = 0, run = 1; COND(c[D_CBC_128_AES][j]); count++) | 1736 | for (count = 0, run = 1; COND; count++) |
| 1801 | AES_cbc_encrypt(buf, buf, | 1737 | AES_cbc_encrypt(buf, buf, |
| 1802 | (unsigned long) lengths[j], &aes_ks1, | 1738 | (unsigned long) lengths[j], &aes_ks1, |
| 1803 | iv, AES_ENCRYPT); | 1739 | iv, AES_ENCRYPT); |
| 1804 | d = Time_F(STOP); | 1740 | d = time_f(STOP); |
| 1805 | print_result(D_CBC_128_AES, j, count, d); | 1741 | print_result(D_CBC_128_AES, j, count, d); |
| 1806 | } | 1742 | } |
| 1807 | } | 1743 | } |
| 1808 | if (doit[D_CBC_192_AES]) { | 1744 | if (doit[D_CBC_192_AES]) { |
| 1809 | for (j = 0; j < SIZE_NUM; j++) { | 1745 | for (j = 0; j < SIZE_NUM; j++) { |
| 1810 | print_message(names[D_CBC_192_AES], c[D_CBC_192_AES][j], lengths[j]); | 1746 | print_message(names[D_CBC_192_AES], lengths[j]); |
| 1811 | Time_F(START); | 1747 | time_f(START); |
| 1812 | for (count = 0, run = 1; COND(c[D_CBC_192_AES][j]); count++) | 1748 | for (count = 0, run = 1; COND; count++) |
| 1813 | AES_cbc_encrypt(buf, buf, | 1749 | AES_cbc_encrypt(buf, buf, |
| 1814 | (unsigned long) lengths[j], &aes_ks2, | 1750 | (unsigned long) lengths[j], &aes_ks2, |
| 1815 | iv, AES_ENCRYPT); | 1751 | iv, AES_ENCRYPT); |
| 1816 | d = Time_F(STOP); | 1752 | d = time_f(STOP); |
| 1817 | print_result(D_CBC_192_AES, j, count, d); | 1753 | print_result(D_CBC_192_AES, j, count, d); |
| 1818 | } | 1754 | } |
| 1819 | } | 1755 | } |
| 1820 | if (doit[D_CBC_256_AES]) { | 1756 | if (doit[D_CBC_256_AES]) { |
| 1821 | for (j = 0; j < SIZE_NUM; j++) { | 1757 | for (j = 0; j < SIZE_NUM; j++) { |
| 1822 | print_message(names[D_CBC_256_AES], c[D_CBC_256_AES][j], lengths[j]); | 1758 | print_message(names[D_CBC_256_AES], lengths[j]); |
| 1823 | Time_F(START); | 1759 | time_f(START); |
| 1824 | for (count = 0, run = 1; COND(c[D_CBC_256_AES][j]); count++) | 1760 | for (count = 0, run = 1; COND; count++) |
| 1825 | AES_cbc_encrypt(buf, buf, | 1761 | AES_cbc_encrypt(buf, buf, |
| 1826 | (unsigned long) lengths[j], &aes_ks3, | 1762 | (unsigned long) lengths[j], &aes_ks3, |
| 1827 | iv, AES_ENCRYPT); | 1763 | iv, AES_ENCRYPT); |
| 1828 | d = Time_F(STOP); | 1764 | d = time_f(STOP); |
| 1829 | print_result(D_CBC_256_AES, j, count, d); | 1765 | print_result(D_CBC_256_AES, j, count, d); |
| 1830 | } | 1766 | } |
| 1831 | } | 1767 | } |
| 1832 | if (doit[D_IGE_128_AES]) { | 1768 | if (doit[D_IGE_128_AES]) { |
| 1833 | for (j = 0; j < SIZE_NUM; j++) { | 1769 | for (j = 0; j < SIZE_NUM; j++) { |
| 1834 | print_message(names[D_IGE_128_AES], c[D_IGE_128_AES][j], lengths[j]); | 1770 | print_message(names[D_IGE_128_AES], lengths[j]); |
| 1835 | Time_F(START); | 1771 | time_f(START); |
| 1836 | for (count = 0, run = 1; COND(c[D_IGE_128_AES][j]); count++) | 1772 | for (count = 0, run = 1; COND; count++) |
| 1837 | AES_ige_encrypt(buf, buf2, | 1773 | AES_ige_encrypt(buf, buf2, |
| 1838 | (unsigned long) lengths[j], &aes_ks1, | 1774 | (unsigned long) lengths[j], &aes_ks1, |
| 1839 | iv, AES_ENCRYPT); | 1775 | iv, AES_ENCRYPT); |
| 1840 | d = Time_F(STOP); | 1776 | d = time_f(STOP); |
| 1841 | print_result(D_IGE_128_AES, j, count, d); | 1777 | print_result(D_IGE_128_AES, j, count, d); |
| 1842 | } | 1778 | } |
| 1843 | } | 1779 | } |
| 1844 | if (doit[D_IGE_192_AES]) { | 1780 | if (doit[D_IGE_192_AES]) { |
| 1845 | for (j = 0; j < SIZE_NUM; j++) { | 1781 | for (j = 0; j < SIZE_NUM; j++) { |
| 1846 | print_message(names[D_IGE_192_AES], c[D_IGE_192_AES][j], lengths[j]); | 1782 | print_message(names[D_IGE_192_AES], lengths[j]); |
| 1847 | Time_F(START); | 1783 | time_f(START); |
| 1848 | for (count = 0, run = 1; COND(c[D_IGE_192_AES][j]); count++) | 1784 | for (count = 0, run = 1; COND; count++) |
| 1849 | AES_ige_encrypt(buf, buf2, | 1785 | AES_ige_encrypt(buf, buf2, |
| 1850 | (unsigned long) lengths[j], &aes_ks2, | 1786 | (unsigned long) lengths[j], &aes_ks2, |
| 1851 | iv, AES_ENCRYPT); | 1787 | iv, AES_ENCRYPT); |
| 1852 | d = Time_F(STOP); | 1788 | d = time_f(STOP); |
| 1853 | print_result(D_IGE_192_AES, j, count, d); | 1789 | print_result(D_IGE_192_AES, j, count, d); |
| 1854 | } | 1790 | } |
| 1855 | } | 1791 | } |
| 1856 | if (doit[D_IGE_256_AES]) { | 1792 | if (doit[D_IGE_256_AES]) { |
| 1857 | for (j = 0; j < SIZE_NUM; j++) { | 1793 | for (j = 0; j < SIZE_NUM; j++) { |
| 1858 | print_message(names[D_IGE_256_AES], c[D_IGE_256_AES][j], lengths[j]); | 1794 | print_message(names[D_IGE_256_AES], lengths[j]); |
| 1859 | Time_F(START); | 1795 | time_f(START); |
| 1860 | for (count = 0, run = 1; COND(c[D_IGE_256_AES][j]); count++) | 1796 | for (count = 0, run = 1; COND; count++) |
| 1861 | AES_ige_encrypt(buf, buf2, | 1797 | AES_ige_encrypt(buf, buf2, |
| 1862 | (unsigned long) lengths[j], &aes_ks3, | 1798 | (unsigned long) lengths[j], &aes_ks3, |
| 1863 | iv, AES_ENCRYPT); | 1799 | iv, AES_ENCRYPT); |
| 1864 | d = Time_F(STOP); | 1800 | d = time_f(STOP); |
| 1865 | print_result(D_IGE_256_AES, j, count, d); | 1801 | print_result(D_IGE_256_AES, j, count, d); |
| 1866 | } | 1802 | } |
| 1867 | } | 1803 | } |
| @@ -1870,11 +1806,11 @@ speed_main(int argc, char **argv) | |||
| 1870 | CRYPTO_gcm128_setiv(ctx, (unsigned char *) "0123456789ab", 12); | 1806 | CRYPTO_gcm128_setiv(ctx, (unsigned char *) "0123456789ab", 12); |
| 1871 | 1807 | ||
| 1872 | for (j = 0; j < SIZE_NUM; j++) { | 1808 | for (j = 0; j < SIZE_NUM; j++) { |
| 1873 | print_message(names[D_GHASH], c[D_GHASH][j], lengths[j]); | 1809 | print_message(names[D_GHASH], lengths[j]); |
| 1874 | Time_F(START); | 1810 | time_f(START); |
| 1875 | for (count = 0, run = 1; COND(c[D_GHASH][j]); count++) | 1811 | for (count = 0, run = 1; COND; count++) |
| 1876 | CRYPTO_gcm128_aad(ctx, buf, lengths[j]); | 1812 | CRYPTO_gcm128_aad(ctx, buf, lengths[j]); |
| 1877 | d = Time_F(STOP); | 1813 | d = time_f(STOP); |
| 1878 | print_result(D_GHASH, j, count, d); | 1814 | print_result(D_GHASH, j, count, d); |
| 1879 | } | 1815 | } |
| 1880 | CRYPTO_gcm128_release(ctx); | 1816 | CRYPTO_gcm128_release(ctx); |
| @@ -1896,12 +1832,12 @@ speed_main(int argc, char **argv) | |||
| 1896 | nonce_len = EVP_AEAD_nonce_length(aead); | 1832 | nonce_len = EVP_AEAD_nonce_length(aead); |
| 1897 | 1833 | ||
| 1898 | for (j = 0; j < SIZE_NUM; j++) { | 1834 | for (j = 0; j < SIZE_NUM; j++) { |
| 1899 | print_message(names[D_AES_128_GCM],c[D_AES_128_GCM][j],lengths[j]); | 1835 | print_message(names[D_AES_128_GCM], lengths[j]); |
| 1900 | Time_F(START); | 1836 | time_f(START); |
| 1901 | for (count = 0, run = 1; COND(c[D_AES_128_GCM][j]); count++) | 1837 | for (count = 0, run = 1; COND; count++) |
| 1902 | EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce, | 1838 | EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce, |
| 1903 | nonce_len, buf, lengths[j], NULL, 0); | 1839 | nonce_len, buf, lengths[j], NULL, 0); |
| 1904 | d=Time_F(STOP); | 1840 | d = time_f(STOP); |
| 1905 | print_result(D_AES_128_GCM,j,count,d); | 1841 | print_result(D_AES_128_GCM,j,count,d); |
| 1906 | } | 1842 | } |
| 1907 | EVP_AEAD_CTX_free(ctx); | 1843 | EVP_AEAD_CTX_free(ctx); |
| @@ -1924,12 +1860,12 @@ speed_main(int argc, char **argv) | |||
| 1924 | nonce_len = EVP_AEAD_nonce_length(aead); | 1860 | nonce_len = EVP_AEAD_nonce_length(aead); |
| 1925 | 1861 | ||
| 1926 | for (j = 0; j < SIZE_NUM; j++) { | 1862 | for (j = 0; j < SIZE_NUM; j++) { |
| 1927 | print_message(names[D_AES_256_GCM],c[D_AES_256_GCM][j],lengths[j]); | 1863 | print_message(names[D_AES_256_GCM], lengths[j]); |
| 1928 | Time_F(START); | 1864 | time_f(START); |
| 1929 | for (count = 0, run = 1; COND(c[D_AES_256_GCM][j]); count++) | 1865 | for (count = 0, run = 1; COND; count++) |
| 1930 | EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce, | 1866 | EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce, |
| 1931 | nonce_len, buf, lengths[j], NULL, 0); | 1867 | nonce_len, buf, lengths[j], NULL, 0); |
| 1932 | d=Time_F(STOP); | 1868 | d = time_f(STOP); |
| 1933 | print_result(D_AES_256_GCM, j, count, d); | 1869 | print_result(D_AES_256_GCM, j, count, d); |
| 1934 | } | 1870 | } |
| 1935 | EVP_AEAD_CTX_free(ctx); | 1871 | EVP_AEAD_CTX_free(ctx); |
| @@ -1953,13 +1889,12 @@ speed_main(int argc, char **argv) | |||
| 1953 | nonce_len = EVP_AEAD_nonce_length(aead); | 1889 | nonce_len = EVP_AEAD_nonce_length(aead); |
| 1954 | 1890 | ||
| 1955 | for (j = 0; j < SIZE_NUM; j++) { | 1891 | for (j = 0; j < SIZE_NUM; j++) { |
| 1956 | print_message(names[D_CHACHA20_POLY1305], | 1892 | print_message(names[D_CHACHA20_POLY1305], lengths[j]); |
| 1957 | c[D_CHACHA20_POLY1305][j], lengths[j]); | 1893 | time_f(START); |
| 1958 | Time_F(START); | 1894 | for (count = 0, run = 1; COND; count++) |
| 1959 | for (count = 0, run = 1; COND(c[D_CHACHA20_POLY1305][j]); count++) | ||
| 1960 | EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce, | 1895 | EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce, |
| 1961 | nonce_len, buf, lengths[j], NULL, 0); | 1896 | nonce_len, buf, lengths[j], NULL, 0); |
| 1962 | d=Time_F(STOP); | 1897 | d = time_f(STOP); |
| 1963 | print_result(D_CHACHA20_POLY1305, j, count, d); | 1898 | print_result(D_CHACHA20_POLY1305, j, count, d); |
| 1964 | } | 1899 | } |
| 1965 | EVP_AEAD_CTX_free(ctx); | 1900 | EVP_AEAD_CTX_free(ctx); |
| @@ -1968,37 +1903,37 @@ speed_main(int argc, char **argv) | |||
| 1968 | #ifndef OPENSSL_NO_CAMELLIA | 1903 | #ifndef OPENSSL_NO_CAMELLIA |
| 1969 | if (doit[D_CBC_128_CML]) { | 1904 | if (doit[D_CBC_128_CML]) { |
| 1970 | for (j = 0; j < SIZE_NUM; j++) { | 1905 | for (j = 0; j < SIZE_NUM; j++) { |
| 1971 | print_message(names[D_CBC_128_CML], c[D_CBC_128_CML][j], lengths[j]); | 1906 | print_message(names[D_CBC_128_CML], lengths[j]); |
| 1972 | Time_F(START); | 1907 | time_f(START); |
| 1973 | for (count = 0, run = 1; COND(c[D_CBC_128_CML][j]); count++) | 1908 | for (count = 0, run = 1; COND; count++) |
| 1974 | Camellia_cbc_encrypt(buf, buf, | 1909 | Camellia_cbc_encrypt(buf, buf, |
| 1975 | (unsigned long) lengths[j], &camellia_ks1, | 1910 | (unsigned long) lengths[j], &camellia_ks1, |
| 1976 | iv, CAMELLIA_ENCRYPT); | 1911 | iv, CAMELLIA_ENCRYPT); |
| 1977 | d = Time_F(STOP); | 1912 | d = time_f(STOP); |
| 1978 | print_result(D_CBC_128_CML, j, count, d); | 1913 | print_result(D_CBC_128_CML, j, count, d); |
| 1979 | } | 1914 | } |
| 1980 | } | 1915 | } |
| 1981 | if (doit[D_CBC_192_CML]) { | 1916 | if (doit[D_CBC_192_CML]) { |
| 1982 | for (j = 0; j < SIZE_NUM; j++) { | 1917 | for (j = 0; j < SIZE_NUM; j++) { |
| 1983 | print_message(names[D_CBC_192_CML], c[D_CBC_192_CML][j], lengths[j]); | 1918 | print_message(names[D_CBC_192_CML], lengths[j]); |
| 1984 | Time_F(START); | 1919 | time_f(START); |
| 1985 | for (count = 0, run = 1; COND(c[D_CBC_192_CML][j]); count++) | 1920 | for (count = 0, run = 1; COND; count++) |
| 1986 | Camellia_cbc_encrypt(buf, buf, | 1921 | Camellia_cbc_encrypt(buf, buf, |
| 1987 | (unsigned long) lengths[j], &camellia_ks2, | 1922 | (unsigned long) lengths[j], &camellia_ks2, |
| 1988 | iv, CAMELLIA_ENCRYPT); | 1923 | iv, CAMELLIA_ENCRYPT); |
| 1989 | d = Time_F(STOP); | 1924 | d = time_f(STOP); |
| 1990 | print_result(D_CBC_192_CML, j, count, d); | 1925 | print_result(D_CBC_192_CML, j, count, d); |
| 1991 | } | 1926 | } |
| 1992 | } | 1927 | } |
| 1993 | if (doit[D_CBC_256_CML]) { | 1928 | if (doit[D_CBC_256_CML]) { |
| 1994 | for (j = 0; j < SIZE_NUM; j++) { | 1929 | for (j = 0; j < SIZE_NUM; j++) { |
| 1995 | print_message(names[D_CBC_256_CML], c[D_CBC_256_CML][j], lengths[j]); | 1930 | print_message(names[D_CBC_256_CML], lengths[j]); |
| 1996 | Time_F(START); | 1931 | time_f(START); |
| 1997 | for (count = 0, run = 1; COND(c[D_CBC_256_CML][j]); count++) | 1932 | for (count = 0, run = 1; COND; count++) |
| 1998 | Camellia_cbc_encrypt(buf, buf, | 1933 | Camellia_cbc_encrypt(buf, buf, |
| 1999 | (unsigned long) lengths[j], &camellia_ks3, | 1934 | (unsigned long) lengths[j], &camellia_ks3, |
| 2000 | iv, CAMELLIA_ENCRYPT); | 1935 | iv, CAMELLIA_ENCRYPT); |
| 2001 | d = Time_F(STOP); | 1936 | d = time_f(STOP); |
| 2002 | print_result(D_CBC_256_CML, j, count, d); | 1937 | print_result(D_CBC_256_CML, j, count, d); |
| 2003 | } | 1938 | } |
| 2004 | } | 1939 | } |
| @@ -2006,13 +1941,13 @@ speed_main(int argc, char **argv) | |||
| 2006 | #ifndef OPENSSL_NO_IDEA | 1941 | #ifndef OPENSSL_NO_IDEA |
| 2007 | if (doit[D_CBC_IDEA]) { | 1942 | if (doit[D_CBC_IDEA]) { |
| 2008 | for (j = 0; j < SIZE_NUM; j++) { | 1943 | for (j = 0; j < SIZE_NUM; j++) { |
| 2009 | print_message(names[D_CBC_IDEA], c[D_CBC_IDEA][j], lengths[j]); | 1944 | print_message(names[D_CBC_IDEA], lengths[j]); |
| 2010 | Time_F(START); | 1945 | time_f(START); |
| 2011 | for (count = 0, run = 1; COND(c[D_CBC_IDEA][j]); count++) | 1946 | for (count = 0, run = 1; COND; count++) |
| 2012 | idea_cbc_encrypt(buf, buf, | 1947 | idea_cbc_encrypt(buf, buf, |
| 2013 | (unsigned long) lengths[j], &idea_ks, | 1948 | (unsigned long) lengths[j], &idea_ks, |
| 2014 | iv, IDEA_ENCRYPT); | 1949 | iv, IDEA_ENCRYPT); |
| 2015 | d = Time_F(STOP); | 1950 | d = time_f(STOP); |
| 2016 | print_result(D_CBC_IDEA, j, count, d); | 1951 | print_result(D_CBC_IDEA, j, count, d); |
| 2017 | } | 1952 | } |
| 2018 | } | 1953 | } |
| @@ -2020,13 +1955,13 @@ speed_main(int argc, char **argv) | |||
| 2020 | #ifndef OPENSSL_NO_RC2 | 1955 | #ifndef OPENSSL_NO_RC2 |
| 2021 | if (doit[D_CBC_RC2]) { | 1956 | if (doit[D_CBC_RC2]) { |
| 2022 | for (j = 0; j < SIZE_NUM; j++) { | 1957 | for (j = 0; j < SIZE_NUM; j++) { |
| 2023 | print_message(names[D_CBC_RC2], c[D_CBC_RC2][j], lengths[j]); | 1958 | print_message(names[D_CBC_RC2], lengths[j]); |
| 2024 | Time_F(START); | 1959 | time_f(START); |
| 2025 | for (count = 0, run = 1; COND(c[D_CBC_RC2][j]); count++) | 1960 | for (count = 0, run = 1; COND; count++) |
| 2026 | RC2_cbc_encrypt(buf, buf, | 1961 | RC2_cbc_encrypt(buf, buf, |
| 2027 | (unsigned long) lengths[j], &rc2_ks, | 1962 | (unsigned long) lengths[j], &rc2_ks, |
| 2028 | iv, RC2_ENCRYPT); | 1963 | iv, RC2_ENCRYPT); |
| 2029 | d = Time_F(STOP); | 1964 | d = time_f(STOP); |
| 2030 | print_result(D_CBC_RC2, j, count, d); | 1965 | print_result(D_CBC_RC2, j, count, d); |
| 2031 | } | 1966 | } |
| 2032 | } | 1967 | } |
| @@ -2034,13 +1969,13 @@ speed_main(int argc, char **argv) | |||
| 2034 | #ifndef OPENSSL_NO_BF | 1969 | #ifndef OPENSSL_NO_BF |
| 2035 | if (doit[D_CBC_BF]) { | 1970 | if (doit[D_CBC_BF]) { |
| 2036 | for (j = 0; j < SIZE_NUM; j++) { | 1971 | for (j = 0; j < SIZE_NUM; j++) { |
| 2037 | print_message(names[D_CBC_BF], c[D_CBC_BF][j], lengths[j]); | 1972 | print_message(names[D_CBC_BF], lengths[j]); |
| 2038 | Time_F(START); | 1973 | time_f(START); |
| 2039 | for (count = 0, run = 1; COND(c[D_CBC_BF][j]); count++) | 1974 | for (count = 0, run = 1; COND; count++) |
| 2040 | BF_cbc_encrypt(buf, buf, | 1975 | BF_cbc_encrypt(buf, buf, |
| 2041 | (unsigned long) lengths[j], &bf_ks, | 1976 | (unsigned long) lengths[j], &bf_ks, |
| 2042 | iv, BF_ENCRYPT); | 1977 | iv, BF_ENCRYPT); |
| 2043 | d = Time_F(STOP); | 1978 | d = time_f(STOP); |
| 2044 | print_result(D_CBC_BF, j, count, d); | 1979 | print_result(D_CBC_BF, j, count, d); |
| 2045 | } | 1980 | } |
| 2046 | } | 1981 | } |
| @@ -2048,13 +1983,13 @@ speed_main(int argc, char **argv) | |||
| 2048 | #ifndef OPENSSL_NO_CAST | 1983 | #ifndef OPENSSL_NO_CAST |
| 2049 | if (doit[D_CBC_CAST]) { | 1984 | if (doit[D_CBC_CAST]) { |
| 2050 | for (j = 0; j < SIZE_NUM; j++) { | 1985 | for (j = 0; j < SIZE_NUM; j++) { |
| 2051 | print_message(names[D_CBC_CAST], c[D_CBC_CAST][j], lengths[j]); | 1986 | print_message(names[D_CBC_CAST], lengths[j]); |
| 2052 | Time_F(START); | 1987 | time_f(START); |
| 2053 | for (count = 0, run = 1; COND(c[D_CBC_CAST][j]); count++) | 1988 | for (count = 0, run = 1; COND; count++) |
| 2054 | CAST_cbc_encrypt(buf, buf, | 1989 | CAST_cbc_encrypt(buf, buf, |
| 2055 | (unsigned long) lengths[j], &cast_ks, | 1990 | (unsigned long) lengths[j], &cast_ks, |
| 2056 | iv, CAST_ENCRYPT); | 1991 | iv, CAST_ENCRYPT); |
| 2057 | d = Time_F(STOP); | 1992 | d = time_f(STOP); |
| 2058 | print_result(D_CBC_CAST, j, count, d); | 1993 | print_result(D_CBC_CAST, j, count, d); |
| 2059 | } | 1994 | } |
| 2060 | } | 1995 | } |
| @@ -2073,8 +2008,7 @@ speed_main(int argc, char **argv) | |||
| 2073 | * optimization here! names[D_EVP] somehow | 2008 | * optimization here! names[D_EVP] somehow |
| 2074 | * becomes NULL | 2009 | * becomes NULL |
| 2075 | */ | 2010 | */ |
| 2076 | print_message(names[D_EVP], save_count, | 2011 | print_message(names[D_EVP], lengths[j]); |
| 2077 | lengths[j]); | ||
| 2078 | 2012 | ||
| 2079 | if ((ctx = EVP_CIPHER_CTX_new()) == NULL) { | 2013 | if ((ctx = EVP_CIPHER_CTX_new()) == NULL) { |
| 2080 | BIO_printf(bio_err, "Failed to " | 2014 | BIO_printf(bio_err, "Failed to " |
| @@ -2087,30 +2021,29 @@ speed_main(int argc, char **argv) | |||
| 2087 | EVP_EncryptInit_ex(ctx, evp_cipher, NULL, key16, iv); | 2021 | EVP_EncryptInit_ex(ctx, evp_cipher, NULL, key16, iv); |
| 2088 | EVP_CIPHER_CTX_set_padding(ctx, 0); | 2022 | EVP_CIPHER_CTX_set_padding(ctx, 0); |
| 2089 | 2023 | ||
| 2090 | Time_F(START); | 2024 | time_f(START); |
| 2091 | if (decrypt) | 2025 | if (decrypt) |
| 2092 | for (count = 0, run = 1; COND(save_count * 4 * lengths[0] / lengths[j]); count++) | 2026 | for (count = 0, run = 1; COND; count++) |
| 2093 | EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[j]); | 2027 | EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[j]); |
| 2094 | else | 2028 | else |
| 2095 | for (count = 0, run = 1; COND(save_count * 4 * lengths[0] / lengths[j]); count++) | 2029 | for (count = 0, run = 1; COND; count++) |
| 2096 | EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[j]); | 2030 | EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[j]); |
| 2097 | if (decrypt) | 2031 | if (decrypt) |
| 2098 | EVP_DecryptFinal_ex(ctx, buf, &outl); | 2032 | EVP_DecryptFinal_ex(ctx, buf, &outl); |
| 2099 | else | 2033 | else |
| 2100 | EVP_EncryptFinal_ex(ctx, buf, &outl); | 2034 | EVP_EncryptFinal_ex(ctx, buf, &outl); |
| 2101 | d = Time_F(STOP); | 2035 | d = time_f(STOP); |
| 2102 | EVP_CIPHER_CTX_free(ctx); | 2036 | EVP_CIPHER_CTX_free(ctx); |
| 2103 | } | 2037 | } |
| 2104 | if (evp_md) { | 2038 | if (evp_md) { |
| 2105 | names[D_EVP] = OBJ_nid2ln(EVP_MD_type(evp_md)); | 2039 | names[D_EVP] = OBJ_nid2ln(EVP_MD_type(evp_md)); |
| 2106 | print_message(names[D_EVP], save_count, | 2040 | print_message(names[D_EVP], lengths[j]); |
| 2107 | lengths[j]); | ||
| 2108 | 2041 | ||
| 2109 | Time_F(START); | 2042 | time_f(START); |
| 2110 | for (count = 0, run = 1; COND(save_count * 4 * lengths[0] / lengths[j]); count++) | 2043 | for (count = 0, run = 1; COND; count++) |
| 2111 | EVP_Digest(buf, lengths[j], &(md[0]), NULL, evp_md, NULL); | 2044 | EVP_Digest(buf, lengths[j], &(md[0]), NULL, evp_md, NULL); |
| 2112 | 2045 | ||
| 2113 | d = Time_F(STOP); | 2046 | d = time_f(STOP); |
| 2114 | } | 2047 | } |
| 2115 | print_result(D_EVP, j, count, d); | 2048 | print_result(D_EVP, j, count, d); |
| 2116 | } | 2049 | } |
| @@ -2127,11 +2060,11 @@ speed_main(int argc, char **argv) | |||
| 2127 | rsa_count = 1; | 2060 | rsa_count = 1; |
| 2128 | } else { | 2061 | } else { |
| 2129 | pkey_print_message("private", "rsa", | 2062 | pkey_print_message("private", "rsa", |
| 2130 | rsa_c[j][0], rsa_bits[j], | 2063 | rsa_bits[j], |
| 2131 | RSA_SECONDS); | 2064 | RSA_SECONDS); |
| 2132 | /* RSA_blinding_on(rsa_key[j],NULL); */ | 2065 | /* RSA_blinding_on(rsa_key[j],NULL); */ |
| 2133 | Time_F(START); | 2066 | time_f(START); |
| 2134 | for (count = 0, run = 1; COND(rsa_c[j][0]); count++) { | 2067 | for (count = 0, run = 1; COND; count++) { |
| 2135 | ret = RSA_sign(NID_md5_sha1, buf, 36, buf2, | 2068 | ret = RSA_sign(NID_md5_sha1, buf, 36, buf2, |
| 2136 | &rsa_num, rsa_key[j]); | 2069 | &rsa_num, rsa_key[j]); |
| 2137 | if (ret == 0) { | 2070 | if (ret == 0) { |
| @@ -2142,7 +2075,7 @@ speed_main(int argc, char **argv) | |||
| 2142 | break; | 2075 | break; |
| 2143 | } | 2076 | } |
| 2144 | } | 2077 | } |
| 2145 | d = Time_F(STOP); | 2078 | d = time_f(STOP); |
| 2146 | BIO_printf(bio_err, mr ? "+R1:%ld:%d:%.2f\n" | 2079 | BIO_printf(bio_err, mr ? "+R1:%ld:%d:%.2f\n" |
| 2147 | : "%ld %d bit private RSA in %.2fs\n", | 2080 | : "%ld %d bit private RSA in %.2fs\n", |
| 2148 | count, rsa_bits[j], d); | 2081 | count, rsa_bits[j], d); |
| @@ -2157,10 +2090,10 @@ speed_main(int argc, char **argv) | |||
| 2157 | rsa_doit[j] = 0; | 2090 | rsa_doit[j] = 0; |
| 2158 | } else { | 2091 | } else { |
| 2159 | pkey_print_message("public", "rsa", | 2092 | pkey_print_message("public", "rsa", |
| 2160 | rsa_c[j][1], rsa_bits[j], | 2093 | rsa_bits[j], |
| 2161 | RSA_SECONDS); | 2094 | RSA_SECONDS); |
| 2162 | Time_F(START); | 2095 | time_f(START); |
| 2163 | for (count = 0, run = 1; COND(rsa_c[j][1]); count++) { | 2096 | for (count = 0, run = 1; COND; count++) { |
| 2164 | ret = RSA_verify(NID_md5_sha1, buf, 36, buf2, | 2097 | ret = RSA_verify(NID_md5_sha1, buf, 36, buf2, |
| 2165 | rsa_num, rsa_key[j]); | 2098 | rsa_num, rsa_key[j]); |
| 2166 | if (ret <= 0) { | 2099 | if (ret <= 0) { |
| @@ -2171,7 +2104,7 @@ speed_main(int argc, char **argv) | |||
| 2171 | break; | 2104 | break; |
| 2172 | } | 2105 | } |
| 2173 | } | 2106 | } |
| 2174 | d = Time_F(STOP); | 2107 | d = time_f(STOP); |
| 2175 | BIO_printf(bio_err, mr ? "+R2:%ld:%d:%.2f\n" | 2108 | BIO_printf(bio_err, mr ? "+R2:%ld:%d:%.2f\n" |
| 2176 | : "%ld %d bit public RSA in %.2fs\n", | 2109 | : "%ld %d bit public RSA in %.2fs\n", |
| 2177 | count, rsa_bits[j], d); | 2110 | count, rsa_bits[j], d); |
| @@ -2202,10 +2135,10 @@ speed_main(int argc, char **argv) | |||
| 2202 | rsa_count = 1; | 2135 | rsa_count = 1; |
| 2203 | } else { | 2136 | } else { |
| 2204 | pkey_print_message("sign", "dsa", | 2137 | pkey_print_message("sign", "dsa", |
| 2205 | dsa_c[j][0], dsa_bits[j], | 2138 | dsa_bits[j], |
| 2206 | DSA_SECONDS); | 2139 | DSA_SECONDS); |
| 2207 | Time_F(START); | 2140 | time_f(START); |
| 2208 | for (count = 0, run = 1; COND(dsa_c[j][0]); count++) { | 2141 | for (count = 0, run = 1; COND; count++) { |
| 2209 | ret = DSA_sign(EVP_PKEY_DSA, buf, 20, buf2, | 2142 | ret = DSA_sign(EVP_PKEY_DSA, buf, 20, buf2, |
| 2210 | &kk, dsa_key[j]); | 2143 | &kk, dsa_key[j]); |
| 2211 | if (ret == 0) { | 2144 | if (ret == 0) { |
| @@ -2216,7 +2149,7 @@ speed_main(int argc, char **argv) | |||
| 2216 | break; | 2149 | break; |
| 2217 | } | 2150 | } |
| 2218 | } | 2151 | } |
| 2219 | d = Time_F(STOP); | 2152 | d = time_f(STOP); |
| 2220 | BIO_printf(bio_err, mr ? "+R3:%ld:%d:%.2f\n" | 2153 | BIO_printf(bio_err, mr ? "+R3:%ld:%d:%.2f\n" |
| 2221 | : "%ld %d bit DSA signs in %.2fs\n", | 2154 | : "%ld %d bit DSA signs in %.2fs\n", |
| 2222 | count, dsa_bits[j], d); | 2155 | count, dsa_bits[j], d); |
| @@ -2232,10 +2165,10 @@ speed_main(int argc, char **argv) | |||
| 2232 | dsa_doit[j] = 0; | 2165 | dsa_doit[j] = 0; |
| 2233 | } else { | 2166 | } else { |
| 2234 | pkey_print_message("verify", "dsa", | 2167 | pkey_print_message("verify", "dsa", |
| 2235 | dsa_c[j][1], dsa_bits[j], | 2168 | dsa_bits[j], |
| 2236 | DSA_SECONDS); | 2169 | DSA_SECONDS); |
| 2237 | Time_F(START); | 2170 | time_f(START); |
| 2238 | for (count = 0, run = 1; COND(dsa_c[j][1]); count++) { | 2171 | for (count = 0, run = 1; COND; count++) { |
| 2239 | ret = DSA_verify(EVP_PKEY_DSA, buf, 20, buf2, | 2172 | ret = DSA_verify(EVP_PKEY_DSA, buf, 20, buf2, |
| 2240 | kk, dsa_key[j]); | 2173 | kk, dsa_key[j]); |
| 2241 | if (ret <= 0) { | 2174 | if (ret <= 0) { |
| @@ -2246,7 +2179,7 @@ speed_main(int argc, char **argv) | |||
| 2246 | break; | 2179 | break; |
| 2247 | } | 2180 | } |
| 2248 | } | 2181 | } |
| 2249 | d = Time_F(STOP); | 2182 | d = time_f(STOP); |
| 2250 | BIO_printf(bio_err, mr ? "+R4:%ld:%d:%.2f\n" | 2183 | BIO_printf(bio_err, mr ? "+R4:%ld:%d:%.2f\n" |
| 2251 | : "%ld %d bit DSA verify in %.2fs\n", | 2184 | : "%ld %d bit DSA verify in %.2fs\n", |
| 2252 | count, dsa_bits[j], d); | 2185 | count, dsa_bits[j], d); |
| @@ -2283,13 +2216,11 @@ speed_main(int argc, char **argv) | |||
| 2283 | rsa_count = 1; | 2216 | rsa_count = 1; |
| 2284 | } else { | 2217 | } else { |
| 2285 | pkey_print_message("sign", "ecdsa", | 2218 | pkey_print_message("sign", "ecdsa", |
| 2286 | ecdsa_c[j][0], | ||
| 2287 | test_curves_bits[j], | 2219 | test_curves_bits[j], |
| 2288 | ECDSA_SECONDS); | 2220 | ECDSA_SECONDS); |
| 2289 | 2221 | ||
| 2290 | Time_F(START); | 2222 | time_f(START); |
| 2291 | for (count = 0, run = 1; COND(ecdsa_c[j][0]); | 2223 | for (count = 0, run = 1; COND; count++) { |
| 2292 | count++) { | ||
| 2293 | ret = ECDSA_sign(0, buf, 20, | 2224 | ret = ECDSA_sign(0, buf, 20, |
| 2294 | ecdsasig, &ecdsasiglen, | 2225 | ecdsasig, &ecdsasiglen, |
| 2295 | ecdsa[j]); | 2226 | ecdsa[j]); |
| @@ -2300,7 +2231,7 @@ speed_main(int argc, char **argv) | |||
| 2300 | break; | 2231 | break; |
| 2301 | } | 2232 | } |
| 2302 | } | 2233 | } |
| 2303 | d = Time_F(STOP); | 2234 | d = time_f(STOP); |
| 2304 | 2235 | ||
| 2305 | BIO_printf(bio_err, mr ? "+R5:%ld:%d:%.2f\n" : | 2236 | BIO_printf(bio_err, mr ? "+R5:%ld:%d:%.2f\n" : |
| 2306 | "%ld %d bit ECDSA signs in %.2fs \n", | 2237 | "%ld %d bit ECDSA signs in %.2fs \n", |
| @@ -2318,11 +2249,10 @@ speed_main(int argc, char **argv) | |||
| 2318 | ecdsa_doit[j] = 0; | 2249 | ecdsa_doit[j] = 0; |
| 2319 | } else { | 2250 | } else { |
| 2320 | pkey_print_message("verify", "ecdsa", | 2251 | pkey_print_message("verify", "ecdsa", |
| 2321 | ecdsa_c[j][1], | ||
| 2322 | test_curves_bits[j], | 2252 | test_curves_bits[j], |
| 2323 | ECDSA_SECONDS); | 2253 | ECDSA_SECONDS); |
| 2324 | Time_F(START); | 2254 | time_f(START); |
| 2325 | for (count = 0, run = 1; COND(ecdsa_c[j][1]); count++) { | 2255 | for (count = 0, run = 1; COND; count++) { |
| 2326 | ret = ECDSA_verify(0, buf, 20, ecdsasig, ecdsasiglen, ecdsa[j]); | 2256 | ret = ECDSA_verify(0, buf, 20, ecdsasig, ecdsasiglen, ecdsa[j]); |
| 2327 | if (ret != 1) { | 2257 | if (ret != 1) { |
| 2328 | BIO_printf(bio_err, "ECDSA verify failure\n"); | 2258 | BIO_printf(bio_err, "ECDSA verify failure\n"); |
| @@ -2331,7 +2261,7 @@ speed_main(int argc, char **argv) | |||
| 2331 | break; | 2261 | break; |
| 2332 | } | 2262 | } |
| 2333 | } | 2263 | } |
| 2334 | d = Time_F(STOP); | 2264 | d = time_f(STOP); |
| 2335 | BIO_printf(bio_err, mr ? "+R6:%ld:%d:%.2f\n" | 2265 | BIO_printf(bio_err, mr ? "+R6:%ld:%d:%.2f\n" |
| 2336 | : "%ld %d bit ECDSA verify in %.2fs\n", | 2266 | : "%ld %d bit ECDSA verify in %.2fs\n", |
| 2337 | count, test_curves_bits[j], d); | 2267 | count, test_curves_bits[j], d); |
| @@ -2405,18 +2335,16 @@ speed_main(int argc, char **argv) | |||
| 2405 | rsa_count = 1; | 2335 | rsa_count = 1; |
| 2406 | } else { | 2336 | } else { |
| 2407 | pkey_print_message("", "ecdh", | 2337 | pkey_print_message("", "ecdh", |
| 2408 | ecdh_c[j][0], | ||
| 2409 | test_curves_bits[j], | 2338 | test_curves_bits[j], |
| 2410 | ECDH_SECONDS); | 2339 | ECDH_SECONDS); |
| 2411 | Time_F(START); | 2340 | time_f(START); |
| 2412 | for (count = 0, run = 1; | 2341 | for (count = 0, run = 1; COND; count++) { |
| 2413 | COND(ecdh_c[j][0]); count++) { | ||
| 2414 | ECDH_compute_key(secret_a, | 2342 | ECDH_compute_key(secret_a, |
| 2415 | outlen, | 2343 | outlen, |
| 2416 | EC_KEY_get0_public_key(ecdh_b[j]), | 2344 | EC_KEY_get0_public_key(ecdh_b[j]), |
| 2417 | ecdh_a[j], kdf); | 2345 | ecdh_a[j], kdf); |
| 2418 | } | 2346 | } |
| 2419 | d = Time_F(STOP); | 2347 | d = time_f(STOP); |
| 2420 | BIO_printf(bio_err, mr | 2348 | BIO_printf(bio_err, mr |
| 2421 | ? "+R7:%ld:%d:%.2f\n" | 2349 | ? "+R7:%ld:%d:%.2f\n" |
| 2422 | : "%ld %d-bit ECDH ops in %.2fs\n", | 2350 | : "%ld %d-bit ECDH ops in %.2fs\n", |
| @@ -2569,7 +2497,7 @@ show_res: | |||
| 2569 | } | 2497 | } |
| 2570 | 2498 | ||
| 2571 | static void | 2499 | static void |
| 2572 | print_message(const char *s, long num, int length) | 2500 | print_message(const char *s, int length) |
| 2573 | { | 2501 | { |
| 2574 | BIO_printf(bio_err, mr ? "+DT:%s:%d:%d\n" | 2502 | BIO_printf(bio_err, mr ? "+DT:%s:%d:%d\n" |
| 2575 | : "Doing %s for %ds on %d size blocks: ", s, SECONDS, length); | 2503 | : "Doing %s for %ds on %d size blocks: ", s, SECONDS, length); |
| @@ -2578,7 +2506,7 @@ print_message(const char *s, long num, int length) | |||
| 2578 | } | 2506 | } |
| 2579 | 2507 | ||
| 2580 | static void | 2508 | static void |
| 2581 | pkey_print_message(const char *str, const char *str2, long num, | 2509 | pkey_print_message(const char *str, const char *str2, |
| 2582 | int bits, int tm) | 2510 | int bits, int tm) |
| 2583 | { | 2511 | { |
| 2584 | BIO_printf(bio_err, mr ? "+DTP:%d:%s:%s:%d\n" | 2512 | BIO_printf(bio_err, mr ? "+DTP:%d:%s:%s:%d\n" |
diff --git a/src/usr.bin/openssl/ts.c b/src/usr.bin/openssl/ts.c index 2bb35d84a4..29485bf7dc 100644 --- a/src/usr.bin/openssl/ts.c +++ b/src/usr.bin/openssl/ts.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ts.c,v 1.29 2024/08/26 18:40:50 tb Exp $ */ | 1 | /* $OpenBSD: ts.c,v 1.30 2025/11/21 08:25:43 tb Exp $ */ |
| 2 | /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL | 2 | /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL |
| 3 | * project 2002. | 3 | * project 2002. |
| 4 | */ | 4 | */ |
| @@ -736,33 +736,23 @@ create_digest(BIO *input, char *digest, const EVP_MD *md, | |||
| 736 | static ASN1_INTEGER * | 736 | static ASN1_INTEGER * |
| 737 | create_nonce(int bits) | 737 | create_nonce(int bits) |
| 738 | { | 738 | { |
| 739 | unsigned char buf[20]; | 739 | BIGNUM *bn; |
| 740 | ASN1_INTEGER *nonce = NULL; | 740 | ASN1_INTEGER *nonce = NULL; |
| 741 | int len = (bits - 1) / 8 + 1; | ||
| 742 | int i; | ||
| 743 | 741 | ||
| 744 | /* Generating random byte sequence. */ | 742 | if ((bn = BN_new()) == NULL) |
| 745 | if (len > (int) sizeof(buf)) | ||
| 746 | goto err; | 743 | goto err; |
| 747 | arc4random_buf(buf, len); | 744 | if (!BN_rand(bn, bits, BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY)) |
| 748 | |||
| 749 | /* Find the first non-zero byte and creating ASN1_INTEGER object. */ | ||
| 750 | for (i = 0; i < len && !buf[i]; ++i) | ||
| 751 | ; | ||
| 752 | if ((nonce = ASN1_INTEGER_new()) == NULL) | ||
| 753 | goto err; | 745 | goto err; |
| 754 | free(nonce->data); | 746 | if ((nonce = BN_to_ASN1_INTEGER(bn, NULL)) == NULL) |
| 755 | /* Allocate at least one byte. */ | ||
| 756 | nonce->length = len - i; | ||
| 757 | if ((nonce->data = malloc(nonce->length + 1)) == NULL) | ||
| 758 | goto err; | 747 | goto err; |
| 759 | memcpy(nonce->data, buf + i, nonce->length); | 748 | BN_free(bn); |
| 760 | 749 | ||
| 761 | return nonce; | 750 | return nonce; |
| 762 | 751 | ||
| 763 | err: | 752 | err: |
| 764 | BIO_printf(bio_err, "could not create nonce\n"); | 753 | BIO_printf(bio_err, "could not create nonce\n"); |
| 765 | ASN1_INTEGER_free(nonce); | 754 | ASN1_INTEGER_free(nonce); |
| 755 | BN_free(bn); | ||
| 766 | return NULL; | 756 | return NULL; |
| 767 | } | 757 | } |
| 768 | 758 | ||
